Changed function function links_admin_edit:

function links_admin_edit($lid) {
  $query = db_query("select url, link_title from {links} where lid = '$lid'");
  $row = db_fetch_array($query);
  $form = '<p>' . t('Editing this link affects <strong>all</strong> content pages that refer to it.').'</p>';
  $form .= form_textfield(t('Title'),'link_title',$row['link_title'], '50', '', '',t('Title of an external web page'), '1', FALSE);
  $form .= form_textfield(t('URL'),'link_url',$row['url'], '100', '', '',t('URL of an external web page'), '1', FALSE);
  $form .= form_hidden('lid',$lid);
  $form .= form_submit(t('Edit'));
  $output = form($form, 'post', '/admin/links/'.$lid.'/edit');
  return $output;
}

And updated the links_admin_links function added this to the bottom:

 } elseif($op == t('Edit')) {
      if (empty($edit['link_title']) || empty($edit['link_url'])) {
        form_set_error('', t('Missing data'));
      } else {
        drupal_set_message(t('Your changes was saved'));
		$query=db_query("update {links} set url='".mysql_real_escape_string($edit['link_url'])."', link_title='".mysql_real_escape_string($edit['link_title'])."' where lid='".$edit['lid']."'");
	  }
  }

There is no major input validation, there should be. I don't know if there is any build in to drupal? Also note that this is my first ever modification of Drupal.

CommentFileSizeAuthor
#4 links.module12.32 KBxqus
links_related.module20.7 KBxqus

Comments

syscrusher’s picture

The links bundle is still very much an "alpha" level, and as you've correctly pointed out, isn't feature-complete yet. I'll review your patch ASAP; thanks for the contrib. :-)

Scott

syscrusher’s picture

I just got around to looking at your patch...it appears that the attachment is the same as my existing version. :-) Perhaps the wrong file got uploaded? Could you please check, and make sure the attachment is your updated version? Thanks.

Scott

syscrusher’s picture

Assigned: Unassigned » syscrusher
xqus’s picture

StatusFileSize
new12.32 KB

Sorry about that, I uploaded the wrong file. :P

Try this.

syscrusher’s picture

Status: Needs review » Active

This code has been converted to Drupal 4.7 and is committed into the CVS version. I still have to finish converting the code that calls it, unfortunately, so it's not yet possible to see it work. :-) I will get to that ASAP, but wanted to go ahead and do an early commit. This issue remains open until that TODO is completed.

Thanks again for the code!

Scott