Autore Topic: Errore 1064 con AdsManager  (Letto 427 volte)

Offline marcodicri

  • Nuovo arrivato
  • *
  • Post: 15
    • Mostra profilo
Errore 1064 con AdsManager
« il: 04 Giu 2019, 11:41:46 »
Buongiorno, non riesco a modificare i campi in adsmanager:

1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '10)' at line 2

Ogni volta che provo a modificare un campo mi restituisce questa stringa.. Anche se poi effettivamente crea o modifica il campo.
Qual'è il problema principale?

Oltre a restituire l'errore, i campi non vengono visualizzati nel front-end quando bisogna inserire un'annuncio

Pensate si debba modificare il codice php del componente? Qualcuno mi può consigliare le eventuali modifiche?

Online tomtomeight

  • Global Moderator
  • Fuori controllo
  • ********
  • Post: 30341
  • Sesso: Maschio
  • Gli automatismi aiutano ma non insegnano nulla.
    • Mostra profilo
Re:Errore 1064 con AdsManager
« Risposta #1 il: 04 Giu 2019, 12:02:04 »
Credo che dovresti aggiornare, componente o versione database ma mai modificare il codice, specialmente se non si sa cosa come e dove.
NEWS DataGrill Xataface Installer (Ver. 1.0.1) per Joomla 3.8.x - DEMO Gestione Magazzino

Offline marcodicri

  • Nuovo arrivato
  • *
  • Post: 15
    • Mostra profilo
Re:Errore 1064 con AdsManager
« Risposta #2 il: 04 Giu 2019, 15:23:50 »
Grazie per la risposta, anche se non sono sicurissimo della soluzione. L'hosting è stato aggiornato recentemente. Magari è un altro il problema?


La versione PHP è la 7.2
La versione di Joomla è l'ultima.
La versione di adsmanager è anche l'ultima


Quando torno a casa faccio qualche altro screenshot, spero di trovare una soluzione perché è da mesi che lavoro a questo progetto

Online tomtomeight

  • Global Moderator
  • Fuori controllo
  • ********
  • Post: 30341
  • Sesso: Maschio
  • Gli automatismi aiutano ma non insegnano nulla.
    • Mostra profilo
Re:Errore 1064 con AdsManager
« Risposta #3 il: 04 Giu 2019, 15:35:17 »
Verifica pure la versione mysql dato che l'errore riguarda proprio il db.
NEWS DataGrill Xataface Installer (Ver. 1.0.1) per Joomla 3.8.x - DEMO Gestione Magazzino

Offline marcodicri

  • Nuovo arrivato
  • *
  • Post: 15
    • Mostra profilo
Re:Errore 1064 con AdsManager
« Risposta #4 il: 04 Giu 2019, 18:21:26 »

questa è la versione di joomla:
Joomla! 3.9.6



questa è la versione di adsmanager:

Adsmanager 3.2.4




questo riguarda il database ed è stato preso dal cPanel:


SERVER DEL DATABASE

Server: Localhost via UNIX socket
  • Tipo di server: MySQL
  • Connessione Server: SSL inattivo Documentazione
  • Versione del server: 5.7.26 - MySQL Community Server (GPL)
  • Versione protocollo: 10
  • Utente: easydrin@localhost
  • Codifica caratteri del server: UTF-8 Unicode (utf8)

WEB SERVER
cpsrvd 11.80.0.12
  • Versione del client del database: libmysql - 5.1.73
  • Versione PHP: 7.2.7
« Ultima modifica: 04 Giu 2019, 18:24:23 da marcodicri »

Online tomtomeight

  • Global Moderator
  • Fuori controllo
  • ********
  • Post: 30341
  • Sesso: Maschio
  • Gli automatismi aiutano ma non insegnano nulla.
    • Mostra profilo
Re:Errore 1064 con AdsManager
« Risposta #5 il: 04 Giu 2019, 18:41:54 »
E' strano ma può darsi che forse la versione php 7.2.7 è troppo avanti per adsmanager, io proverei con un php un poco inferiore.
NEWS DataGrill Xataface Installer (Ver. 1.0.1) per Joomla 3.8.x - DEMO Gestione Magazzino

