1
TexAcoon
Classifieds_2.4 - Parse error
  • 2010/5/16 5:20

  • TexAcoon

  • Just popping in

  • Posts: 35

  • Since: 2010/5/10


When I tried to delete a test classified ad .. I ended up with a parse error ..


Parse error: syntax error, unexpected T_ELSE in /home/nebcnorg/domains/nebcn.org/public_html/portal/modules/classifieds/modify.php on line 265


Took a look at the modify.php for line 265 ... See [265]

td>";
    }else{
[265]    echo "
<td class="head">".constant($main_lang."_SENDBY")." td><td class="head"><input type="hidden" name="submitter" value="$submitter">$submittertd>";


What I find odd is the }else{ ... I never seen that written like that in php...

Thanks!
Doug


2
ghia
Re: Classifieds_2.4 - Parse error
  • 2010/5/16 10:54

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


That's only human reading formatting. Makes no difference to PHP.
Problem is most likely a } too much somewhere. Try to examine it with Notepad++.

3
culex
Re: Classifieds_2.4 - Parse error
  • 2010/5/16 11:05

  • culex

  • Module Developer

  • Posts: 711

  • Since: 2004/9/23


I find a few mistakes in this file, but for me its working if you

Change line 258

from
if ($premium == "0") { {


to
if ($premium == "0") {



And line 348

from
redirect_header("index.php",3,""._RETURNANN."");


to
redirect_header("index.php",3,_RETURNANN);
Programming is like sex:
One mistake and you have to support it for the rest of your life.

4
TexAcoon
Re: Classifieds_2.4 - Parse error
  • 2010/5/16 13:02

  • TexAcoon

  • Just popping in

  • Posts: 35

  • Since: 2010/5/10


Thanks ghia & culex for the quick reply ....

cluex: did make changes to the modify.php as stated .. For some unkown reason I would get another parse error reflected elsewhere in the script ..
Starting to think the "Ads for Xoop2" isn't 100% sound ..

I do not have issues uploading an ad or images .. It also places in admin queues waiting approvals and sends me and email .. So it all works great until you try to re-edit or delete the ad.. ??????

Do you have the modify.php code..

5
TexAcoon
Re: Classifieds_2.4 - Parse error
  • 2010/5/16 13:07

  • TexAcoon

  • Just popping in

  • Posts: 35

  • Since: 2010/5/10


Here is the "Ads for Xoops" .. modify.php ... code
From my experence (not much) .. I see all kinds of issues with the script ...


// $Id: modify.php,v 2.1 02/08/2010 12:51:25 jlm69 Exp $                     //
//                                                                           //
//               Classified Ads Module for Xoops                             //
//      Redesigned by John Mordo user jlm69 at www.xoops.org                 //
//          Find it or report problems at www.jlmzone.com                    //
//                                                                           //
//      Started with the MyAds module and made MANY, MANY changes            //
//                                                                           //
// ------------------------------------------------------------------------- //
//                   Original credits below                                  //
// ------------------------------------------------------------------------- //
// Original Author: Pascal Le Boustouller                                    //
// Author Website : pascal.e-xoops@perso-search.com                          //
// Licence Type   : GPL                                                      //
// ------------------------------------------------------------------------- //
include("header.php");
$mydirname basenamedirname__FILE__ ) ) ;
$main_lang =  '_' strtoupper$mydirname ) ;
require_once( 
XOOPS_ROOT_PATH."/modules/$mydirname/include/gtickets.php" ) ;
$myts =& MyTextSanitizer::getInstance();
$module_id $xoopsModule->getVar('mid');

if (
is_object($xoopsUser)) {
$groups $xoopsUser->getGroups();
} else {
$groups XOOPS_GROUP_ANONYMOUS;
}
$gperm_handler =& xoops_gethandler('groupperm');
if (isset(
$_POST['item_id'])) {
$perm_itemid intval($_POST['item_id']);
} else {
$perm_itemid 0;
}
//If no access
if (!$gperm_handler->checkRight("".$mydirname."_submit"$perm_itemid$groups$module_id)) {
   
redirect_header(XOOPS_URL."/modules/$mydirname/index.php"3_NOPERM);
   exit();
}
if (!
$gperm_handler->checkRight("jobs_premium"$perm_itemid$groups$module_id)) {
$premium 0;
} else {
$premium 1;
}

