Jump to content

simon

Members
  • Posts

    14
  • Joined

  • Last visited

simon's Achievements

Apprentice

Apprentice (3/14)

  • First Post
  • Collaborator
  • Conversation Starter
  • Week One Done
  • One Month Later

Recent Badges

0

Reputation

  1. Raul, I agree that it all looks bizarre. I sorted all the obvious reasons so I am now trying to think laterally. I set up over 25 domains through my reseller's account. So I think I would now by now I use 'packages', I just checked and the package comes with 'unlimited' databases so I should be fine. I installed frontpage extensions and I did everything 'as usual'. I do not know what to think. I posted a support ticket and it seems to be working fine at your end, I tried again using a different browser and a different machine (netscape on a mac) and it still does not work. I am now completely confused Simon
  2. There seem to be two separate problems : 1) When I am in the control panel and I try to access phpAdmin I get the "cannot find server" message. 2) I am trying to install AnnounceMail. I set up the database, run setup.php and what I get is 0:localhost can't continue. The table is not created inside the database and announcemail does not work. I have successfully installed AnnounceMail in other websites and it worked without a problem. 3) I am also trying to install sendcard (an e-card script that I have used several times) Warning: mysql_connect(): Access denied for user: 'usecards@localhost' (Using password: YES) in /home/jamesc/public_html/sendcard/include/db_mysql.php on line 73 Database error: connect(localhost, usecards, $Password) failed. MySQL Error: () again I have installed this script other times without a problem. It looks as if I am unable to connect to 'localhost' for whatever reason. Could it be the way I set up the domain name (again, I have done it over 20 times so one would think I should know how to do it by now !) Can anybody shed some light ? Simon
  3. I am trying to install scripts I have installed before without any problems (in other words, been there, done it, etc.). I cannot get a connection to localhost. I am a reseller, so I set up the domain. Is there any way I could have done something wrong in setting up the domain ? I have already defined the database tables, without a problem. I have problems getting to phpAdmin. The other websites I run do not have the same issues. I tried installing the same scripts in another website and they work without a problem. I am a bit confused, can anybody help ? Thanks Simon
  4. Hi, I have two scripts which I have installed half a dozen times (IOW I know what I am doing), to-day I have installed them on a new sites. I cannot get the connection to localhost. When I call the controlpanel of that URL (I am a reseller), I have problem getting to the phpAdmin, I need to refresh three times to get there. Could the two problems be related ? Any suggestions to sort things out ? Thanks simon
  5. Hello guys and thanks for your help Borfast, I though that # was the first line of a comment so you had to take it out. (That shows that I am not a PERL guru either ) Richard, thanks for your suggestion of the freebie script. Yours is great, where did you get it ? Also I have been using their documentation page. I have also been using their support forum. I did not look at it for a few days.NOw I am ready to start again...unless I find the source of your freebie calendar Simon
  6. Richard, yes... also I used the File Manager of cpanel to re-upload two files once I realised that I had the wrong path to the cgi-bin (I put www.sclhosts.com rather than /home/sclhost/public_html/cgi-bin ) Now they are error log talks about Premature End of the script. As you probably have gathered this is the first time I am dealing with perl. Thanks for your (and anybody else's) help Simon This is the code as uploaded : !/usr/bin/perl # # CalendarScript # Version: 3.2 # # Copyright 2001,2002 Matt Kruse # http://www.CalendarScript.com/ # BEGIN { # CHANGE THE LINE BELOW IF NECESSARY # Be sure to remove the # before $BASE_DIR, and change the path between the quotes $BASE_DIR = "/home/sclhost/public_html/cgi-bin/calendarscript/"; # DO NOT CHANGE ANYTHING BELOW HERE! if ($BASE_DIR ne "") { $BASE_DIR =~ s|([^/])$|$1/|; } else { my ($path) = $ENV{'PATH_TRANSLATED'} || $ENV{'SCRIPT_FILENAME'}; unless ($path) { print "Content-type:text/html\n\n<B>ERROR:</B><BR>Your server does not provide the PATH_TRANSLATED or SCRIPT_FILENAME environment variables.<br><br>Please see the installation documentation for how to set the \$BASE_DIR variable manually."; exit(0); } $path =~ s|[^/\\]*$||; $path =~ s|([^/])$|$1/|; $BASE_DIR = $path . "calendarscript/"; } unshift(@INC,$BASE_DIR."lib"); require "asp.inc"; require "DBFile.pm"; require "DBFileUtil.inc"; require "TimeLocal.inc"; require "Date.inc"; require "ConfigFile.pm"; require "Event.inc"; require "HTML.pm"; require "CGISession.inc"; require "User.pm"; require "SimpleDateFormat.pm"; require "calendars.inc"; } sub ERROR { my($msg,$severity) = @_; &addUserMessage($msg); &showScreen(); } sub FATALERROR { my ($msg) = @_; &addErrorMessage($msg); if ($in{template} eq "error.html") { print "FATAL ERROR: COULD NOT LOAD error.html"; exit(0); } $in{template} = "error.html"; &showScreen(); } # Load the required template and execute it # ----------------------------------------- sub showScreen { &populateTemplateVariables(); $template_dir = $BASE_DIR . "templates/calendars/" . $Config->get("template_dir") . "/"; $template_file = $template_dir . $in{'template'}; $template = &ASPLoadTemplate($template_file); &ASPEval($template,$template_dir); &ASPError($tmp_parsed_template) if $@; exit(0); } sub showSameScreen() { &populateTemplateVariables(); $in{'template'} = $in{'fromTemplate'} || "error.html"; &showScreen(); } # Handle error messages # --------------------- sub addUserMessage { my($msg) = shift; if ($msg ne "") { $Template::userMessage .= $msg . "<BR>"; } } sub addErrorMessage { my($msg) = shift; if ($msg ne "") { $Template::errorMessage .= $msg . "<BR>"; } } # Get message text to support language translation # ------------------------------------------------ sub getMessage() { my ($name,$p1,$p2,$p3,$p4) = @_; # Only read in the file if there is a message to be retrieved unless ($MESSAGES) { $msgfile = $BASE_DIR . "templates/admin/$admin_template_dir/messages.txt"; open(MESSAGES,$msgfile) || &FATALERROR("Error opening messages file [$msgfile]: $!"); while(<MESSAGES>) { next if /^#/; next unless /\S/; chomp; my($name,$value) = split(/=/,$_,2); $MESSAGES->{$name} = $value; } close(MESSAGES); } my ($message) = $MESSAGES->{$name}; if ($message eq "") { return "MESSAGE TEXT MISSING FOR: $name"; } if ($p1) { $message =~ s/\%s/$p1/; } if ($p2) { $message =~ s/\%s/$p2/; } if ($p3) { $message =~ s/\%s/$p3/; } if ($p4) { $message =~ s/\%s/$p4/; } return $message; } # Get a list of plugin files # -------------------------- sub getPluginFileList { my ($file,$plugin); my ($pluginfiles,$pluginsfilesfile); $pluginsfilesfile = $plugins_dir."plugin_files.txt"; if (-e $pluginsfilesfile) { open(PLUGINFILES,$pluginsfilesfile) || &FATALERROR(&getMessage("ERROR_OPENING_PLUGIN_FILES_LIST",$!)); while (<PLUGINFILES>) { next if /^\s*(#|$)/; chomp; ($file,$plugin) = split(/\t/); unless (exists $pluginfiles->{$file}) { $pluginfiles->{$file} = "plugins/$plugin/$file"; } } close(PLUGINFILES); } return $pluginfiles; } # Handle custom-defined functionality # ----------------------------------- sub handleCustomFunction() { my ($funcName,@args) = @_; my ($result) = 0; my ($filename) = $funcName . ".pl"; if ($PluginFiles->{$filename}) { $filename = $BASE_DIR . $PluginFiles->{$filename}; eval("require \"$filename\";"); if ($@) { # Error including file - return error msg and continue running normal functions &addUserMessage(&getMessage("ERROR_REQUIRING_CUSTOM_FUNCTION",$filename,$@)); return 0; } # Try to call custom function eval("\$result = \&${funcName}(\@args);"); if ($@) { # Error calling function - return error msg and continue running normal functions &addUserMessage(&getMessage("ERROR_RUNNING_CUSTOM_FUNCTION",$funcName,$@)); return 0; } # Custom function was executed. Return whatever it returned. return $result; } return 0; } # Get a Template Preference value, either from the config file or the default # --------------------------------------------------------------------------- sub getTemplatePreference { my ($name) = @_; my ($key) = "template_preference_".$Config->get("template_dir")."_".$name; if ($Config->contains($key)) { return $Config->get($key); } return $main::TemplateDefaults->{$name}; } sub LZ { my($x)=shift;if(length($x)==1){return "0$x";}return $x; } sub URLEncode { my($url)=@_; my(@characters)=split(/(\%[0-9a-fA-F]{2})/,$url); foreach(@characters) { if ( /\%[0-9a-fA-F]{2}/ ) { unless ( /(20|7f|[0189a-fA-F][0-9a-fA-F])/i || /2[2356fF]|3[a-fA-F]|40/i ) { s/\%([2-7][0-9a-fA-F])/sprintf "%c",hex($1)/e; } } else { s/([\000-\040\177-\377\074\076\042])/sprintf "%%%02x",unpack("C",$1)/egx; } } return join("",@characters); } # Get input Data # -------------- sub getInput { my ($in,@in,$key,$val); my (@keys,%formvars); if ($ENV{'REQUEST_METHOD'}) { if ($ENV{'REQUEST_METHOD'} eq "GET") { $in = $ENV{'QUERY_STRING'}; } elsif ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN,$in,$ENV{'CONTENT_LENGTH'}); } @in = split(/&/,$in); # First get all the raw form vars foreach $i (0 .. $#in) { $in[$i] =~ s/\+/ /g; ($key, $val) = split(/=/,$in[$i],2); $key =~ s/%(..)/pack("c",hex($1))/ge; $val =~ s/%(..)/pack("c",hex($1))/ge; # Keep a record of their order, because later values take precendent push(@keys,$key); $formvars{$key} = $val; } # Process the special QUERY_STRING field, if it exists # These values come first and then might be over-written if ($formvars{'QUERY_STRING'}) { @in = split(/&/,$formvars{'QUERY_STRING'}); foreach $i (0 .. $#in) { $in[$i] =~ s/\+/ /g; ($key, $val) = split(/=/,$in[$i],2); if ($val ne "") { $in{$key} = $val; if ($in{'datestring'} && (($key eq 'year') || ($key eq 'month') || ($key eq 'date'))) { delete $in{'datestring'}; } if ($key eq "datestring") { delete $in{'year'}; delete $in{'month'}; delete $in{'date'}; } } } delete $formvars{'QUERY_STRING'}; } # Process all the new field values, over-writing the old ones foreach $key (@keys) { next if ($key eq "QUERY_STRING"); $in{$key} = $formvars{$key}; if ($in{'datestring'} && (($key eq 'year') || ($key eq 'month') || ($key eq 'date'))) { delete $in{'datestring'}; } if ($key eq "datestring") { delete $in{'year'}; delete $in{'month'}; delete $in{'date'}; } } # Form the query string from form input foreach $key (keys %in) { if (($key eq "command") || ($key eq "username") || ($key eq "password") || ($key =~/^FIELD_/)) { delete $formvars{$key}; next; } if ($QUERY_STRING ne "") { $QUERY_STRING .= "&"; } $QUERY_STRING .= &URLEncode($key) . "=" . &URLEncode($in{$key}); } $FORM_QUERY = join('&', map {"$_=$formvars{$_}"} keys %formvars); } elsif ($ENV{'DOCUMENT_URI'}) { open(SSI,$BASE_DIR."ssi.txt"); while(<SSI>) { chomp; ($key,$val) = ( /^\s*([^=]+)\s*=\s*"?(.*?)"?$/o ); $key =~ s|\s*$||; $val =~ s|\s*$||; next unless ($key); $in{$key} = $val; } close(SSI); $no_session = 1; } elsif ($#ARGV >= 0) { while ($in = shift(@ARGV)) { ($key,$val) = split(/=/,$in); $in{$key} = $val; } $no_session = 1; $no_header=1; } } ################################# # Here is all the dirty work... # ################################# $|=1; # Read the main admin config file $admin_config = $BASE_DIR . "config.txt"; $AdminConfig = new ConfigFile($admin_config); $Template::AdminConfig = $AdminConfig; $admin_template_dir = $AdminConfig->get("admin_template_dir") || "English"; $plugins_dir = $BASE_DIR . "plugins/"; $PluginFiles = &getPluginFileList(); # Get input unless(&handleCustomFunction("display_before_getInput")) { &getInput(); } &handleCustomFunction("display_after_getInput"); # Start output # ------------ if (($ENV{'HTTP_COOKIE'} =~ /CGISessionID/) || ($in{'command'} eq "login")) { $Session = new CGISession($BASE_DIR . "session/"); unless ($no_session) { my ($id) = ($ENV{'HTTP_COOKIE'} =~ /CGISessionID\s*=\s*([^;]*)/); $Session->getSession($id); if (($Session->isValid()) && ($in{'command'} ne "logout")) { print "Set-cookie: CGISessionID=",$Session->getValue("_id"),";path=/\n"; } else { print "Set-cookie: CGISessionID=;path=/;expires=Thu, 01-Jan-1970 00:00:00 GMT\n"; } } # Make session available in template files $Template::Session = $Session; } unless ($no_header) { print "Content-type: text/html\n\n"; } $in{'calendar'} ||= $AdminConfig->get("default_calendar"); $in{'calendar'} =~ s|[^\w\d\._]||g; $calendar = $in{'calendar'}; $in{'template'} ||= "default.html"; $in{'template'} =~ s|[^\w\d\._]||g; $db_dir = $BASE_DIR . "calendars/" . $in{'calendar'} . "/"; $config_file = $db_dir . "config.txt"; $schedule_db = $db_dir . "schedule"; $events_db = $db_dir . "events"; $calendars_db = $BASE_DIR . "calendars"; $users_db = $BASE_DIR . "users"; $permissions_db = $BASE_DIR . "permissions"; # Read the config file for the calendar $Config = new ConfigFile($config_file); $Template::Config = $Config; # Get calendar name, description $Calendar = &getCalendarInfo($calendar); # Get display options for the template set to be used $TemplateFields = &GetFieldProperties($BASE_DIR."templates/calendars/".$Config->get("template_dir")."/preferences.txt"); foreach $field (@$TemplateFields) { $TemplateDefaults->{$field->{'field_name'}} = $field->{'defaultvalue'}; } # The CGI URL for call-back $Template::CGI_URL = $AdminConfig->get("calendar_url") || $ENV{'SCRIPT_NAME'} || $ENV{'REQUEST_URI'}; $Template::CGI_URL_QUERYSTRING = $Template::CGI_URL . "?".$QUERY_STRING; if ($QUERY_STRING ne "") { $Template::CGI_URL_QUERYSTRING .= "&"; } $Template::QUERY_STRING = $QUERY_STRING; $Template::CGI_HIDDEN_FIELDS .= "<INPUT TYPE=\"hidden\" NAME=\"QUERY_STRING\" VALUE=\"$FORM_QUERY\">"; $Template::ADMIN_CGI_URL = $AdminConfig->get("calendar_admin_url"); # Attempt to Login? # ----------------- if ($in{'command'} eq "login") { unless(&handleCustomFunction("display_before_login")) { $User = new User($in{username}, $users_db, $permissions_db); my ($result) = $User->login($in{password}); if ($result == 1) { # User logged in $Session->{'username'} = $User->{'username'}; $Session->{'name'} = $User->{'name'}; $Session->{'calendar'} = $calendar; &addUserMessage(($User->{'name'} || $User->{'username'}) . $User::MSG_LOGGED_IN_SUCCESSFULLY); } elsif ($result == 2) { undef $Session; &addUserMessage(&getMessage("CALENDAR_PASSWORD_MUST_BE_CHANGED")); &showSameScreen(); } else { &addUserMessage($User->getErrorMessage()); &showSameScreen(); } } &handleCustomFunction("display_after_login"); } # Handle Logout # ------------- if ($in{'command'} eq "logout") { unless(&handleCustomFunction("display_before_logout")) { $Session->ExpireNow(); $Session->cleanupExpiredSessions(); undef $Session; undef $Template::Session; undef $User; } &handleCustomFunction("display_after_logout"); } # Create a global "User" object if it doesn't already exist # --------------------------------------------------------- unless(&handleCustomFunction("display_before_create_user")) { unless ($User) { if ($Session && ($Session->{'username'} ne "")) { $User = new User($Session->{'username'}, $users_db, $permissions_db); $User->{'logged_in'} = 1; $Session->{'calendar'} = $calendar; } else { $User = new User('anonymous', $users_db, $permissions_db); $User->{'logged_in'} = 0; } } $Template::User = $User; } &handleCustomFunction("display_after_create_user"); # Require Login? # -------------- if ($Config->get("require_login")) { unless(&handleCustomFunction("display_before_require_login")) { if ($Session->{'username'}) { unless ($User->hasPermission($calendar,"VIEW")) { $Template::userMessage = &getMessage("CALENDAR_NO_VIEW_PERMISSION"); &FATALERROR(""); } } else { $in{'template'} = "login.html"; &showScreen(); } } } &handleCustomFunction("display_after_require_login"); # Create the event and schedule database objects $DBEvents = new DBFile($events_db); $DBSchedule = new DBFile($schedule_db); # Handle any commands here # ------------------------ # SEARCH # ------ if ($in{'command'} eq "search") { unless(&handleCustomFunction("display_before_search")) { my ($properties,$name,$field); foreach $name (keys %in) { $field = $name; if (($in{$name} ne "") && ($field =~ s/^FIELD_//)) { $properties->{$field} = $in{$name}; } } if (scalar keys %$properties <= 0) { &addUserMessage("Search query must not be blank!"); } else { $start = Time::Local::timegm(0,0,0,$in{start_date},$in{start_month}-1,$in{start_year}); $end = Time::Local::timegm(0,0,0,$in{end_date},$in{end_month}-1,$in{end_year}); $Template::SEARCH_RESULTS = &Event::search($DBEvents, $DBSchedule, "", $properties, $start, $end); } } &handleCustomFunction("display_after_search"); } # Load the required template and execute it # ----------------------------------------- &showScreen(); END { if (defined $main::Session && ref($main::Session) eq "CGISession") { $main::Session->saveSession(); } } ################################################## # Populate variables and references for templates ################################################## sub populateTemplateVariables { $localtime_offset = 3600*$Config->get("time_zone_offset"); ($now_ss,$now_mi,$now_hh,$now_dd,$now_mm,$now_yy,$now_wd,$now_yd,$now_dst) = localtime(time+$localtime_offset); $now_mm++; $now_yy += 1900; # Get the displayed dates, etc $year = substr($in{'datestring'},0,4) || $in{'year'} || substr($in{'selected_datestring'},0,4) || $now_yy; $month = substr($in{'datestring'},4,2) || $in{'month'} || substr($in{'selected_datestring'},4,2) || $now_mm; $date = substr($in{'datestring'},6,2) || $in{'date'} || substr($in{'selected_datestring'},6,2) || $now_dd; # Get selected date $selected_datestring = $in{'selected_datestring'} || $year.&LZ($now_mm).&LZ($now_dd); # Date-related fields and HTML elements $Template::YEAR_SELECT = "<SELECT NAME=\"year\">" . &HTML::yearOptions($year) ."</SELECT>"; $Template::MONTH_SELECT = "<SELECT NAME=\"month\">" . &HTML::monthNameOptions($month) . "</SELECT>"; $Template::MONTH_ABBREVIATION_SELECT = "<SELECT NAME=\"month\">" . &HTML::monthAbbreviationOptions($month) . "</SELECT>"; $Template::DAY_NAMES = $Config->get("day_names"); $Template::DAY_ABBREVIATIONS = $Config->get("day_abbreviations"); $Template::MONTH_NAMES = $Config->get("month_names"); $Template::MONTH_ABBREVIATIONS = $Config->get("month_abbreviations"); for ($i=0; $i<7; $i++) { ${"Template::DAY_NAME_".$i} = $Template::DAY_NAMES->[$i]; } for ($i=0; $i<12; $i++) { ${"Template::MONTH_NAME_".$i} = $Template::MONTH_NAMES->[$i]; } for ($i=0; $i<7; $i++) { ${"Template::DAY_ABBREVIATION_".$i} = $Template::DAY_ABBREVIATIONS->[$i]; } for ($i=0; $i<12; $i++) { ${"Template::MONTH_ABBREVIATION_".$i} = $Template::MONTH_ABBREVIATIONS->[$i]; } $Template::MONTH_NAME = $Template::MONTH_NAMES->[$month-1]; $Template::YEAR = $year; $Template::MONTH = $month; $Template::DATE = $date; $Template::DATESTRING = $year . &LZ($month) . &LZ($date); $Template::NEXT_YEAR = $year+1; $Template::LAST_YEAR = $year-1; ($Template::NEXT_MONTH_YEAR,$Template::NEXT_MONTH) = &Date::getNextMonthYear($year,$month); $Template::NEXT_MONTH_NAME = $Template::MONTH_NAMES->[$Template::NEXT_MONTH-1]; ($Template::LAST_MONTH_YEAR,$Template::LAST_MONTH) = &Date::getLastMonthYear($year,$month); $Template::LAST_MONTH_NAME = $Template::MONTH_NAMES->[$Template::LAST_MONTH-1]; ($Template::LAST_WEEK_YEAR,$Template::LAST_WEEK_MONTH,$Template::LAST_WEEK_DATE) = &Date::getLastWeek($year,$month,$date); ($Template::NEXT_WEEK_YEAR,$Template::NEXT_WEEK_MONTH,$Template::NEXT_WEEK_DATE) = &Date::getNextWeek($year,$month,$date); ($Template::NEXT_DAY_YEAR,$Template::NEXT_DAY_MONTH,$Template::NEXT_DAY_DATE) = &Date::getTomorrow($year,$month,$date); $Template::NEXT_DAY_DATESTRING = $Template::NEXT_DAY_YEAR . &LZ($Template::NEXT_DAY_MONTH) . &LZ($Template::NEXT_DAY_DATE); ($Template::PREVIOUS_DAY_YEAR,$Template::PREVIOUS_DAY_MONTH,$Template::PREVIOUS_DAY_DATE) = &Date::getYesterday($year,$month,$date); $Template::PREVIOUS_DAY_DATESTRING = $Template::PREVIOUS_DAY_YEAR . &LZ($Template::PREVIOUS_DAY_MONTH) . &LZ($Template::PREVIOUS_DAY_DATE); ($Template::TODAY_YEAR,$Template::TODAY_MONTH,$Template::TODAY_DATE) = ($now_yy,$now_mm,$now_dd); $Template::TODAY_DATESTRING = $Template::TODAY_YEAR . &LZ($Template::TODAY_MONTH) . &LZ($Template::TODAY_DATE); # Other $Template::CALENDAR = $Calendar; $Template::CALENDAR_KEY = $Calendar->{'key'}; # Call-back method to get events *Template::getEvents = \&getEvents; *Template::getEvent = \&getEvent; # Method to get template preferences *Template::getPreference = \&getTemplatePreference; # Form input %Template::in = %in; # Looping and conditional special tags &ASPCustomTag('\s*FOREACH\s*GRID\s*ROW\s*','foreach $ROW (0 .. $Grid->{rowcount}-1) {'); &ASPCustomTag('\s*FOREACH\s*GRID\s*COLUMN\s*','foreach $COL (0 .. $Grid->{colcount}-1) { $DAY = $Grid->{grid}->[$ROW]->[$COL]; my ($EVENTS) = $Grid->{grid}->[$ROW]->[$COL]->{events};'); &ASPCustomTag('\s*FOREACH\s*DAY\s*OF\s*WEEK\s*','foreach $COL (0 .. $Grid->{colcount}-1) { $DAY = $Grid->{grid}->[0]->[$COL]; my ($EVENTS) = $Grid->{grid}->[0]->[$COL]->{events};'); &ASPCustomTag('\s*FOREACH\s*HOUR\s*OF\s*DAY\s*','foreach $HOUR ( 99, $Config->{days_hours_display_start} .. $Config->{days_hours_display_end} ) { my ($EVENTS) = $DAY->{hours}->[$HOUR]->{events};'); &ASPCustomTag('\s*FOREACH\s*EVENTLIST','foreach $datestring (sort keys %$EventList) { $DAY = $EventList->{$datestring}; my ($EVENTS) = $DAY->{events};'); &ASPCustomTag('\s*FOREACH\s*EVENT\s*','foreach $EVENT (@$EVENTS) { '); &ASPCustomTag('\s*FOREACH\s*SEARCH\s*RESULT\s*','foreach $i (0 .. $#$SEARCH_RESULTS) { $EVENT = $SEARCH_RESULTS->[$i]; '); &ASPCustomTag('\s*IF\s*SEARCH\s*RESULT\s*','if ($in{command} eq "search") {'); &ASPCustomTag('\s*IF\s*SEARCH\s*RESULTS\s*EXIST\s*','if ($#$SEARCH_RESULTS < 0) {'); &ASPCustomTag('\s*IF\s*EVENTS\s*EXIST\s*','if ($#{$EVENTS} >= 0) {'); &ASPCustomTag('\s*IF\s*NEXT\s*OCCURRENCE\s*EXISTS\s*','if ($EVENT->{schedule}->{nextoccurrence}) {'); &ASPCustomTag('\s*IF\s*NO\s*EVENTS\s*EXIST\s*','if (!($#{$EVENTS} >= 0)) {'); &ASPCustomTag('\s*IF\s*DISPLAY\s*','if ($DAY->{\'display\'}) {'); &ASPCustomTag('\s*IF\s*SELECTED\s*','if ($DAY->{\'selected\'}) {'); &ASPCustomTag('\s*IF\s*USER\s*LOGGED\s*IN\s*','if ($User->{username} ne "anonymous") {'); &ASPCustomTag('\s*/FOREACH\s*','}'); &ASPCustomTag('\s*ELSE\s*','}else{'); &ASPCustomTag('\s*/IF\s*','}'); # Other special tags &ASPCustomTag('=?\s*EVENT\s*FIELD\s*\((\w+)\)\s*','= $EVENT->{details}->{$1} '); &ASPCustomTag('=?\s*SCHEDULE\s*FIELD\s*\((\w+)\)\s*','= $EVENT->{schedule}->{$1} '); &ASPCustomTag('=?\s*PREFERENCE\s*\((\w+)\)\s*','= &getPreference(\'$1\') '); &ASPCustomTag('\s*LAST\s*YEAR\s*LINK\s*','= $CGI_URL_QUERYSTRING."year=".$LAST_YEAR'); &ASPCustomTag('\s*NEXT\s*YEAR\s*LINK\s*','= $CGI_URL_QUERYSTRING."year=".$NEXT_YEAR'); &ASPCustomTag('\s*LAST\s*MONTH\s*LINK\s*','= $CGI_URL_QUERYSTRING."year=".$LAST_MONTH_YEAR."&month=".$LAST_MONTH'); &ASPCustomTag('\s*NEXT\s*MONTH\s*LINK\s*','= $CGI_URL_QUERYSTRING."year=".$NEXT_MONTH_YEAR."&month=".$NEXT_MONTH'); &ASPCustomTag('\s*LAST\s*WEEK\s*LINK\s*','= $CGI_URL_QUERYSTRING."year=".$LAST_WEEK_YEAR."&month=".$LAST_WEEK_MONTH."&date=".$LAST_WEEK_DATE'); &ASPCustomTag('\s*NEXT\s*WEEK\s*LINK\s*','= $CGI_URL_QUERYSTRING."year=".$NEXT_WEEK_YEAR."&month=".$NEXT_WEEK_MONTH."&date=".$NEXT_WEEK_DATE'); &ASPCustomTag('\s*PREVIOUS\s*DAY\s*LINK\s*','= $CGI_URL_QUERYSTRING."datestring=".$PREVIOUS_DAY_DATESTRING."&selected_datestring=".$PREVIOUS_DAY_DATESTRING'); &ASPCustomTag('\s*NEXT\s*DAY\s*LINK\s*','= $CGI_URL_QUERYSTRING."datestring=".$NEXT_DAY_DATESTRING."&selected_datestring=".$NEXT_DAY_DATESTRING'); &ASPCustomTag('\s*CALENDAR\s*NAME\s*','= ($CALENDAR->{name})'); &ASPCustomTag('\s*CALENDAR\s*DESCRIPTION\s*','= ($CALENDAR->{description})'); &ASPCustomTag('\s*CALENDAR\s*KEY\s*','= ($CALENDAR->{key})'); } ################################################## # Subroutine called by Template to get an event ################################################## sub getEvent { my ($id) = @_; unless(&handleCustomFunction("display_before_getEvent",$id)) { my ($db) = new DBFile($events_db); my ($event) = $db->getRecord( {'id'=>$id } ); if ($event == 0) { return {}; } # Add the auto-links if necessary if ($Config->get("auto_link")) { foreach $key (keys %$event) { $event->{$key} = &HTML::autoLink($event->{$key},$Config->get("auto_link_target")); } } &handleCustomFunction("display_after_getEvent"); return $event; } } ################################################## # Subroutine called by Template to populate events ################################################## sub getEvents { my ($properties) = @_; unless(&handleCustomFunction("display_before_getEvents",$properties)) { my ($event_ids,$events,$event_details,$s); my ($month,$year,$date,$datestring,$start,$end); $month = &LZ($properties->{'month'}) || &LZ($Template::MONTH); $year = $properties->{'year'} || ($Template::YEAR); $date = &LZ($properties->{'date'}) || &LZ($Template::DATE); if ($properties->{'range'} eq "month") { $datestring = $year . $month . "01"; $properties->{'startdate'} = $datestring; } else { $datestring = $year . $month . $date; $properties->{'startdate'} ||= $datestring; } ($start,$end) = &Date::getTimeSpan( $properties ); $Template::RANGE_START = &SimpleDateFormat::formatDate($start,$Config->get("date_format")); ($Template::RANGE_START_DATE,$Template::RANGE_START_MONTH,$Template::RANGE_START_YEAR) = (gmtime($start))[3,4,5]; $Template::RANGE_START_MONTH++; $Template::RANGE_START_YEAR+=1900; $Template::RANGE_END = &SimpleDateFormat::formatDate($end,$Config->get("date_format")); ($Template::RANGE_END_DATE,$Template::RANGE_END_MONTH,$Template::RANGE_END_YEAR) = (gmtime($end))[3,4,5]; $Template::RANGE_END_MONTH++; $Template::RANGE_END_YEAR+=1900; $schedule = &Event::getEventsInRange($DBSchedule,$start,$end); foreach $s (@$schedule) { $event_ids->{$s->{'event_id'}}=1; } $event_details = &Event::getEventDetails($DBEvents,$event_ids); foreach $s (@$schedule) { # Skip the event unless it's approved next unless ($event_details->{$s->{'event_id'}}->{'approved'}); # Skip if it's private next if ($event_details->{$s->{'event_id'}}->{'private'}); push(@$events, { 'schedule'=>$s, 'details'=>$event_details->{$s->{'event_id'}} } ); } # Put the raw events into the template # ------------------------------------ $Template::EVENTS = $events; my ($Grid); my ($start_ss,$start_mi,$start_hh,$start_dd,$start_mm,$start_yy,$start_wd,$start_yd,$start_dst) = gmtime($start); $week_start_day = $Config->get("week_start_day"); if ($start_wd >= $week_start_day) { $offset_days = $start_wd - $week_start_day; } elsif ($start_wd < $week_start_day) { $offset_days = 7-$week_start_day+$start_wd; } $i = $start; my $x = 0; my $y = 0; # Place pre-empty grid cells if more than one row if ((($end - $start)/86400) > 7) { foreach (0 .. ($offset_days-1)) { $Grid->{'grid'}->[$y]->[$x]->{'display'} = 0; $x++; } } while ($i < $end) { my ($ss,$mi,$hh,$dd,$mm,$yy,$wd,$yd,$dst) = gmtime($i); my ($datestring) = (1900+$yy) . &LZ($mm+1) . &LZ($dd); $gridMappings->{$datestring} = [$y,$x]; $Grid->{'grid'}->[$y]->[$x]->{'dd'} = $dd; $Grid->{'grid'}->[$y]->[$x]->{'mm'} = $mm+1; $Grid->{'grid'}->[$y]->[$x]->{'yyyy'} = 1900+$yy; $Grid->{'grid'}->[$y]->[$x]->{'wd'} = $wd; $Grid->{'grid'}->[$y]->[$x]->{'yd'} = $yd; $Grid->{'daynames'}->[$x] = $Template::DAY_NAMES->[$wd]; $Grid->{'grid'}->[$y]->[$x]->{'dayname'} = $Template::DAY_NAMES->[$wd]; $Grid->{'grid'}->[$y]->[$x]->{'dayabbreviation'} = $Template::DAY_ABBREVIATIONS->[$wd]; $Grid->{'grid'}->[$y]->[$x]->{'monthname'} = $Template::MONTH_NAMES->[$mm]; $Grid->{'grid'}->[$y]->[$x]->{'monthabbreviation'} = $Template::MONTH_ABBREVIATIONS->[$mm]; $Grid->{'grid'}->[$y]->[$x]->{'datestring'} = $datestring; $Grid->{'grid'}->[$y]->[$x]->{'display'} = 1; if ($datestring eq $selected_datestring) { $Grid->{'grid'}->[$y]->[$x]->{'selected'} = 1; } $x++; $Grid->{'rowcount'} = $y+1; if ($x > $Grid->{'colcount'}) { $Grid->{'colcount'} = $x; } if ($x > 6) { $x=0; $y++; } $i+=86400; } # Place post-empty grid cells if more than one row if ((($end - $start)/86400) > 7) { while($wd < 6) { $Grid->{'grid'}->[$y]->[$x]->{'display'} = 0; $x++; $wd++; } } $Template::Grid = $Grid; $Template::GRID_ROW_COUNT = $Grid->{'rowcount'}; $Template::GRID_COLUMN_COUNT = $Grid->{'colcount'}; # Map events on to Grid and dates/hours/etc # ----------------------------------------- foreach $event (sort {$a->{'schedule'}->{'start'} <=> $b->{'schedule'}->{'start'} } @$events) { # Time of event if ($event->{'schedule'}->{'start_time'} == $event->{'schedule'}->{'end_time'}) { $event->{'schedule'}->{'end_time'} = ""; } if ($event->{'schedule'}->{'all_day'}) { $event->{'schedule'}->{'start_time'} = ""; $event->{'schedule'}->{'end_time'} = ""; $event->{'schedule'}->{'start_hh'}=99; $event->{'schedule'}->{'start_mm'}=0; $event->{'schedule'}->{'end_hh'}=99; $event->{'schedule'}->{'end_mm'}=0; } else { ($hh,$mm) = ($event->{'schedule'}->{'start_time'} =~ /^(\d\d)(\d\d)/); $event->{'schedule'}->{'start_hh'} = $hh; $event->{'schedule'}->{'start_mm'} = $mm; ($hh,$mm) = ($event->{'schedule'}->{'end_time'} =~ /^(\d\d)(\d\d)/); $event->{'schedule'}->{'end_hh'} = $hh; $event->{'schedule'}->{'end_mm'} = $mm; $event->{'schedule'}->{'start_time'} = &Date::formatTime($event->{'schedule'}->{'start_time'}, $Config->get("time_format")); $event->{'schedule'}->{'end_time'} = &Date::formatTime($event->{'schedule'}->{'end_time'} , $Config->get("time_format")); } # Date, month, day name, month name, etc my ($event_start) = $event->{'schedule'}->{'start'}; my ($event_end) = $event->{'schedule'}->{'end'}; my ($continued) = 0; # If event spans multiple days, keep track of it $event->{'schedule'}->{'span'} = (($event_end - $event_start) > 86400)?1:0; while ($event_start <= $event_end) { if (($event_start >= $start) && ($event_start <= $end)) { my ($ss,$mi,$hh,$dd,$mm,$yy,$wd,$yd,$dst) = gmtime($event_start); $event->{'schedule'}->{'year'} = (1900+$yy); $event->{'schedule'}->{'month'} = $mm+1; $event->{'schedule'}->{'date'} = $dd; $event->{'schedule'}->{'day'} = $wd; my ($datestring) = (1900+$yy) . &LZ($mm+1) . &LZ($dd); $event->{'schedule'}->{'datestring'} = $datestring; if ($event->{'schedule'}->{'all_day'}) { $hh = 99; } else { $hh = &LZ($hh); } push(@{$Grid->{'grid'}->[$gridMappings->{$datestring}->[0]]->[$gridMappings->{$datestring}->[1]]->{'events'}} , $event); push(@{$Grid->{'grid'}->[$gridMappings->{$datestring}->[0]]->[$gridMappings->{$datestring}->[1]]->{'hours'}->[$hh]->{'events'}} , $event); $continued=1; } $event_start = $event_start+86400; } } # Sort the events on each day into chronological order for ($y=0; $y<$Grid->{'rowcount'}; $y++) { for ($x=0; $x<$Grid->{'colcount'}; $x++) { if ($Grid->{'grid'}->[$y]->[$x]->{'display'}) { @{$Grid->{'grid'}->[$y]->[$x]->{'events'}} = sort { ($a->{'schedule'}->{'start'} <=> $b->{'schedule'}->{'start'}) || ($a->{'details'}->{'id'} <=> $b->{'details'}->{'id'}) } @{$Grid->{'grid'}->[$y]->[$x]->{'events'}}; $EventList->{$Grid->{'grid'}->[$y]->[$x]->{'datestring'}} = $Grid->{'grid'}->[$y]->[$x]; } } } $Template::EventList = $EventList; if ($properties->{'range'} eq "day") { $Template::DAY = $Grid->{'grid'}->[0]->[0]; $Template::EVENTS = $Grid->{'grid'}->[0]->[0]->{'events'}; } } &handleCustomFunction("display_after_getEvents",$properties); }
  7. Thanks for your help folks. I am really beginning to feel stupid. I have now double checked that I have FTP-ed everything and CHMOD-ed everything as I should. All the path for relevant directories are there, etc... I still get that a file has no execute permission even after I changed it. To be double sure I did it through the File Manager from the cpanel. Any other idea ? Silly question of the year : If I change a file permission through the file manager, is the change immediate ? thanks again Simon
  8. Borfast, thanks for replying. I made sure that the "Execute" box is checked but I still get the same message. I would look into the server error log if I knew where to find it. Simon
  9. I am trying to install a CGI-Script. I have a few silly questions (First time I am trying this!) 1) Am I correct to assume that the cgi-bin folder in www is the correct place for the "cgi-bin" ? 2) I installed the script and when I try it I get this message "The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, webmaster@sclhosts.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log." So where do I find the error log ? 3) Is the .pl extensio ok or do I have to rename the files .cgi ? Thanks for your help Simon
×
×
  • Create New...