1
Kainaij
Catads 1.30 - Array submission error...
  • 2005/5/25 18:33

  • Kainaij

  • Quite a regular

  • Posts: 256

  • Since: 2004/10/5


I am aware of this thread:
https://xoops.org/modules/newbb/viewtopic.php?viewmode=flat&topic_id=31831&forum=4

After attempting to submit an ad, I get this error:

There was an error. Your ad has not been added
Array


My question is, has there been any kind of resolution to this problem? I started this thread because I do not feel that there was adequate closure to this issue.


2
Kainaij
Re: Catads 1.30 - Array submission error...
  • 2005/5/26 9:54

  • Kainaij

  • Quite a regular

  • Posts: 256

  • Since: 2004/10/5


Anyone? anyone?

(In my best Ferris Beuller teacher imitation)

3
theCat
Re: Catads 1.30 - Array submission error...
  • 2005/5/26 10:38

  • theCat

  • Just popping in

  • Posts: 77

  • Since: 2004/2/2 2


Is it an upgrade or fresh install ?
Wich config (xoops, php, server) ?

For test, can you add in class/ads.php the 4 lines echo and post the result ?
function insert(&$ads)
    {
        if (
get_class($ads) != 'CatadsAds') {
echo 
"Error 1 </ br>";
            return 
false;
        }
        if (!
$ads->cleanVars()) {
echo 
"Error 2 </ br>";
            return 
false;
        }
        foreach (
$ads->cleanVars as $k => $v) {
            ${
$k} = $v;
        }
        if (empty(
$ads_id)) {
            
$ads_id $this->db->genId('catads_ads_ads_id_seq');
            
$sql 'INSERT INTO '.$this->db->prefix('catads_ads').' (ads_id, cat_id, ads_title, ads_type, ads_desc, price, monnaie, price_option, email, uid, phone, town, codpost, created, published, expired, photo, view, notify_pub, poster_ip, contact_mode, countpub, suspend, waiting) VALUES ('.$ads_id.', '.$cat_id.', '.$this->db->quoteString($ads_title).', '.$this->db->quoteString($ads_type).', '.$this->db->quoteString($ads_desc).', '.$price.', '.$this->db->quoteString($monnaie).', '.$this->db->quoteString($price_option).', '.$this->db->quoteString($email).', '.$uid.', '.$this->db->quoteString($phone).', '.$this->db->quoteString($town).', '.$this->db->quoteString($codpost).', '.$created.', '.$published.', '.$expired.', '.$this->db->quoteString($photo).', '.$view.', '.$notify_pub.', '.$this->db->quoteString($poster_ip).', '.$contact_mode.', '.$countpub.', '.$suspend.', '.$waiting.')';
        } else {
            
$sql 'UPDATE '.$this->db->prefix('catads_ads').' SET cat_id='.$cat_id.', ads_title='.$this->db->quoteString($ads_title).', ads_type='.$this->db->quoteString($ads_type).', ads_desc='.$this->db->quoteString($ads_desc).', price='.$price.', monnaie='.$this->db->quoteString($monnaie).', price_option='.$this->db->quoteString($price_option).', email='.$this->db->quoteString($email).', uid='.$uid.', phone='.$this->db->quoteString($phone).', town='.$this->db->quoteString($town).', codpost='.$this->db->quoteString($codpost).', created='.$created.', published='.$published.', expired='.$expired.', photo='.$this->db->quoteString($photo).', view='.$view.', notify_pub = '.$notify_pub.', poster_ip='.$this->db->quoteString($poster_ip).', contact_mode='.$contact_mode.', countpub='.$countpub.', suspend='.$suspend.', waiting='.$waiting.' WHERE ads_id='.$ads_id;
        }
        if (!
$result $this->db->queryF($sql)) {
echo 
$sql."</ br>";
echo 
"Error 3 </ br>";
            return 
false;
        }
        if (empty(
$ads_id)) {
            
$ads_id $this->db->getInsertId();
        }
        
$ads->assignVar('ads_id'$ads_id);
        return 
$ads_id;
    }

{Edit]
If the query is displayed, try to copy and paste this query in phpmyadmin.

