2 class NP_Mediatocu extends NucleusPlugin
\r
5 function NP_Mediatocu()
\r
7 // $this->baseUrl = $this->getAdminURL();
\r
9 $this->baseUrl = str_replace ($CONF['AdminURL'], '', $this->getAdminURL());
\r
17 function getAuthor()
\r
19 return 'yamamoto,shizuki, Nucleus JP team, and Cacher';
\r
25 return 'http://japan.nucleuscms.org/wiki/plugins:np_mediatocu';//2008-11-10 cacher
\r
28 function getVersion()
\r
30 return '1.0.8.1 SP1 RC6';
\r
33 function getDescription()
\r
35 return _MEDIA_PHP_37;
\r
38 function supportsFeature($w)
\r
40 return ($w == 'SqlTablePrefix') ? 1 : 0;
\r
45 /**2005.3--2005.09.26 00:50 keiei edit
\r
46 * media-tocu3.01.zip for register_globals=off
\r
50 * media-tocu3.02.zip
\r
51 * T.Kosugi edit 2006.8.22 for security reason
\r
54 * media-tocu-dirs1.0.zip
\r
55 * extends media-tocu3.02.zip
\r
56 * 1.0.7 m17n and making to plugin. by yamamoto
\r
57 * 1.0.6 to put it even by the thumbnail image click, small bug. by yamamoto
\r
58 * 1.0.5 to put it even by the thumbnail image click, it remodels it. by yamamoto
\r
59 * 1.0.4 bug fix mkdir if memberdir is missing incase mkdir
\r
60 * 1.0.3 bug fix missing memberdir in uploading file.
\r
61 * 1.0.2 add checking filname with null
\r
62 * 1.0.1 add first dir check
\r
65 // add language definition by yamamoto
\r
71 $this->createOption(
\r
76 'datatype=numerical'
\r
78 $this->createOption(
\r
83 'datatype=numerical'
\r
85 $this->createOption(
\r
90 'datatype=numerical'
\r
92 $this->createOption(
\r
97 'datatype=numerical'
\r
99 $this->createOption(
\r
104 'datatype=numerical'
\r
105 );//restore 2008-05-14 Cacher
\r
106 $this->createOption(
\r
111 'datatype=numerical'
\r
112 );//restore 2008-05-14 Cacher
\r
113 $this->createOption(
\r
114 'paste_mode_checked',
\r
119 $this->createOption(
\r
123 'thumb,thumbnail,phpthumb'
\r
125 $this->createOption(
\r
130 _MEDIA_PHP_34 . '|default|' . _MEDIA_PHP_35 . '|ascii'
\r
132 $this->createOption(
\r
143 function _addExtraHead(&$data)
\r
146 $this->memberid = $member->id;
\r
147 $this->memberadmin = $member->admin;
\r
148 $this->_getExtraHead($data);
\r
151 // function unInstall() {}
\r
152 //2008-11-10 cacher
\r
156 // include language file for this plugin
\r
157 $language = ereg_replace( '[\\|/]', '', getLanguageName());
\r
158 if (file_exists($this->getDirectory() . 'lang/' . $language . '.php')) {
\r
159 include_once($this->getDirectory() . 'lang/' . $language . '.php');
\r
161 include_once($this->getDirectory() . 'lang/english.php');
\r
165 function getEventList()
\r
168 'AdminPrePageHead',
\r
169 'BookmarkletExtraHead',
\r
170 'PreSendContentType'
\r
174 function event_BookmarkletExtraHead(&$data)
\r
176 $this->_addExtraHead($data['extrahead']);
\r
179 function event_AdminPrePageHead(&$data)
\r
182 $action = $data['action'];
\r
183 if (($action != 'createitem') && ($action != 'itemedit')) {
\r
186 $this->_addExtraHead($data['extrahead']);
\r
189 function event_PreSendContentType(&$data)
\r
191 $pageType = $data['pageType'];
\r
192 if ( ($pageType == 'bookmarklet-add')
\r
193 || ($pageType == 'bookmarklet-edit')
\r
194 || ($pageType == 'admin-createitem')
\r
195 || ($pageType == 'admin-itemedit')
\r
197 if ($data['contentType'] == 'application/xhtml+xml') {
\r
198 $data['contentType'] = 'text/html';
\r
203 function _getExtraHead(&$extrahead)
\r
205 global $CONF, $manager, $itemid, $blogid ;
\r
206 if ($manager->pluginInstalled('NP_TinyMCE')) return;
\r
207 $mediatocu = $manager->getPlugin('NP_Mediatocu');
\r
208 $popup_width = $mediatocu->getOption('popup_width');//restore 2008-05-14 Cacher
\r
209 $popup_height = $mediatocu->getOption('popup_height');//restore 2008-05-14 Cacher
\r
210 $mediaPhpURL = $CONF['AdminURL'] . $this->baseUrl . 'media.php';
\r
211 // $GreyBox = $mediatocu->getOption('use_gray_box');
\r
212 if ($mediatocu->getOption('use_gray_box') == 'yes') {
\r
213 $extrahead .= <<<_EXTRAHEAD_
\r
215 <script type="text/javascript" src="plugins/mediatocu/greybox/AJS.js"></script>
\r
216 <script type="text/javascript" src="plugins/mediatocu/greybox/AJS_fx.js"></script>
\r
217 <script type="text/javascript">
\r
218 var GB_ROOT_DIR = "./plugins/mediatocu/greybox/";
\r
220 <script type="text/javascript" src="plugins/mediatocu/greybox/gb_scripts.js"></script>
\r
221 <link href="plugins/mediatocu/greybox/gb_styles.css" rel="stylesheet" type="text/css" media="all" />
\r
222 <style TYPE="text/css">
\r
225 background : url(plugins/mediatocu/greybox/header_bg.gif);
\r
228 <script type="text/javascript">
\r
229 function addMedia() {
\r
230 GB_showFullScreen('Mediatocu', '{$mediaPhpURL}');
\r
236 $extrahead .= <<<_EXTRAHEAD_
\r
238 <script type="text/javascript">
\r
239 function addMedia() {
\r
240 window.open('{$mediaPhpURL}', "name" , "width=$popup_width , height=$popup_height , scrollbars=yes , resizable=yes" );
\r