Gossamer Forum
Quote Reply
Any ideas?
Hi, I have set up several copies of Links 2 on other servers, but on this one i keep getting an error. The error is as follows;

Error including libraries: syntax error at links.cfg line 55, near "sub date_to_unix "
syntax error at links.cfg line 71, near "}"

Any ideas would be much appreciated.

Yours

A.J.Newby
webmaster@youradds.com
http://ace.upyour.com

Quote Reply
Re: Any ideas? In reply to
Could you post that section of the code please so I can look at it to try and solve the problem!

From Paul Wilson.
http://www.audio-grabber.com
On error resume next..
Quote Reply
Re: Any ideas? In reply to
Sure, the code is below;

$db_script_path = "/u227/rpcnexus/links/cgi-bin/admin";
$db_dir_url = "http://www.u-need-2-know.com/links/cgi-bin/admin";
$db_cgi_url = "http://www.u-need-2-know.com/links/cgi-bin/";
$build_root_path = "/u227/rpcnexus/links/pages/";
$build_root_url = "http://www.u-need-2-know.com/links/pages/";
$build_new_path = "$build_root_path/New";
$build_new_url = "$build_root_url/New";
$build_cool_path = "$build_root_pathCool";
$build_cool_url = "$build_root_url/Cool";
$build_ratings_path = "$build_root_path/Ratings";
$build_ratings_url = "$build_root_url/Ratings";
$db_use_flock ="1";
$db_nocache ="0";
$db_iis ="1";
$db_main_category ="1";
@db_referers = ();
$db_mail_path = '/usr/sbin/sendmail';
$db_smtp_server = '';
$db_admin_email = 'webmaster@u-need-2-know.com';
$db_email_add = 1;
$db_email_modify = 1;
$db_mailer_log = '';
$db_popular_cutoff = 0.03;
$db_new_cutoff = 15;
$search_bold = 1;
$build_index = "index.html";
$build_extension = ".html";
$db_single_category = 1;
$build_dir_per = 0777;
$build_links_per_page = "10";
$build_detailed = 0;
$build_detail_path = "$build_root_path/Detailed";
$build_detail_url = "$build_root_url/Detailed";
$build_use_templates = 1;
$build_site_title = 'U Need 2 Know Directory'

# Date Routines
# --------------------------------------------------------
# Your date format can be whatever you like, as long as the following
# two functions are defined &date_to_unix and &unix_to_date:
# The default is dd-mmm-yyyy.

sub date_to_unix {

my $date = shift; my $i;
my %months = map { $_ => $i++ } qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!;
my ($day, $mon, $year) = split(/-/, $date);

exists $months{$mon} or return undef;
$day = int($day); $year = $year - 1900;

require Time::Local;
my $time = 0;
eval {
$time = &Time::Local::timelocal(0,0,0, $day, $months{$mon}, $year);
};
if ($@) { die "invalid date format: $date - parsed as (day: $day, month: $months{$mon}, year: $year). Reason: $@"; }
return $time;
}

sub unix_to_date {
# --------------------------------------------------------
# This routine must take a unix time and return your date format
# A much simpler routine, just make sure your format isn't so complex that
# you can't get it back into unix time.
#
my $time = shift;
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $tz) = localtime $time;
my @months = qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!;
$year = $year + 1900;
return "$day-$months[$mon]-$year";
}

sub long_date {
# --------------------------------------------------------
# This routine is for printing a nicer date format on the what's new page. It should
# take in a date in your current format and return a new one.
my $time = shift;
$time = &date_to_unix ($time);
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $tz) = localtime $time;
my @months = qw!January February March April May June July August September October November December!;
my @days = qw!Sunday Monday Tuesday Wednesday Thursday Friday Saturday!;
$year = $year + 1900;
return "$days[$dweek], $months[$mon] $day $year";
}
# -------------------------------------------------------------
# Extra Paths -- unless you feel the need to rename files, you
# can leave this as is.
# -------------------------------------------------------------
$db_script_url = $db_dir_url . "/admin.cgi";
$db_header_path = $db_script_path . "/header";
$db_footer_path = $db_script_path . "/footer";
$build_search_url = $db_cgi_url . "/search.cgi";
$build_add_url = $db_cgi_url . "/add.cgi";
$build_modify_url = $db_cgi_url . "/modify.cgi";
$build_jump_url = $db_cgi_url . "/jump.cgi";
$build_email_url = $db_cgi_url . "/subscribe.cgi";
$build_rate_url = $db_cgi_url . "/rate.cgi";
$db_mail_url = $db_dir_url . "/nph-email.cgi";
$build_css_url = $build_root_url . "/links.css";

$db_lib_path = "$db_script_path";
$db_links_name = "$db_script_path/data/links.db";
$db_category_name = "$db_script_path/data/categories.db";
$db_valid_name = "$db_script_path/data/validate.db";
$db_modified_name = "$db_script_path/data/modified.db";
$db_url_name = "$db_script_path/data/url.db";
$db_email_name = "$db_script_path/data/email.db";
$db_links_id_file_name = "$db_script_path/data/linksid.txt";
$db_category_id_file_name = "$db_script_path/data/categoryid.txt";
$db_hits_path = "$db_script_path/data/hits";
$db_template_path = "$db_script_path/templates";
$db_rates_path = "$db_script_path/data/rates";
1;



Thanks a lot

Yours

A.J.Newby
webmaster@youradds.com
http://ace.upyour.com