Offline marcodicri

  • Nuovo arrivato
  • *
  • Post: 15
    • Mostra profilo
Re:Errore 1064 con AdsManager
« Risposta #6 il: 04 Giu 2019, 18:46:11 »
Ho provato a cambiare la versione di PHP.. ma niente, il messaggio di errore rimane sempre


Offline marcodicri

  • Nuovo arrivato
  • *
  • Post: 15
    • Mostra profilo
Re:Errore 1064 con AdsManager
« Risposta #7 il: 04 Giu 2019, 18:53:30 »
Ho trovato dove si comunicano i campi dal backend al server..


il percorso del file è:
public_html/offertopoly.com/administrator/components/com_adsmanager/models/field.php




il codice del file in questione field.php

Codice: [Seleziona]

<?php
/**
 * @package      AdsManager
 * @copyright   Copyright (C) 2010-2014 Juloa.com. All rights reserved.
 * @license      GNU/GPL
 */


// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );


jimport('joomla.application.component.model');
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_adsmanager'.DS.'tables');


/**
 * @package      Joomla
 * @subpackage   Contact
 */
class AdsmanagerModelField extends TModel
{
   public static 
$_plugins;
   
   function 
getNbFields()
    {
       
$this->_db->setQuery"SELECT count(*) FROM #__adsmanager_fields WHERE 1 ORDER by ordering");
      
$nb $this->_db->loadResult();
      return 
$nb;
    }
    
    function 
getSearchFields($catid=0)
    {
       
$this->_db->setQuery"SELECT f.* FROM #__adsmanager_fields AS f ".
                      
"WHERE f.searchable = 1 AND f.published = 1 ORDER by f.ordering" );
   
      
$results $this->_db->loadObjectList();
       
$fields = array();
        foreach (
$results as $r ) {
           if (
$catid === 0
              
$fields[] = $r;
         else if (
$r->catsid == ",-1,")            
            
$fields[] = $r;
         else 
         {   
            if (
$catid != 0) {
               
$find ",".$catid.",";
               if (
strstr($r->catsid$find))
                  
$fields[] = $r;
            }
         }
      }
      foreach(
$fields as $key => $field) {
         
$fields[$key]->options json_decode($field->options);
      }
      return 
$fields;
    }
    
    function 
getOrderFields($catid)
    {
       
$this->_db->setQuery"SELECT f.title,f.fieldid,f.catsid FROM #__adsmanager_fields AS f WHERE f.sort = 1 AND f.published = 1 ORDER BY f.ordering ASC" );
      
$results $this->_db->loadObjectList();
      
$orders = array();
        foreach (
$results as $r ) {
         if (
$r->catsid == ",-1,")            
            
$orders[] = $r;
         else 
         {   
            if (
$catid != 0) {
               
$find ",".$catid.",";
               if (
strstr($r->catsid$find))
                  
$orders[] = $r;
            }
         }
      }
      return 
$orders;
    }
    
   function 
getFields($onlyPublished=true,$limitstart=null,$limit=null,$filter_order="fieldid",$filter_order_Dir="ASC",$usergroups=true,$mode='read') {
      if (
$onlyPublished == true)
         
$published " f.published = 1 ";
      else
         
$published " 1 ";
         
      if ((
$limitstart === null)||($limit === null))
         
$this->_db->setQuery"SELECT * FROM #__adsmanager_fields as f WHERE $published ORDER by f.ordering ASC");
       else
             
$this->_db->setQuery"SELECT * FROM #__adsmanager_fields as f WHERE $published ORDER by $filter_order $filter_order_Dir",
                          
$limitstart,$limit );
      
//f.published = 1
      
$fields $this->_db->loadObjectList('name');
        
$allowedFields = array();
      foreach(
$fields as $key => $field) {
         
$fields[$key]->options json_decode($field->options);
      }
        
        if(
$usergroups) {
            require_once(
JPATH_ROOT.'/components/com_adsmanager/lib/tpermissions.php');
            
$fields TPermissions::getAuthorisedFields($fields$mode);
        }
        
      return 
$fields;
    }
    
    function 