function 
ListingDel($lid$ok)
{
    global 
$xoopsDB$xoopsUser$xoopsConfig$xoopsTheme$xoopsLogger$mydirname$main_lang;

    
$result $xoopsDB->query("select usid, p.lid, p.url FROM ".$xoopsDB->prefix("".$mydirname."_listing")." l LEFT JOIN ".$xoopsDB->prefix("".$mydirname."_pictures")." p  ON l.lid=p.lid where l.lid=".mysql_real_escape_string($lid)."");
    list(
$usid$plid$purl) = $xoopsDB->fetchRow($result);

    if (
$xoopsUser) {
        
$currentid $xoopsUser->getVar("uid""E");
        if (
$usid == $currentid) {
            if(
$ok==1) {
                
$xoopsDB->queryf("delete from ".$xoopsDB->prefix("".$mydirname."_listing")." where lid=".mysql_real_escape_string($lid)."");
                if (
$purl) {
                    
$destination XOOPS_ROOT_PATH."/modules/$mydirname/photo";
                    if (
file_exists("$destination/$purl")) {
                        
unlink("$destination/$purl");
                    }
                    
$destination2 XOOPS_ROOT_PATH."/modules/$mydirname/photo/thumbs";
                    if (
file_exists("$destination2/thumb_$purl")) {
                        
unlink("$destination2/thumb_$purl");
                    }
                    
$destination3 XOOPS_ROOT_PATH."/modules/$mydirname/photo/resized";
                    if (
file_exists("$destination3/resized_$purl")) {
                        
unlink("$destination3/resized_$purl");
                    }
                }
                
redirect_header("index.php",3,constant($main_lang."_ANNDEL"));
                exit();
            } else {
                echo 
"n";
                echo 
"
";
                echo 
"".constant($main_lang."_SURDELANN")."";
            }
            echo 
"[ modify.php?op=ListingDel&amp;lid=".addslashes($lid)."&amp;ok=1">".constant($main_lang."_OUI")." | viewad.php?lid=".addslashes($lid)."">".constant($main_lang."_NON")." ]";
            echo 
"";
        }
    }
}

function 
DelReply($r_lid$ok)
{
    global 
$xoopsDB$xoopsUser$xoopsConfig$xoopsTheme$xoopsLogger$mydirname$main_lang;

    
$result $xoopsDB->query("select l.usid, r.r_lid, r.lid, r.title, r.date, r.submitter, r.message, r.tele, r.email, r.r_usid FROM ".$xoopsDB->prefix("".$mydirname."_listing")." l LEFT JOIN ".$xoopsDB->prefix("".$mydirname."_replies")." r ON l.lid=r.lid  where r.r_lid=".mysql_real_escape_string($r_lid)."");
    list(
$usid$r_lid$rlid$title$date$submitter$message$tele$email$r_usid) = $xoopsDB->fetchRow($result);

    if (
$xoopsUser) {
        
$currentid $xoopsUser->getVar("uid""E");
        if (
$usid == $currentid) {
            if(
$ok==1) {
                
$xoopsDB->queryf("delete from ".$xoopsDB->prefix("".$mydirname."_replies")." where r_lid=".mysql_real_escape_string($r_lid)."");
                
redirect_header("members.php?usid=".addslashes($usid)."",3,constant($main_lang."_REPLYDEL"));
                exit();
            } else {
                echo 
"n";
                echo 
"
";
                echo 
"".constant($main_lang."_SURDELANN")."";
            }
            echo 
"[ modify.php?op=DelReply&amp;r_lid=".addslashes($r_lid)."&amp;ok=1">".constant($main_lang."_OUI")." | members.php?usid=".addslashes($usid)."">".constant($main_lang."_NON")." ]";
            echo 
"";
        }
    }
}

