Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

'add_system_field' type functionalty?

Quote Reply
'add_system_field' type functionalty?
Alex,

Is there a way to get the same functionality of the 'add_sytem_fields' in a plugin?

Such that a user can set defaults

field_one=1,field_two='99', ....

And this is stored as a hash, rather than a string for the loader?

barring that, would this:

Code:
my $input = $IN->get_hash;
my $clean_fields = $PLUGIN_CFG->{add_plugin_fields};
my @valid_fields = split (',', $clean_fields);
foreach my $field (@valid_fields) {
my ($key, $value) = split (m'\s+=\s+', $field); ## should remove = and any attached spaces
$key =~ s/^\s+//g; ## might still have leading spaces
$value =~ s/\s+$//g; ## might still have trailing spaces
$value =~ s/^(\'|\")//; ## value might have been enclosed in ' or " leading
$value =~ s/(\'|\")$//; ## value might have been enclosed in ' or " trailing
$input->{$key} = $value; ## set, or overwrite any supplied values.
}
do what I think it should - which is set (or overwrite user-provided) fields to the
webmaster set defaults??

This would be changed slightly for a modify, where $PLUGIN_CFG->{'preserve_plugin_fields'}
would be used, and would overwrite the above values.

I'm concerned with security as much as efficiency, and draw any data from a stored database (links table, config files, etc) where possible, rather than trust they were sent back from a form unaltered. Only values that are allowed to change, or are presented to the user to be changed, are not overwritten or expunged before a database update or add.


PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Plugins:http://LinkSQL.com/plugin
Subject Author Views Date
Thread 'add_system_field' type functionalty? pugdog 2940 Jul 6, 2001, 2:36 AM
Thread Re: 'add_system_field' type functionalty?
Paul 2848 Jul 6, 2001, 4:12 AM
Post Re: 'add_system_field' type functionalty?
Alex 2832 Jul 6, 2001, 9:17 AM
Thread Re: 'add_system_field' type functionalty?
Alex 2858 Jul 6, 2001, 9:27 AM
Post Re: 'add_system_field' type functionalty?
pugdog 2804 Jul 6, 2001, 11:57 AM