getAdminFields($filters null,$limitstart=null,$limit=null,$filter_order="fieldid",$filter_order_Dir="ASC") {
       
$search"";
       if (isset(
$filters))
       {
          foreach(
$filters as $key => $filter)
          {
             if (
$search == "")
                
$temp " WHERE ";
             else
                
$temp " AND ";
             switch(
$key)
             {
                case 
'published':
                   if (
$filter !== "")
                      
$search .= $temp."f.published = ".(int)$filter;
                   break;
                case 
'columnid':
                   if (
$filter != "")
                      
$search .= $temp."f.columnid = ".(int)$filter;
                   break;
                case 
'pos':
                   if (
$filter != "")
                      
$search .= $temp."f.pos = ".(int)$filter;
                   break;
                case 
'type':
                   if (
$filter != "")
                      
$search .= $temp."f.type = ".$this->_db->Quote($filter);
                   break;
                case 
'search':
                   if (
$filter != "")
                      
$search .= $temp."f.name LIKE ".$this->_db->Quote("%$filter%");
                   break;
                case 
'category':
                   if (
$filter != "")
                      
$search .= $temp." ((f.catsid = ',-1,') OR (f.catsid LIKE ".$this->_db->Quote("%,$filter,%")."))";
                   break;
             }
          }
       }


       if ((
$limitstart === null)||($limit === null))
          
$this->_db->setQuery"SELECT f.* FROM #__adsmanager_fields as f $search ORDER by f.ordering ASC");
       else
          
$this->_db->setQuery"SELECT f.* FROM #__adsmanager_fields as f $search ORDER by $filter_order $filter_order_Dir",
                
$limitstart,$limit );
       
//f.published = 1
       
$fields $this->_db->loadObjectList('name');
       foreach(
$fields as $key => $field) {
          
$fields[$key]->options json_decode($field->options);
       }
       return 
$fields;
    }
    
    function 
getFieldsbyColumns($published true$usergroups=true$mode 'read') {
       if (
$published) {
          
$sqlpublished "AND c.published = 1 ";
       } else {
          
$sqlpublished "";
       }
         
$this->_db->setQuery"SELECT c.* FROM #__adsmanager_fields AS c ".
                      
"WHERE c.columnid != -1 $sqlpublished ORDER by c.columnorder,c.fieldid" );
   
      
$fields $this->_db->loadObjectList();
      foreach(
$fields as $key => $field) {
         
$fields[$key]->options json_decode($field->options);
      }
      
        if(
$usergroups) {
            require_once(
JPATH_ROOT.'/components/com_adsmanager/lib/tpermissions.php');
            
$fields TPermissions::getAuthorisedFields($fields$mode);
        }
        
      
// establish the hierarchy of the menu
      
$fColumn = array();
      
// first pass - collect children
      
if (isset($fields))
      {
         foreach (
$fields as $f ) {
            
$pt    $f->columnid;
            
$list    = @$fColumn[$pt] ? $fColumn[$pt] : array();
            
array_push$list$f );
            
$fColumn[$pt] = $list;
         }
      }
      return 
$fColumn;
    }
    
    function 
getFieldsbyPositions($published true$usergroups=true$mode 'read',$type='details') {
         
          
        if (
$type == "details") {
           
$where  "f.pos != -1";
            
           if (
$published) {
              
$where .= " AND f.published = 1 ";
           }
           
          
$this->_db->setQuery"SELECT f.*,f.pos as positionid FROM #__adsmanager_fields AS f ".
                         
"WHERE $where ORDER by f.posorder ASC" );
      
         
$fields $this->_db->loadObjectList();
         if (
$this->_db->getErrorNum()) {
            echo 
$this->_db->stderr();
            return;
         }
       } else {
          
$where  "1";
           
          if (
$published) {
             
$where .= " AND f.published = 1 ";
          }
          
          
$query "SELECT f.*,fp.positionid FROM #__adsmanager_fields AS f 
                  INNER JOIN #__adsmanager_field2position as fp ON fp.fieldid = f.fieldid
                      INNER JOIN #__adsmanager_positions as p ON p.id = fp.positionid
                  WHERE 
$where AND p.type = '".$type."' ORDER by fp.ordering ASC";
          
$this->_db->setQuery($query);
          
$fields $this->_db->loadObjectList();
         if (
$this->_db->getErrorNum()) {
            echo 
$this->_db->stderr();
            return;
         }   
       } 
      
      foreach(
$fields as $key => $field) {
         
$fields[$key]->options json_decode($field->options);
      }
      
        if(
$usergroups) {
            require_once(
JPATH_ROOT.'/components/com_adsmanager/lib/tpermissions.php');
            
$fields TPermissions::getAuthorisedFields($fields$mode);
        }
        
      
