Web Threads » Development » Nucleus Podcast Uploads Via Applet
Nucleus Podcast Uploads Via Applet
If you need to provide a way for the technically challenged to easily upload media such as a podcast, one solution is to provide an ftp java applet for transferring the files so that you do not have to provide ftp access to the account. There are filesize upload limits on many servers and podcasts can be quite large. In our case we were using Nucleus for this CMS. This is an older article dug up from our previous archives that we thought worth saving.
After hours of searching for a suitable java applet, I found an ideal in JClientUpload which is dynamic and well supported as of this writing, includes drag and drop file support, ideal for easy use and affordable commercial licensing.
Always have backups before making modifications!
Install the JClient on your server and test to make sure it works before proceeding with the Nucleus modifications. Support for the ftp applet installation is at www.javazoom.net. Once you have JClient working properly, you can proceed to modify Nucleus. Note that if you are only installing this client and not integrating it with Nucleus logins, you should secure the applet appropriately. A basic installation will be insecure.
Modifying Nucleus
This has only been tested with Nucleus version 3.31! If you have a lesser version, upgrade or adapt the hacks to suit your install. It may or may not work with higher versions.
Copy your working JClient to the directory where you’d like it to load from. Later we will create a new applet_ftp.js file to pass the correct nucleus media directory information.
It is also recommended to take additional steps to secure the Nucleus media directory. See Nucleus forum discussion.
Adding the Custom Edit Button
This uses the Nucleus FAQ as a guide, don’t forget to back up your files before you begin modifying them. Keep in mind that Nucleus upgrades will overwrite these hacks so you may want to keep a list of changes so that you can redo the modifications after an upgrade.
Edit file: /nucleus/javascript/edit.js. Create the new button popup window function.
function addFtpFile() { var ftppopup = window.open(nucleusFtpPopUrl + '.ftpmedia.php', 'name', 'status=yes,toolbar=no,scrollbars=yes,resizable=yes,width=500,height=450,top=0,left=0'); return; function setFtpPopupURL(url) { nucleusFtpPopupURL = url; } }
Add the auto insert podcast tag function to work if NP_Podcast is installed. (This is available from the Nucleus Plugins) You can still include this function if NP_Podcast is not installed. It will only be used if the plugin is loaded.
Find:
function includeOtherMedia(collection, filename) {
if (isCaretEmpty()) {
text = prompt("Text to display ?","");
} else {
text = getCaretText();
}
// add collection name when not private collection (or editing a message that's not your)
var fullName;
if (isNaN(collection) || (nucleusAuthorId != collection)) {
fullName = collection + '/' + filename;
} else {
fullName = filename;
}
var replaceBy = '<%media(' + fullName + '|' + text +')%>';
insertAtCaret(replaceBy);
updAllPreviews();
}And add after it:
function includePodcast(collection, filename) {
if (isCaretEmpty()) {
text = prompt("Name of Content ?","");
} else {
text = getCaretText();
}
// add collection name when not private collection (or editing a message that's not your)
var fullName;
if (isNaN(collection) || (nucleusAuthorId != collection)) {
fullName = collection + '/' + filename;
} else {
fullName = filename;
}
var replaceBy = '<%Podcast(' + fullName + '|' + text +')%>';
insertAtCaret(replaceBy);
updAllPreviews();
}Edit file: /nucleus/libs/PAGEFACTORY.PHP. Add buttons to the editor menus for both javascript blocks.
Find twice:
$this->_jsbutton('right',"rightThis()",_ADD_RIGHT_TT);
Add after:
$this->_jsbutton('file',"addFtpFile()",_ADD_FTP_TT);
Add your 16×16 ftp button image to /nucleus/images/, named button-file.gif.
Adding a popup media/applet page
* Create a new media file /nucleus/ftpmedia.php, which is based on media.php. This will work with the ftp applet instead of the standard Nucleus media upload script.
ftpmedia.php
<?php /* * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) * Copyright (C) 2002-2007 The Nucleus Group * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * (see nucleus/documentation/index.html#license for more info) */ /** * Media popup window for Nucleus * * Purpose: * - can be openen from an add-item form or bookmarklet popup * - shows a list of recent files, allowing browsing, search and * upload of new files * - close the popup by selecting a file in the list. The file gets * passed through to the add-item form (linkto, popupimg or inline img) * * @license http://nucleuscms.org/license.txt GNU General Public License * @copyright Copyright (C) 2002-2007 The Nucleus Group * $Id: ftpmedia.php,v 1.00 April 19, 2008 01:48:27 PM purplepaisley68 * */ $CONF = array(); // defines how much media items will be shown per page. You can override this // in config.php if you like. (changing it in config.php instead of here will // allow your settings to be kept even after a Nucleus upgrade) $CONF['MediaPerPage'] = 10; // include all classes and config data require('../config.php'); include($DIR_LIBS . 'MEDIA.php'); // media classes sendContentType('application/xhtml+xml', 'media'); // user needs to be logged in to use this if (!$member->isLoggedIn()) { media_loginAndPassThrough(); exit; } // check if member is on at least one teamlist $query = 'SELECT * FROM ' . sql_table('team'). ' WHERE tmember=' . $member->getID(); $teams = mysql_query($query); if (mysql_num_rows($teams) == 0) media_doError(_ERROR_DISALLOWEDUPLOAD); // get action $action = requestVar('action'); if ($action == '') $action = 'selectmedia'; // check ticket $aActionsNotToCheck = array('selectmedia', _MEDIA_FILTER_APPLY, _MEDIA_COLLECTION_SELECT); if (!in_array($action, $aActionsNotToCheck)) { if (!$manager->checkTicket()) media_doError(_ERROR_BADTICKET); } switch($action) { case 'chooseupload': case _MEDIA_UPLOAD_TO: case _MEDIA_UPLOAD_NEW: ftp_choose(); break; case 'uploadfile': media_select(); break; case _MEDIA_FILTER_APPLY: case 'selectmedia': case _MEDIA_COLLECTION_SELECT: default: media_select(); break; } // select a file from a list function media_select() { global $member, $CONF, $DIR_MEDIA, $manager; media_head(); // show 10 files + navigation buttons // show msg when no files // show upload form // files sorted according to last modification date // currently selected collection $currentCollection = requestVar('collection'); if (!$currentCollection || !@is_dir($DIR_MEDIA . $currentCollection)) $currentCollection = $member->getID(); // get collection list $collections = MEDIA::getCollectionList(); if (sizeof($collections) > 1) { ?> <form method="post" action="ftpmedia.php"><div> <label for="media_collection"><?php echo htmlspecialchars(_MEDIA_COLLECTION_LABEL)?></label> <select name="collection" id="media_collection"> <?php foreach ($collections as $dirname => $description) { echo '<option value="',htmlspecialchars($dirname),'"'; if ($dirname == $currentCollection) { echo ' selected="selected"'; } echo '>',htmlspecialchars($description),'</option>'; } ?> </select> <input type="submit" name="action" value="<?php echo htmlspecialchars(_MEDIA_COLLECTION_SELECT) ?>" title="<?php echo htmlspecialchars(_MEDIA_COLLECTION_TT)?>" /> <input type="submit" name="action" value="<?php echo htmlspecialchars(_MEDIA_UPLOAD_TO) ?>" title="<?php echo htmlspecialchars(_MEDIA_UPLOADLINK) ?>" /> <?php $manager->addTicketHidden() ?> </div></form> <?php } else { ?> <form method="post" action="ftpmedia.php" style="float:right"><div> <input type="hidden" name="collection" value="<?php echo htmlspecialchars($currentCollection)?>" /> <input type="submit" name="action" value="<?php echo htmlspecialchars(_MEDIA_UPLOAD_NEW) ?>" title="<?php echo htmlspecialchars(_MEDIA_UPLOADLINK) ?>" /> <?php $manager->addTicketHidden() ?> </div></form> <?php } // if sizeof $filter = requestVar('filter'); $offset = intRequestVar('offset'); $arr = MEDIA::getMediaListByCollection($currentCollection, $filter); ?> <form method="post" action="ftpmedia.php"><div> <label for="media_filter"><?php echo htmlspecialchars(_MEDIA_FILTER_LABEL)?></label> <input id="media_filter" type="text" name="filter" value="<?php echo htmlspecialchars($filter)?>" /> <input type="submit" name="action" value="<?php echo htmlspecialchars(_MEDIA_FILTER_APPLY) ?>" /> <input type="hidden" name="collection" value="<?php echo htmlspecialchars($currentCollection)?>" /> <input type="hidden" name="offset" value="<?php echo intval($offset)?>" /> </div></form> <?php ?> <table width="100%"> <caption><?php echo _MEDIA_COLLECTION_LABEL . htmlspecialchars($collections[$currentCollection])?></caption> <tr> <th><?php echo _MEDIA_MODIFIED?></th><th><?php echo _MEDIA_FILENAME?></th><th><?php echo _MEDIA_DIMENSIONS?></th> </tr> <?php if (sizeof($arr)>0) { if (($offset + $CONF['MediaPerPage']) >= sizeof($arr)) $offset = sizeof($arr) - $CONF['MediaPerPage']; if ($offset < 0) $offset = 0; $idxStart = $offset; $idxEnd = $offset + $CONF['MediaPerPage']; $idxNext = $idxEnd; $idxPrev = $idxStart - $CONF['MediaPerPage']; if ($idxPrev < 0) $idxPrev = 0; if ($idxEnd > sizeof($arr)) $idxEnd = sizeof($arr); for($i=$idxStart;$i<$idxEnd;$i++) { $obj = $arr[$i]; $filename = $DIR_MEDIA . $currentCollection . '/' . $obj->filename; $old_level = error_reporting(0); $size = @GetImageSize($filename); error_reporting($old_level); $width = $size[0]; $height = $size[1]; $filetype = $size[2]; echo "<tr>"; echo "<td>". date("Y-m-d",$obj->timestamp) ."</td>"; // strings for javascript $jsCurrentCollection = str_replace("'","\'",$currentCollection); $jsFileName = str_replace("'","\'",$obj->filename); if ($filetype != 0) { // image (gif/jpg/png/swf) echo "<td><a href="ftpmedia.php" onclick="chooseImage('", htmlspecialchars($jsCurrentCollection), "','", htmlspecialchars($jsFileName), "'," . "'", htmlspecialchars($width), "','" , htmlspecialchars($height), "'" . ")" title="" . htmlspecialchars($obj->filename). "">" . htmlspecialchars(shorten($obj->filename,25,'...')) ."</a>"; echo ' (<a href="', htmlspecialchars($CONF['MediaURL'] . $currentCollection . '/' . $obj->filename), '" onclick="window.open(this.href); return false;" title="',htmlspecialchars(_MEDIA_VIEW_TT),'">',_MEDIA_VIEW,'</a>)'; echo "</td>"; } elseif (strstr($jsFileName,'mp3') && ($manager->pluginInstalled('NP_Podcast')) ) { // Podcast (mp3) echo "<td><a href="ftpmedia.php" onclick="choosePodcast('", htmlspecialchars($jsCurrentCollection), "','", htmlspecialchars($jsFileName), "'," . "'", htmlspecialchars($width), "','" , htmlspecialchars($height), "'" . ")" title="" . htmlspecialchars($obj->filename). "">" . htmlspecialchars(shorten($obj->filename,25,'...')) ."</a>"; echo ' (<a href="', htmlspecialchars($CONF['MediaURL'] . $currentCollection . '/' . $obj->filename), '" onclick="window.open(this.href); return false;" title="',htmlspecialchars(_MEDIA_VIEW_TT),'">',_MEDIA_VIEW,'</a>)'; echo "</td>"; } else { // no image (e.g. mpg) echo "<td><a href='media.php' onclick="chooseOther('" , htmlspecialchars($jsCurrentCollection), "','", htmlspecialchars($jsFileName), "'" . ")" title="" . htmlspecialchars($obj->filename). "">" . htmlspecialchars(shorten($obj->filename,30,'...')) ."</a></td>"; } echo '<td>' , htmlspecialchars($width) , 'x' , htmlspecialchars($height) , '</td>'; echo '</tr>'; } } // if (sizeof($arr)>0) ?> </table> <?php if ($idxStart > 0) echo "<a href='media.php?offset=$idxPrev&collection=".urlencode($currentCollection)."'>". _LISTS_PREV."</a> "; if ($idxEnd < sizeof($arr)) echo "<a href='media.php?offset=$idxNext&collection=".urlencode($currentCollection)."'>". _LISTS_NEXT."</a> "; ?> <input id="typeradio0" type="radio" name="typeradio" onclick="setType(0);" checked="checked" /><label for="typeradio0"><?php echo _MEDIA_INLINE?></label> <input id="typeradio1" type="radio" name="typeradio" onclick="setType(1);" /><label for="typeradio1"><?php echo _MEDIA_POPUP?></label> <?php media_foot(); } /** * Shows a screen where you can select the file to upload */ /* Replaced function function media_choose() { global $CONF, $member, $manager; $currentCollection = requestVar('collection'); $collections = MEDIA::getCollectionList(); media_head(); ?> <h1><?php echo _UPLOAD_TITLE?></h1> <p><?php echo _UPLOAD_MSG?></p> <form method="post" enctype="multipart/form-data" action="ftpmedia.php"> <div> <input type="hidden" name="action" value="uploadfile" /> <?php $manager->addTicketHidden() ?> <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $CONF['MaxUploadSize']?>" /> File: <br /> <input name="uploadfile" type="file" size="40" /> <?php if (sizeof($collections) > 1) { ?> <br /><br /><label for="upload_collection">Collection:</label> <br /><select name="collection" id="upload_collection"> <?php foreach ($collections as $dirname => $description) { echo '<option value="',htmlspecialchars($dirname),'"'; if ($dirname == $currentCollection) { echo ' selected="selected"'; } echo '>',htmlspecialchars($description),'</option>'; } ?> </select> <?php } else { ?> <input name="collection" type="hidden" value="<?php echo htmlspecialchars(requestVar('collection'))?>" /> <?php } // if sizeof ?> <br /><br /> <input type="submit" value="<?php echo _UPLOAD_BUTTON?>" /> </div> </form> <?php media_foot(); } */ /** * Shows a screen with the file upload applet */ function ftp_choose() { global $CONF, $member, $manager; $currentCollection = requestVar('collection'); $collections = MEDIA::getCollectionList(); media_head(); ?> <h1><?php echo _UPLOAD_TITLE?></h1> <p><?php echo _UPLOAD_MSG?></p> <!-- jClientUpload Applet : Begin copy/paste --> <script src="podcasts/applet_ftp.js.php?memberid=<?php echo $currentCollection; ?>"></script> <!-- jClientUpload Applet : End copy/paste --> <br /> <form method="post" action="ftpmedia.php"> <div> <input type="hidden" name="action" value="uploadfile" /> <?php $manager->addTicketHidden() ?> <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $CONF['MaxUploadSize']?>" /> File: <br /> <input type="submit" value="<?php echo _FINISH_BUTTON?>" /> </div> </form> <p><b>jClientUpload 1.9.3 Applet</b><br> Homepage : <a href="http://www.javazoom.net/applets/jclientupload/jclientupload.html" target="_blank">http://www.javazoom.net</a> <br> <br> <?php media_foot(); } /** * accepts a file for upload */ function media_upload() { global $DIR_MEDIA, $member, $CONF; $uploadInfo = postFileInfo('uploadfile'); $filename = $uploadInfo['name']; $filetype = $uploadInfo['type']; $filesize = $uploadInfo['size']; $filetempname = $uploadInfo['tmp_name']; $fileerror = intval($uploadInfo['error']); switch ($fileerror) { case 0: // = UPLOAD_ERR_OK break; case 1: // = UPLOAD_ERR_INI_SIZE case 2: // = UPLOAD_ERR_FORM_SIZE media_doError(_ERROR_FILE_TOO_BIG); case 3: // = UPLOAD_ERR_PARTIAL case 4: // = UPLOAD_ERR_NO_FILE case 6: // = UPLOAD_ERR_NO_TMP_DIR case 7: // = UPLOAD_ERR_CANT_WRITE default: // include error code for debugging // (see http://www.php.net/manual/en/features.file-upload.errors.php) media_doError(_ERROR_BADREQUEST . ' (' . $fileerror . ')'); } if ($filesize > $CONF['MaxUploadSize']) media_doError(_ERROR_FILE_TOO_BIG); // check file type against allowed types $ok = 0; $allowedtypes = explode (',', $CONF['AllowedTypes']); foreach ( $allowedtypes as $type ) if (eregi("." .$type. "$",$filename)) $ok = 1; if (!$ok) media_doError(_ERROR_BADFILETYPE); if (!is_uploaded_file($filetempname)) media_doError(_ERROR_BADREQUEST); // prefix filename with current date (YYYY-MM-DD-) // this to avoid nameclashes if ($CONF['MediaPrefix']) $filename = strftime("%Y%m%d-", time()) . $filename; $collection = requestVar('collection'); $res = MEDIA::addMediaObject($collection, $filetempname, $filename); if ($res != '') media_doError($res); // shows updated list afterwards media_select(); } function media_loginAndPassThrough() { media_head(); ?> <h1><?php echo _LOGIN_PLEASE?></h1> <form method="post" action="ftpmedia.php"> <div> <input name="action" value="login" type="hidden" /> <input name="collection" value="<?php echo htmlspecialchars(requestVar('collection'))?>" type="hidden" /> <?php echo _LOGINFORM_NAME?>: <input name="login" /> <br /><?php echo _LOGINFORM_PWD?>: <input name="password" type="password" /> <br /><input type="submit" value="<?php echo _LOGIN?>" /> </div> </form> <p><a href="media.php" onclick="window.close();"><?php echo _POPUP_CLOSE?></a></p> <?php media_foot(); exit; } function media_doError($msg) { media_head(); ?> <h1><?php echo _ERROR?></h1> <p><?php echo $msg?></p> <p><a href="ftpmedia.php" onclick="history.back()"><?php echo _BACK?></a></p> <?php media_foot(); exit; } function media_head() { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Nucleus Media</title> <link rel="stylesheet" type="text/css" href="styles/popups.css" /> <script type="text/javascript"> var type = 0; function setType(val) { type = val; } function chooseImage(collection, filename, width, height) { window.opener.focus(); window.opener.includeImage(collection, filename, type == 0 ? 'inline' : 'popup', width, height ); window.close(); } function chooseOther(collection, filename) { window.opener.focus(); window.opener.includeOtherMedia(collection, filename); window.close(); } function choosePodcast(collection, filename) { window.opener.focus(); window.opener.includePodcast(collection, filename); window.close(); } </script> </head> <body> <?php } function media_foot() { ?> </body> </html> <?php } ?>
At this point, if all the edited files are uploaded, you should have a new button in the Editor and clicking it should load a new media upload window. **But we are not finished yet!**
* Edit language files /nucleus/language/english.php, and english-utf8.php, you can adjust the podcast text as you wish.
Find in each:
define('_ADD_ALIGNCENTER_TT', 'Align Center');
Add after (edit to suit):
define('_ADD_FTP_TT', 'FTP Upload - Podcast');
And also find in each:
define('_MEDIA_COLLECTION_LABEL', 'Current collection: ');
Add after:
define('_FINISH_BUTTON', 'Finished..');
Uploading to the correct Media directory
In the ftpmedia.php applet upload page, instead of calling applet_ftp.js, we’re calling a new php file, applet_ftp.js.php to generate our javascript dynamically, and passing the applet the parameter information about the Nucleus user so that it uploads the file to the user’s media directory, else it won’t appear in the user’s media list.
<!-- jClientUpload Applet : Begin copy/paste --> <script src="path/to/applet_ftp.js.php?memberid=<?php echo $currentCollection; ?>"></script> <!-- jClientUpload Applet : End copy/paste -->
* Create a copy of applet_ftp.js and name it applet_ftp.js.php.
* Add at the top:
<?php // get the $memberid $memberid = $_GET['memberid']; ?>
* Add this to both parameter blocks to use this memberid.
document.write('param5="account" ');
document.write('value5="/public_html/path-to-nucelus/media/<? echo $memberid; ?>/" '); document.writeln('<PARAM NAME="param5" VALUE="account"> ');
document.writeln('<PARAM NAME="value5" VALUE="/public_html/path-to-nucelus/media/<? echo $memberid; ?>/"> ');* You’ll also need add the relative path to where you installed the applet to be sure the ftpmedia page can find it. Do this for each file called in the line below and in both sets of parameters.
ARCHIVE="path/to/lib/jclientupload.jar,
Sample applet_ftp.js.php:
<?php // get the $memberid $memberid = $_GET['memberid']; if (isset($memberid)) { ?> <!-- var _info = navigator.userAgent; var _ns = false; var _ns6 = false; var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0); if (_info.indexOf("Opera") > 0) _ie = false; var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0) || (_info.indexOf("AIX") > 0) || (_info.indexOf("OS/2") > 0) || (_info.indexOf("IRIX") > 0))); var _ns6 = ((_ns == true) && (_info.indexOf("Mozilla/5") >= 0)); if (_ie == true) { document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH="250" HEIGHT="250" NAME="clientupload" codebase="http://java.sun.com/update/1.4.2/jinstall-1_4-windows-i586.cab#Version=1,4,0,0">'); } else if (_ns == true && _ns6 == false) { // BEGIN: Update parameters below for NETSCAPE 3.x and 4.x support. document.write('<EMBED '); document.write('type="application/x-java-applet;version=1.4" '); document.write('CODE="javazoom.upload.client.MApplet.class" '); document.write('JAVA_CODEBASE="./" '); document.write('ARCHIVE="podcasts/lib/jclientupload.jar,podcasts/lib/ftpimpl.jar,podcasts/lib/cnet.jar,podcasts/lib/clogging.jar" '); document.write('NAME="clientupload" '); document.write('WIDTH="250" '); document.write('HEIGHT="250" '); document.write('url="ftp://ftpsite.org" '); document.write('param1="username" '); document.write('value1="ftpuser" '); document.write('param2="password" '); document.write('value2="ftppass" '); document.write('param3="pasv" '); document.write('value3="true" '); document.write('mode="ftp" '); document.write('scriptable=true '); document.write('maxsize="75*1024*1024" '); document.write('whitelist="*.mp3" '); document.write('param4="deleteonfail" '); document.write('value4="true" '); document.write('param5="account" '); document.write('value5="/path/to/media/<? echo $memberid; ?>/" '); document.writeln('pluginspage="http://java.sun.com/products/plugin/index.html#download"><NOEMBED>'); // END } else { document.write('<APPLET CODE="javazoom.upload.client.MApplet.class" JAVA_CODEBASE="./" ARCHIVE="podcasts/lib/jclientupload.jar,podcasts/lib/ftpimpl.jar,podcasts/lib/cnet.jar,podcasts/lib/clogging.jar" WIDTH="250" HEIGHT="250" NAME="clientupload">'); } // BEGIN: Update parameters below for INTERNET EXPLORER, FIREFOX, SAFARI, OPERA, MOZILLA, NETSCAPE 6+ support. document.writeln('<PARAM NAME=CODE VALUE="javazoom.upload.client.MApplet.class">'); document.writeln('<PARAM NAME=CODEBASE VALUE="./">'); document.writeln('<PARAM NAME=ARCHIVE VALUE="podcasts/lib/jclientupload.jar,podcasts/lib/ftpimpl.jar,podcasts/lib/cnet.jar,podcasts/lib/clogging.jar">'); document.writeln('<PARAM NAME=NAME VALUE="clientupload">'); document.writeln('<PARAM NAME="type" VALUE="application/x-java-applet;version=1.4">'); document.writeln('<PARAM NAME="scriptable" VALUE="true">'); document.writeln('<PARAM NAME="url" VALUE="ftp://ftpsite.org">'); document.writeln('<PARAM NAME="param1" VALUE="username">'); document.writeln('<PARAM NAME="value1" VALUE="ftplogin">'); document.writeln('<PARAM NAME="param2" VALUE="password">'); document.writeln('<PARAM NAME="value2" VALUE="ftppass">'); document.writeln('<PARAM NAME="param3" VALUE="pasv">'); document.writeln('<PARAM NAME="value3" VALUE="true">'); document.writeln('<PARAM NAME="mode" VALUE="ftp">'); document.writeln('<PARAM NAME="maxsize" VALUE="75*1024*1024"> '); document.writeln('<PARAM NAME="whitelist" VALUE="*.mp3"> '); document.writeln('<PARAM NAME="param4" VALUE="deleteonfail"> '); document.writeln('<PARAM NAME="value4" VALUE="true"> '); document.writeln('<PARAM NAME="param5" VALUE="account"> '); document.writeln('<PARAM NAME="value5" VALUE="/path/to/media/<? echo $memberid; ?>/"> '); // END if (_ie == true) { document.write('</OBJECT>'); } else if (_ns == true && _ns6 == false) { document.write('</NOEMBED></EMBED>'); } else { document.write('</APPLET>'); } //--> <? } else echo 'Hack attempt, forbidden'; ?>
Be sure to change the paths and login details to your own server needs and upload your changed files. You may also want to change occurrences of
<? .. ?>
to
<?php .. ?>
This code is years old.
Now when you add a new item, your new upload button popup should load ftpmedia.php, and when you Select Upload File, it will load the applet page. Selecting the mp3 in the list should insert the correct media or podcast tags if NP_Podcast is installed. If not, make sure that all your paths and structure are correct for your installation.
Finally, be sure to secure your ftp applet and javascript file access.
Filed under: Development · Tags: applet, code, ftp, nucleus, podcasting




Like









