Jump to content
Sign in to follow this  
VJ

[Contribution] Links Manager for osC v1.00

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

Share this post


Link to post
Share on other sites

I shall give it a try and do that when my other little problem is fix.

 

Thanks Jack

Share this post


Link to post
Share on other sites

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);

}

}

}

?>

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Do you know what code that would be? Is it an SQL problem maybe?

 

It doesnt seem to effect the way it works at all. Everything works well.

 

:)

Share this post


Link to post
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

Share this post


Link to post
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?

Share this post


Link to post
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

Share this post


Link to post
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-->

Share this post


Link to post
Share on other sites

This thread doesn't support that contribution. You should ask in the support thread for it.

 

Jack

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Nope, That didnt work either. I dont know whats wrong with it.

 

(refering to Jacks last post with a code to change for me)

Share this post


Link to post
Share on other sites

LOL! Oh my! Jack, I just discovered something about this contribution that is interesting.

Makes it difficult to get back links for those checking the link URL, though.

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

I just did. Download the file, read the instructions and apply the fix.

 

Jack

Share this post


Link to post
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?

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×