Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Links Manager for osC v1.00


VJ

Recommended Posts

In case you have not tried it yet, change this lines in the admin/link_categories.php file

$sql_data_array = array_merge($sql_data_array, $insert_sql_data);
tep_db_perform(TABLE_LINK_CATEGORIES, $sql_data_array);

to

$sql_data_array = array_merge((array)$sql_data_array, (array)$insert_sql_data);
tep_db_perform(TABLE_LINK_CATEGORIES, (array)$sql_data_array);

The problem is with php 5, which I assume you are using. The code is not detecting the object as an array. When you place (array) in from of the object, you are telling the code to treat it as an array. If it still fails, post what the line number of the failure is and I will take another look.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • Replies 1.1k
  • Created
  • Last Reply

Top Posters In This Topic

Tried it but it didnt work.

 

Errors are on lines 17 & 18 in here.

 

Warning: reset() [function.reset]: Passed variable is not an array or object in /home/wwwshop/public_html/admin/includes/classes/object_info.php on line 17

 

Warning: Variable passed to each() is not an array or object in /home/wwwshop/public_html/admin/includes/classes/object_info.php on line 18

 

This is the file code below:

 

<?php

/*

$Id: object_info.php,v 1.6 2003/06/20 16:23:08 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

class objectInfo {

 

// class constructor

function objectInfo($object_array) {

reset($object_array);

while (list($key, $value) = each($object_array)) {

$this->$key = tep_db_prepare_input($value);

}

}

}

?>

Link to comment
Share on other sites

That is just common code and is not the cause of the problem, most likley. It is the code that is calling that that needs to be changed.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

No, that's why I was asking you where the problem was at. :) You would need to note what file you are in at the time of the failure as well as what it is you are doing. The code segment could be determined from there.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

First of all, I wanted to say kudos for this contribution. It was a tricky thing to set it up, but seems to work well when every little step is carefully followed and the patches added.

 

I am leery of getting spammed to death again with this contribution, though.

 

From way back on page 33, someone else was having trouble with spam. It was suggested:

 

adding a simple CAPTCHA to the submit form will be a great idea - you will bock most like that.
i am no coder so i cant tell you how to do it, but if you look through contribution section you will find this little contrib
http://www.oscommerce.com/community/contri...arch,validation
i havent installed it yet so cant tell you if its easy enough to do, but certinly worth a try

 

I have this CAPTCHA installed on my create_account page, but can't seem to figure out how to make this work with the submit link form. Has anyone done that yet?

Link to comment
Share on other sites

There's a contribution for that, anti robot or something like that. It should be easy to add to the page though I haven't tried it.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

There's a contribution for that, anti robot or something like that. It should be easy to add to the page though I haven't tried it.

 

Jack

 

< sigh > Yes, I suppose it would be easy for a real programmer.

 

I have the Anti Robot Registration Validation on the contact_us page, etc.

 

Its not as if I can just drop in an "include" statement. There's about 3 different places to insert the code in the contact page. I can see no easy way to determine where the code would work in the links_submit page.

 

Besides, the code seems to say it wants to validate $email, not $links_contact_email?

 

Does this even go together right?

 

  require('includes/application_top.php');

// BOF Anti Robot Validation v2.5
 if (ACCOUNT_VALIDATION == 'true' && ACCOUNT_CREATE_VALIDATION == 'true') {
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ACCOUNT_VALIDATION);
include_once('includes/functions/' . FILENAME_ACCOUNT_VALIDATION);
 }
// EOF Anti Robot Registration v2.5

// needs to be included earlier to set the success message in the messageStack
 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_LINKS_SUBMIT);
 require(DIR_WS_FUNCTIONS . 'links.php');

 $process = false;
 if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process')) {
$process = true;

$links_title = tep_db_prepare_input($HTTP_POST_VARS['links_title']);
$links_url = tep_db_prepare_input($HTTP_POST_VARS['links_url']);  
$links_category = tep_db_prepare_input($HTTP_POST_VARS['links_category']);
$links_category_suggest = tep_db_prepare_input($HTTP_POST_VARS['links_cat_suggest']);
$links_description = tep_db_prepare_input($HTTP_POST_VARS['links_description']);
$links_image = tep_db_prepare_input($HTTP_POST_VARS['links_image']);
$links_contact_name = tep_db_prepare_input($HTTP_POST_VARS['links_contact_name']);
$links_contact_email = tep_db_prepare_input($HTTP_POST_VARS['links_contact_email']);
if (LINKS_RECIPROCAL_REQUIRED == 'True') $links_reciprocal_url = tep_db_prepare_input($HTTP_POST_VARS['links_reciprocal_url']);

// BOF Anti Robot Registration v2.5
if (ACCOUNT_VALIDATION == 'true' && ACCOUNT_CREATE_VALIDATION == 'true') {
$antirobotreg = tep_db_prepare_input($HTTP_POST_VARS['antirobotreg']);
}
// EOF Anti Robot Registration v2.5

$error = false;

 

 

And any ideas on where in the submit_links page should I put this code?

 

<!-- // BOF Anti Robot Registration v2.5-->
<?php
 if (ACCOUNT_VALIDATION == 'true' && strstr($PHP_SELF,'links_submit') &&  ACCOUNT_EDIT_VALIDATION == 'true') {
?>
  <tr>
	<td class="main"><b><?php echo CATEGORY_ANTIROBOTREG; ?></b></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" cellspacing="2" cellpadding="2">
		  <tr>
<?php
if (ACCOUNT_VALIDATION == 'true' && strstr($PHP_SELF,'links_submit') &&  ACCOUNT_EDIT_VALIDATION == 'true') {
  if ($is_read_only == false || (strstr($PHP_SELF,'links_submit')) ) {
	$sql = "DELETE FROM " . TABLE_ANTI_ROBOT_REGISTRATION . " WHERE timestamp < '" . (time() - 3600) . "' OR session_id = '" . tep_session_id() . "'";
	if( !$result = tep_db_query($sql) ) { die('Could not delete validation key'); }
	$reg_key = gen_reg_key();
	$sql = "INSERT INTO ". TABLE_ANTI_ROBOT_REGISTRATION . " VALUES ('" . tep_session_id() . "', '" . $reg_key . "', '" . time() . "')";
	if( !$result = tep_db_query($sql) ) { die('Could not check registration information'); }
?>
		  <tr>
			<td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="formArea">
			  <tr>
				<td class="main"><table border="0" cellspacing="0" cellpadding="2">
				  <tr>
					<td class="main" width="100%" NOWRAP><span class="main"> <?php echo ENTRY_ANTIROBOTREG; ?></span></td>
				  </tr>
				  <tr>
					<td class="main" width="100%">
<?php
	  $check_anti_robotreg_query = tep_db_query("select session_id, reg_key, timestamp from anti_robotreg where session_id = '" . tep_session_id() . "'");
	  $new_guery_anti_robotreg = tep_db_fetch_array($check_anti_robotreg_query);
	  $validation_images = tep_image('validation_png.php?rsid=' . $new_guery_anti_robotreg['session_id']);
	  if ($entry_antirobotreg_error == true) {
?>
<span>
<?php
		echo $validation_images . ' <br> ';
		echo tep_draw_input_field('antirobotreg') . ' <br><b><font color="red">' . ERROR_VALIDATION . '<br>' . $text_antirobotreg_error . '</b></font>';
	  } else {
?>
<span>
<?php	  
		echo $validation_images . ' <br> ';
		echo tep_draw_input_field('antirobotreg', $account['entry_antirobotreg']) . ' ' . ENTRY_ANTIROBOTREG_TEXT;
	  }
	}
  }
?>
</span>
					</td>
				  </tr>
				</table></td>
			  </tr>
			</table></td>
		  </tr>
		</tr>
	  </table></td>
	</tr>
  </table></td>
</tr>
<tr>
  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?php
}
?>

<!-- // EOF Anti Robot Registration v2.5-->

Link to comment
Share on other sites

Stewps here Jack,

 

(No, that's why I was asking you where the problem was at. You would need to note what file you are in at the time of the failure as well as what it is you are doing. The code segment could be determined from there.

 

Jack)

 

 

I wasnt in any file. I was in Admin, click links Manager then click links catagory then click add catagory button and thats when the errors pop up on the top of the page.

 

Thanks

Link to comment
Share on other sites

Stewps here Jack,

 

(No, that's why I was asking you where the problem was at. You would need to note what file you are in at the time of the failure as well as what it is you are doing. The code segment could be determined from there.

 

Jack)

I wasnt in any file. I was in Admin, click links Manager then click links catagory then click add catagory button and thats when the errors pop up on the top of the page.

 

Thanks

That would mean you are in the links_categories.php file (if you look in the url it will show it). On the default installation of Links Manager, there is a New Category button and then a Save button on the Edit page. I don't have a Add Category page but I assume you mean one of those?

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Yes, thats the one, here is the url of the page the errors pop up on

 

https://www.myshop.com/admin/link_categorie...&action=new

 

so, even though the errors say:

 

Warning: reset() [function.reset]: Passed variable is not an array or object in /home/wwwshop/public_html/admin/includes/classes/object_info.php on line 17

 

Warning: Variable passed to each() is not an array or object in /home/wwwshop/public_html/admin/includes/classes/object_info.php on line 18

 

The problem lies here link_categories.php, is that right.

 

Thanks

Link to comment
Share on other sites

In the links_categories.php file, find this code

	  case 'insert':
  case 'update':

A few lines down will be this code

$sql_data_array = array_merge($sql_data_array, $insert_sql_data);

Change it to

$sql_data_array = array_merge((array)$sql_data_array, (array)$insert_sql_data);

If that doesn't work, I don't have any other suggestions.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

For those who want to add an Anti Robot to the links_submit.php page, there is now a new contribution that will allow you to do so.

 

http://www.oscommerce.com/community/contributions,1237

 

It works for me, but I didn't code it.

 

If you run into issues with it, please double check your install and/or visit their forum for help.

Link to comment
Share on other sites

  • 2 weeks later...

Hello,

I have this great contribution installed and running perfectly on one of my websites. I tried installing this to another ms2 shop, but i recieve the following error when clicking on "link categories" in admin:

 

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 '-4, 4' at line 1

 

select lc.link_categories_id, lc.link_categories_image, lc.link_categories_status, lc.link_categories_sort_order, lc.link_categories_date_added, lc.link_categories_last_modified, lcd.link_categories_name, lcd.link_categories_description from link_categories lc left join link_categories_description lcd on lc.link_categories_id = lcd.link_categories_id where lcd.language_id = '1' order by lc.link_categories_sort_order, lcd.link_categories_name limit -4, 4

 

[TEP STOP]

 

I had a similar issue when clicking on links, but i solved it by inserting a new link from links_submit in catalog area.

 

Unfortunately, i cannot add a category from catalog side....

 

any idea how to fix this issue or how to add a category manually to the database?

 

Thanks!

Link to comment
Share on other sites

You need to download the latest oscommerce update (Solutions->downloads in above menu) and install the fix for the split_page_results file.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

This is a live website, i cannot just download the latest oscommerce solution, i would like to find the fix.

Can you please direct me to the fix for this file?

Thanks for your help Jack.

 

You need to download the latest oscommerce update (Solutions->downloads in above menu) and install the fix for the split_page_results file.

 

Jack

Link to comment
Share on other sites

the table displaying the links is getting out of whack when very long URL are shown, is there a way for me to set the decription TD portion to, lets say, 70% and get the table to adjust to it, perhaps even truncating the link so it will only show, lets say, 20 characters?

 

i tryed looking at the contribution and added $lc_width to all the coulmns and seting it to '0%' to all but the desciptions, but i could not see any changes in the table.....

i tryed to understand the table construction proccess but could not see how the

new linkListingBox($list_box_contents);

bit construct the table out of the differant :

case 'LINK_LIST_DESCRIPTION':
		$lc_align = 'right';
		$lc_text = $listing['links_description'];
		$lc_width = '100%';
		break;

case bits...

can you help me ?

currently using OSC2.2MS2 051113 with the following contributions:

 

AJAX Attributemanager 2.1 - All_products 4.4 - Banner manager 1.5b - banner hack picture in manager * description in product listing hack ms2 v2.4 * drop shadow boxes v.1.1 * Easy populater 2.76d-ms2 by surfalot * FCKEditor * header tag controller v2.5.9 * jcssmenu * LoginBox 5.6 * option type feature v1.71 * OSC-Cach-v1.1 * popup_imagecleaned_stilized_2 * Remove from cart button hack * scrolling bestsellers * Article manager1.4 * Links Manager v1.14. * proffessional invoice&packingslip 6.1 * Ultimate SEO URLs

Personaly i think all these features NEED to be in the main core as they are quite basic features that are missing. but then again what do i know?

Link to comment
Share on other sites

sorry Jack, but i cant find the file you are refering to. can you post the link here?

thnks again.

Take a look at the top of this page. You will see a menu there with a Solutions menu item. Click on that and you will see a sub-item that says Downloads. Click on that the first package is for Update 060817. Doenload that.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...