4
Kainaij
Re: Catads 1.30 - Array submission error...
  • 2005/5/26 10:40

  • Kainaij

  • Quite a regular

  • Posts: 256

  • Since: 2004/10/5


Fresh install

5
Kainaij
Re: Catads 1.30 - Array submission error...
  • 2005/5/26 10:46

  • Kainaij

  • Quite a regular

  • Posts: 256

  • Since: 2004/10/5


I added your code into ads.php, tried to submit another ad, and recieved the exact same error.

What action did you want me to perform to incite an error?

6
theCat
Re: Catads 1.30 - Array submission error...
  • 2005/5/26 12:48

  • theCat

  • Just popping in

  • Posts: 77

  • Since: 2004/2/2 2


Quote:
I added your code into ads.php, tried to submit another ad, and recieved the exact same error.

Normal, it's not a fix, but a test.

What is diplayed on the top left of your page ? Error 1, error 2, ...?

7
Kainaij
Re: Catads 1.30 - Array submission error...
  • 2005/5/26 13:22

  • Kainaij

  • Quite a regular

  • Posts: 256

  • Since: 2004/10/5


What is displayed in the top left is "Catads".

The address for my module is at:

http://blackfootcountry.com/modules/catads/

I inserted the code you told me to on line 82 if the ads.php file.

8
theCat
Re: Catads 1.30 - Array submission error...
  • 2005/5/26 13:42

  • theCat

  • Just popping in

  • Posts: 77

  • Since: 2004/2/2 2


Quote:
I inserted the code you told me to on line 82 if the ads.php file.

There is a problem with your file class/ads.php.
Function insert(&$ads) is in line 124 !!!

Try to upload again this file by ftp

[Edit]
you should set debug mode php on under preferences

9
Kainaij
Re: Catads 1.30 - Array submission error...
  • 2005/5/27 9:39

  • Kainaij

  • Quite a regular

  • Posts: 256

  • Since: 2004/10/5


Hi TheCat, sorry for not responding to you promptly this morning and thank you for your patience with me.

Ok now, I turned on PHP debugging and after I tried to submit an ad I get this:

Catads
There was an error
Your ad has not been added
Array
Notice [PHP]: Undefined variablephotos_dir in file modules/catads/submit1.php line 205


Also on the the catads main page at the bottom I get a whole bunch of this:

