Sponsored by NuSphere - PHP Software for PHP Application Developers - On Sale This Week for $100



Go Back   PHP-Editors > Programming Help > PHP Programming Help

PHP Programming Help Post any question relating to PHP Programming here and hopefully someone can help.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 2007-02-28, 01:52 PM
Junior Member
 
Join Date: Feb 2007
Posts: 2
noloco is on a distinguished road
Default OScommerce PHP error...Stuck!

Hello,

I've installed a module in OSCommerce for cross sales promotions, but the module has a problem with the code. I have been looking at it for a while and cannot seem to see it, was hoping a little extra eyes might help.

Here is the error I am receiving:
Parse error: syntax error, unexpected T_IF in /strange/webroot/sites/dev/dev.shoplenak.com/admin/includes/functions/general.php on line 20

Here is the code it is refering to:

<?php
/*
$Id: general.php,v 1.160 2003/07/12 08:32:47 hpdl Exp $

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright (c) 2003 osCommerce

Released under the GNU General Public License
*/

//Cache
function rdel($path, $deldir = true) {
// $path est le chemin relatif au fichier php
// $deldir (paramètre optionel, par dĂ©faut Ă* vrai) permet de dire si vous souhaitez supprimer le rĂ©pertoire (vrai) ou le vider uniquement
(faux)

// on vĂ©rifie d'abord que le nom du repertoire contient "/" Ă* la fin, sinon on le lui rajoute
if ($path[strlen($path)-1] != "/")
$path .= "/";

if (is_dir($path)) {
$d = opendir($path);

while ($f = readdir($d)) {
if ($f != "." && $f != "..") {
$rf = $path . $f; // chemin relatif au fichier php

if (is_dir($rf)) // si c'est un répertoire on appel récursivement la fonction
rdel($rf);
else // sinon on efface le fichier
unlink($rf);
}
}
closedir($d);

if ($deldir) // si $deldir est vrai on efface le répertoire
rmdir($path);
}
else {
unlink($path);
}
}

//Fin cache



Thanks!

Ben
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 2007-03-02, 03:54 AM
Junior Member
 
Join Date: Mar 2007
Posts: 1
SecondV is on a distinguished road
Default

Try this:

PHP Code:
<?php
/*
$Id: general.php,v 1.160 2003/07/12 08:32:47 hpdl Exp $

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright (c) 2003 osCommerce

Released under the GNU General Public License
*/

//Cache
function rdel($path$deldir true)
{
    
// $path est le chemin relatif au fichier php
    // $deldir (paramètre optionel, par dĂ©faut Ă* vrai) permet de dire si vous souhaitez supprimer le rĂ©pertoire (vrai) ou le vider uniquement (faux)
    // on vĂ©rifie d'abord que le nom du repertoire contient "/" Ă* la fin, sinon on le lui rajoute
    
if ($path[strlen($path)-1] != "/")
    {
        
$path .= "/";
    }

    if (
is_dir($path))
    {
        
$d opendir($path);

        while (
$f readdir($d))
        {
            if (
$f != "." && $f != "..")
            {
                
$rf $path $f// chemin relatif au fichier php

                
if (is_dir($rf)) // si c'est un rĂ©pertoire on appel rĂ©cursivement la fonction
                
{
                    
rdel($rf);
                }
                else 
// sinon on efface le fichier
                
{
                    
unlink($rf);
                }
            }
        }
        
closedir($d);

        if (
$deldir// si $deldir est vrai on efface le rĂ©pertoire
        
{
            
rmdir($path);
        }
    }
    else
    {
        
unlink($path);
    }
}

//Fin cache
Reply With Quote
  #3 (permalink)  
Old 2007-03-02, 11:41 AM
Junior Member
 
Join Date: Feb 2007
Posts: 2
noloco is on a distinguished road
Default

That worked perfectly!! Thank you very much!
Reply With Quote
Must read Review for Serious PHP Developers


NuSphere PhpED 5.5 : The Staff of php-editors.com recently spent a few days working with NuSphere PhpED 5.5 (a popular PHP IDE) and NuCoder 2.0 (a PHP Encoding Utility), read up on all the details.

Sponsored Links
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 11:00 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.