function 
ModAd($lid)
{
    global 
$xoopsDB$xoopsModule$xoopsConfig$xoopsModuleConfig$xoopsUser$xoopsTheme$myts$xoopsLogger$mydirname$main_lang;

    include_once 
XOOPS_ROOT_PATH."/class/xoopsformloader.php";
    include_once 
XOOPS_ROOT_PATH."/modules/$mydirname/include/functions.php";
    echo 
"javascript">nfunction CLA(CLA) { var MainWindow = window.open (CLA, "_blank","width=500,height=300,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no");}n";

    include_once(
XOOPS_ROOT_PATH."/modules/$mydirname/class/classifiedstree.php");
    
$mytree = new ClassifiedsTree($xoopsDB->prefix("".$mydirname."_categories"),"cid","pid");

    
$result $xoopsDB->query("select lid, cid, title, status, expire, type, desctext, tel, price, typeprice, date, email, submitter, usid, town, country, contactby, premium, valid from ".$xoopsDB->prefix("".$mydirname."_listing")." where lid=".mysql_real_escape_string($lid)."");
    list(
$lid$cide$title$status$expire$type$desctext$tel$price$typeprice$date$email$submitter$usid$town$country$contactby$premium$valid) = $xoopsDB->fetchRow($result);

    
$categories classifieds_MygetItemIds("".$mydirname."_submit");
    if(
is_array($categories) && count($categories) > 0) {
    if(!
in_array($cide$categories)) {
    
redirect_header(XOOPS_URL."/modules/$mydirname/index.php"3_NOPERM);
    exit();
    }
    } else {    
// User can't see any category
    
redirect_header(XOOPS_URL.'/index.php'3_NOPERM);
    exit();
    }

    if (
$xoopsUser) {
    
$calusern $xoopsUser->uid();
    if (
$usid == $calusern) {
    echo 
"
".constant($main_lang."_MODIFANN")."";
    
$title $myts->htmlSpecialChars($title);
    
$status $myts->htmlSpecialChars($status);
    
$expire $myts->htmlSpecialChars($expire);
    
$type $myts->htmlSpecialChars($type);
    if (
$xoopsModuleConfig["".$mydirname."_form_options"] == 'dhtmltextarea') {
    
$desctext $myts->displayTarea($desctext,0,0,0,0,0);
    } else {
    
$desctext $myts->displayTarea($desctext1,0,1,1,1);
    }
    
$tel $myts->htmlSpecialChars($tel);
    
$price number_format($price2"."",");
    
$typeprice $myts->htmlSpecialChars($typeprice);
    
$submitter $myts->htmlSpecialChars($submitter);    
    
$town $myts->htmlSpecialChars($town);
    
$country $myts->htmlSpecialChars($country);
    
$contactby $myts->htmlSpecialChars($contactby);
    
$premium $myts->htmlSpecialChars($premium);
    
$useroffset "";
    if(
$xoopsUser) {
    
$timezone $xoopsUser->timezone();
    if(isset(
$timezone)){
    
$useroffset $xoopsUser->timezone();
    }else{
    
$useroffset $xoopsConfig['default_TZ'];
    }
    }
    
$dates = ($useroffset*3600) + $date;    
    
$dates formatTimestamp($date,"s");

    echo 
"modify.php" method=post enctype="multipart/form-data">
    head" border="2">
    head">".constant($main_lang."_NUMANNN").head" border="1">$lid ".constant($main_lang."_DU").$dates
    
";
    if (
$xoopsModuleConfig["".$mydirname."_diff_name"] == "1") {
    echo 
"head">".constant($main_lang."_SENDBY").head">text" name="submitter" size="50" value="$submitter" />";
    }else{
    echo 
"head">".constant($main_lang."_SENDBY").head">hidden" name="submitter" value="$submitter">$submitter";
    }
    echo 
"
";
    echo 
".constant($main_lang."_CONTACTBY").contactby">
    $contactby."">".$contactby."
    $main_lang."_CONTACT_BY_EMAIL")."">".constant($main_lang."_CONTACT_BY_EMAIL")."
    $main_lang."_CONTACT_BY_PM")."">".constant($main_lang."_CONTACT_BY_PM")."
    $main_lang."_CONTACT_BY_BOTH")."">".constant($main_lang."_CONTACT_BY_BOTH")."
    $main_lang."_CONTACT_BY_PHONE")."">".constant($main_lang."_CONTACT_BY_PHONE")."
";
    if (
$xoopsModuleConfig["".$mydirname."_diff_email"] == '1') {    
    echo 
"head">".constant($main_lang."_EMAIL").head">text" name="email" size="50" value="$email" />";
    } else {
    echo 
"
head">".constant($main_lang."_EMAIL").head">$emailhidden" name="email" value="$email" />";
    }
    echo 
"

    head">".constant($main_lang."_TEL").head">text" name="tel" size="50" value="$tel" />
    
";
    echo 
"
    head">".constant($main_lang."_TOWN").head">text" name="town" size="50" value="$town" />
    
";
    if (
$xoopsModuleConfig["".$mydirname."_use_country"] == '1') {
    echo 
"
    head">".constant($main_lang."_COUNTRY").head">text" name="country" size="50" value="$country" />
    
";
    } else {
    echo 
"hidden" name="country" value="">";
    }
    echo 
"
".constant($main_lang."_STATUS")."radio" name="status" value="0"";
    if (
$status == "0") {
    echo 
"checked";
    }
    echo 
">".constant($main_lang."_ACTIVE")."   radio" name="status" value="1""
    if (
$status == "1") {
    echo 
"checked";
    } 
    echo 
">".constant($main_lang."_INACTIVE")."   radio" name="status" value="2"";
    if (
$status == "2") {
    echo 
"checked";
    } 
    echo 
">".constant($main_lang."_SOLD")."
";
    echo 
"
    head">".constant($main_lang."_TITLE2").head">text" name="title" size="50" value="$title" />
    
";
    echo 
"head">".constant($main_lang."_PRICE2").head">"$xoopsModuleConfig["".$mydirname."_money"]."text" name="price" size="20" value="$price" />";
    
$result3 $xoopsDB->query("select nom_price from ".$xoopsDB->prefix("".$mydirname."_price")." order by id_price");
    echo 
typeprice">$typeprice">$typeprice";
    while(list(
$nom_price) = $xoopsDB->fetchRow($result3)) {
    echo 
"$nom_price">$nom_price";
    }
    echo 
"
";
    if (
$premium == "1") {
    echo 
"
    ".constant($main_lang."_WILL_LAST").$expire  ".constant($main_lang."_DAY")."
    
";
    echo 
"hidden" name="expire" value="$expire" />";
    } else {
    echo 
"

    ".constant($main_lang."_HOW_LONG").text" name="expire" size="3" maxlength="3" value="$expire" />  ".constant($main_lang."_DAY")."
    
";
    }
    echo 
"
    head">".constant($main_lang."_TYPE").head">type">";
    