Notice [PHP]: Use of undefined constant _MI_CATADS_NAME assumed '_MI_CATADS_NAME' in file modules/catads/xoops_version.php line 26
Notice 
[PHP]: Use of undefined constant _MI_CATADS_DESC assumed '_MI_CATADS_DESC' in file modules/catads/xoops_version.php line 28
Notice 
[PHP]: Use of undefined constant _MI_CATADS_BNAME1 assumed '_MI_CATADS_BNAME1' in file modules/catads/xoops_version.php line 62
Notice 
[PHP]: Use of undefined constant _MI_CATADS_BNAME2 assumed '_MI_CATADS_BNAME2' in file modules/catads/xoops_version.php line 70
Notice 
[PHP]: Use of undefined constant _MI_CATADS_BNAME3 assumed '_MI_CATADS_BNAME3' in file modules/catads/xoops_version.php line 76
Notice 
[PHP]: Use of undefined constant _MI_CATADS_SMENU2 assumed '_MI_CATADS_SMENU2' in file modules/catads/xoops_version.php line 86
Notice 
[PHP]: Use of undefined constant _MI_CATADS_LIN assumed '_MI_CATADS_LIN' in file modules/catads/xoops_version.php line 220
Notice 
[PHP]: Use of undefined constant _MI_CATADS_COL assumed '_MI_CATADS_COL' in file modules/catads/xoops_version.php line 220
Notice 
[PHP]: Use of undefined constant _MI_CATADS_GLOBAL_NOTIFY assumed '_MI_CATADS_GLOBAL_NOTIFY' in file modules/catads/xoops_version.php line 289
Notice 
[PHP]: Use of undefined constant _MI_CATADS_GLOBAL_NOTIFYDSC assumed '_MI_CATADS_GLOBAL_NOTIFYDSC' in file modules/catads/xoops_version.php line 290
Notice 
[PHP]: Use of undefined constant _MI_CATADS_CATEGORY_NOTIFY assumed '_MI_CATADS_CATEGORY_NOTIFY' in file modules/catads/xoops_version.php line 294
Notice 
[PHP]: Use of undefined constant _MI_CATADS_CATEGORY_NOTIFYDSC assumed '_MI_CATADS_CATEGORY_NOTIFYDSC' in file modules/catads/xoops_version.php line 295
Notice 
[PHP]: Use of undefined constant _MI_CATADS_ADS_NOTIFY assumed '_MI_CATADS_ADS_NOTIFY' in file modules/catads/xoops_version.php line 301
Notice 
[PHP]: Use of undefined constant _MI_CATADS_ADS_NOTIFYDSC assumed '_MI_CATADS_ADS_NOTIFYDSC' in file modules/catads/xoops_version.php line 302
Notice 
[PHP]: Use of undefined constant _MI_CATADS_GLOBAL_ADSSUBMIT_NOTIFY assumed '_MI_CATADS_GLOBAL_ADSSUBMIT_NOTIFY' in file modules/catads/xoops_version.php line 310
Notice 
[PHP]: Use of undefined constant _MI_CATADS_GLOBAL_ADSSUBMIT_NOTIFYCAP assumed '_MI_CATADS_GLOBAL_ADSSUBMIT_NOTIFYCAP' in file modules/catads/xoops_version.php line 311
Notice 
[PHP]: Use of undefined constant _MI_CATADS_GLOBAL_ADSSUBMIT_NOTIFYDSC assumed '_MI_CATADS_GLOBAL_ADSSUBMIT_NOTIFYDSC' in file modules/catads/xoops_version.php line 312
Notice 
[PHP]: Use of undefined constant _MI_CATADS_GLOBAL_ADSSUBMIT_NOTIFYSBJ assumed '_MI_CATADS_GLOBAL_ADSSUBMIT_NOTIFYSBJ' in file modules/catads/xoops_version.php line 314
Notice 
[PHP]: Use of undefined constant _MI_CATADS_GLOBAL_NEWADS_NOTIFY assumed '_MI_CATADS_GLOBAL_NEWADS_NOTIFY' in file modules/catads/xoops_version.php line 318
Notice 
[PHP]: Use of undefined constant _MI_CATADS_GLOBAL_NEWADS_NOTIFYCAP assumed '_MI_CATADS_GLOBAL_NEWADS_NOTIFYCAP' in file modules/catads/xoops_version.php line 319
Notice 
[PHP]: Use of undefined constant _MI_CATADS_GLOBAL_NEWADS_NOTIFYDSC assumed '_MI_CATADS_GLOBAL_NEWADS_NOTIFYDSC' in file modules/catads/xoops_version.php line 320
Notice 
[PHP]: Use of undefined constant _MI_CATADS_GLOBAL_NEWADS_NOTIFYSBJ assumed '_MI_CATADS_GLOBAL_NEWADS_NOTIFYSBJ' in file modules/catads/xoops_version.php line 322
Notice 
[PHP]: Use of undefined constant _MI_CATADS_CATEGORY_SUBMIT_NOTIFY assumed '_MI_CATADS_CATEGORY_SUBMIT_NOTIFY' in file modules/catads/xoops_version.php line 327
Notice 
[PHP]: Use of undefined constant _MI_CATADS_CATEGORY_SUBMIT_NOTIFYCAP assumed '_MI_CATADS_CATEGORY_SUBMIT_NOTIFYCAP' in file modules/catads/xoops_version.php line 328
Notice 
[PHP]: Use of undefined constant _MI_CATADS_CATEGORY_SUBMIT_NOTIFYDSC assumed '_MI_CATADS_CATEGORY_SUBMIT_NOTIFYDSC' in file modules/catads/xoops_version.php line 329
Notice 
[PHP]: Use of undefined constant _MI_CATADS_CATEGORY_SUBMIT_NOTIFYSBJ assumed '_MI_CATADS_CATEGORY_SUBMIT_NOTIFYSBJ' in file modules/catads/xoops_version.php line 331
Notice 
[PHP]: Use of undefined constant _MI_CATADS_CATEGORY_NEWADS_NOTIFY assumed '_MI_CATADS_CATEGORY_NEWADS_NOTIFY' in file modules/catads/xoops_version.php line 335
Notice 
[PHP]: Use of undefined constant _MI_CATADS_CATEGORY_NEWADS_NOTIFYCAP assumed '_MI_CATADS_CATEGORY_NEWADS_NOTIFYCAP' in file modules/catads/xoops_version.php line 336
Notice 
[PHP]: Use of undefined constant _MI_CATADS_CATEGORY_NEWADS_NOTIFYDSC assumed '_MI_CATADS_CATEGORY_NEWADS_NOTIFYDSC' in file modules/catads/xoops_version.php line 337
Notice 
[PHP]: Use of undefined constant _MI_CATADS_CATEGORY_NEWADS_NOTIFYSBJ assumed '_MI_CATADS_CATEGORY_NEWADS_NOTIFYSBJ' in file modules/catads/xoops_version.php line 339
Notice 
[PHP]: Use of undefined constant _MI_CATADS_ADS_APPROVE_NOTIFY assumed '_MI_CATADS_ADS_APPROVE_NOTIFY' in file modules/catads/xoops_version.php line 344
Notice 
[PHP]: Use of undefined constant _MI_CATADS_ADS_APPROVE_NOTIFYCAP assumed '_MI_CATADS_ADS_APPROVE_NOTIFYCAP' in file modules/catads/xoops_version.php line 345
Notice 
[PHP]: Use of undefined constant _MI_CATADS_ADS_APPROVE_NOTIFYDSC assumed '_MI_CATADS_ADS_APPROVE_NOTIFYDSC' in file modules/catads/xoops_version.php line 346
Notice 
[PHP]: Use of undefined constant _MI_CATADS_ADS_APPROVE_NOTIFYSBJ assumed '_MI_CATADS_ADS_APPROVE_NOTIFYSBJ' in file modules/catads/xoops_version.php line 348


