Post PHP Related Questions and doubts , answered in 48 hours.
Step 1 :
config.php and locate line:
$Config['ConfigAllowedCommands'] = array(’QuickUpload’, ‘FileUpload’, ‘GetFolders’, ‘GetFoldersAndFiles’, ‘CreateFolder’) ;
just add function ‘DeleteFile’
Like this:
$Config['ConfigAllowedCommands'] = array(’QuickUpload’, ‘FileUpload’, ‘GetFolders’, ‘GetFoldersAndFiles’, ‘CreateFolder’, ‘DeleteFile’) ;
Step 2:
Place the delete image into filemanager/browser/default/images
Step 3:
Open up filemanager/frmresourceslist.html for editing with your favorite text-editor
Create a Delete Link which will call the DeleteFile function (which we’ll create later)
Go to line #66 where you’ll find this:
JavaScript:
var sLink = ‘<a href=”#” onclick=”OpenFile(\” + fileUrl + ‘\’);return false;”>’ ;
Underneath that line, now insert this:
JavaScript:
var dLink = ‘<a href=”#” title=”Delete file” onclick=”DeleteFile(\” + escape(fileName) + ‘\’);return false;”>’ ;
Add the created Delete Link to the page
Go to line #75 (#74 if you haven’t added the Delete Link yet) where you’ll find this:
JavaScript:
oCell.innerHTML = sLink + ‘<img alt=”" src=”images/icons/’ + sIcon + ‘.gif” width=”16″ height=”16″ border=”0″></a>’ ;
Replace that line with:
JavaScript:
oCell.innerHTML = sLink + ‘<img alt=”" src=”images/icons/’ + sIcon + ‘.gif” width=”16″ height=”16″ border=”0″></a> ‘ + dLink + ‘<img alt=”" src=”images/delete.gif” width=”16″ height=”16″ border=”0″></a>’ ;
Add a DeleteFile function (which will call the PHP script) and a DeleteFileCallBack function (which is called after the file was deleted) just before window.onload = { … }
The DeleteFile function:
JavaScript:
function DeleteFile( fileName, fileUrl ) {
if (confirm(’Are you sure you wish to delete ‘ + unescape(fileName) + ‘?’)) {
oConnector.SendCommand( ‘DeleteFile’, “FileName=” + fileName, DeleteFileCallBack ) ;
}
}
The DeleteFileCallBack function
function DeleteFileCallBack ( fckXml ) {
var oNodes = fckXml.SelectNodes( ‘Connector/Error’ );
if (oNodes!=null && oNodes.length>0) {
var errNo = parseInt(oNodes[0].attributes.getNamedItem(’number’).value) ;
switch (errNo) {
case 0 :
break;
case 102 :
case 103 :
alert(oNodes[0].attributes.getNamedItem(’originalDescription’).value);
break;
default:
alert(’DFi: Invalid XML response from connector..’);
}
} else {
alert(’DFi: Invalid XML response from connector.’);
}
Refresh();
}
Step 4:
Open up filemanager/connectors/php/commands.php for editing at the very end of the file (just before the ?>)
Add a DeleteFile function which actually deletes the file
PHP:
function DeleteFile($resourceType, $currentFolder) {
$sErrorNumber = ‘0′ ;
$sErrorMsg = ” ;
if ( isset( $_GET['FileName'] ) ) {
// Map the virtual path to the local server path.
$sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ;
$sFileName = $_GET['FileName'] ;
if ( strpos( $sFileName, ‘..’ ) !== FALSE ) {
$sErrorNumber = ‘102′ ; // Invalid file name.
$sErrorMsg = ‘Invalid file name’;
} else {
if ( @unlink($sServerDir.$sFileName) ) {
$sErrorNumber = ‘0′ ; // deleted
} else {
$sErrorNumber = ‘103′ ; // not deleted
$sErrorMsg = ‘Could not delete file ‘.$sServerDir.$sFileName;
}
}
} else {
$sErrorNumber = ‘102′ ; // no file set
$sErrorMsg = ‘No file specified’;
}
// Create the “Error” node.
echo ‘<Error number=”‘ . $sErrorNumber . ‘” originalDescription=”‘ . ConvertToXmlAttribute( $sErrorMsg ) . ‘” />’ ;
}
Step 5:
Open up filemanager/connectors/php/connector.php for editing
Modify the switch statement to include the DeleteFile action
Go to line 100 where you’ll find “break ;”, after that add:
PHP:
case ‘DeleteFile’ : // Added by Bramus!
DeleteFile( $sResourceType, $sCurrentFolder ) ;
break ;
The PHP-QA team would like to announce the
TestFest for the month of
May 2008. The TestFest is an event that aims at improving the
code coverage of the
test suite for the PHP
language itself. As part of this event, local User Groups (UG) are
invited to join the TestFest. These UGs can meet physically or come
together virtually. The point however is that people network to learn
together. Aside from being an opportunity for all of you to make friends
with like minded people in your (virtual) community, it also will
hopefully reduce the work load for the PHP.net mentors.
All it takes is someone to organize a UG to spearhead the event and
to get others involved in
writing phpt tests.
The submissions will then be reviewed by members of php.net before
getting included in the official test suite. Please visit the
TestFest homepage to get
additional details on the TestFest on how to get involved, either as a
UG or by setting up the necessary infrastructure.
The Free and Open Source Conference (FrOSCon) 2008 is a two-day conference on free software and open source. It will take place on August, 23th and 24th 2008 in Sankt Augustin near Bonn, Germany.
The PHP Usergroups Dortmund, Köln/Bonn and Hamburg are cooperatively organizing the PHP track as a sub-conference of the FrOSCon. The call for paper is now open.
Once again we are glad to announce that we have been accepted to be a Google Summer of Code project. See our program for this year's GSoC.
We would like to take this opportunity to say thanks to Google Inc. for this privilege to participate once again, and would like to invite everyone to look at our list of ideas: http://wiki.php.net/gsoc/2008.Students are of course more than welcome to come up with their own ideas for their proposals and we will consider each and every application that we will receive.
So once again, thanks to everyone who is involved in this magnificent journey and we hope to see many of you great students and open source passionate join us in our most enjoyable Google Summer of Code projects.
The publishers of php|architect Magazine are proud to announce the php|tek 2008 conference in Chicago, Illinois, USA.
The PHP Community meets May 20-23 for one of North America's premier PHP conferences of 2008. Join us to hear top speakers such as Derick Rethans (eZ Systems), Lucas Nelan (Facebook), Chris Shiflett (OmniTI), Eli White (Digg) and yes, even Terry Chay (Tagged).
For the past two years, php|architect's spring conference has sold out weeks before the start date, so if you're interested in attending, don't delay, and be sure to sign up ASAP!
2008 PHP Quebec Conference & Job Fair
The PHP Quebec team is pleased to present the sixth edition of the PHP
Quebec Conference. The Conference will take place in Montreal, Canada,
on March 12 through
14.
Join us for the PHPLabs, 2 days of technical talks, the Open Source Job
Fair & Cocktail. Meet with well know community members such as: John
Coggeshall, Marcus Boerger, Zak Greant, Chris Shiflett, Damien Seguy and
many more.
Take note that online registration ends on March 7th. For more information,
visit the website: http://conf.phpquebec.com
February 29th (Leap Year Day). phplondon.org announce their third
annual community conference
to be held at Inmarsat, Old Street, London.
This year the conference will run two tracks and include speakers such as Derick Rethans, Wez Furlong, Scott MacVicar and Zoe Slattery.
We will also be holding an extended presentation and discussion on frameworks for PHP.
Visit our conference site to register. Early bird discount is available until 1st February 2008.
2008 DC PHP Conference June 2nd – 4th
Join us at the 3rd Annual DC PHP Conference. The event will take place at George Washington University's Cafritz Conference Center in the heart of Washington DC. The three day conference begins June 2nd and 3rd with general sessions, and ends June 4th with tutorials.
For more details go to http://www.dcphpconference.com/node/346
The PHP development team would like to announce the immediate availability of
PHP 4.4.8. It continues to improve the security and the stability of the 4.4
branch and all users are strongly encouraged to upgrade to it as soon as
possible. This release wraps up all the outstanding patches for the PHP 4.4
series, and is therefore the last normal PHP 4.4 release. If necessary,
releases to address security issues could be made until 2008-08-08.
Security Enhancements and Fixes in PHP 4.4.8:
For a full list of changes in PHP 4.4.8, see the ChangeLog.