// establish the hierarchy of the menu
      
$fDisplay = array();
      
// first pass - collect children
      
if (isset($fields))
      {
         foreach (
$fields as $f ) {
            
$pt    $f->positionid;
            
$list    = @$fDisplay[$pt] ? $fDisplay[$pt] : array();
            
array_push$list$f );
            
$fDisplay[$pt] = $list;
         }
      }
      return 
$fDisplay;
    }
    
    function 
getFieldsByName($listfields,$usergroups=true,$mode='read') {
      
$query "SELECT f.* FROM #__adsmanager_fields AS f ".
                      
"WHERE f.name IN ($listfields) AND f.published = 1 ORDER by f.ordering" ;
      
$this->_db->setQuery$query);
      
$searchfields $this->_db->loadObjectList("name");
      
      foreach(
$searchfields as $key => $field) {
         
$searchfields[$key]->options json_decode($field->options);
      }
      
      if(
$usergroups) {
         require_once(
JPATH_ROOT.'/components/com_adsmanager/lib/tpermissions.php');
         
$searchfields TPermissions::getAuthorisedFields($searchfields$mode);
      }
      
      return 
$searchfields;
    }
    
   function 
getFieldValues($fieldid null) {
      
$cacheKey md5(serialize(func_get_args()));
      static 
$cache;
      if (!isset(
$cache[$cacheKey])) {


       if (
$fieldid!== null) {
          
$fvalues $this->_db->setQuery"SELECT * "
                   
"\n FROM #__adsmanager_field_values"
                   
"\n WHERE fieldid=".(int)$fieldid
                   
"\n ORDER BY ordering" );
          
$field_values $this->_db->loadObjectList();
       }
       else {
          
$this->_db->setQuery"SELECT * FROM #__adsmanager_field_values ORDER by ordering ");
         
$fieldvalues $this->_db->loadObjectList();
         if (
$this->_db -> getErrorNum()) {
            echo 
$this->_db -> stderr();
            return 
false;
         }
         
         
$field_values = array();
         
// first pass - collect children
         
if (isset($fieldvalues))
         {
            foreach (
$fieldvalues as $v ) {
               
$pt    $v->fieldid;
               
$list    = @$field_values[$pt] ? $field_values[$pt] : array();
               
array_push$list$v );
               
$field_values[$pt] = $list;
            }
         }   
         if (
COMMUNITY_BUILDER == 1) {
            
$this->_db->setQuery"SELECT fieldid,cbfieldvalues FROM #__adsmanager_fields as f WHERE published = 1 ORDER by f.ordering ASC");
            
$fields $this->_db->loadObjectList();
            foreach(
$fields as $field) {
               if (
$field->cbfieldvalues != "-1")
               {
                  
/*get CB value fields */
                  
$cbfieldvalues $this->getCBFieldValues($field->cbfieldvalues);
                  
$field_values[$field->fieldid] = $cbfieldvalues;
               }
            }
         }
       }
         
$cache[$cacheKey] = $field_values;
      }
       
       return 
$cache[$cacheKey];
    }
    
   function 
getField($id) {
      
$this->_db->setQuery("SELECT * FROM #__adsmanager_fields WHERE fieldid = ".(int)$id  );
      
//echo "SHOW TABLES LIKE '".$mosConfig_dbprefix."comprofiler_fields'" ;
      
$field $this->_db-> loadObject();
      
$field->options json_decode($field->options);
      return 
$field;
   }
   
   function 