Here is the code for the ads.php file that I am using:

<?php
// $Id: class/ads.php,v 1.2 2005/03/06 C. Felix AKA the Cat
// ------------------------------------------------------------------------- //
// Catads for XOOPS                                                          //
// ------------------------------------------------------------------------- //
//  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.                                      //
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//---------------------------------------------------------------------------//

class CatadsAds extends XoopsObject
{

    var 
$_catTitle;
    var 
$_displayPrice;
    var 
$commentstable;
    
    function 
CatadsAds()
    {
        
$this->XoopsObject();
        
$this->initVar('ads_id'XOBJ_DTYPE_INTnullfalse);
        
$this->initVar('cat_id'XOBJ_DTYPE_INTnulltrue);
        
$this->initVar('ads_title'XOBJ_DTYPE_TXTBOXnulltrue100);
        
$this->initVar('ads_type'XOBJ_DTYPE_TXTBOXnulltrue40);
        
$this->initVar('ads_desc'XOBJ_DTYPE_TXTBOXnullfalse);
        
$this->initVar('price'XOBJ_DTYPE_INT0false);
        
$this->initVar('monnaie'XOBJ_DTYPE_TXTBOXnullfalse);
        
$this->initVar('price_option'XOBJ_DTYPE_TXTBOXnullfalse);
        
$this->initVar('email'XOBJ_DTYPE_TXTBOXnullfalse);
        
$this->initVar('uid'XOBJ_DTYPE_INT0false);
        
$this->initVar('phone'XOBJ_DTYPE_TXTBOXnullfalse);
        
$this->initVar('town'XOBJ_DTYPE_TXTBOXnullfalse);
        
$this->initVar('codpost'XOBJ_DTYPE_TXTBOXnullfalse);
        
$this->initVar('created'XOBJ_DTYPE_INT0false);
        
$this->initVar('published'XOBJ_DTYPE_INT0false);
        
$this->initVar('expired'XOBJ_DTYPE_INT0false);
        
$this->initVar('photo'XOBJ_DTYPE_TXTBOXnullfalse);
        
$this->initVar('view'XOBJ_DTYPE_INT0false);
        
$this->initVar('notify_pub'XOBJ_DTYPE_INT0false);
        
$this->initVar('poster_ip'XOBJ_DTYPE_TXTBOXnullfalse);
        
$this->initVar('contact_mode'XOBJ_DTYPE_INT0false);
        
$this->initVar('countpub'XOBJ_DTYPE_INT0false);
        
$this->initVar('suspend'XOBJ_DTYPE_INT0false);
        
//add v1.30
        
$this->initVar('waiting'XOBJ_DTYPE_INT0false);
    }