$result5=$xoopsDB->query("select nom_type from ".$xoopsDB->prefix("".$mydirname."_type")." order by nom_type");
    while(list(
$nom_type) = $xoopsDB->fetchRow($result5)) {
    
$sel "";
    if (
$nom_type == $type) {
    
$sel "selected";
    }
    echo 
"$nom_type$sel>$nom_type";
    }
    echo 
"";
    echo 
"

    head">".constant($main_lang."_CAT").head">";
    
$mytree->makeMySelBox('title','title'$cide,'','cid');
    echo 
"
    

    head">".constant($main_lang."_DESC").head">";
    
$wysiwyg_text_areaclassifieds_getEditorconstant($main_lang."_DESC"), "desctext"$desctext'100%''200px');
    echo 
$wysiwyg_text_area->render();
    echo 
"
";
    echo 
"submit" value="".constant($main_lang."_MODIFANN")."" />
    
"
;
    echo 
"hidden" name="op" value="ModAdS" />";
    if (
$premium == "0") { {
    if (
$xoopsModuleConfig["".$mydirname."_moderated"] == '1') {
    echo 
"hidden" name="valid" value="No" />";
    echo 
"".constant($main_lang."_MODIFBEFORE")."";
    } else {
    echo 
"hidden" name="valid" value="Yes" />";
    }
    } else {
    echo 
"hidden" name="valid" value="Yes" />";
    }
    echo 
"hidden" name="lid" value="$lid" />";
    echo 
"hidden" name="premium" value="$premium" />";
    echo 
"hidden" name="date" value="$date" />
    "
.$GLOBALS['xoopsGTicket']->getTicketHtml__LINE__ 1800 'token')."";
        echo 
"
"
;
            }
    }
}

function 
ModAdS($lid$cat$title$status$expire$type$desctext$tel$price$typeprice$date$email$submitter$town$country$contactby$premium$valid)
{
    global 
$xoopsDB$xoopsConfig$xoopsModuleConfig$myts$xoopsLogger$mydirname$main_lang$xoopsGTicket;
    
    if ( ! 
$xoopsGTicket->checktrue 'token' ) ) {
        
redirect_header(XOOPS_URL."/modules/$mydirname/index.php"3,$xoopsGTicket->getErrors());
    }
    
$title $myts->addSlashes($title);
    
$status $myts->addSlashes($status);
    
$expire $myts->addSlashes($expire);
    
$type $myts->addSlashes($type);
    if (
$xoopsModuleConfig["".$mydirname."_form_options"] == 'dhtmltextarea') {
    
$desctext $myts->displayTarea($desctext,0,0,0,0,0);
    } else {
    
$desctext $myts->displayTarea($desctext1,0,1,1,1);
    }
    
$tel $myts->addSlashes($tel);
    
$price str_replace(array(','), ''$price);
    
$typeprice $myts->addSlashes($typeprice);
    
$submitter $myts->addSlashes($submitter);    
    
$town $myts->addSlashes($town);
    
$country $myts->addSlashes($country);
    
$contactby $myts->addSlashes($contactby);
    
$premium $myts->addSlashes($premium);

    
$xoopsDB->query("update ".$xoopsDB->prefix("".$mydirname."_listing")." set cid='$cat', title='$title', status='$status',  expire='$expire', type='$type', desctext='$desctext', tel='$tel', price='$price', typeprice='$typeprice', email='$email', submitter='$submitter', town='$town', country='$country', contactby='$contactby', premium='$premium', valid='$valid' where lid=$lid");

    
redirect_header("index.php",3,constant($main_lang."_ANNMOD2"));
    exit();
}

####################################################
foreach ($_POST as $k => $v) {
    ${
$k} = $v;
}
$ok = isset( $_GET['ok'] ) ? $_GET['ok'] : '' ;

if(!isset(
$_POST['lid']) && isset($_GET['lid']) ) {
    
$lid $_GET['lid'] ;
}
if(!isset(
$_POST['r_lid']) && isset($_GET['r_lid']) ) {
    
$r_lid $_GET['r_lid'] ;
}
if(!isset(
$_POST['op']) && isset($_GET['op']) ) {
    
$op $_GET['op'] ;
}
switch (
$op) {

    case 
"ModAd":
        include(
XOOPS_ROOT_PATH."/header.php");
        
ModAd($lid);
        include(
XOOPS_ROOT_PATH."/footer.php");
    break;
    
    case 
"ModAdS":
            
ModAdS($lid$cid$title$status$expire$type$desctext$tel$price$typeprice$date$email$submitter$town$country$contactby$premium$valid);
    break;

        case 
"ListingDel":
        include(
XOOPS_ROOT_PATH."/header.php");
         
ListingDel($lid$ok);
        include(
XOOPS_ROOT_PATH."/footer.php");
        break;

    case 
"DelReply":
        include(
XOOPS_ROOT_PATH."/header.php");
         
DelReply($r_lid$ok);
        include(
XOOPS_ROOT_PATH."/footer.php");
        break;

    default:
        
redirect_header("index.php",3,""._RETURNANN."");
    break;
}
?>

