OSDN Git Service

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