    function 
setCatTitle($value)
    {
        
$this->_catTitle $value;
    }

    function 
getCatTitle()
    {
        return 
$this->_catTitle;
    }
    function 
setDisplayPrice($value)
    {
        
$this->_displayPrice $value;
    }

    function 
getDisplayPrice()
    {
        return 
$this->_displayPrice;
    }
}
function 
insert(&$ads)
    {
        if (
get_class($ads) != 'CatadsAds') {
echo 
"Error 1 </ br>";
            return 
false;
        }
        if (!
$ads->cleanVars()) {
echo 
"Error 2 </ br>";
            return 
false;
        }
        foreach (
$ads->cleanVars as $k => $v) {
            ${
$k} = $v;
        }
        if (empty(
$ads_id)) {
            
$ads_id $this->db->genId('catads_ads_ads_id_seq');
            
$sql 'INSERT INTO '.$this->db->prefix('catads_ads').' (ads_id, cat_id, ads_title, ads_type, ads_desc, price, monnaie, price_option, email, uid, phone, town, codpost, created, published, expired, photo, view, notify_pub, poster_ip, contact_mode, countpub, suspend, waiting) VALUES ('.$ads_id.', '.$cat_id.', '.$this->db->quoteString($ads_title).', '.$this->db->quoteString($ads_type).', '.$this->db->quoteString($ads_desc).', '.$price.', '.$this->db->quoteString($monnaie).', '.$this->db->quoteString($price_option).', '.$this->db->quoteString($email).', '.$uid.', '.$this->db->quoteString($phone).', '.$this->db->quoteString($town).', '.$this->db->quoteString($codpost).', '.$created.', '.$published.', '.$expired.', '.$this->db->quoteString($photo).', '.$view.', '.$notify_pub.', '.$this->db->quoteString($poster_ip).', '.$contact_mode.', '.$countpub.', '.$suspend.', '.$waiting.')';
        } else {
            
$sql 'UPDATE '.$this->db->prefix('catads_ads').' SET cat_id='.$cat_id.', ads_title='.$this->db->quoteString($ads_title).', ads_type='.$this->db->quoteString($ads_type).', ads_desc='.$this->db->quoteString($ads_desc).', price='.$price.', monnaie='.$this->db->quoteString($monnaie).', price_option='.$this->db->quoteString($price_option).', email='.$this->db->quoteString($email).', uid='.$uid.', phone='.$this->db->quoteString($phone).', town='.$this->db->quoteString($town).', codpost='.$this->db->quoteString($codpost).', created='.$created.', published='.$published.', expired='.$expired.', photo='.$this->db->quoteString($photo).', view='.$view.', notify_pub = '.$notify_pub.', poster_ip='.$this->db->quoteString($poster_ip).', contact_mode='.$contact_mode.', countpub='.$countpub.', suspend='.$suspend.', waiting='.$waiting.' WHERE ads_id='.$ads_id;
        }
        if (!
$result $this->db->queryF($sql)) {
echo 
$sql."</ br>";
echo 
"Error 3 </ br>";
            return 
false;
        }
        if (empty(
$ads_id)) {
            
$ads_id $this->db->getInsertId();
        }
        
$ads->assignVar('ads_id'$ads_id);
        return 
$ads_id;
    }
 