6
culex
Re: Classifieds_2.4 - Parse error
  • 2010/5/17 12:45

  • culex

  • Module Developer

  • Posts: 711

  • Since: 2004/9/23


I just checked here re modify and delete, and I do not find any issues, all from my end seem to work fine..Here is my code after I changed (modify.php)

// $Id: modify.php,v 2.1 02/08/2010 12:51:25 jlm69 Exp $                     //
//                                                                           //
//               Classified Ads Module for Xoops                             //
//      Redesigned by John Mordo user jlm69 at www.xoops.org                 //
//          Find it or report problems at www.jlmzone.com                    //
//                                                                           //
//      Started with the MyAds module and made MANY, MANY changes            //
//                                                                           //
// ------------------------------------------------------------------------- //
//                   Original credits below                                  //
// ------------------------------------------------------------------------- //
// Original Author: Pascal Le Boustouller                                    //
// Author Website : pascal.e-xoops@perso-search.com                          //
// Licence Type   : GPL                                                      //
// ------------------------------------------------------------------------- //
include("header.php");
$mydirname basenamedirname__FILE__ ) ) ;
$main_lang =  '_' strtoupper$mydirname ) ;
require_once( 
XOOPS_ROOT_PATH."/modules/$mydirname/include/gtickets.php" ) ;
$myts =& MyTextSanitizer::getInstance();
$module_id $xoopsModule->getVar('mid');

if (
is_object($xoopsUser)) {
$groups $xoopsUser->getGroups();
} else {
$groups XOOPS_GROUP_ANONYMOUS;
}
$gperm_handler =& xoops_gethandler('groupperm');
if (isset(
$_POST['item_id'])) {
$perm_itemid intval($_POST['item_id']);
} else {
$perm_itemid 0;
}
//If no access
if (!$gperm_handler->checkRight("".$mydirname."_submit"$perm_itemid$groups$module_id)) {
   
redirect_header(XOOPS_URL."/modules/$mydirname/index.php"3_NOPERM);
   exit();
}
if (!
$gperm_handler->checkRight("jobs_premium"$perm_itemid$groups$module_id)) {
$premium 0;
} else {
$premium 1;
}

function 
ListingDel($lid$ok)
{
    global 
$xoopsDB$xoopsUser$xoopsConfig$xoopsTheme$xoopsLogger$mydirname$main_lang;

    
$result $xoopsDB->query("select usid, p.lid, p.url FROM ".$xoopsDB->prefix("".$mydirname."_listing")." l LEFT JOIN ".$xoopsDB->prefix("".$mydirname."_pictures")." p  ON l.lid=p.lid where l.lid=".mysql_real_escape_string($lid)."");
    list(
$usid$plid$purl) = $xoopsDB->fetchRow($result);

    if (
$xoopsUser) {
        
$currentid $xoopsUser->getVar("uid""E");
        if (
$usid == $currentid) {
            if(
$ok==1) {
                
$xoopsDB->queryf("delete from ".$xoopsDB->prefix("".$mydirname."_listing")." where lid=".mysql_real_escape_string($lid)."");
                if (
$purl) {
                    
$destination XOOPS_ROOT_PATH."/modules/$mydirname/photo";
                    if (
file_exists("$destination/$purl")) {
                        
unlink("$destination/$purl");
                    }
                    
$destination2 XOOPS_ROOT_PATH."/modules/$mydirname/photo/thumbs";
                    if (
file_exists("$destination2/thumb_$purl")) {
                        
unlink("$destination2/thumb_$purl");
                    }
                    
$destination3 XOOPS_ROOT_PATH."/modules/$mydirname/photo/resized";
                    if (
file_exists("$destination3/resized_$purl")) {
                        
unlink("$destination3/resized_$purl");
                    }
                }
                
redirect_header("index.php",3,constant($main_lang."_ANNDEL"));
                exit();
            } else {
                echo 
"n";
                echo 
"
";
                echo 
"".constant($main_lang."_SURDELANN")."";
            }
            echo 
"[ modify.php?op=ListingDel&amp;lid=".addslashes($lid)."&amp;ok=1">".constant($main_lang."_OUI")." | viewad.php?lid=".addslashes($lid)."">".constant($main_lang."_NON")." ]";
            echo 
"";
        }
    }
}

function 
DelReply($r_lid$ok)
{
    global 
$xoopsDB$xoopsUser$xoopsConfig$xoopsTheme$xoopsLogger$mydirname$main_lang;

    
$result $xoopsDB->query("select l.usid, r.r_lid, r.lid, r.title, r.date, r.submitter, r.message, r.tele, r.email, r.r_usid FROM ".$xoopsDB->prefix("".$mydirname."_listing")." l LEFT JOIN ".$xoopsDB->prefix("".$mydirname."_replies")." r ON l.lid=r.lid  where r.r_lid=".mysql_real_escape_string($r_lid)."");
    list(
$usid$r_lid$rlid$title$date$submitter$message$tele$email$r_usid) = $xoopsDB->fetchRow($result);

    if (
$xoopsUser) {
        
$currentid $xoopsUser->getVar("uid""E");
        if (
$usid == $currentid) {
            if(
$ok==1) {
                
$xoopsDB->queryf("delete from ".$xoopsDB->prefix("".$mydirname."_replies")." where r_lid=".mysql_real_escape_string($r_lid)."");
                
redirect_header("members.php?usid=".addslashes($usid)."",3,constant($main_lang."_REPLYDEL"));
                exit();
            } else {
                echo 
"n";
                echo 
"
";
                echo 
"".constant($main_lang."_SURDELANN")."";
            }
            echo 
"[ modify.php?op=DelReply&amp;r_lid=".addslashes($r_lid)."&amp;ok=1">".constant($main_lang."_OUI")." | members.php?usid=".addslashes($usid)."">".constant($main_lang."_NON")." ]";
            echo 
"";
        }
    }
}