getSearchFieldsSql($fields)
    {
       if (isset(
$this->searchSQL)&&($this->searchSQL != ""))
          return 
$this->searchSQL;
          
       
$search "";
      
$plugins $this->getPlugins();
      foreach(
$fields as $fsearch)
      {
         switch(
$fsearch->type)
         {
            case 
'multicheckbox':
            case 
'multicheckboximage':
            case 
'multiselect':
               
$value JRequest::getVar$fsearch->name,   array() );
                    if(!
is_array($value)) {
                  
$value = array($value);
               }
                    
               for(
$i 0,$nb=count($value);$i $nb;$i++)
               {
                        if(
$value[$i] == '') {
                     continue;
                  }
                  if (
$i == 0)
                     
$search .= " AND (";   
                  if (
version_compare(JVERSION,'1.7.0','<')) {
                            
$search .= "a.$fsearch->name LIKE '%,".$this->_db->getEscaped($value[$i],true).",%'";
                        }else{
                            
$search .= "a.$fsearch->name LIKE '%,".$this->_db->escape($value[$i],true).",%'";
                        }
                  if (
$i $nb 1)
                     
$search .= " OR ";
                  else
                     
$search .= " )";   
               }
               break;
            case 
'checkbox':
            case 
'radio':
                case 
'radioimage':
            case 
'select':   
               
$value JRequest::getVar$fsearch->name,   "");
               if (
$value != "")
               {
                  if ((
ADSMANAGER_SPECIAL == "abrivac")&&(strpos($fsearch->name,"distance") !== false)) {
                     
$this->_db->setQuery"SELECT fieldvalue FROM #__adsmanager_field_values WHERE fieldid=".$fsearch->fieldid." ORDER by ordering ASC");
                     
$fvalues $this->_db->loadObjectList();
                     
$values = array();
                     foreach(
$fvalues as $v) {
                        if (
$v->fieldvalue != $value
                           
$values[] = $this->_db->Quote($v->fieldvalue);
                        else {
                           
$values[] = $this->_db->Quote($v->fieldvalue);
                           break;
                        }
                     }
                     
$search .= " AND a.$fsearch->name IN (".implode(',',$values).")";
                  } else if (
is_array($value)) {
                     foreach(
$value as &$v) {
                        
$v $this->_db->Quote($v);
                     }
                     
$search .= " AND a.$fsearch->name IN (".implode(',',$value).")";
                  } else {
                     
$search .= " AND a.$fsearch->name = ".$this->_db->Quote($value);
                  }
               }
               break;
               
            case 
'price':
            case 
'number':
               
$options $fsearch->options;
               if (!isset(
$options)){
                  
$options = new stdClass();
               }
               if (!isset(
$options->search_type)) {
                  
$options->search_type "textfield";
               }
               switch(
$options->search_type) {
                  case 
"textfield":
                     
$value JRequest::getVar$fsearch->name,   "");
                     if (
$value != "")
                     {
                        if (
version_compare(JVERSION,'1.7.0','<')) {
                           
$search .= " AND a.$fsearch->name = '".$this->_db->getEscaped($value,true)."'";
                        }else{
                           
$search .= " AND a.$fsearch->name = '".$this->_db->escape($value,true)."'";
                        }
                     }
                     break;
                     
                  case 
"select":
                     
$value JRequest::getVar$fsearch->name,   "");
                     if (
$value != "")
                     {
                        
$pos strpos($value'-');
                        
$fieldsql "a.$fsearch->name + 0"// Little hack to convert in number
                        
if ($pos !== false)
                        {
                           if (
$pos == 0// $pos is = 0 for $value = -x $pos is = 1 only for this format 0-10 {
                           
{
                              
$search .= " AND $fieldsql < ".(float)substr($value,1)."";
                           }            
                           else if (
$pos == strlen($value) - 1)
                           {
                              
$search .= " AND $fieldsql > ".(float)substr($value,0,strlen($value)-1);
                           }
                           else
                           {
                              
$search .= " AND ($fieldsql >= ".(float)substr($value,0,$pos)." AND $fieldsql <= ".(float)substr($value,$pos+1).")";
                           }
                        }
                     }
                     break;
                     
                  case 
"minmax":
                     
$minvalue JRequest::getVar$fsearch->name."_min",   "");
                     