class 
CatadsAdsHandler
{
    var 
$db;

    function 
CatadsAdsHandler(&$db)
    {
        
$this->db =& $db;
    }

    function &
getInstance(&$db)
    {
        static 
$instance;
        if (!isset(
$instance)) {
            
$instance = new CatadsAdsHandler($db);
        }
        return 
$instance;
    }

    function &
create()
    {
        return new 
CatadsAds();
    }

    function &
get($id)
    {
        
$id intval($id);
        if (
$id 0) {
            
$sql 'SELECT * FROM '.$this->db->prefix('catads_ads').' WHERE ads_id='.$id;
            if (!
$result $this->db->query($sql)) {
                return 
false;
            }
            
$numrows $this->db->getRowsNum($result);
            if (
$numrows == 1) {
                
$ads = new CatadsAds();
                
$ads->assignVars($this->db->fetchArray($result));
                return 
$ads;
            }
        }
        return 
false;
    }

    function 
insert(&$ads)
    {
        if (
get_class($ads) != 'CatadsAds') {
            return 
false;
        }
        if (!
$ads->cleanVars()) {
            return 
false;
        }
        foreach (
$ads->cleanVars as $k => $v) {
            ${
$k} = $v;
        }
        if (empty(
$ads_id)) {
            
$ads_id $this->db->genId('catads_ads_ads_id_seq');
            
$sql 'INSERT INTO '.$this->db->prefix('catads_ads').' (ads_id, cat_id, ads_title, ads_type, ads_desc, price, monnaie, price_option, email, uid, phone, town, codpost, created, published, expired, photo, view, notify_pub, poster_ip, contact_mode, countpub, suspend, waiting) VALUES ('.$ads_id.', '.$cat_id.', '.$this->db->quoteString($ads_title).', '.$this->db->quoteString($ads_type).', '.$this->db->quoteString($ads_desc).', '.$price.', '.$this->db->quoteString($monnaie).', '.$this->db->quoteString($price_option).', '.$this->db->quoteString($email).', '.$uid.', '.$this->db->quoteString($phone).', '.$this->db->quoteString($town).', '.$this->db->quoteString($codpost).', '.$created.', '.$published.', '.$expired.', '.$this->db->quoteString($photo).', '.$view.', '.$notify_pub.', '.$this->db->quoteString($poster_ip).', '.$contact_mode.', '.$countpub.', '.$suspend.', '.$waiting.')';
        } else {
            
$sql 'UPDATE '.$this->db->prefix('catads_ads').' SET cat_id='.$cat_id.', ads_title='.$this->db->quoteString($ads_title).', ads_type='.$this->db->quoteString($ads_type).', ads_desc='.$this->db->quoteString($ads_desc).', price='.$price.', monnaie='.$this->db->quoteString($monnaie).', price_option='.$this->db->quoteString($price_option).', email='.$this->db->quoteString($email).', uid='.$uid.', phone='.$this->db->quoteString($phone).', town='.$this->db->quoteString($town).', codpost='.$this->db->quoteString($codpost).', created='.$created.', published='.$published.', expired='.$expired.', photo='.$this->db->quoteString($photo).', view='.$view.', notify_pub = '.$notify_pub.', poster_ip='.$this->db->quoteString($poster_ip).', contact_mode='.$contact_mode.', countpub='.$countpub.', suspend='.$suspend.', waiting='.$waiting.' WHERE ads_id='.$ads_id;
        }
        if (!
$result $this->db->queryF($sql)) {
            return 
false;
        }
        if (empty(
$ads_id)) {
            
$ads_id $this->db->getInsertId();
        }
        
$ads->assignVar('ads_id'$ads_id);
        return 
$ads_id;
    }

    function 
delete(&$ads){
        global 
$xoopsModule;
        if (
get_class($ads) != 'CatadsAds') {
            return 
false;
        }
        
$sql sprintf("DELETE FROM %s WHERE ads_id = %u"$this->db->prefix('catads_ads'), $ads->getVar('ads_id'));
       if (isset(
$this->commentstable) && $this->commentstable != "") {
            
xoops_comment_delete($xoopsModule->getVar('mid'), $ads_id);
        }

        if (!
$result $this->db->query($sql)) {
            return 
false;
        }
        return 
true;
    }
    
    function &
getObjects($criteria null)
    {
        
$ret = array();
        
$limit $start 0;
        
$sql 'SELECT * FROM '.$this->db->prefix('catads_ads');
        if (isset(
$criteria) && is_subclass_of($criteria'criteriaelement')) {
            
$sql .= ' '.$criteria->renderWhere();
            
$sort = ($criteria->getSort() != '') ? $criteria->getSort() : 'ads_id';
            
$sql .= ' ORDER BY '.$sort.' '.$criteria->getOrder();
            
$limit $criteria->getLimit();
            
$start $criteria->getStart();
        }
        
$result $this->db->query($sql$limit$start);
        if (!
$result) {
            return 
$ret;
        }
        while (
$myrow $this->db->fetchArray($result)) {
            
$ads = new CatadsAds();
            
$ads->assignVars($myrow);
            
$ret[] =& $ads;
            unset(
$ads);
        }
        return 
$ret;
    }

    function 
getAllAds($criteria null)
    {
        
$ret = array();
        
$limit $start 0;
        
$sql 'SELECT a.*, c.display_price, c.title FROM '.$this->db->prefix("catads_ads ").'a LEFT JOIN '.$this->db->prefix('catads_cat').' c ON c.cat_id = a.cat_id ';
        if (isset(
$criteria) && is_subclass_of($criteria'criteriaelement')) {
            
$sql .= ' '.$criteria->renderWhere();
            
$sort = ($criteria->getSort() != '') ? $criteria->getSort() : 'ads_id';
            
$sql .= ' ORDER BY '.$sort.' '.$criteria->getOrder();
            
$limit $criteria->getLimit();
            
$start $criteria->getStart();
        }
        
$result $this->db->query($sql$limit$start);
        if (!
$result) {
            return 
$ret;
        }

        while (
$myrow $this->db->fetchArray($result)) {
            
$ads = new CatadsAds();
            
$ads->assignVars($myrow);
            
$ads->setCatTitle($myrow['title']);
            
$ads->setDisplayPrice($myrow['display_price']);
            
$ret[] =& $ads;
            unset(
$ads);
        }
        return 
$ret;
    }


    function 
getCount($criteria null)
    {
        
$sql 'SELECT COUNT(*) FROM '.$this->db->prefix('catads_ads');
        if (isset(
$criteria) && is_subclass_of($criteria'criteriaelement')) {
            
$sql .= ' '.$criteria->renderWhere();
        }
        if (!
$result =& $this->db->query($sql)) {
            return 
0;
        }
        list(
$count) = $this->db->fetchRow($result);
        return 
$count;
    }

    function 
incView($ads_id)
    {
        
$sql "UPDATE ".$this->db->prefix("catads_ads ")." SET view=view+1 WHERE ads_id = '$ads_id'";
        if (!
$result =& $this->db->queryF($sql)) {
            return 
false;
        }
        return 
true;
    }

    function 
getCountAdsByCat($criteria null)
    {
        
$arr = array();
        
$sql "SELECT cat_id, count(*) FROM ".$this->db->prefix("catads_ads ");
        if (isset(
$criteria) && is_subclass_of($criteria'criteriaelement')) {
            
$sql .= ' '.$criteria->renderWhere();
        }
        
$sql .= " GROUP BY cat_id";
        if (!
$result =& $this->db->query($sql)) {
            return 
0;
        }
        while (
$myrow $this->db->fetchArray($result)) {
            
$arr[$myrow['cat_id']] =  $myrow['count(*)'];
        } 
        return 
$arr;
    }


}
?>


Lastly I can PM you an FTP account password to access my site if you wish. Thank you again.

10
theCat
Re: Catads 1.30 - Array submission error...
  • 2005/5/29 19:12

  • theCat

  • Just popping in

  • Posts: 77

  • Since: 2004/2/2 2


You use certainly XOOPS 2.0.10 !!!

Other modules have bugs with this release (Formulaire,...).

Download this fix for catads (only 2 files).

I hope solve your problem .

Login

Who's Online

223 user(s) are online (152 user(s) are browsing Support Forums)


Members: 0


Guests: 223


more...

Donat-O-Meter

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

Latest GitHub Commits