function 
ModAd($lid)
{
    global 
$xoopsDB$xoopsModule$xoopsConfig$xoopsModuleConfig$xoopsUser$xoopsTheme$myts$xoopsLogger$mydirname$main_lang;

    include_once 
XOOPS_ROOT_PATH."/class/xoopsformloader.php";
    include_once 
XOOPS_ROOT_PATH."/modules/$mydirname/include/functions.php";
    echo 
"javascript">nfunction CLA(CLA) { var MainWindow = window.open (CLA, "_blank","width=500,height=300,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no");}n";

    include_once(
XOOPS_ROOT_PATH."/modules/$mydirname/class/classifiedstree.php");
    
$mytree = new ClassifiedsTree($xoopsDB->prefix("".$mydirname."_categories"),"cid","pid");

    
$result $xoopsDB->query("select lid, cid, title, status, expire, type, desctext, tel, price, typeprice, date, email, submitter, usid, town, country, contactby, premium, valid from ".$xoopsDB->prefix("".$mydirname."_listing")." where lid=".mysql_real_escape_string($lid)."");
    list(
$lid$cide$title$status$expire$type$desctext$tel$price$typeprice$date$email$submitter$usid$town$country$contactby$premium$valid) = $xoopsDB->fetchRow($result);

    
$categories classifieds_MygetItemIds("".$mydirname."_submit");
    if(
is_array($categories) && count($categories) > 0) {
    if(!
in_array($cide$categories)) {
    
redirect_header(XOOPS_URL."/modules/$mydirname/index.php"3_NOPERM);
    exit();
    }
    } else {    
// User can't see any category
    
redirect_header(XOOPS_URL.'/index.php'3_NOPERM);
    exit();
    }

    if (
$xoopsUser) {
    
$calusern $xoopsUser->uid();
    if (
$usid == $calusern) {
    echo 
"
".constant($main_lang."_MODIFANN")."";
    
$title $myts->htmlSpecialChars($title);
    
$status $myts->htmlSpecialChars($status);
    
$expire $myts->htmlSpecialChars($expire);
    
$type $myts->htmlSpecialChars($type);
    if (
$xoopsModuleConfig["".$mydirname."_form_options"] == 'dhtmltextarea') {
    
$desctext $myts->displayTarea($desctext,0,0,0,0,0);
    } else {
    
$desctext $myts->displayTarea($desctext1,0,1,1,1);
    }
    
$tel $myts->htmlSpecialChars($tel);
    
$price number_format($price2"."",");
    
$typeprice $myts->htmlSpecialChars($typeprice);
    
$submitter $myts->htmlSpecialChars($submitter);    
    
$town $myts->htmlSpecialChars($town);
    
$country $myts->htmlSpecialChars($country);
    
$contactby $myts->htmlSpecialChars($contactby);
    
$premium $myts->htmlSpecialChars($premium);
    
$useroffset "";
    if(
$xoopsUser) {
    
$timezone $xoopsUser->timezone();
    if(isset(
$timezone)){
    
$useroffset $xoopsUser->timezone();
    }else{
    
$useroffset $xoopsConfig['default_TZ'];
    }
    }
    
$dates = ($useroffset*3600) + $date;    
    
$dates formatTimestamp($date,"s");

    echo 
"modify.php" method=post enctype="multipart/form-data">
    head" border="2">
    head">".constant($main_lang."_NUMANNN").head" border="1">$lid ".constant($main_lang."_DU").$dates
    
";
    if (
$xoopsModuleConfig["".$mydirname."_diff_name"] == "1") {
    echo 
"head">".constant($main_lang."_SENDBY").head">text" name="submitter" size="50" value="$submitter" />";
    }else{
    echo 
"head">".constant($main_lang."_SENDBY").head">hidden" name="submitter" value="$submitter">$submitter";
    }
    echo 
"
";
    echo 
".constant($main_lang."_CONTACTBY").contactby">
    $contactby."">".$contactby."
    $main_lang."_CONTACT_BY_EMAIL")."">".constant($main_lang."_CONTACT_BY_EMAIL")."
    $main_lang."_CONTACT_BY_PM")."">".constant($main_lang."_CONTACT_BY_PM")."
    $main_lang."_CONTACT_BY_BOTH")."">".constant($main_lang."_CONTACT_BY_BOTH")."
    $main_lang."_CONTACT_BY_PHONE")."">".constant($main_lang."_CONTACT_BY_PHONE")."
