Category: Php
Top 10 PHP Frameworks
Posted by gladwing in Php Saturday, 20 February 2010 09:07 No Comments
2 Yii
3 CakePHP
4 Zend
5 Symfony
7 Prado
8 Akelos
9 ZooP
10 QPHP
Post PHP Related Questions here
Posted by gladwing in Php Monday, 29 June 2009 02:17 No Comments
Post PHP Related Questions and doubts , answered in 48 hours.
FCK with delete option – File manager plugin
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 glad
DeleteFile( $sResourceType, $sCurrentFolder ) ;
break ;
TestFest 2008
Posted by gladwing in Php Tuesday, 1 April 2008 06:39 No Comments
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.
PHP @ FrOSCon: Call for Papers
Posted by gladwing in Php Tuesday, 1 April 2008 06:39 No Comments
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.