OSDN Git Service

This is a official release 3.51 by nucleus-jp team.
[nucleus-jp/nucleus-jp-ancient.git] / utf8 / nucleus / plugins / NP_SkinFiles.php
1 <?php
2
3 class NP_SkinFiles extends NucleusPlugin {
4
5    /* ==========================================================================================
6     * Nucleus SkinFiles Plugin
7     *
8     * Copyright 2005-2009 by Jeff MacMichael and Niels Leenheer
9     *
10     * @version $Id$
11     * @version $NucleusJP: NP_SkinFiles.php,v 1.4 2007/02/04 06:28:46 kimitake Exp $
12     *
13     * ==========================================================================================
14     * This program is free software and open source software; you can redistribute
15     * it and/or modify it under the terms of the GNU General Public License as
16     * published by the Free Software Foundation; either version 2 of the License,
17     * or (at your option) any later version.
18     *
19     * This program is distributed in the hope that it will be useful, but WITHOUT
20     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21     * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
22     * more details.
23     *
24     * You should have received a copy of the GNU General Public License along
25     * with this program; if not, write to the Free Software Foundation, Inc.,
26     * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  or visit
27     * http://www.gnu.org/licenses/gpl.html
28     * ==========================================================================================
29     *
30     * Changes:
31     * v0.91 ged   - added ICO, PHPx files, fixed/added some icons
32     *             - changed perms on file or folder creation or upload to 0755 from 0640
33     *             - changed 'cancel' links for delete actions to $parent dir from http_referer
34     *             - changed order of links next to files... moved 'del' over a bit.  ;)
35     * v0.92 ged   - changed order of links next to dirs
36     *               $privateskins = FALSE by default
37     * v1.0  ged   - fixed security catch so it actually quits the script
38     *               "columnated" the files & dirs display for easier viewing
39     *               Made the edit cancel link more intuitive
40     * v1.01 ged   - fixed event_QuickMenu to properly skip for non-admins
41     *               lined up columns for directories & added <tr> highlights
42     * v2.00 rakaz - Almost complete rewrite
43     * v2.01 yama  - modified form button for IE
44     * v2.02 kimitake - multilingual support, modified form button for IE
45     * v2.03 yama - CSS out source. and textarea width bug fix for IE. And some lang add.And add routine empty file delete.
46         * v2.031 cacher - replace function 'basename' (PHP BUG)
47                           add help
48     */
49
50
51     function getName() {
52         return 'SkinFiles';
53     }
54
55     function getAuthor() {
56         return 'Misc authors';
57     }
58
59     function getURL() {
60         return 'http://wakka.xiffy.nl/skinfiles';
61     }
62
63     function getVersion() {
64                 return '2.031';
65     }
66
67     function getDescription() {
68         return _SKINFILES_01;
69     }
70
71     function supportsFeature($what) {
72         switch($what) {
73             case 'SqlTablePrefix':
74             case 'HelpPage':
75                 return 1;
76             default:
77                 return 0;
78         }
79     }
80
81     function install() {
82         $this->createOption(
83             'generate_backup',
84                         '_SKINFILES_OPT_GENBACKUP',
85             'yesno',
86             'no'
87         );
88         $this->createOption(
89             'backup_prefix',
90                         '_SKINFILES_OPT_BACKUPPREFIX',
91             'text',
92             'bkup_'
93         );
94     }
95     
96     function unInstall() {
97     }
98
99     function getEventList() {
100         return array(
101             'QuickMenu',
102                         'AdminPrePageHead',
103                         'PrePluginOptionsEdit'
104         );
105     }
106     
107     function hasAdminArea() {
108         return 1;
109     }
110
111     function init() {
112         // include language file for this plugin
113         $language = preg_replace( '@\\|/@', '', getLanguageName());
114         if (file_exists($this->getDirectory().$language.'.php'))
115             include_once($this->getDirectory().$language.'.php');
116         else
117             include_once($this->getDirectory().'english.php');
118     }
119     
120         function event_QuickMenu(&$data) {
121         global $member;
122
123         // only show to admins
124         if (!($member->isLoggedIn() && $member->isAdmin())) return;
125
126         array_push(
127             $data['options'], 
128             array(
129                 'title'   => _SKINFILES_TITLE,
130                 'url'     => $this->getAdminURL(),
131                 'tooltip' => _SKINFILES_TOOLTIP
132             )
133         );
134     }
135
136
137 // start add yama.kyms
138         function event_AdminPrePageHead(&$data) {
139         global $CONF;
140         $path = $CONF['PluginURL'];
141         if ($data['action'] != 'plugin_SkinFiles') return;
142         
143             $data['extrahead'] .= <<< EOS
144 <link rel="stylesheet" type="text/css" href="{$path}skinfiles/style.css" />
145 EOS;
146         }
147         
148 // end add yama.kyms
149
150         function event_PrePluginOptionsEdit($data)
151         {
152                 if ($data['plugid'] === $this->getID()) {
153                         foreach($data['options'] as $key => $value){
154                                 if (defined($value['description'])) {
155                                         $data['options'][$key]['description'] = constant($value['description']);
156                                 }
157                         }
158                 }
159         }
160 }
161
162 ?>