NJO Project

#!/usr/local/bin/perl #################################################################### # Script: | Poll It # # Version: | 2.05 # # By: | Jason Berry (i2 Services, Inc. / CGI World) # # Contact: | jason@cgi-world.com # # WWWeb: | http://www.cgi-world.com # # Copyright: | Jason Berry (CGI World of i2 Services, Inc.) # # Released | August 09, 1998 # #################################################################### # By using this software, you have agreed to the license # # agreement packaged with this program. # # # #################################################################### # Variables: # # $image_url = "http://njoproject.skywalkeronline.net/images/pollimage.gif"; # URL to the 'image.gif' that was packaged with this script. Upload # that GIF Image to your website & enter the URL to it above. $vote_text = "Vote!"; # Text that is shown on the submit button when casting your vote. # Note: ################################################################## # If you're looking to use an image in one of the variables # below, input the IMAGE tag inside of the quotes as: # <-- Placing backslashes (\) # before the extra quotes inside a quote. ########################################################### $last_poll_text = "
  • our Previous Polls Results"; # Text that is linked to view the previous results of your # previous poll. $results_not_available = "
    The results will be posted soon..."; # Message shown when the number of votes is not greater then # the ammount you opted for when setting up a poll. $poll_not_available = ""; # Message listed when a poll is not available. # $non_SSI_CGI_FileName = "poll.cgi"; # The name of the file that was originaly named "Poll_It_v2.0.cgi" when # you received this zipped up package. If you renamed that file to poll.cgi # then enter "poll.cgi" above. # # # (We do not support this script if you edit below this line ) ################################################################ # # %in = &ReadForm; if ($0=~m#^(.*)(\\|/)#) { $cgidir = $1; } else { $cgidir = `pwd`; chomp $cgidir; } $script_url = $ENV{'SCRIPT_NAME'}; $data_dir = "$cgidir/pollit_files"; $poll_options = "$data_dir/poll_options.txt"; $poll_info = "$data_dir/poll_info.txt"; $ips_file = "$data_dir/ips.txt"; $last_file = "$data_dir/last_poll.txt"; $lockdir = "$data_dir/filelock"; open(IPS,"<$ips_file"); @ips = ; close(IPS); $all_ips = join('|',@ips); $addr = "$ENV{'REMOTE_ADDR'}\n"; if(@ips && $addr =~ /$all_ips/) { $voted = 1; } if($option_selected && !$voted) { &FileLock("$lockdir"); open(MIPS,">>$ips_file"); print MIPS "$ENV{'REMOTE_ADDR'}\n"; close(MIPS); &FileUnlock("$lockdir"); open(POPTIONS,"<$poll_options"); while() { ($option_id,$poll_option,$votes_received) = split(/=/,$_); if($option_id eq "total") { $new_total = $poll_option + 1; $push = "total=$new_total\n"; push(@reprint,$push); } else { if($option_id eq "$option_selected") { $new_ototal = $votes_received + 1; $push = "$option_id\=$poll_option\=$new_ototal\n"; push(@reprint,$push); } else { push(@reprint,$_); } } } close(POPTIONS); &FileLock("$lockdir"); open(REPRINT,">$poll_options"); print REPRINT @reprint; close(REPRINT); &FileUnlock("$lockdir"); $voted = 1; print "Location: $ENV{'HTTP_REFERER'}\n\n"; } # Print Out SSI Poll Box: ############################################################### &Template("$data_dir/_ssi_poll.html"); open(POLLINFO,"<$poll_info"); while() { chop($_); ($pinfo,$pvalue) = split(/=/,$_); $$pinfo = "$pvalue"; } close(POLLINFO); open(POLLOPTIONS,"<$poll_options"); @unsorted_poll_options = ; close(POLLOPTIONS); foreach$unsorted(@unsorted_poll_options) { ($option_id,$poll_option,$votes_received) = split(/=/,$unsorted); chop($votes_recieved); if($option_id eq "total") { $total = $poll_option; $show_total = "Total Votes: $total"; } $push = "$votes_received\=$option_id\=$poll_option"; push(@poll_options,$push); } # Show Voting Results: ##################################### if($voted) { foreach$p_option(sort { $b <=> $a } @poll_options) { ($votes_received,$option_id,$poll_option) = split(/=/,$p_option); if($option_id ne "total" && $total > "0") { $percent = (int(($votes_received / $total) * 1000)) / 10; $percent = substr($percent,0,4); $sign = "%"; if($votes_received < 1) { $percent = "0"; } $width = int($percent * 1); if($votes_received < 1) { $width = 2; } $percent = "$percent$sign"; $image_percent = ""; $show_results .= &Cell('poll_results'); } } $show_results .= &Cell('total_votes'); if($show_results_after > $total) { undef($show_results); $show_results = "$results_not_available"; } } # Show Voting Options: ##################################### if(!$voted) { foreach$p_option(@poll_options) { ($votes_received,$option_id,$poll_option) = split(/=/,$p_option); if($option_id ne "total") { $display_options .= &Cell("show_options"); } } if(!$display_options) { $display_options = "$poll_not_available" }; } if($display_options) { $submit = "
    " }; open(LASTPOLL,"<$last_file"); @last_poll = ; close(LASTPOLL); if(@last_poll) { $last_poll = "$last_poll_text
    "; } print &Template("$data_dir/_ssi_poll.html",'html'); # Load Template: # ############################################################### sub Template { local(*FILE); if ($_[1] eq 'html') { print "Content-type: text/html\n\n" unless ($ContentType++ > 0); } elsif ($_[1] eq 'text') { print "Content-type: text/plain\n\n" unless ($ContentType++ > 0); } if (!$_[0]) { return "
    \nTemplate : No file was specified
    \n"; } elsif (!-e "$_[0]") { return "
    \nTemplate : File '$_[0]' does not exist
    \n"; } else { open(FILE, "<$_[0]") || return "
    \nTemplate : Could open $_[0]
    \n"; while () { $FILE .= $_; } close(FILE); for ($FILE) { s//\1/gi; # show hidden inserts s/(?:\r\n|\n)?(.*?)/ $CELL{$1}=$2;''/ges; # read/remove template cells s/\$(\w+)\$/${$1}/g; # translate $scalars$ } } return $FILE; } # Translate Cell: # ############################################################### sub Cell { my($CELL); for (0..$#_) { if ($_[$_]) { $CELL .= $CELL{$_[$_]}; }} if (!$_[0]) { return "
    \nCell : No cell was specified
    \n"; } elsif (!$CELL) { return "
    \nCell : Cell '$_[0]' is not defined
    \n"; } else { $CELL =~ s/\$(\w+)\$/${$1}/g; } # translate $scalars$ return $CELL; } # Parse Form: # ############################################################### # Usage : %in = &ReadForm; # # # ############################################################### sub ReadForm { my($max) = $_[1]; # Max Input Size my($name,$value,$pair,@pairs,$buffer,%hash); # localize variables # Check input size if max input size is defined if ($max && ($ENV{'CONTENT_LENGTH'}||length $ENV{'QUERY_STRING'}) > $max) { die("ReadForm : Input exceeds max input limit of $max bytes\n"); } # Read GET or POST form into $buffer if ($ENV{'REQUEST_METHOD'} eq 'POST') { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } if ($ENV{'QUERY_STRING'}) { $buffer .= $ENV{'QUERY_STRING'}; } @pairs = split(/&/, $buffer); # Split into name/value pairs foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); # split into $name and $value $value =~ tr/+/ /; # replace "+" with " " $value =~ s/%([A-F0-9]{2})/pack("C", hex($1))/egi; # replace %hex with char $$name = $value; } return %hash; } # File Locking: # ############################################################### # Usage : &FileLock("$lockdir"); # # : &FileUnlock("$lockdir"); # # # ############################################################### sub FileLock { my($i); # sleep counter while (!mkdir($_[0],0777)) { # if there already is a lock sleep 1; # sleep for 1 sec and try again if (++$i>60) { die("File_Lock : Can't create filelock : $!\n"); } } } sub FileUnlock { rmdir($_[0]); # remove file lock dir } ####################################################################
  • TIE Fighter Total Conversion for XWA Released
    Posted Wednesday, November 2, 2005 by Chris
    Those of you eagerly awaiting the release of The Invasion Begins should check out the TIE Fighter Total Conversion, available now for download at its thread on the XWA Upgrade Forum.

    The End is Nigh
    Posted Friday, September 9, 2005 by Chris
    Dear Friends,

    It is with sadness that I must announce the impending end of the New Jedi Order Project mod The Invasion Begins. We began five years ago with an ambitious attempt to create a game that had an engaging and heartfelt storyline through a series of creative and fun X-Wing Alliance missions. Life, it seems, has caught up with us.

    My partner in crime Terribly Mauled has begun his film career in earnest, and I intend after graduating from university in December to begin a writing career while doing film editing on the side (though, I should reverse that order until I sell my first novel). We cannot devote any more time to this project if we are to get on with life. Five years is a long time. We gave it a shot, but we did not meet our goal.

    This does not mean, however, that some form of The Invasion Begins will not be released. We have finished five of the 16 missions so far, with others in various stages of completion. The five finished missions will be packaged in serialized form, separated by cutscenes of the familiar Star Wars text crawl that will explain the story up to that point. We will also hopefully have versions of the opening and closing cutscenes that were originally scheduled for the final game. You will not need Darksaber's Ultimate Craft Pack to play this game.

    If you're thinking that this seems pitifully miniscule compared to the amount of time that has passed, you'd be right. Our bottleneck was the OPTs. I'll be frank. Too many were needed to successfully pull off a New Jedi Order scenario of this magnitude, and we simply did not have the skill or time to complete them all.

    Supplemental materials will also be posted, including the source files for the entire project and the full script, which includes the e-mails, commander briefing and debriefing pieces of fiction, and dialogue. When the mod is released, it will be done so as open source (well, as open source as you can make a derivative of a copyrighted game). We do this with the small hope that eventually we'll see someone tell our story.

    Anyone may modify the missions and create new ones to flesh out the story if they wish. They will have access to the art used, but will have to ask permission of the creators of the OPTs and concourse art included in our release of The Invasion Begins to use those items in their own version. We did not create them, and so have no right to place them under open source. If anyone actually manages to complete their vision of The Invasion Begins, it will be hosted right here on this site.

    Well, I guess that's about it. I'm sorry guys that we couldn't finish it for ya. Thanks for hanging on through the lack of updates and for giving us a chance. We couldn't have gotten this far with out all of you. :)

    Expect this mod to be released within the next six months.

    Yours,

    Christopher Walker

    It is a paradoxical but profoundly true and important principle of life that the most likely way to reach a goal is to be aiming not at that goal itself but at some more ambitious goal beyond it.
    - Arnold Toynbee (1889 - 1975)

    Soap Opera Over
    Posted Wednesday, May 4, 2005 by Chris
    If you've been visiting this website within the last six months, you may have noticed that we've been down for about half of that time. My apologies. :(

    We had some issues with our web host, but they're resolved now. Unfortunately the forums got trashed in the process. Everything on this website should be back up and running (except the forum has no posts). If you find something that doesn't work, please contact me. You'll find my e-mail on the 'Contact Us' web page.

    One note: Some of the links have changed. The Episode I Shipset and The Path Not Taken mirrors can be found at their respective links below:

    http://www.njoproject.com/episodeishipset/
    http://www.njoproject.com/pathnottaken/

    Nameserver Change
    Posted Wednesday, March 9, 2005 by Chris
    Apologies to anyone who couldn't find our website during this last week. Our host surprised us and changed nameservers on us. Anyways, we're back.

    Errant Venture
    Posted Thursday, February 3, 2005 by Chris
    Errant Venture is a matchmaking service created for X-Wing vs. TIE Fighter and X-Wing Alliance by TRA_Stresser of the Dark Jedi Organization gaming club, intending to replace the Microsoft Gaming Zone's service when they stopped supporting the X-Wing series of games. This software has since become officially endorsed by BattleStats.com for their Weeks of War tournaments, and now it has found a home with the NJO Project as well and will, if all goes according to plan, be the software that players can use to set up multiplayer matches with other The Invasion Begins players.

    So go download it. :) The link is available on the downloads menu.