Jump to content



Latest News: (loading..)

bibleman

Member Since 03 Sep 2003
OFFLINE Last Active Aug 05 2012 09:28 PM
-----

Posts I've Made

In Topic: Help with a PHP 5.3 error in faqdesk_show.php file

09 July 2012 - 04:09 PM

View PostMrPhil, on 09 July 2012 - 02:28 PM, said:

You're going to have to look back up through the code to see where $id was last set before being used in line 85. Was there some other code change (add-on or manual edit) that might have accidentally repurposed $id? Or was $id originally a string for some other purpose, and someone/something removed the repurposing of it to an array? In either case, this shows the great weakness of untyped or weakly typed languages

Thanks for responding Phil,

The only time the $id is used prior to line 85 is on line 68.


// -------------------------------------------------------------------------------------------------------------------------------------------------------------
function FAQDesk_show_category($counter) {
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
(line 68) global $foo_faqdesk, $categories_faqdesk_string, $id;

for ($a=0; $a<$foo_faqdesk[$counter]['level']; $a++) {
	$categories_faqdesk_string .= "&nbsp;&nbsp;";
}

$categories_faqdesk_string .= '<a href="';

if ($foo_faqdesk[$counter]['parent'] == 0) {
	$faqPath_new = 'faqPath=' . $counter;
} else {
	$faqPath_new = 'faqPath=' . $foo_faqdesk[$counter]['path'];
}

$categories_faqdesk_string .= tep_href_link(FILENAME_FAQDESK_INDEX, $faqPath_new);
$categories_faqdesk_string .= '">';

if ( ($id) && (in_array($counter, $id)) ) {
	$categories_faqdesk_string .= '<b>';
}

Then you see it again beginning on line 168

//------------------------
if ($faqPath) {
	$new_path = '';
//	$id = split('_', $faqPath);
(line 168)	$id = preg_split('/_/', $faqPath);
	
	reset($id);
	while (list($key, $value) = each($id)) {
		unset($prev_id);
		unset($first_id);

		$categories_faqdesk_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_FAQDESK_CATEGORIES . " c, "
		. TABLE_FAQDESK_CATEGORIES_DESCRIPTION . " cd where c.catagory_status = '1' and c.parent_id = '" . $value . "'
		and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_name");

		$category_faqdesk_check = tep_db_num_rows($categories_faqdesk_query);
		if ($category_faqdesk_check > 0) {
			$new_path .= $value;
			while ($row = tep_db_fetch_array($categories_faqdesk_query)) {
				$foo_faqdesk[$row['categories_id']] = array(
					'name' => $row['categories_name'],
					'parent' => $row['parent_id'],
					'level' => $key+1,
					'path' => $new_path . '_' . $row['categories_id'],
					'next_id' => false
				);

That's it for the whole file.

Thanks for helping,
Leon

In Topic: Help with a PHP 5.3 error in faqdesk_show.php file

09 July 2012 - 05:08 AM

NOW... in the same contribution I have another error.

In the faqdesk .php file I am getting this error.

PHP Warning: in_array() expects parameter 2 to be array, string given in /var/www/vhosts/mystore.com/httpdocs/includes/boxes/faqdesk.php on line 85


if ($foo_faqdesk[$counter]['parent'] == 0) {
	$faqPath_new = 'faqPath=' . $counter;
} else {
	$faqPath_new = 'faqPath=' . $foo_faqdesk[$counter]['path'];
}

$categories_faqdesk_string .= tep_href_link(FILENAME_FAQDESK_INDEX, $faqPath_new);
$categories_faqdesk_string .= '">';

if ( ($id) && (in_array($counter, $id)) ) {
	$categories_faqdesk_string .= '<b>';
}


Line 85 is:

if ( ($id) && (in_array($counter, $id)) ) {

Got any idea what I need to do to fix this?

Thanks

Leon

In Topic: Help with a PHP 5.3 error in contact_us.php file

02 July 2012 - 12:07 AM

View PostDunWeb, on 29 June 2012 - 04:54 AM, said:

@bibleman

You will find there is more errors and THIS contribution may help.




Chris

GREAT! Will take a look.
Thanks

In Topic: Help with a PHP 5.3 error in contact_us.php file

29 June 2012 - 04:10 AM

Thanks Don,

I will give that a try.

In Topic: Rename Images (help)

12 June 2012 - 12:51 AM

Just got a clue from myphpmyadmin.

I can get it to do it through myphpadmin but don't know how to write it into the file in php code.

update products set products_image = replace(products_image,'OLD_FILE_NAME.jpg','NEW_FILE_NAME.jpg');

BUT the code for the page would need to do this:

update products set products_image = replace(products_image,'SELECT OLD_FILE_NAME from ABOVE','SELECT NEW FILE NAME FROM ABOVE.jpg');

Anyone with any ideas?