Gossamer Forum
Home : Products : Links 2.0 : Customization :

Expirator fix

Quote Reply
Expirator fix
That expire script didn't seem to work so i messed around with it alot
until i got it to work.
NOTE : I dont know crap about programming or perl so use this at your
own risk, and dont come askin me questions about it.

back up your stuff and try it out.
it works but i might have screwed somethin else up Smile

in links.def
you should have these or whatever numbers you set them to.
use $db_expire instead of $db_expiredays or change the line in
nhpepirator.cgi to match.

ExpireDays => [15, 'numer', 2, 2, 1, '90', ''],

$db_expire = 15;

Code:
in nph-expirator.cgi
find and change :

LINE: foreach $line (@lines) {
if ($line =~ /^$/) { next LINE; }
if ($line =~ /^#/) { $output .= $line; next LINE; }
chomp ($line);
@rec = &split_decode($line);

$days = &days_old($rec[$db_modified]);

to read :

LINE: foreach $line (@lines) {
if ($line =~ /^$/) { next LINE; }
if ($line =~ /^#/) { $output .= $line; next LINE; }
chomp ($line);
@rec = &split_decode($line);

$days = &days_old($rec[$db_modified]);
$db_expiration = $db_expire;

and also change :

# Print Main Body.
for ($i = 0; $i < $numhits; $i++) {
%tmp = &array_to_hash ($i, @hits);
print qq|<TR><TD valign=top width="50">
<INPUT TYPE=CHECKBOX NAME="$tmp{$db_key}" VALUE="delete">$tmp{$db_key}</font></TD>|;

### LDN MODIFY START -----------------------------------------------------------------
print qq|
<td><strong><a href="$build_jump_url?$db_key=$tmp{$db_key}">$tmp{'Title'}</a></strong>
</td><td>$tmp{'Date'}</td><td>$tmp{'ExpireDays'}</td>
|;

### &html_record_form_spreadsheet_expire (%tmp); # Original Code

### LDN MODIFY END -------------------------------------------------------------------

print qq|
<TD>$num_days[$i]</TD></TR>|;
}

to read :

# Print Main Body.
for ($i = 0; $i < $numhits; $i++) {
%tmp = &array_to_hash ($i, @hits);
print qq|<TR><TD valign=top width="50">
<INPUT TYPE=CHECKBOX NAME="$tmp{$db_key}" VALUE="delete">$tmp{$db_key}</font></TD>|;
$daysexpired = $num_days[$i] - $tmp{'ExpireDays'};

### LDN MODIFY START
print qq|
<td><strong><a href="$build_jump_url?$db_key=$tmp{$db_key}">$tmp{'Title'}</a></strong>
</td><td>$tmp{'Date'}</td><td>$tmp{'ExpireDays'}</td>
|;

### &html_record_form_spreadsheet_expire (%tmp); # Original Code

### LDN MODIFY END

print qq|
<TD>$daysexpired</TD></TR>|;
}


OPTIONAL : lets you run expirator from admi panel.
note : my script is named nph-expirator.cgi
change to your script name.

in admin_html.pl
find and change :

<p><$font><b>Links<br></b></font>
<$font>
<a href="$db_script_url?db=links&view_search=1">View</a><br>
<a href="$db_script_url?db=links&add_form=1">Add</a><br>
<a href="$db_script_url?db=links&delete_search=1">Delete</a><br>
<a href="$db_script_url?db=links&modify_search=1">Modify</a><br>
<a href="$db_script_url?db=links&validate_form=1">Validate</a><br>
<a href="$db_script_url?db=links&check_duplicates=1">Check Dup.</a><br>
</font>

to read :

<p><$font><b>Links<br></b></font>
<$font>
<a href="$db_script_url?db=links&view_search=1">View</a><br>
<a href="$db_script_url?db=links&add_form=1">Add</a><br>
<a href="$db_script_url?db=links&delete_search=1">Delete</a><br>
<a href="$db_script_url?db=links&modify_search=1">Modify</a><br>
<a href="$db_script_url?db=links&validate_form=1">Validate</a><br>
<a href="$db_script_url?db=links&check_duplicates=1">Check Dup.</a><br>
<a href="$db_dir_url/nph-expirator.cgi">Expired Links?</a>
</font>

Well thats it hope it works for you guys Smile

------------------
Half-Life Player model conversion center.
Converted.cjb.net

Links, 3D FPS Gaming Directory
http://GamersCorner.cjb.net
Cheers, HalfDead
And come check out one of my sites :D