";
    if (
$xoopsModuleConfig["".$mydirname."_diff_email"] == '1') {    
    echo 
"head">".constant($main_lang."_EMAIL").head">text" name="email" size="50" value="$email" />";
    } else {
    echo 
"
head">".constant($main_lang."_EMAIL").head">$emailhidden" name="email" value="$email" />";
    }
    echo 
"

    head">".constant($main_lang."_TEL").head">text" name="tel" size="50" value="$tel" />
    
";
    echo 
"
    head">".constant($main_lang."_TOWN").head">text" name="town" size="50" value="$town" />
    
";
    if (
$xoopsModuleConfig["".$mydirname."_use_country"] == '1') {
    echo 
"
    head">".constant($main_lang."_COUNTRY").head">text" name="country" size="50" value="$country" />
    
";
    } else {
    echo 
"hidden" name="country" value="">";
    }
    echo 
"
".constant($main_lang."_STATUS")."radio" name="status" value="0"";
    if (
$status == "0") {
    echo 
"checked";
    }
    echo 
">".constant($main_lang."_ACTIVE")."   radio" name="status" value="1""
    if (
$status == "1") {
    echo 
"checked";
    } 
    echo 
">".constant($main_lang."_INACTIVE")."   radio" name="status" value="2"";
    if (
$status == "2") {
    echo 
"checked";
    } 
    echo 
">".constant($main_lang."_SOLD")."
";
    echo 
"
    head">".constant($main_lang."_TITLE2").head">text" name="title" size="50" value="$title" />
    
";
    echo 
"head">".constant($main_lang."_PRICE2").head">"$xoopsModuleConfig["".$mydirname."_money"]."text" name="price" size="20" value="$price" />";
    
$result3 $xoopsDB->query("select nom_price from ".$xoopsDB->prefix("".$mydirname."_price")." order by id_price");
    echo 
typeprice">$typeprice">$typeprice";
    while(list(
$nom_price) = $xoopsDB->fetchRow($result3)) {
    echo 
"$nom_price">$nom_price";
    }
    echo 
"
";
    if (
$premium == "1") {
    echo 
"
    ".constant($main_lang."_WILL_LAST").$expire  ".constant($main_lang."_DAY")."
    
";
    echo 
"hidden" name="expire" value="$expire" />";
    } else {
    echo 
"

    ".constant($main_lang."_HOW_LONG").text" name="expire" size="3" maxlength="3" value="$expire" />  ".constant($main_lang."_DAY")."
    
";
    }
    echo 
"
    head">".constant($main_lang."_TYPE").head">type">";
    
$result5=$xoopsDB->query("select nom_type from ".$xoopsDB->prefix("".$mydirname."_type")." order by nom_type");
    while(list(
$nom_type) = $xoopsDB->fetchRow($result5)) {
    
$sel "";
    if (
$nom_type == $type) {
    
$sel "selected";
    }
    echo 
"$nom_type$sel>$nom_type";
    }
    echo 
"";
    echo 
"

    head">".constant($main_lang."_CAT").head">";
    
$mytree->makeMySelBox('title','title'$cide,'','cid');
    echo 
"
    

    head">".constant($main_lang."_DESC").head">";
    
$wysiwyg_text_areaclassifieds_getEditorconstant($main_lang."_DESC"), "desctext"$desctext'100%''200px');
    echo 
$wysiwyg_text_area->render();
    echo 
"
";
    echo 
"submit" value="".constant($main_lang."_MODIFANN")."" />
    
"
;
    echo 
"hidden" name="op" value="ModAdS" />";
    if (
$premium == "0") {
    if (
$xoopsModuleConfig["".$mydirname."_moderated"] == '1') {
    echo 
"hidden" name="valid" value="No" />";
    echo 
"".constant($main_lang."_MODIFBEFORE")."";
    } else {
    echo 
"hidden" name="valid" value="Yes" />";
    }
    } else {
    echo 
"hidden" name="valid" value="Yes" />";
    }
    echo 
"hidden" name="lid" value="$lid" />";
    echo 
"hidden" name="premium" value="$premium" />";
    echo 
"hidden" name="date" value="$date" />
    "
.$GLOBALS['xoopsGTicket']->getTicketHtml__LINE__ 1800 'token')."";
        echo 
"
"
;
            }
    }
}

function 
ModAdS($lid$cat$title$status$expire$type$desctext$tel$price$typeprice$date$email$submitter$town$country$contactby$premium$valid)
{
    global 
$xoopsDB$xoopsConfig$xoopsModuleConfig$myts$xoopsLogger$mydirname$main_lang$xoopsGTicket;
    
    if ( ! 
$xoopsGTicket->checktrue 'token' ) ) {
        
redirect_header(XOOPS_URL."/modules/$mydirname/index.php"3,$xoopsGTicket->getErrors());
    }
    
$title $myts->addSlashes($title);
    