$maxvalue JRequest::getVar$fsearch->name."_max",   "");
                     
$fieldsql "a.$fsearch->name + 0"// Little hack to convert in number
                     
if ($minvalue != "") {
                        
$search .= " AND $fieldsql >= ".(float)$minvalue;
                     }
                     if (
$maxvalue != "") {
                        
$search .= " AND $fieldsql <= ".(float)$maxvalue;
                     }
                     break;
                  
               }
               break;
      
            case 
'textarea':
            case 
'emailaddress':
            case 
'url':
            case 
'text':
            case 
'date':
               
$value JRequest::getVar$fsearch->name,   "");
               if (
$value != "")
               {
                  if ((
ADSMANAGER_SPECIAL == "abrivac")&&(($fsearch->name == "ad_capaciteconf")||($fsearch->name == "ad_capacitemax"))) {
                     
$search .= " AND a.$fsearch->name >= ".(int)$value." ";   
                  } else {
                            if (
version_compare(JVERSION,'1.7.0','<')) {
                                
$search .= " AND a.$fsearch->name LIKE '%".$this->_db->getEscaped($value,true)."%'";
                            }else{
                                
$search .= " AND a.$fsearch->name LIKE '%".$this->_db->escape($value,true)."%'";
                            }
                  }
               }
               break;


            default:
               if(isset(
$plugins[$fsearch->type]))
               {
               
$value JRequest::getVar$fsearch->name,   "");


                  if (
method_exists($plugins[$fsearch->type],"getSqlFilter")) {
                     
$filter =  $plugins[$fsearch->type]->getSqlFilter($fsearch,$value);
                     if (
$filter != null)
                        
$search .= $filter;
                  } else {
                     if (
$value != "") {
                               if (
version_compare(JVERSION,'1.7.0','<')) {
                                   
$search .= " AND a.$fsearch->name LIKE '%".$this->_db->getEscaped($value,true)."%'";
                               }else{
                                   
$search .= " AND a.$fsearch->name LIKE '%".$this->_db->escape($value,true)."%'";
                               }
                     }
                  }
               }
               break;
         }
      }
      
      if (
function_exists("editPaidAd")) {
         if (
JRequest::getInt"ad_featured",0) == 1) {
            
$search .= " AND adext.featured = 1 ";
         }
          
         if (
JRequest::getInt"ad_highlight",0) == 1) {
            
$search .= " AND adext.highlight = 1 ";
         }
          
         if (
JRequest::getInt"ad_top",0) == 1) {
            
$search .= " AND adext.top = 1 ";
         }
      }
       
       if (
JRequest::getInt"images",0) == 1) {
         
$search .= " AND (a.images != '' AND a.images != '[]') ";
      }
       
      
$dispatcher JDispatcher::getInstance();
      
JPluginHelper::importPlugin('adsmanagercontent');
      
      
$results $dispatcher->trigger('ADSonSqlFilter', array ());
      foreach(
$results as $r) {
         if (
$r != null) {
            
$search .= $r;
         }
      }   
      
      
$this->searchSQL " 1 ".$search;
      
//echo $this->searchSQL ;
      
return $this->searchSQL;
    }
    
   function 
getAllCbFields() {
      
$config   JFactory::getConfig();
      
$dbprefix JOOMLA_J3 $config->get('dbprefix') : $config->getValue('config.dbprefix');
      
      
$this->_db->setQuery("SHOW TABLES LIKE '".$dbprefix."comprofiler_fields'"  );
      
$tables $this->_db-> loadObjectList();
      if (
count($tables) > 0)
      {
         
$this->_db->setQuery("SELECT * FROM #__comprofiler_fields WHERE 1"  );
         
$cb_fields $this->_db-> loadObjectList();
         return 
$cb_fields;
      }
      else
         return array();
   }
    
    function 
getJoomlaUserPluginFields() {
      
$config   JFactory::getConfig();
      
$dbprefix JOOMLA_J3 $config->get('dbprefix') : $config->getValue('config.dbprefix');
      
      
$this->_db->setQuery("SHOW TABLES LIKE '".$dbprefix."user_profiles'"  );
      
$tables $this->_db-> loadObjectList();
      if (
count($tables) > 0)
      {
         
$this->_db->setQuery("SELECT DISTINCT(profile_key) FROM #__user_profiles WHERE 1"  );
         
$fields $this->_db-> loadObjectList();
         return 
$fields;
      }
      else
         return array();
   }
    
   function 
getCBFieldValues($fieldcbid)
   {
      
$this->_db->setQuery"SELECT *, fieldtitle as fieldvalue FROM #__comprofiler_field_values WHERE fieldid = ".(int)$fieldcbid."    ORDER by ordering ");
      
$cbfieldvalues $this->_db->loadObjectList();
      return 
$cbfieldvalues;
   }
    
   function 
getPlugins()
   {


      if (
self::$_plugins) {
         return 
self::$_plugins;
      }
      else {
         
$plugins = array();
         
         if(
file_exists(JPATH_ROOT "/images/com_adsmanager/plugins/")) { 
            
$path JPATH_ROOT."/images/com_adsmanager/plugins/";
            
$handle opendir$path );
            while (
$file readdir($handle)) {
               
$dir $path.'/'.$file;
               if (
is_dir($dir))
               {
                  if ((
$file != ".") && ($file != "..")) {
                     if (
file_exists($path.'/'.$file.'/plug.php')) {
                        include_once(
$path.'/'.$file.'/plug.php');
                        if (
$file == "zipcode")
                           
$plugins["zipcode"] = new AdsManagerZipCodePlugin();
                        if (
$file == "region")
                           
$plugins["region"] = new AdsManagerRegionPlugin();
                     } else {
                                if(
is_file($path.'/'.$file)) {
                                    
JFolder::delete($path.'/'.$file);
                                }
                     }
                  }
               }
            }
         
            
closedir($handle);
         }
         
self::$_plugins $plugins;
         
         return 
self::$_plugins;
      }
   }


   function 
