Bug in fleixcontent.fields.php

More
11 years 11 months ago #38276 by rubenreyes
FC version: 2.0.2 r1680

We found several error messages in our PHP log like the following:

PHP Warning: implode(): Invalid arguments passed in /public_html/components/com_flexicontent/classes/flexicontent.fields.php on line 291

In line 291 we found the following:
Code:
$aid_list = implode(",", $aid);

It seems like this error was happening when $aid had the default value 0 and was not an array.

I changed the line to
Code:
$aid_list = (is_array($aid)) ? implode(",", $aid) : implode(",", $user->getAuthorisedViewLevels());

The error message stopped but please check to make sure it is the best solution.

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago #38277 by ggppdk
Hello

this is strange because the function getItemFields() having this code is ONLY called by function getFields(), which does this already

-- i will duplicate the check of getFields() inside getItemFields() too

Just asking:
do you have some custom code that might be calling the function getItemFields() ?


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago #38295 by rubenreyes
Yes, we have a custom field similar to your related items field:
Code:
// Get item fields require_once("components/com_flexicontent/models/".FLEXI_ITEMVIEW.".php"); require_once("components/com_flexicontent/classes/flexicontent.fields.php"); require_once("components/com_flexicontent/classes/flexicontent.helper.php"); $relitemmodel = new FlexicontentModelItem(); $relitem = $relitemmodel->getItem($result->id,false); FlexicontentFields::getItemFields($relitem,true); $relitem->fieldvalues = FlexicontentFields::_getFieldsvalues($relitem->id, $relitem->fields); if($title_link) $item_link = JRoute::_(FlexicontentHelperRoute::getItemRoute($itemslug, $catslug)); $display_text = $pretext; // Photo if($image!='') { $imagefield = unserialize($relitem->fieldvalues[$relitem->fields[$image]->id][0]); $display_text.='<div class="photo">'; if($title_link) $display_text.='<a href="'.$item_link.'" >'; $display_text.='<img src="images/stories/flexicontent/'.$imagesize.'_'.$imagefield['originalname'].'" alt="'.$imagefield['alt'].'" title="'.$imagefield['title'].'" />'; if($title_link) $display_text.=''; $display_text.='</div>'; } // Title $itemtitle = $result->title; if($title_field!='') { switch($relitem->fields[$title_field]->field_type) { case 'relateditems'||'relateditems_advanced': $myrelitemmodel = new FlexicontentModelItem(); $myrelitem = $myrelitemmodel->getItem($relitem->fieldvalues[$relitem->fields[$title_field]->id][0],false); $itemtitle = $myrelitem->title; break; default: FlexicontentFields::getFieldDisplay($relitem, $title_field, $values=null, $method='display'); $itemtitle = $relitem->fields[$title_field]->display; break; } } $display_text.='<div class="'.($title_field?$title_field:'title').'">'; if($title_link) $display_text.='<a href="'.$item_link.'">'; $display_text.=$itemtitle; if($title_link) $display_text.=''; $display_text.='</div>'; // Additional Fields if($add_field!=''){ $item_add_field = explode("|",$add_field); foreach($item_add_field as $fieldname) { FlexicontentFields::getFieldDisplay($relitem, $fieldname, $values=null, $method='display'); if($relitem->fields[$fieldname]->display) $display_text.='<div class="'.$fieldname.'">'.$relitem->fields[$fieldname]->display.'</div>'; else $display_text.='<div class="'.$fieldname.'">'.$relitem->fieldvalues[$relitem->fields[$fieldname]->id][0].'</div>'; } } $display_text.= $posttext; $display[]= $display_text;

This is based losely on your FAQ guide at www.flexicontent.org/documentation/faq/7...-3rd-party-code.html

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago #38297 by ggppdk
Hello,

thanks for feedback and information
your temporary fix is correct,

already made a fix for v2.0.3

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago #38302 by micker
thanks for shareing

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.376 seconds
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save