$status $myts->addSlashes($status);
    
$expire $myts->addSlashes($expire);
    
$type $myts->addSlashes($type);
    if (
$xoopsModuleConfig["".$mydirname."_form_options"] == 'dhtmltextarea') {
    
$desctext $myts->displayTarea($desctext,0,0,0,0,0);
    } else {
    
$desctext $myts->displayTarea($desctext1,0,1,1,1);
    }
    
$tel $myts->addSlashes($tel);
    
$price str_replace(array(','), ''$price);
    
$typeprice $myts->addSlashes($typeprice);
    
$submitter $myts->addSlashes($submitter);    
    
$town $myts->addSlashes($town);
    
$country $myts->addSlashes($country);
    
$contactby $myts->addSlashes($contactby);
    
$premium $myts->addSlashes($premium);

    
$xoopsDB->query("update ".$xoopsDB->prefix("".$mydirname."_listing")." set cid='$cat', title='$title', status='$status',  expire='$expire', type='$type', desctext='$desctext', tel='$tel', price='$price', typeprice='$typeprice', email='$email', submitter='$submitter', town='$town', country='$country', contactby='$contactby', premium='$premium', valid='$valid' where lid=$lid");

    
redirect_header("index.php",3,constant($main_lang."_ANNMOD2"));
    exit();
}

####################################################
foreach ($_POST as $k => $v) {
    ${
$k} = $v;
}
$ok = isset( $_GET['ok'] ) ? $_GET['ok'] : '' ;

if(!isset(
$_POST['lid']) && isset($_GET['lid']) ) {
    
$lid $_GET['lid'] ;
}
if(!isset(
$_POST['r_lid']) && isset($_GET['r_lid']) ) {
    
$r_lid $_GET['r_lid'] ;
}
if(!isset(
$_POST['op']) && isset($_GET['op']) ) {
    
$op $_GET['op'] ;
}
switch (
$op) {

    case 
"ModAd":
        include(
XOOPS_ROOT_PATH."/header.php");
        
ModAd($lid);
        include(
XOOPS_ROOT_PATH."/footer.php");
    break;
    
    case 
"ModAdS":
            
ModAdS($lid$cid$title$status$expire$type$desctext$tel$price$typeprice$date$email$submitter$town$country$contactby$premium$valid);
    break;

        case 
"ListingDel":
        include(
XOOPS_ROOT_PATH."/header.php");
         
ListingDel($lid$ok);
        include(
XOOPS_ROOT_PATH."/footer.php");
        break;

    case 
"DelReply":
        include(
XOOPS_ROOT_PATH."/header.php");
         
DelReply($r_lid$ok);
        include(
XOOPS_ROOT_PATH."/footer.php");
        break;

    default:
        
redirect_header("index.php",3,_RETURNANN);
    break;
}
?>
Programming is like sex:
One mistake and you have to support it for the rest of your life.

7
TexAcoon
Re: Classifieds_2.4 - Parse error
  • 2010/5/17 13:03

  • TexAcoon

  • Just popping in

  • Posts: 35

  • Since: 2010/5/10


Thanks Culex,,


Gave it a try and still picked up a parse error ..

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in modules/classifieds/modify.php on line 79


I took a look on line 79 and did not show me an expected string as mentioned ..

Here is a copy of line 79

list($usid, $plid, $purl) = $xoopsDB->fetchRow($result);

if ($xoopsUser) { LINE 79
$currentid = $xoopsUser->getVar("uid", "E");
if ($usid == $currentid) {
if($ok==1) {

8
culex
Re: Classifieds_2.4 - Parse error
  • 2010/5/18 19:28

  • culex

  • Module Developer

  • Posts: 711

  • Since: 2004/9/23


Are you sure this is version 2.4 your using ?

On line 79 I have

echo "[ modify.php?op=ListingDel&amp;lid=".addslashes($lid)."&amp;ok=1">".constant($main_lang."_OUI")." | viewad.php?lid=".addslashes($lid)."">".constant($main_lang."_NON")." ]";
Programming is like sex:
One mistake and you have to support it for the rest of your life.

9
ghia
Re: Classifieds_2.4 - Parse error
  • 2010/5/19 8:20

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


The code window may have distorted some code:
echo "[ ".constant($main_lang."_OUI")." | ".constant($main_lang."_NON")." ]

";

eg ."&ok=1">". and ."">".

Better is to use ' for string delimiter allowing easy use of " inside.

echo '[ '.constant($main_lang."_OUI").' | '.constant($main_lang."_NON").' ]

';

10
TexAcoon
Re: Classifieds_2.4 - Parse error
  • 2010/5/19 12:25

  • TexAcoon

  • Just popping in

  • Posts: 35

  • Since: 2010/5/10


@culex ... Yes I'm using 2.4 .. Did try the code you gave me and it did not work ..

@ghia .. I'll give it a try latter today ..

Off to work I go ....

Thanks Guys!

Login

Who's Online

269 user(s) are online (146 user(s) are browsing Support Forums)


Members: 0


Guests: 269


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits