3 * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
\r
4 * Copyright (C) 2002-2007 The Nucleus Group
\r
6 * This program is free software; you can redistribute it and/or
\r
7 * modify it under the terms of the GNU General Public License
\r
8 * as published by the Free Software Foundation; either version 2
\r
9 * of the License, or (at your option) any later version.
\r
10 * (see nucleus/documentation/index.html#license for more info)
\r
13 * Media popup window for Nucleus
\r
16 * - can be openen from an add-item form or bookmarklet popup
\r
17 * - shows a list of recent files, allowing browsing, search and
\r
18 * upload of new files
\r
19 * - close the popup by selecting a file in the list. The file gets
\r
20 * passed through to the add-item form (linkto, popupimg or inline img)
\r
22 * @license http://nucleuscms.org/license.txt GNU General Public License
\r
23 * @copyright Copyright (C) 2002-2007 The Nucleus Group
\r
24 * @version $Id: media.php 1116 2007-02-03 08:24:29Z kimitake $
\r
25 * $NucleusJP: media.php,v 1.4 2007/03/27 12:13:47 kimitake Exp $
\r
31 if (!defined('_MEDIA_PHP_DEFINED')) {
\r
32 define('_MEDIA_PHP_DEFINED', 1);
\r
35 // add definition end
\r
38 // defines how much media items will be shown per page. You can override this
\r
39 // in config.php if you like. (changing it in config.php instead of here will
\r
40 // allow your settings to be kept even after a Nucleus upgrade)
\r
43 //rem yama 20070928 $CONF['MediaPerPage'] = $media_per_page;
\r
45 $Prefix_thumb = "thumb_";
\r
47 // include all classes and config data
\r
48 require('../../../config.php');
\r
50 // added yama20070928
\r
51 $mediatocu = $manager->getPlugin('NP_Mediatocu');
\r
52 $media_per_page = $mediatocu->getOption('media_per_page');
\r
53 $CONF['MediaPerPage'] = $media_per_page;
\r
56 include($DIR_LIBS . 'MEDIA.php'); // media classes
\r
58 * Start append by T.Kosugi
\r
59 * Reffering /lib/MEDIA.php (v3.22)
\r
61 class MEDIADIRS extends MEDIA
\r
63 function MEDIADIRES()
\r
68 function getCollectionList()
\r
70 global $member, $DIR_MEDIA, $manager;
\r
72 $collections = array();
\r
73 /* edit T.Kosugi 2006/09/06
\r
74 // add private directory for member
\r
75 $collections[$member->getID()] = _MEDIA_PHP_32;
\r
79 $prefix = $member->getID();
\r
80 $collections = array_merge($collections, (array)MEDIADIRS::traceCorrectionDir($searchDir, $prefix, _MEDIA_PHP_32));
\r
82 // add global collections
\r
83 if (!is_dir($DIR_MEDIA)) {
\r
84 return $collections;
\r
87 $dirhandle = opendir($DIR_MEDIA);
\r
88 while ($dirname = readdir($dirhandle)) {
\r
89 // only add non-numeric (numeric=private) dirs
\r
90 if (@is_dir($DIR_MEDIA . $dirname) && ($dirname != '.') && ($dirname != '..') && ($dirname != 'CVS') && (!is_numeric($dirname))) {
\r
91 $collections[$dirname] = $dirname;
\r
95 $collections = array_merge($collections, (array)MEDIADIRS::traceCorrectionDir($searchDir, $prefix, $dirname));
\r
99 closedir($dirhandle);
\r
100 // add T.Kosugi 2006/09/06
\r
101 // add private directory for member
\r
102 // $collections[$member->getID()] = _MEDIA_PHP_32;
\r
104 // ksort($collections, SORT_STRING);
\r
106 $hiddendir = array();
\r
107 $mediatocu = $manager->getPlugin('NP_Mediatocu');
\r
108 $hiddendir = explode(',', $mediatocu->getOption('hidden_dir'));
\r
109 foreach ($hiddendir as $value)
\r
111 $value = trim($value);
\r
112 unset($collections["$value"]);
\r
114 foreach ($collections as $value)
\r
118 $collections = array_merge($collections, (array)MEDIADIRS::traceCorrectionDir($searchDir, $prefix, $value));
\r
120 $collections[$member->getID()] = _MEDIA_PHP_32;
\r
122 $prefix = $member->getID();
\r
123 $collections = array_merge($collections, (array)MEDIADIRS::traceCorrectionDir($searchDir, $prefix, _MEDIA_PHP_32));
\r
124 ksort($collections, SORT_STRING);
\r
125 return $collections;
\r
129 function getPrivateCollectionList()
\r
131 global $member, $DIR_MEDIA;
\r
133 $collections = array();
\r
134 $prefix = $member->getID();
\r
136 $collections = MEDIADIRS::traceCorrectionDir($searchDir, $prefix, _MEDIA_PHP_32);
\r
137 // add private directory for member
\r
138 $collections[$prefix] = _MEDIA_PHP_32;
\r
139 ksort($collections, SORT_STRING);
\r
140 return $collections;
\r
143 function traceCorrectionDir($searchDir, $prefix ='', $preName)
\r
146 $collections = array(); //http://japan.nucleuscms.org/bb/viewtopic.php?p=21230&highlight=#21230
\r
147 $dirhandle = @opendir($DIR_MEDIA . $prefix . $searchDir);
\r
151 while ($dirname = readdir($dirhandle)) {
\r
152 // only add non-numeric (numeric=private) dirs
\r
153 if (@is_dir($DIR_MEDIA . $prefix . $searchDir . $dirname) && ($dirname != '.') && ($dirname != '..') && ($dirname != 'CVS')) {
\r
154 $collections[$prefix . $searchDir . $dirname] = $preName . $searchDir . $dirname;
\r
155 $collections = array_merge($collections, (array)MEDIADIRS::traceCorrectionDir($searchDir . $dirname . '/', $prefix, $preName));
\r
158 closedir($dirhandle);
\r
160 return $collections;
\r
163 function getMediaListByCollection($collection, $filter = '')
\r
167 $filelist = array();
\r
169 // 1. go through all objects and add them to the filelist
\r
171 $mediadir = $DIR_MEDIA . $collection . '/';
\r
173 // return if dir does not exist
\r
174 if (!is_dir($mediadir)) {
\r
178 $dirhandle = opendir($mediadir);
\r
179 while ($filename = readdir($dirhandle)) {
\r
180 // only add files that match the filter
\r
181 if (!@is_dir($mediadir . $filename) && MEDIA::checkFilter($filename, $filter)) {
\r
182 array_push($filelist, new MEDIAOBJECT($collection, $filename, filemtime($mediadir . $filename)));
\r
185 closedir($dirhandle);
\r
187 // sort array so newer files are shown first
\r
188 usort($filelist, 'sort_media');
\r
195 * End append by T.Kosugi
\r
197 sendContentType('application/xhtml+xml', 'media');
\r
199 // user needs to be logged in to use this
\r
200 if (!$member->isLoggedIn()) {
\r
201 media_loginAndPassThrough();
\r
205 // check if member is on at least one teamlist
\r
206 $query = 'SELECT * FROM ' . sql_table('team'). ' WHERE tmember=' . $member->getID();
\r
207 //$teams = mysql_query($query);
\r
208 $teams = sql_query($query);
\r
209 if (mysql_num_rows($teams) == 0) {
\r
210 media_doError(_ERROR_DISALLOWEDUPLOAD);
\r
214 $action = requestVar('action');
\r
215 if ($action == '') {
\r
216 $action = 'selectmedia';
\r
220 $aActionsNotToCheck = array('selectmedia', _MEDIA_PHP_30, _MEDIA_COLLECTION_SELECT);
\r
221 if (!in_array($action, $aActionsNotToCheck)) {
\r
222 if (!$manager->checkTicket()) {
\r
223 media_doError(_ERROR_BADTICKET);
\r
227 /*-------kei edit & append 2005.5.26-------*/
\r
228 // <080213 fix $_POST to postVar by shizuki>
\r
229 //if ($_POST[targetthumb]) {//}
\r
230 if (postVar('targetthumb')) {
\r
231 // $mediapath = $DIR_MEDIA . $_POST[currentCollection] . "/";
\r
232 $mediapath = $DIR_MEDIA . postVar('currentCollection') . "/";
\r
233 // switch ($_POST[myaction]) {//}
\r
234 switch (postVar('myaction')) {
\r
236 // $msg1 = unlink($mediapath . $_POST[targetfile]);
\r
237 $msg1 = unlink($mediapath . postVar('targetfile'));
\r
239 print $selectfile . htmlspecialchars(_MEDIA_PHP_2);
\r
241 // $exist = file_exists($mediapath . $_POST[targetthumb]);
\r
242 $exist = file_exists($mediapath . postVar('targetthumb'));
\r
244 // $msg2 = unlink($mediapath.$_POST[targetthumb]);
\r
245 $msg2 = unlink($mediapath . postVar('targetthumb'));
\r
247 // print $_POST[targetthumb] . _MEDIA_PHP_2;
\r
248 print postVar('targetthumb') . htmlspecialchars(_MEDIA_PHP_2);
\r
253 //chmod($mediapath.$targetfile, 706);
\r
255 T.Kosugi edit 2006.8.22
\r
257 // check file type against allowed types
\r
258 // $newfilename = $_POST[newname];
\r
259 $newfilename = postVar('newname');
\r
260 // T.Kosugi add 2006.9.1
\r
261 if (stristr($newfilename, '%00')) {
\r
262 media_doError(_MEDIA_PHP_38);
\r
264 // T.Kosugi add end
\r
266 $allowedtypes = explode (',', $CONF['AllowedTypes']);
\r
267 foreach ($allowedtypes as $type) {
\r
268 if (eregi("\." . $type . "$", $newfilename)) {
\r
272 if (eregi("\.php$", $newfilename)) {
\r
276 media_doError(_ERROR_BADFILETYPE);
\r
281 // $msg1 = rename($mediapath . $_POST[targetfile], $mediapath . htmlspecialchars($_POST[newname]) );
\r
282 $msg1 = rename($mediapath . postVar('targetfile'), $mediapath . htmlspecialchars(postVar('newname')) );
\r
284 print $selectfile . htmlspecialchars(_MEDIA_PHP_10);
\r
286 // $exist = file_exists($mediapath . $_POST[targetthumb]);
\r
287 $exist = file_exists($mediapath . postVar('targetthumb'));
\r
289 //print "targetthumb=$mediapath$_POST[targetthumb]<BR />";
\r
291 // $thumbnewname = $Prefix_thumb . $_POST[newname];
\r
292 $thumbnewname = $Prefix_thumb . postVar('newname');
\r
293 // $msg2 = rename($mediapath . $_POST[targetthumb], $mediapath . $thumbnewname);
\r
294 $msg2 = rename($mediapath . postVar('targetthumb'), $mediapath . $thumbnewname);
\r
296 print $targetthumb . htmlspecialchars(_MEDIA_PHP_10);
\r
302 // </080213 fix $_POST to postVar by shizuki>
\r
304 case 'chooseupload':
\r
305 case _MEDIA_UPLOAD_TO:
\r
306 case _MEDIA_UPLOAD_NEW:
\r
312 case _MEDIA_PHP_30:
\r
313 case 'selectmedia':
\r
314 case _MEDIA_COLLECTION_SELECT:
\r
319 added forder action by T.Kosugi 2006/08/27
\r
321 case _MEDIA_PHP_ACTION_DIR:
\r
322 case _MEDIA_PHP_ACTION_MKDIR:
\r
323 case _MEDIA_PHP_ACTION_RMDIR:
\r
326 media_mkdir($action);
\r
329 END added forder action by T.Kosugi 2006/08/27
\r
334 function media_select()
\r
336 global $member, $CONF, $DIR_MEDIA, $manager;
\r
337 //added yama 20071013
\r
338 $mediatocu = $manager->getPlugin('NP_Mediatocu');
\r
339 if ($mediatocu->getOption('paste_mode_checked')=="yes") {
\r
340 $paste_mode_popup_checked = 'checked="checked"';
\r
342 $paste_mode_normal_checked = 'checked="checked"';
\r
348 // show 10 files + navigation buttons
\r
349 // show msg when no files
\r
350 // show upload form
\r
351 // files sorted according to last modification date
\r
353 // currently selected collection
\r
354 $currentCollection = requestVar('collection');
\r
355 /*2005.8.31 kei append*/
\r
356 // <080213 fix $_POST to postVar by shizuki>
\r
357 // if ($_POST[currentCollection]) {//}
\r
358 if (postVar('currentCollection')) {
\r
359 // $currentCollection = $_POST[currentCollection];
\r
360 $currentCollection = postVar('currentCollection');
\r
362 // </ 080213 fix $_POST to postVar by shizuki>
\r
363 if (!$currentCollection || !@is_dir($DIR_MEDIA . $currentCollection)) {
\r
364 $currentCollection = $member->getID();
\r
367 // get collection list
\r
368 // start modify by T.Kosugi 2006/08/26
\r
369 //$collections = MEDIA::getCollectionList();
\r
370 $collections = MEDIADIRS::getCollectionList();
\r
372 // modify start T.Kosugi 2006/09/01
\r
373 // if (sizeof($collections) > 1) {
\r
374 if (sizeof($collections) > 0) {
\r
375 // modify end T.Kosugi 2006/09/01
\r
377 <form method="post" action="media.php" style="margin:5px 0;"><div>
\r
378 <label for="media_collection"><?php echo htmlspecialchars(_MEDIA_COLLECTION_LABEL)?></label>
\r
379 <select name="collection" id="media_collection" onchange="return form.submit()">
\r
381 foreach ($collections as $dirname => $description) {
\r
382 echo '<option value="',htmlspecialchars($dirname),'"';
\r
383 if ($dirname == $currentCollection) {
\r
384 echo ' selected="selected"';
\r
386 echo '>',htmlspecialchars($description),'</option>';
\r
390 <!--<input type="submit" name="action" value="<?php echo htmlspecialchars(_MEDIA_COLLECTION_SELECT) ?>" title="<?php echo htmlspecialchars(_MEDIA_COLLECTION_TT)?>" />-->
\r
391 <input type="submit" name="action" value="<?php echo htmlspecialchars(_MEDIA_UPLOAD_NEW) ?>" title="<?php echo htmlspecialchars(_MEDIA_UPLOADLINK) ?>" />
\r
392 <?php // add button start by T.Kosugi 2006/08/26 ?>
\r
393 <input type="submit" name="action" value="<?php echo htmlspecialchars(_MEDIA_PHP_ACTION_DIR) ?>" title="<?php echo htmlspecialchars(_MEDIA_PHP_ACTION_DIR_TT) ?>" />
\r
394 <?php // add bottun end by T.Kosugi 2006/08/26 ?>
\r
395 <?php $manager->addTicketHidden() ?>
\r
400 <form method="post" action="media.php" style="float:right"><div>
\r
401 <input type="hidden" name="collection" value="<?php echo htmlspecialchars($currentCollection)?>" />
\r
402 <input type="submit" name="action" value="<?php echo htmlspecialchars(_MEDIA_UPLOAD_NEW) ?>" title="<?php echo htmlspecialchars(_MEDIA_UPLOADLINK) ?>" />
\r
403 <?php $manager->addTicketHidden() ?>
\r
408 $filter = requestVar('filter');
\r
409 $offset = intRequestVar('offset');
\r
411 // start modify by T.Kosugi 2006/08/26
\r
412 //$arr = MEDIA::getMediaListByCollection($currentCollection, $filter);
\r
413 $arr = MEDIADIRS::getMediaListByCollection($currentCollection, $filter);
\r
416 <form method="post" action="media.php" style="margin:5px 0;"><div>
\r
417 <label for="media_filter"><?php echo htmlspecialchars(_MEDIA_PHP_31)?></label>
\r
418 <input id="media_filter" type="text" name="filter" value="<?php echo htmlspecialchars($filter)?>" />
\r
419 <input type="submit" name="action" value="<?php echo htmlspecialchars(_MEDIA_PHP_30) ?>" />
\r
420 <input type="hidden" name="collection" value="<?php echo htmlspecialchars($currentCollection)?>" />
\r
421 <input type="hidden" name="offset" value="<?php echo intval($offset)?>" />
\r
425 if (sizeof($arr)>0) {
\r
426 $contents = array();
\r
427 /*The numbers of contents except the thumbnail image are requested. */
\r
428 for ($i=0;$i<sizeof($arr);$i++) {
\r
430 if (ereg("thumb", $obj->filename)) {
\r
433 $contents[] = $obj;
\r
435 $conts_count = sizeof($contents);
\r
436 //print "conts_count=$conts_count<br />";
\r
437 if ($conts_count < $CONF['MediaPerPage']) {
\r
440 $maxpage = ceil($conts_count/$CONF['MediaPerPage']);
\r
446 $idxStart = $offset;
\r
447 $idxEnd = $idxStart * $CONF['MediaPerPage'];
\r
448 if ($idxEnd > $conts_count) {
\r
449 $idxEnd = $conts_count;
\r
452 $idxEnd = $CONF['MediaPerPage'];
\r
454 $idxNext = ($idxStart-1) * $CONF['MediaPerPage'];
\r
455 if ($idxNext < 0) {
\r
461 <p><?php echo htmlspecialchars(_MEDIA_COLLECTION_LABEL . $collections[$currentCollection] . _MEDIA_PHP_6 . $conts_count) . " " . intVal($idxNext+1) . " - " . htmlspecialchars($idxEnd . _MEDIA_PHP_7); ?></p>
\r
464 if ($idxStart >0 && $idxNext >0) {
\r
465 $page = ($idxStart-1);
\r
466 echo "<a href='media.php?offset=$page&collection=" . urlencode($currentCollection) . "' title='$page'>" . htmlspecialchars(_MEDIA_PHP_29) . "</a> ";
\r
468 if ($idxStart < $maxpage) {
\r
469 $page = ($idxStart+1);
\r
470 echo "<a href='media.php?offset=$page&collection=" . urlencode($currentCollection) . "' title='$page'>" . htmlspecialchars(_MEDIA_PHP_28) . "</a> ";
\r
474 <form name="top" action="media.php" style="margin:5px;">
\r
476 <?php echo htmlspecialchars(_MEDIA_PHP_11) ?>
\r
477 <input id="typeradio0" type="radio" class="radio" name="typeradio" onclick="setType(0);document.bottom.typeradio[0].checked=true;" onkeypress="setType(0);document.bottom.typeradio[0].checked=true;" <?php echo $paste_mode_normal_checked; ?> />
\r
478 <label for="typeradio0"><?php echo htmlspecialchars(_MEDIA_INLINE);?></label>
\r
479 <input <?php echo $paste_mode_popup_checked; ?> id="typeradio1" type="radio" class="radio" name="typeradio" onclick="setType(1);document.bottom.typeradio[1].checked=true;" onkeypress="setType(1);document.bottom.typeradio[1].checked=true;" />
\r
480 <label for="typeradio1"><?php echo htmlspecialchars(_MEDIA_POPUP); ?></label>
\r
484 <!-- rem yama 20070928 <th><?php echo _MEDIA_MODIFIED; ?></th> -->
\r
486 <th><?php echo htmlspecialchars(_MEDIA_PHP_12); ?></th>
\r
487 <th><?php echo htmlspecialchars(_MEDIA_PHP_25); ?></th>
\r
488 <th><?php echo htmlspecialchars(_MEDIA_PHP_20); ?></th>
\r
491 if (sizeof($arr)>0) {
\r
492 /*-------kei edit & append 2005.5.26-------*/
\r
493 global $myaction, $targetfile, $targetthumb, $Prefix_thumb;
\r
494 global $newname, $thumbnewname;
\r
497 $targetfile = $newname;
\r
500 $thumb_targetfile = $thumbnewname;
\r
501 echo "<script type='text/javascript'>\n\tlocation.replace('media.php');\n</script>";
\r
504 // print"idxNext=$idxNext<BR />";
\r
505 // print"idxEnd=$idxEnd<BR />";
\r
507 for ($i=$idxNext;$i<$idxEnd;$i++) {
\r
508 $filename = $DIR_MEDIA . $currentCollection . '/' . $contents[$i]->filename;
\r
509 // if(!$msg1)$targetfile = $contents[$i]->filename;
\r
510 $targetfile = $contents[$i]->filename;
\r
511 $old_level = error_reporting(0);
\r
512 $size = @GetImageSize($filename);
\r
513 error_reporting($old_level);
\r
514 $width = intval($size[0]);
\r
515 $height = intval($size[1]);
\r
516 $filetype = $size[2];
\r
518 echo "<div class='box'>\n";
\r
519 // rem yama echo "<td>". date("Y-m-d",$contents[$i]->timestamp) ."</td>\n";
\r
521 // strings for javascript
\r
522 $jsCurrentCollection = str_replace("'", "\\'", $currentCollection);
\r
523 $jsFileName = str_replace("'", "\\'", $contents[$i]->filename);
\r
524 $targetfile = str_replace($Prefix_thumb, "", $jsFileName);
\r
525 /*-------kei append 2005.5.26-------*/
\r
526 $mediapath = $DIR_MEDIA . $currentCollection."/";
\r
527 $thumb_file = $Prefix_thumb . $targetfile;
\r
529 $thumb_targetfile = $thumb_file;
\r
531 $thumb_exist = file_exists($mediapath . $thumb_file);
\r
533 // <080213 shizuki add>
\r
534 $hscJsCC = htmlspecialchars($jsCurrentCollection);
\r
535 $hscTGTF = htmlspecialchars($targetfile);
\r
536 $hscTTGT = htmlspecialchars($thumb_targetfile);
\r
537 $hscJsFN = htmlspecialchars($jsFileName);
\r
538 $hscCCol = htmlspecialchars($currentCollection);
\r
539 $hscThFN = htmlspecialchars($thumb_file);
\r
540 $hscMEDA = htmlspecialchars($CONF['MediaURL']);
\r
541 // 2008-02-21 cacher
\r
542 // $hscMVEW = htmlspecialchars(_MEDIA_VIEW_TT);
\r
543 $hscMVEW = htmlspecialchars(_MEDIA_VIEW);
\r
544 $hscMVTT = htmlspecialchars(_MEDIA_VIEW_TT);
\r
545 // /2008-02-21 cacher
\r
546 $media26 = htmlspecialchars(_MEDIA_PHP_26);
\r
547 // </080213 shizuki add>
\r
548 if ($filetype != 0 || $thumb_exist) {
\r
549 // image (gif/jpg/png/swf)
\r
550 $selectfile = $mediapath . $contents[$i]->filename;
\r
551 // print "selectfile=$selectfile<BR />";
\r
552 if (function_exists("ImageCreateFromGif")) {
\r
553 $pattern = array( "/.wmv/" );
\r
555 $pattern = array( "/.gif/", "/.wmv/" );
\r
557 if (!$thumb_exist) {
\r
558 // $thumbfile2 = preg_replace($pattern, ".png", $targetfile); //Extension conversion
\r
559 // $thumb_file = $Prefix_thumb . $thumbfile2;
\r
560 $thumb_file = $Prefix_thumb . $targetfile . ".png";
\r
561 $thumb_exist = file_exists($mediapath . $thumb_file);
\r
562 $notmake_thumb = 0;
\r
563 /*Making is tried if there is no thumbnail. */
\r
564 if (!$thumb_exist) {
\r
565 $notmake_thumb = make_thumbnail($DIR_MEDIA, $currentCollection, $selectfile, $contents[$i]->filename);
\r
569 $thumb_file = $Prefix_thumb . $contents[$i]->filename;
\r
572 // <080213 shizuki add>
\r
573 $hscThFN = htmlspecialchars($thumb_file);
\r
574 // </080213 shizuki add>
\r
575 // 2008-11-01 cacher
\r
577 if (file_exists($mediapath . $thumb_file)) {
\r
578 // /2008-11-01 cacher
\r
579 // <080213 mod by shizuki>
\r
580 // echo "<div class=\"tmb\">
\r
581 // <a href=\"media.php\" onclick=\"chooseImage('", htmlspecialchars($jsCurrentCollection), "','", htmlspecialchars($targetfile), "',"
\r
582 // . "'", htmlspecialchars($width), "','" , htmlspecialchars($height), "'"
\r
583 // . ")\" onkeypress=\"chooseImage('", htmlspecialchars($jsCurrentCollection), "','", htmlspecialchars($targetfile), "',"
\r
584 // . "'", htmlspecialchars($width), "','" , htmlspecialchars($height), "'"
\r
585 // . ")\" title=\"" . htmlspecialchars($targetfile). "\">
\r
586 // <img src=\"../../../media/$currentCollection/$thumb_file\" alt=\"$targetfile\" /></a></div>\n";
\r
589 <a href="media.php" onclick="chooseImage('{$hscJsCC}', '{$hscTGTF}', '{$width}', '{$height}')" onkeypress="chooseImage('{$hscJsCC}', '{$hscTGTF}', '{$width}', '{$height}')" title="{$hscTGTF}">
\r
590 <img src="{$hscMEDA}{$hscCCol}/{$hscThFN}" alt="{$hscTGTF}" /></a></div>
\r
593 //2008-02-21 Cacher
\r
594 // </ 080213 mod by shizuki>
\r
596 // When you do not make the thumbnail with mpg and wmv, etc.
\r
597 // 2008-11-01 cacher
\r
598 $revname=strrev($filename);
\r
599 $file_ext=strtoupper(strrev(substr($revname,0,strpos($revname,"."))));
\r
601 // echo "\t<div class=\"tmb\">$file_ext</div>\n";
\r
602 echo "\t<div class=\"media\">$file_ext</div>\n";
\r
603 // /2008-11-08 yama
\r
604 // /2008-11-01 cacher
\r
606 // 2008-11-01 cacher
\r
608 if ($width||$height){
\r
609 echo $width . ' x ' . $height;
\r
611 // echo "<br />\n\t(" . intval(filesize($filename)) . ")<br />\n\t" //2008-11-06 cacher
\r
612 echo "<br />\n\t" . number_format(filesize($filename)/1024, 1)." KB<br />\n\t"
\r
613 . date("Y-m-d", $contents[$i]->timestamp) . "<br class=\"clear\" />\n";
\r
614 // /2008-11-01 cacher
\r
615 /*File name and size*/
\r
616 //print "targetfile=$targetfile<BR />";
\r
617 if ($filetype != 0) {
\r
618 // image (gif/jpg/png/swf)
\r
619 // <080213 mod by shizuki>
\r
620 // echo "<a href=\"media.php\" onclick=\"chooseImage('", htmlspecialchars($jsCurrentCollection), "','", htmlspecialchars($targetfile), "',"
\r
621 // . "'", htmlspecialchars($width), "','" , htmlspecialchars($height), "'"
\r
622 // . ")\" onkeypress=\"chooseImage('", htmlspecialchars($jsCurrentCollection), "','", htmlspecialchars($targetfile), "',"
\r
623 // . "'", htmlspecialchars($width), "','" , htmlspecialchars($height), "'"
\r
624 // . ")\" title=\"" . htmlspecialchars($targetfile). "\">"
\r
625 // rem yama 20070928 . htmlspecialchars(shorten($targetfile,25,'...'))
\r
626 // . _MEDIA_PHP_26 //added yama 20070928
\r
628 // echo ' (<a href="', htmlspecialchars($CONF['MediaURL'] . $currentCollection . '/' . $targetfile), '" onclick="window.open(this.href); return false;" onkeypress="window.open(this.href); return false;" title="',htmlspecialchars(_MEDIA_VIEW_TT),'">',_MEDIA_VIEW,'</a>)';
\r
629 echo <<<_MEDIAPREVIEW_
\r
630 <a href="media.php" onclick="chooseImage('{$hscJsCC}', '{$hscTGTF}', '{$width}', '{$height}')" onkeypress="chooseImage('{$hscJsCC}', '{$hscTGTF}', '{$width}', '{$height}')" title="{$hscTGTF}">
\r
633 (<a href="{$hscMEDA}{$hscCCol}/{$hscTGTF}" onclick="window.open(this.href); return false;" onkeypress="window.open(this.href); return false;" title="{$hscMVTT}">{$hscMVEW}</a>)
\r
636 //2008-02-21 cacher
\r
637 // </ 080213 mod by shizuki>
\r
639 // not image (e.g. mpg)
\r
640 // <080213 mod by shizuki>
\r
641 // echo "<a href=\"media.php\" onclick=\"chooseOther('" , htmlspecialchars($jsCurrentCollection), "','", htmlspecialchars($targetfile), "'"
\r
642 // . ")\" title=\"" . htmlspecialchars($targetfile). "\">"
\r
643 // . htmlspecialchars(shorten($targetfile,30,'...'))
\r
645 // $shortFN = htmlspecialchars(shorten($targetfile, 30, '...'));
\r
646 echo <<<_MEDIAFILE_
\r
647 <a href="media.php" onclick="chooseOther('{$hscJsCC}', '{$hscTGTF}')" onkeypress="chooseOther('{$hscJsCC}', '{$hscTGTF}')" title="{$hscTGTF}">
\r
650 (<a href="{$hscMEDA}{$hscCCol}/{$hscTGTF}" onclick="window.open(this.href); return false;" onkeypress="window.open(this.href); return false;" title="{$hscMVTT}">{$hscMVEW}</a>)
\r
653 // </080213 mod by shizuki>
\r
655 // <080213 mod by shizuki>
\r
656 // echo"<form method='post' action='media.php' style=\"margin:5px 0 2px;padding:0;\">\n
\r
658 // <input type='hidden' name='currentCollection' value='$currentCollection' />
\r
659 // <input type='hidden' name='offset' value=\"$offset\" />
\r
660 // <input type='hidden' name='targetfile' value=\"$targetfile\" />
\r
661 // <input type ='hidden' name='targetthumb' value=\"$thumb_targetfile\" />
\r
662 // <input type='text' name='newname' value=\"$targetfile\" size=\"24\" /><br />
\r
663 // <input type='submit' name='myaction' value='"._MEDIA_PHP_3."' title='"._MEDIA_PHP_4."' onclick='return kakunin(this.value)' onkeypress='return kakunin(this.value)' style=\"margin-left:5px;\" />\n
\r
664 // <input type='submit' name='myaction' value='"._MEDIA_PHP_1."' onclick='return kakunin(this.value)' onkeypress='return kakunin(this.value)' />\n
\r
666 // </form></div>\n";
\r
667 $media01 = htmlspecialchars(_MEDIA_PHP_1);
\r
668 $media03 = htmlspecialchars(_MEDIA_PHP_3);
\r
669 $media04 = htmlspecialchars(_MEDIA_PHP_4);
\r
670 echo <<<_FORMBLOCK_
\r
671 <form method="post" action="media.php" style="margin:5px 0 2px; padding:0;">
\r
673 <input type="hidden" name="currentCollection" value="{$hscCCol}" />
\r
674 <input type="hidden" name="offset" value="{$offset}" />
\r
675 <input type="hidden" name="targetfile" value="{$hscTGTF}" />
\r
676 <input type="hidden" name="targetthumb" value="{$hscTTGT}" />
\r
677 <input type="text" name="newname" value="{$hscTGTF}" size="24" /><br />
\r
678 <input type="submit" name="myaction" value="{$media03}" title="{$media04}" onclick="return kakunin(this.value)" onkeypress="return kakunin(this.value)" style="margin-left:5px;" />
\r
679 <input type="submit" name="myaction" value="{$media01}" onclick="return kakunin(this.value)" onkeypress="return kakunin(this.value)" />
\r
685 // </080213 mod by shizuki>
\r
687 } // if (sizeof($arr)>0) }
\r
688 echo '<p class="clear">' . "\n";
\r
689 if ($idxStart > 0 && $idxNext > 0) {
\r
690 echo "<a href='media.php?offset=" . intVal($idxStart-1) . "&collection=" . urlencode($currentCollection) . "'>" . htmlspecialchars(_MEDIA_PHP_29) . "</a> ";
\r
692 if ($idxStart < $maxpage) {
\r
693 echo "<a href='media.php?offset=" . intVal($idxStart+1) . "&collection=" . urlencode($currentCollection) . "'>" . htmlspecialchars(_MEDIA_PHP_28) . "</a> ";
\r
696 </p><form name="bottom" action="media.php" style="margin:5px;"><div>
\r
697 <?php echo htmlspecialchars(_MEDIA_PHP_11); ?> <input id="typeradio0b" type="radio" class="radio" name="typeradio" onclick="setType(0);document.top.typeradio[0].checked=true;" onkeypress="setType(0);document.top.typeradio[0].checked=true;" <?php echo $paste_mode_normal_checked; ?> /><label for="typeradio0b"><?php echo htmlspecialchars(_MEDIA_INLINE); ?></label>
\r
698 <input <?php echo $paste_mode_popup_checked; ?> id="typeradio1b" type="radio" class="radio" name="typeradio" onclick="setType(1);document.top.typeradio[0].checked=true;" onkeypress="setType(1);document.top.typeradio[0].checked=true;" /><label for="typeradio1b"><?php echo htmlspecialchars(_MEDIA_POPUP); ?></label>
\r
708 * Shows a screen where you can select the file to upload
\r
710 function media_choose()
\r
712 global $CONF, $member, $manager;
\r
714 $currentCollection = requestVar('collection');
\r
716 // start modify by T.Kosugi 2006/08/26
\r
717 // $collections = MEDIA::getCollectionList();
\r
718 $collections = MEDIADIRS::getCollectionList();
\r
723 <h1><?php echo htmlspecialchars(_UPLOAD_TITLE); ?></h1>
\r
725 <p><?php echo htmlspecialchars(_UPLOAD_MSG); ?></p>
\r
726 <!--//added yama 20070928-->
\r
727 <?php echo _MEDIA_PHP_21; ?>
\r
728 <!--//end yama 20070928-->
\r
730 <form method="post" enctype="multipart/form-data" action="media.php">
\r
732 <input type="hidden" name="action" value="uploadfile" />
\r
733 <?php $manager->addTicketHidden() ?>
\r
734 <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo intVal($CONF['MaxUploadSize']); ?>" />
\r
737 <input name="uploadfile" type="file" size="40" />
\r
738 <?php if (sizeof($collections) > 1) {
\r
740 <br /><br /><label for="upload_collection">Collection:</label>
\r
741 <br /><select name="collection" id="upload_collection">
\r
743 foreach ($collections as $dirname => $description) {
\r
744 echo '<option value="' . htmlspecialchars($dirname) . '"';
\r
745 if ($dirname == $currentCollection) {
\r
746 echo ' selected="selected"';
\r
748 echo '>' . htmlspecialchars($description) . '</option>';
\r
754 <input name="collection" type="hidden" value="<?php echo htmlspecialchars(requestVar('collection'))?>" />
\r
755 <?php } // if sizeof
\r
758 <input type="submit" value="<?php echo htmlspecialchars(_UPLOAD_BUTTON); ?>" />
\r
761 <p><a href="javascript:history.back()"><?php echo htmlspecialchars(_BACK); ?></a></p>
\r
768 * accepts a file for upload
\r
770 function media_upload()
\r
772 global $DIR_MEDIA, $member, $CONF, $manager;
\r
774 $uploadInfo = postFileInfo('uploadfile');
\r
776 $filename = $uploadInfo['name'];
\r
777 $filetype = $uploadInfo['type'];
\r
778 $filesize = $uploadInfo['size'];
\r
779 $filetempname = $uploadInfo['tmp_name'];
\r
780 $fileerror = intval($uploadInfo['error']);
\r
781 $mediatocu = $manager->getPlugin('NP_Mediatocu');
\r
782 // added yama 20080131
\r
783 if ($mediatocu->getOption('filename_rule') == "ascii") {
\r
784 $path_parts = pathinfo($filename);
\r
785 $filename = time() . "." . $path_parts['extension'];
\r
789 switch ($fileerror) {
\r
790 case 0: // = UPLOAD_ERR_OK
\r
792 case 1: // = UPLOAD_ERR_INI_SIZE
\r
793 case 2: // = UPLOAD_ERR_FORM_SIZE
\r
794 media_doError(_ERROR_FILE_TOO_BIG);
\r
796 case 3: // = UPLOAD_ERR_PARTIAL
\r
797 case 4: // = UPLOAD_ERR_NO_FILE
\r
798 case 6: // = UPLOAD_ERR_NO_TMP_DIR
\r
799 case 7: // = UPLOAD_ERR_CANT_WRITE
\r
801 // include error code for debugging
\r
802 // (see http://www.php.net/manual/en/features.file-upload.errors.php)
\r
803 media_doError(_ERROR_BADREQUEST . ' (' . $fileerror . ')');
\r
807 // T.Kosugi add 2006.9.1
\r
808 if (stristr($filename, '%00')) {
\r
809 media_doError(_MEDIA_PHP_38);
\r
811 // T.Kosugi add end
\r
812 if ($filesize > $CONF['MaxUploadSize']) {
\r
813 media_doError(_ERROR_FILE_TOO_BIG);
\r
816 // check file type against allowed types
\r
818 $allowedtypes = explode (',', $CONF['AllowedTypes']);
\r
819 foreach ( $allowedtypes as $type ) {
\r
820 if (eregi("\." .$type. "$",$filename)) {
\r
825 media_doError(_ERROR_BADFILETYPE);
\r
828 if (!is_uploaded_file($filetempname)) {
\r
829 media_doError(_ERROR_BADREQUEST);
\r
832 // prefix filename with current date (YYYY-MM-DD-)
\r
833 // this to avoid nameclashes
\r
834 if ($CONF['MediaPrefix']) {
\r
835 $filename = strftime("%Y%m%d-", time()) . $filename;
\r
838 $collection = requestVar('collection');
\r
839 $res = MEDIA::addMediaObject($collection, $filetempname, $filename);
\r
842 media_doError($res);
\r
844 $uppath = $DIR_MEDIA.$collection . "/";
\r
845 $upfile = $DIR_MEDIA.$collection . "/" . $filename;
\r
847 $res = move_uploaded_file($filetempname, $upfile);
\r
849 media_doError($res);
\r
852 make_thumbnail($DIR_MEDIA, $collection, $upfile, $filename);
\r
854 // shows updated list afterwards
\r
858 * accepts a dirname for mkdir
\r
859 * added by T.Kosugi 2006/08/27
\r
862 function media_mkdir($action)
\r
864 global $DIR_MEDIA, $member, $CONF, $manager;
\r
865 if ($action == _MEDIA_PHP_ACTION_MKDIR || $action =='mkdir' ) {
\r
866 $current = requestVar('mkdir_collection');
\r
867 $mkdirname = postVar('mkdirname');
\r
868 if (!($mkdirname && $current)) {
\r
872 if (is_numeric($current) && !is_dir($DIR_MEDIA . '/' . $current)) {
\r
873 $oldumask = umask(0000);
\r
874 if (!@mkdir($DIR_MEDIA. '/' . $current, 0777)) {
\r
875 return _ERROR_BADPERMISSIONS;
\r
879 $path = $current . '/' . $mkdirname ;
\r
880 $pathArray = explode('/', $path);
\r
881 if ($pathArray[0] !== $member->getID()) {
\r
882 media_doError(_MEDIA_PHP_39 . $pathArray[0] . ':' . $member->getID());
\r
884 if (in_array('..', $pathArray)) {
\r
885 media_doError(_MEDIA_PHP_40);
\r
888 if (is_dir($DIR_MEDIA . '/' . $current)) {
\r
889 $res = @mkdir($DIR_MEDIA . '/' . $current . '/' . $mkdirname);
\r
890 $res .= @chmod($DIR_MEDIA . '/' . $current . '/' . $mkdirname , 0777);
\r
893 media_doError(_MEDIA_PHP_41 . $res );
\r
895 // shows updated list afterwards
\r
897 } elseif($action == _MEDIA_PHP_ACTION_RMDIR ||
\r
898 $action == 'rmdir') {
\r
899 $rmdir_collection = postVar('rmdir_collection');
\r
900 $pathArray = explode('/', $rmdir_collection);
\r
901 if ($pathArray[0] !== $member->getID()) {
\r
902 media_doError(_MEDIA_PHP_39 . $pathArray[0] . ':' . $member->getID());
\r
904 if (in_array('..', $pathArray)) {
\r
905 media_doError(_MEDIA_PHP_40);
\r
907 $rmdir = $DIR_MEDIA . $rmdir_collection;
\r
908 $res = @rmdir($rmdir);
\r
912 media_doError(_MEDIA_PHP_42);
\r
915 $current = requestVar('collection');
\r
916 $collections = MEDIADIRS::getPrivateCollectionList();
\r
920 <h1><?php echo htmlspecialchars(_MEDIA_MKDIR_TITLE); ?></h1>
\r
922 <p><?php echo htmlspecialchars(_MEDIA_MKDIR_MSG); ?></p>
\r
924 <form method="post" action="media.php">
\r
926 <input type="hidden" name="action" value="<?php echo htmlspecialchars(_MEDIA_PHP_ACTION_MKDIR); ?>" />
\r
927 <?php $manager->addTicketHidden() ?>
\r
930 <input name="mkdirname" type="text" size="40" />
\r
931 <?php if (sizeof($collections) > 0) {
\r
933 <br /><br /><label for="mkdir_collection">Collection:</label>
\r
934 <br /><select name="mkdir_collection" id="mkdir_collection">
\r
936 foreach ($collections as $dirname => $description) {
\r
937 echo '<option value="',htmlspecialchars($dirname),'"';
\r
938 if ($dirname == $current) {
\r
939 echo ' selected="selected"';
\r
941 echo '>' . htmlspecialchars($description) . '</option>';
\r
945 <?php } elseif (sizeof($collections) == 1) {
\r
946 $flipCollections = array_flip($collections);
\r
947 $collection = array_pop($flipCollections);
\r
949 <input name="collection" type="hidden" value="<?php echo htmlspecialchars($collection);?>" />
\r
956 <input type="submit" value="<?php echo htmlspecialchars(_MEDIA_MKDIR_BUTTON); ?>" />
\r
959 <?php if (sizeof($collections) > 0) {?>
\r
960 <br /><br /><h1><?php echo htmlspecialchars(_MEDIA_RMDIR_TITLE); ?></h1>
\r
962 <p><?php echo htmlspecialchars(_MEDIA_RMDIR_MSG); ?></p>
\r
964 <form method="post" action="media.php">
\r
966 <input type="hidden" name="action" value="<?php echo htmlspecialchars(_MEDIA_PHP_ACTION_RMDIR); ?>" />
\r
968 <label for="rmdir_collection">Collection:</label>
\r
969 <br /><select name="rmdir_collection" id="rmdir_collection">
\r
971 foreach ($collections as $dirname => $description) {
\r
972 if (is_numeric($dirname)) continue;
\r
973 echo '<option value="',htmlspecialchars($dirname),'"';
\r
974 if ($dirname == $current) {
\r
975 echo ' selected="selected"';
\r
977 echo '>',htmlspecialchars($description),'</option>';
\r
987 <?php $manager->addTicketHidden() ?>
\r
988 <input type="submit" value="<?php echo htmlspecialchars(_MEDIA_RMDIR_BUTTON); ?>" />
\r
991 <p><a href="javascript:history.back()"><?php echo htmlspecialchars(_BACK); ?></a></p>
\r
997 function make_thumbnail($DIR_MEDIA, $collection, $upfile, $filename)
\r
1000 global $Prefix_thumb;
\r
1003 print "DIR_MEDIA=$DIR_MEDIA<BR />";
\r
1004 print "collection=$collection<BR />";
\r
1005 print "upfile=$upfile<BR />";
\r
1007 //print "filename=$filename<BR />\n";
\r
1008 // Thumbnail image size specification
\r
1012 $mediatocu = $manager->getPlugin('NP_Mediatocu');
\r
1013 $thumb_w = intVal($mediatocu->getOption('thumb_width'));
\r
1014 $thumb_h = intVal($mediatocu->getOption('thumb_height'));
\r
1015 $quality = intVal($mediatocu->getOption('thumb_quality'));
\r
1017 $size = getimagesize($upfile);
\r
1018 $thumb_file = "{$DIR_MEDIA}{$collection}/{$Prefix_thumb}{$filename}";
\r
1020 $moto_w = $size[0];
\r
1021 $moto_h = $size[1];
\r
1022 if ($moto_w > $thumb_w || $moto_h > $thumb_h) {
\r
1023 $ritu_w = $thumb_w /$moto_w;
\r
1024 $ritu_h = $thumb_h /$moto_h;
\r
1025 ($ritu_w < $ritu_h) ? $cv_ritu = $ritu_w : $cv_ritu = $ritu_h;
\r
1026 $w = ceil($moto_w * $cv_ritu);
\r
1027 $h = ceil($moto_h * $cv_ritu);
\r
1031 // Making preservation of thumbnail image
\r
1032 thumb_gd($upfile, $thumb_file, $w, $h, $size, $quality); //GD version
\r
1034 //There is no necessity about the resize.
\r
1035 thumb_gd($upfile, $thumb_file, $moto_w, $moto_h, $size, $quality); //GD version
\r
1040 //Thumbnail making(GD)
\r
1041 function thumb_gd($fname, $thumbfile, $out_w, $out_h, $size, $quality)
\r
1043 switch ($size[2]) {
\r
1044 case 1 ://.gif(or .png)
\r
1045 if (function_exists("ImageCreateFromGif")) {
\r
1046 $img_in = @ImageCreateFromGIF($fname);
\r
1048 $fname = str_replace( ".gif", ".png", $fname); //Extension conversion
\r
1049 $img_in = @ImageCreateFromPng($fname);
\r
1053 $img_in = @ImageCreateFromJPEG($fname);
\r
1056 $img_in = @ImageCreateFromPng($fname);
\r
1064 //print "im_in=$img_in<BR />";
\r
1065 $img_out = ImageCreateTrueColor($out_w, $out_h);
\r
1066 //Former image is copied and the thumbnail is made.
\r
1067 ImageCopyResampled($img_out, $img_in, 0, 0, 0, 0, $out_w, $out_h, $size[0], $size[1]);
\r
1068 //Preservation of thumbnail image
\r
1069 switch ($size[2]) {
\r
1071 ImageGif($img_out, $thumbfile);
\r
1074 ImageJpeg($img_out, $thumbfile, $quality);
\r
1077 ImagePng($img_out, $thumbfile);
\r
1080 //The memory that maintains the making image is liberated.
\r
1081 imagedestroy($img_in);
\r
1082 imagedestroy($img_out);
\r
1085 function media_loginAndPassThrough()
\r
1089 <h1><?php echo _LOGIN_PLEASE?></h1>
\r
1091 <form method="post" action="media.php">
\r
1093 <input name="action" value="login" type="hidden" />
\r
1094 <input name="collection" value="<?php echo htmlspecialchars(requestVar('collection')); ?>" type="hidden" />
\r
1095 <?php echo htmlspecialchars(_LOGINFORM_NAME); ?>: <input name="login" />
\r
1096 <br /><?php echo htmlspecialchars(_LOGINFORM_PWD); ?>: <input name="password" type="password" />
\r
1097 <br /><input type="submit" value="<?php echo htmlspecialchars(_LOGIN); ?>" />
\r
1100 <p><a href="media.php" onclick="window.close();"><?php echo htmlspecialchars(_POPUP_CLOSE); ?></a></p>
\r
1101 <?php media_foot();
\r
1105 function media_doError($msg)
\r
1109 <h1><?php echo htmlspecialchars(_ERROR); ?></h1>
\r
1110 <p><?php echo htmlspecialchars($msg); ?></p>
\r
1111 <p><a href="javascript:history.back()"><?php echo htmlspecialchars(_BACK); ?></a></p>
\r
1112 <?php media_foot();
\r
1117 function media_head()
\r
1119 global $manager, $CONF;
\r
1120 $mediatocu = $manager->getPlugin('NP_Mediatocu');
\r
1121 $thumb_w = intVal($mediatocu->getOption('thumb_width'));
\r
1122 $thumb_h = intVal($mediatocu->getOption('thumb_height'));
\r
1123 if ($mediatocu->getOption('paste_mode_checked') == "yes") {
\r
1128 $GreyBox = $mediatocu->getOption('use_gray_box');
\r
1130 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
\r
1131 <html xmlns="http://www.w3.org/1999/xhtml">
\r
1133 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo htmlspecialchars(_CHARSET); ?>" />
\r
1134 <meta http-equiv="Content-Script-Type" content="text/javascript" />
\r
1135 <meta http-equiv="Content-Style-Type" content="text/css" />
\r
1136 <title>Mediatocu</title>
\r
1137 <link rel="stylesheet" type="text/css" href="popups.css" />
\r
1139 if ($manager->pluginInstalled('NP_TinyMCE')) {
\r
1140 $tinyMCE = $manager->getPlugin('NP_TinyMCE');
\r
1142 <script language="javascript" type="text/javascript" src="<?php echo $tinyMCE->getAdminURL(); ?>jscripts/tiny_mce/tiny_mce_popup.js"></script>
\r
1146 <script type="text/javascript">
\r
1147 var type = <?php echo intVal($setType); ?>;
\r
1148 function setType(val) { type = val; }
\r
1150 function chooseImage(collection, filename, width, height) {
\r
1152 if ($manager->pluginInstalled('NP_TinyMCE')) {
\r
1154 var win = tinyMCEPopup.getWindowArg("w_n");
\r
1155 var file_path = "<?php echo $CONF['MediaURL']; ?>" + collection + "/" + filename;
\r
1156 win.document.getElementById(tinyMCEPopup.getWindowArg("f_n")).value = file_path;
\r
1157 if (tinyMCEPopup.getWindowArg("file_type") == "image") {
\r
1158 if (win.ImageDialog.getImageData) win.ImageDialog.getImageData();
\r
1159 if (win.ImageDialog.showPreviewImage) win.ImageDialog.showPreviewImage(file_path);
\r
1161 tinyMCEPopup.close();
\r
1163 } elseif ($GreyBox == 'yes') {
\r
1165 top.window.focus();
\r
1166 top.window.includeImage(collection,
\r
1168 type == 0 ? 'inline' : 'popup',
\r
1172 top.window.GB_hide();
\r
1176 top.opener.focus();
\r
1177 top.opener.includeImage(collection,
\r
1179 type == 0 ? 'inline' : 'popup',
\r
1189 function chooseOther(collection, filename) {
\r
1191 if ($manager->pluginInstalled('NP_TinyMCE')) {
\r
1193 var win = tinyMCEPopup.getWindowArg("w_n");
\r
1194 var file_path = "<?php echo $CONF['MediaURL']; ?>" + collection + "/" + filename;
\r
1195 win.document.getElementById(tinyMCEPopup.getWindowArg("f_n")).value = file_path;
\r
1196 tinyMCEPopup.close();
\r
1198 } elseif ($GreyBox == 'yes') {
\r
1200 top.window.focus();
\r
1201 top.window.includeOtherMedia(collection, filename);
\r
1202 top.window.GB_hide();
\r
1206 top.opener.focus();
\r
1207 top.opener.includeOtherMedia(collection, filename);
\r
1214 function kakunin(value){
\r
1215 res=confirm('<?php echo htmlspecialchars(_MEDIA_PHP_8); ?>'+value+'<?php echo htmlspecialchars(_MEDIA_PHP_9); ?>');
\r
1220 <style type="text/css">
\r
1221 /* 2008-11-08 yama*/
\r
1222 div.tmb, div.media {
\r
1223 /* /2008-11-08 yama*/
\r
1226 width : <?php echo $thumb_w ?>px;
\r
1227 height : <?php echo $thumb_h ?>px;
\r
1228 line-height : <?php echo $thumb_h ?>px;
\r
1231 /* 2008-11-08 yama*/
\r
1232 border : 1px solid #999;
\r
1233 /* /2008-11-08 yama*/
\r
1234 text-align : center;
\r
1236 /* 2008-11-08 yama*/
\r
1238 background-image: url("bg.gif");
\r
1241 background-color: #fff;
\r
1243 div.tmb a, div.media a {
\r
1244 /* /2008-11-08 yama*/
\r
1245 width : <?php echo $thumb_w ?>px;
\r
1246 height : <?php echo $thumb_h ?>px;
\r
1251 <base target="_self" />
\r
1258 function media_foot()
\r