contentMatch($content,$searchvalues)
   {
      
$search "";
      
$fields $this->getFields();
      
$plugins $this->getPlugins();


      foreach(
$fields as $fsearch)
      {
         if (
$searchvalues[$fsearch->name] == '') {
            continue;
         }
         
$fieldname $fsearch->name;
         switch(
$fsearch->type)
         {
            case 
'multicheckbox':
            case 
'multiselect':
               
$ok false;
               if (isset(
$searchvalues[$fsearch->name]) && $searchvalues[$fsearch->name] != "") {
                  
$result false;
                  for(
$i 0,$nb=count($searchvalues$fsearch->name]);$i $nb;$i++)
                  {
                     
$val $searchvalues[$fsearch->name][$i];
                     
                     foreach(
$content->$fieldname as $c) {
                        if (
$c == $val) {
                           
$ok true;
                           break;
                        }
                     }
                  }
                  if (
$ok == false) {
                     return 
false;
                  }
               }
               break;
               case 
'checkbox':
               case 
'radio':
               case 
'select':
                  if (isset(
$searchvalues[$fsearch->name]) && $searchvalues[$fsearch->name] != "") {
                     
$value $searchvalues[$fsearch->name];
                     if (
is_array($value)) {
                        if (!
in_array($content->$fieldname,$value)) {
                           return 
false;
                        }
                     } else {
                        if (
$content->$fieldname != $value) {
                           return 
false;
                        }
                     }   
                  }
                  break;
                     
               case 
'price':
               case 
'number':
                  
$options $fsearch->options;
                  if (!isset(
$options)){
                     
$options = new stdClass();
                  }
                  if (!isset(
$options->search_type)) {
                     
$options->search_type "textfield";
                  }
                  switch(
$options->search_type) {
                     case 
"textfield":
                        if (isset(
$searchvalues[$fsearch->name]) && $searchvalues[$fsearch->name] != "") {
                           
$value $searchvalues[$fsearch->name];
                           if (
$content->$fieldname != $value) {
                              return 
false;
                           }
                        }
                        break;
               
                     case 
"select":
                        if (isset(
$searchvalues[$fsearch->name]) && $searchvalues[$fsearch->name] != "") {
                           
$value $searchvalues[$fsearch->name];
                           
                           
$pos strpos($value'-');
                           if (
$pos !== false)
                           {
                              if (
$pos == 0// $pos is = 0 for $value = -x $pos is = 1 only for this format 0-10 {
                              
{
                                 if (
$content->$fieldname >= (float)substr($value,1)) {
                                    return 
false;
                                 }
                              }
                              else if (
$pos == strlen($value) - 1)
                              {
                                 if (
$content->$fieldname <= (float)substr($value,0,strlen($value)-1)) {
                                    return 
false;
                                 }
                              }
                              else
                              {
                                 if ((
$content->$fieldname < (float)substr($value,0,$pos)) 
                                    && (
$content->$fieldname > (float)substr($value,$pos+1))) {
                                    return 
false;
                                 }
                              }
                           }
                        }
                        break;
                                 
                     case 
"minmax":
                        if (isset(
$searchvalues[$fsearch->name."_min"]) && $searchvalues[$fsearch->name."_min"] != "") {
                           
$minvalue $searchvalues[$fsearch->name."_min"];
                           if (
$content->$fieldname $minvalue) {
                              return 
false;
                           }
                        }
                        if (isset(
$searchvalues[$fsearch->name."_max"]) && $searchvalues[$fsearch->name."_max"] != "") {
                           
$maxvalue $searchvalues[$fsearch->name."_max"];
                           if (
$content->$fieldname $maxvalue) {
                              return 
false;
                           }
                        }
                        break;
                     
                  }
                  break;
   
               case 
'textarea':
               case 
'emailaddress':
               case 
'url':
               case 
'text':
               case 
'date':
                  if (isset(
$searchvalues[$fsearch->name]) && $searchvalues[$fsearch->name] != "") {
                     
$value $searchvalues[$fsearch->name];
                     if (
strpos($content->$fieldname,$value) === false) {
                        return 
false;
                     }
                  }
                  break;
               
               default:
                  if(isset(
$plugins[$fsearch->type]))
                  {
                     
$value JRequest::getVar$fsearch->name,   "");
               
                     
//TODO sans SQL
                     
if (0) { //if (method_exists($plugins[$fsearch->type],"getSqlFilter")) {
                        //$filter =  $plugins[$fsearch->type]->getSqlFilter($fsearch,$value);
                        //if ($filter != null)
                        //   $search .= $filter;
                     
} else {
                        if (isset(
$searchvalues[$fsearch->name]) && $searchvalues[$fsearch->name] != "") {
                           
$value $searchvalues[$fsearch->name];
                           if (
strpos($content->$fieldname,$value) === false) {
                              return 
false;
                           }
                        }
                     }
                  }
               break;
         }
      }
      return 
true;
   }
}





Credo, ma forse data l'inesperienza mi sbaglio, è che ci sia qualche virgoletta o parentesi sbagliata (stano dato che ho installato adsmanager senza apportare modifiche), che potrei andare a modificare, qualcuno vede l'inghippo?
« Ultima modifica: 04 Giu 2019, 18:55:05 da marcodicri »

Offline marcodicri

  • Nuovo arrivato
  • *
  • Post: 15
    • Mostra profilo
Re:Errore 1064 con AdsManager
« Risposta #8 il: 08 Giu 2019, 15:40:51 »
C'è qualche possibilità di trovare una soluzione? Magari un amministratore che possa dare un'occhiata da dentro?

Online tomtomeight

  • Global Moderator
  • Fuori controllo
  • ********
  • Post: 30341
  • Sesso: Maschio
  • Gli automatismi aiutano ma non insegnano nulla.
    • Mostra profilo
Re:Errore 1064 con AdsManager
« Risposta #9 il: 08 Giu 2019, 21:44:30 »
Piuttosto prova a chiedere allo sviluppatore se c'è qualche incompatibilità di  versione. Non è che gli amministratori fanno supervisione di codice in questo forum.
NEWS DataGrill Xataface Installer (Ver. 1.0.1) per Joomla 3.8.x - DEMO Gestione Magazzino

 

Host

Torna su