From: <qr...@us...> - 2006-12-09 19:27:09
|
Revision: 267 http://svn.sourceforge.net/opengate/?rev=267&view=rev Author: qrstuvw Date: 2006-12-09 11:27:09 -0800 (Sat, 09 Dec 2006) Log Message: ----------- Moved website from revision 262 to new directories Revision Links: -------------- http://svn.sourceforge.net/opengate/?rev=262&view=rev Added Paths: ----------- trunk/website/ trunk/website/about.php trunk/website/contact.php trunk/website/downloads.php trunk/website/extlib/ trunk/website/extlib/Snoopy.class.inc trunk/website/frame.php trunk/website/game/ trunk/website/game/account.php trunk/website/game/activate.php trunk/website/game/admin.php trunk/website/game/css/ trunk/website/game/css/opengate.css trunk/website/game/database.php trunk/website/game/download.php trunk/website/game/forum.php trunk/website/game/game_login.php trunk/website/game/images/ trunk/website/game/images/logo.png trunk/website/game/images/logo.svg trunk/website/game/include/ trunk/website/game/include/connect.php.inc trunk/website/game/include/forum_add.php.inc trunk/website/game/include/forum_browse.php.inc trunk/website/game/include/login_check.php.inc trunk/website/game/include/parse_xml.php trunk/website/game/index.php trunk/website/game/login.php trunk/website/game/logout.php trunk/website/game/news.php trunk/website/game/opengate.sql.bz2 trunk/website/game/register.php trunk/website/game/stats.php trunk/website/game/terms.php trunk/website/images/ trunk/website/images/icons/ trunk/website/images/icons/amanath.png trunk/website/images/icons/amanath.svg trunk/website/images/icons/quantar.png trunk/website/images/icons/quantar.svg trunk/website/images/icons/solrain.png trunk/website/images/icons/solrain.svg trunk/website/images/menu.png trunk/website/images/menu.svg trunk/website/images/menu_background.png trunk/website/images/menu_left.png trunk/website/images/menu_right.png trunk/website/images/models/ trunk/website/images/models/base_solrain.jpg trunk/website/images/models/octavius_apteryx.jpg trunk/website/images/models/octavius_apteryx_texturing_wip.jpg trunk/website/images/models/octavius_apteryx_texturing_wip_2.jpg trunk/website/images/models/octavius_condor.jpg trunk/website/images/models/octavius_phoenix.jpg trunk/website/images/models/quantar_storm.jpg trunk/website/images/models/quantar_storm_texturing_wip.jpg trunk/website/images/models/quantar_typhoon.jpg trunk/website/images/models/solrain_intensity.jpg trunk/website/images/models/solrain_pioneer.jpg trunk/website/images/models/solrain_premia.jpg trunk/website/images/models/thumbs/ trunk/website/images/models/thumbs/base_solrain.jpg trunk/website/images/models/thumbs/octavius_apteryx.jpg trunk/website/images/models/thumbs/octavius_apteryx_texturing_wip.jpg trunk/website/images/models/thumbs/octavius_apteryx_texturing_wip_2.jpg trunk/website/images/models/thumbs/octavius_condor.jpg trunk/website/images/models/thumbs/octavius_phoenix.jpg trunk/website/images/models/thumbs/quantar_storm.jpg trunk/website/images/models/thumbs/quantar_storm_texturing_wip.jpg trunk/website/images/models/thumbs/quantar_typhoon.jpg trunk/website/images/models/thumbs/solrain_intensity.jpg trunk/website/images/models/thumbs/solrain_pioneer.jpg trunk/website/images/models/thumbs/solrain_premia.jpg trunk/website/images/models/thumbs/weapon_liar.jpg trunk/website/images/models/thumbs/weapon_s_w_28.jpg trunk/website/images/models/weapon_liar.jpg trunk/website/images/models/weapon_s_w_28.jpg trunk/website/images/screenshots/ trunk/website/images/screenshots/01_apteryx_vs_storm.jpg trunk/website/images/screenshots/thumbs/ trunk/website/images/screenshots/thumbs/01_apteryx_vs_storm.jpg trunk/website/index.html trunk/website/layout.inc trunk/website/links.php trunk/website/news.php trunk/website/opengate.dtd trunk/website/rss_cache.inc trunk/website/rss_fetch.inc trunk/website/rss_parse.inc trunk/website/rss_utils.inc trunk/website/screenshots.php Added: trunk/website/about.php =================================================================== --- trunk/website/about.php (rev 0) +++ trunk/website/about.php 2006-12-09 19:27:09 UTC (rev 267) @@ -0,0 +1,11 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> + +<body> + <?php + require_once('layout.inc'); + + echo "<h1>About</h1><br>"; + + echo "<p>TODO</p>"; + ?> +</body> \ No newline at end of file Property changes on: trunk/website/about.php ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/website/contact.php =================================================================== --- trunk/website/contact.php (rev 0) +++ trunk/website/contact.php 2006-12-09 19:27:09 UTC (rev 267) @@ -0,0 +1,13 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> + +<body> + <?php + require_once('layout.inc'); + + echo "<h1>Contact</h1><br>"; + + echo "<a href=\"mailto:ope...@li...\">Mailinglist for development questions</a><br>"; + + echo "<a href=\"http://sourceforge.net/sendmessage.php?touser=62712\">Contact form to the project administrator</a><br>"; + ?> +</body> Property changes on: trunk/website/contact.php ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/website/downloads.php =================================================================== --- trunk/website/downloads.php (rev 0) +++ trunk/website/downloads.php 2006-12-09 19:27:09 UTC (rev 267) @@ -0,0 +1,11 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> + +<body> + <?php + require_once('layout.inc'); + + echo "<h1>Downloads</h1><br>"; + + echo "<p>TODO</p>"; + ?> +</body> \ No newline at end of file Property changes on: trunk/website/downloads.php ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/website/extlib/Snoopy.class.inc =================================================================== --- trunk/website/extlib/Snoopy.class.inc (rev 0) +++ trunk/website/extlib/Snoopy.class.inc 2006-12-09 19:27:09 UTC (rev 267) @@ -0,0 +1,900 @@ +<?php + +/************************************************* + +Snoopy - the PHP net client +Author: Monte Ohrt <mo...@is...> +Copyright (c): 1999-2000 ispi, all rights reserved +Version: 1.0 + + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You may contact the author of Snoopy by e-mail at: +m...@is... + +Or, write to: +Monte Ohrt +CTO, ispi +237 S. 70th suite 220 +Lincoln, NE 68510 + +The latest version of Snoopy can be obtained from: +http://snoopy.sourceforge.com + +*************************************************/ + +class Snoopy +{ + /**** Public variables ****/ + + /* user definable vars */ + + var $host = "www.php.net"; // host name we are connecting to + var $port = 80; // port we are connecting to + var $proxy_host = ""; // proxy host to use + var $proxy_port = ""; // proxy port to use + var $agent = "Snoopy v1.0"; // agent we masquerade as + var $referer = ""; // referer info to pass + var $cookies = array(); // array of cookies to pass + // $cookies["username"]="joe"; + var $rawheaders = array(); // array of raw headers to send + // $rawheaders["Content-type"]="text/html"; + + var $maxredirs = 5; // http redirection depth maximum. 0 = disallow + var $lastredirectaddr = ""; // contains address of last redirected address + var $offsiteok = true; // allows redirection off-site + var $maxframes = 0; // frame content depth maximum. 0 = disallow + var $expandlinks = true; // expand links to fully qualified URLs. + // this only applies to fetchlinks() + // or submitlinks() + var $passcookies = true; // pass set cookies back through redirects + // NOTE: this currently does not respect + // dates, domains or paths. + + var $user = ""; // user for http authentication + var $pass = ""; // password for http authentication + + // http accept types + var $accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*"; + + var $results = ""; // where the content is put + + var $error = ""; // error messages sent here + var $response_code = ""; // response code returned from server + var $headers = array(); // headers returned from server sent here + var $maxlength = 500000; // max return data length (body) + var $read_timeout = 0; // timeout on read operations, in seconds + // supported only since PHP 4 Beta 4 + // set to 0 to disallow timeouts + var $timed_out = false; // if a read operation timed out + var $status = 0; // http request status + + var $curl_path = "/usr/bin/curl"; + // Snoopy will use cURL for fetching + // SSL content if a full system path to + // the cURL binary is supplied here. + // set to false if you do not have + // cURL installed. See http://curl.haxx.se + // for details on installing cURL. + // Snoopy does *not* use the cURL + // library functions built into php, + // as these functions are not stable + // as of this Snoopy release. + + // send Accept-encoding: gzip? + var $use_gzip = true; + + /**** Private variables ****/ + + var $_maxlinelen = 4096; // max line length (headers) + + var $_httpmethod = "GET"; // default http request method + var $_httpversion = "HTTP/1.0"; // default http request version + var $_submit_method = "POST"; // default submit method + var $_submit_type = "application/x-www-form-urlencoded"; // default submit type + var $_mime_boundary = ""; // MIME boundary for multipart/form-data submit type + var $_redirectaddr = false; // will be set if page fetched is a redirect + var $_redirectdepth = 0; // increments on an http redirect + var $_frameurls = array(); // frame src urls + var $_framedepth = 0; // increments on frame depth + + var $_isproxy = false; // set if using a proxy server + var $_fp_timeout = 30; // timeout for socket connection + +/*======================================================================*\ + Function: fetch + Purpose: fetch the contents of a web page + (and possibly other protocols in the + future like ftp, nntp, gopher, etc.) + Input: $URI the location of the page to fetch + Output: $this->results the output text from the fetch +\*======================================================================*/ + + function fetch($URI) + { + + //preg_match("|^([^:]+)://([^:/]+)(:[\d]+)*(.*)|",$URI,$URI_PARTS); + $URI_PARTS = parse_url($URI); + if (!empty($URI_PARTS["user"])) + $this->user = $URI_PARTS["user"]; + if (!empty($URI_PARTS["pass"])) + $this->pass = $URI_PARTS["pass"]; + + switch($URI_PARTS["scheme"]) + { + case "http": + $this->host = $URI_PARTS["host"]; + if(!empty($URI_PARTS["port"])) + $this->port = $URI_PARTS["port"]; + if($this->_connect($fp)) + { + if($this->_isproxy) + { + // using proxy, send entire URI + $this->_httprequest($URI,$fp,$URI,$this->_httpmethod); + } + else + { + $path = $URI_PARTS["path"].(isset($URI_PARTS["query"]) ? "?".$URI_PARTS["query"] : ""); + // no proxy, send only the path + $this->_httprequest($path, $fp, $URI, $this->_httpmethod); + } + + $this->_disconnect($fp); + + if($this->_redirectaddr) + { + /* url was redirected, check if we've hit the max depth */ + if($this->maxredirs > $this->_redirectdepth) + { + // only follow redirect if it's on this site, or offsiteok is true + if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) + { + /* follow the redirect */ + $this->_redirectdepth++; + $this->lastredirectaddr=$this->_redirectaddr; + $this->fetch($this->_redirectaddr); + } + } + } + + if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0) + { + $frameurls = $this->_frameurls; + $this->_frameurls = array(); + + while(list(,$frameurl) = each($frameurls)) + { + if($this->_framedepth < $this->maxframes) + { + $this->fetch($frameurl); + $this->_framedepth++; + } + else + break; + } + } + } + else + { + return false; + } + return true; + break; + case "https": + if(!$this->curl_path || (!is_executable($this->curl_path))) { + $this->error = "Bad curl ($this->curl_path), can't fetch HTTPS \n"; + return false; + } + $this->host = $URI_PARTS["host"]; + if(!empty($URI_PARTS["port"])) + $this->port = $URI_PARTS["port"]; + if($this->_isproxy) + { + // using proxy, send entire URI + $this->_httpsrequest($URI,$URI,$this->_httpmethod); + } + else + { + $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); + // no proxy, send only the path + $this->_httpsrequest($path, $URI, $this->_httpmethod); + } + + if($this->_redirectaddr) + { + /* url was redirected, check if we've hit the max depth */ + if($this->maxredirs > $this->_redirectdepth) + { + // only follow redirect if it's on this site, or offsiteok is true + if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) + { + /* follow the redirect */ + $this->_redirectdepth++; + $this->lastredirectaddr=$this->_redirectaddr; + $this->fetch($this->_redirectaddr); + } + } + } + + if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0) + { + $frameurls = $this->_frameurls; + $this->_frameurls = array(); + + while(list(,$frameurl) = each($frameurls)) + { + if($this->_framedepth < $this->maxframes) + { + $this->fetch($frameurl); + $this->_framedepth++; + } + else + break; + } + } + return true; + break; + default: + // not a valid protocol + $this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n'; + return false; + break; + } + return true; + } + + + +/*======================================================================*\ + Private functions +\*======================================================================*/ + + +/*======================================================================*\ + Function: _striplinks + Purpose: strip the hyperlinks from an html document + Input: $document document to strip. + Output: $match an array of the links +\*======================================================================*/ + + function _striplinks($document) + { + preg_match_all("'<\s*a\s+.*href\s*=\s* # find <a href= + ([\"\'])? # find single or double quote + (?(1) (.*?)\\1 | ([^\s\>]+)) # if quote found, match up to next matching + # quote, otherwise match up to next space + 'isx",$document,$links); + + + // catenate the non-empty matches from the conditional subpattern + + while(list($key,$val) = each($links[2])) + { + if(!empty($val)) + $match[] = $val; + } + + while(list($key,$val) = each($links[3])) + { + if(!empty($val)) + $match[] = $val; + } + + // return the links + return $match; + } + +/*======================================================================*\ + Function: _stripform + Purpose: strip the form elements from an html document + Input: $document document to strip. + Output: $match an array of the links +\*======================================================================*/ + + function _stripform($document) + { + preg_match_all("'<\/?(FORM|INPUT|SELECT|TEXTAREA|(OPTION))[^<>]*>(?(2)(.*(?=<\/?(option|select)[^<>]*>[\r\n]*)|(?=[\r\n]*))|(?=[\r\n]*))'Usi",$document,$elements); + + // catenate the matches + $match = implode("\r\n",$elements[0]); + + // return the links + return $match; + } + + + +/*======================================================================*\ + Function: _striptext + Purpose: strip the text from an html document + Input: $document document to strip. + Output: $text the resulting text +\*======================================================================*/ + + function _striptext($document) + { + + // I didn't use preg eval (//e) since that is only available in PHP 4.0. + // so, list your entities one by one here. I included some of the + // more common ones. + + $search = array("'<script[^>]*?>.*?</script>'si", // strip out javascript + "'<[\/\!]*?[^<>]*?>'si", // strip out html tags + "'([\r\n])[\s]+'", // strip out white space + "'&(quote|#34);'i", // replace html entities + "'&(amp|#38);'i", + "'&(lt|#60);'i", + "'&(gt|#62);'i", + "'&(nbsp|#160);'i", + "'&(iexcl|#161);'i", + "'&(cent|#162);'i", + "'&(pound|#163);'i", + "'&(copy|#169);'i" + ); + $replace = array( "", + "", + "\\1", + "\"", + "&", + "<", + ">", + " ", + chr(161), + chr(162), + chr(163), + chr(169)); + + $text = preg_replace($search,$replace,$document); + + return $text; + } + +/*======================================================================*\ + Function: _expandlinks + Purpose: expand each link into a fully qualified URL + Input: $links the links to qualify + $URI the full URI to get the base from + Output: $expandedLinks the expanded links +\*======================================================================*/ + + function _expandlinks($links,$URI) + { + + preg_match("/^[^\?]+/",$URI,$match); + + $match = preg_replace("|/[^\/\.]+\.[^\/\.]+$|","",$match[0]); + + $search = array( "|^http://".preg_quote($this->host)."|i", + "|^(?!http://)(\/)?(?!mailto:)|i", + "|/\./|", + "|/[^\/]+/\.\./|" + ); + + $replace = array( "", + $match."/", + "/", + "/" + ); + + $expandedLinks = preg_replace($search,$replace,$links); + + return $expandedLinks; + } + +/*======================================================================*\ + Function: _httprequest + Purpose: go get the http data from the server + Input: $url the url to fetch + $fp the current open file pointer + $URI the full URI + $body body contents to send if any (POST) + Output: +\*======================================================================*/ + + function _httprequest($url,$fp,$URI,$http_method,$content_type="",$body="") + { + if($this->passcookies && $this->_redirectaddr) + $this->setcookies(); + + $URI_PARTS = parse_url($URI); + if(empty($url)) + $url = "/"; + $headers = $http_method." ".$url." ".$this->_httpversion."\r\n"; + if(!empty($this->agent)) + $headers .= "User-Agent: ".$this->agent."\r\n"; + if(!empty($this->host) && !isset($this->rawheaders['Host'])) + $headers .= "Host: ".$this->host."\r\n"; + if(!empty($this->accept)) + $headers .= "Accept: ".$this->accept."\r\n"; + + if($this->use_gzip) { + // make sure PHP was built with --with-zlib + // and we can handle gzipp'ed data + if ( function_exists(gzinflate) ) { + $headers .= "Accept-encoding: gzip\r\n"; + } + else { + trigger_error( + "use_gzip is on, but PHP was built without zlib support.". + " Requesting file(s) without gzip encoding.", + E_USER_NOTICE); + } + } + + if(!empty($this->referer)) + $headers .= "Referer: ".$this->referer."\r\n"; + if(!empty($this->cookies)) + { + if(!is_array($this->cookies)) + $this->cookies = (array)$this->cookies; + + reset($this->cookies); + if ( count($this->cookies) > 0 ) { + $cookie_headers .= 'Cookie: '; + foreach ( $this->cookies as $cookieKey => $cookieVal ) { + $cookie_headers .= $cookieKey."=".urlencode($cookieVal)."; "; + } + $headers .= substr($cookie_headers,0,-2) . "\r\n"; + } + } + if(!empty($this->rawheaders)) + { + if(!is_array($this->rawheaders)) + $this->rawheaders = (array)$this->rawheaders; + while(list($headerKey,$headerVal) = each($this->rawheaders)) + $headers .= $headerKey.": ".$headerVal."\r\n"; + } + if(!empty($content_type)) { + $headers .= "Content-type: $content_type"; + if ($content_type == "multipart/form-data") + $headers .= "; boundary=".$this->_mime_boundary; + $headers .= "\r\n"; + } + if(!empty($body)) + $headers .= "Content-length: ".strlen($body)."\r\n"; + if(!empty($this->user) || !empty($this->pass)) + $headers .= "Authorization: BASIC ".base64_encode($this->user.":".$this->pass)."\r\n"; + + $headers .= "\r\n"; + + // set the read timeout if needed + if ($this->read_timeout > 0) + socket_set_timeout($fp, $this->read_timeout); + $this->timed_out = false; + + fwrite($fp,$headers.$body,strlen($headers.$body)); + + $this->_redirectaddr = false; + unset($this->headers); + + // content was returned gzip encoded? + $is_gzipped = false; + + while($currentHeader = fgets($fp,$this->_maxlinelen)) + { + if ($this->read_timeout > 0 && $this->_check_timeout($fp)) + { + $this->status=-100; + return false; + } + + // if($currentHeader == "\r\n") + if(preg_match("/^\r?\n$/", $currentHeader) ) + break; + + // if a header begins with Location: or URI:, set the redirect + if(preg_match("/^(Location:|URI:)/i",$currentHeader)) + { + // get URL portion of the redirect + preg_match("/^(Location:|URI:)\s+(.*)/",chop($currentHeader),$matches); + // look for :// in the Location header to see if hostname is included + if(!preg_match("|\:\/\/|",$matches[2])) + { + // no host in the path, so prepend + $this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port; + // eliminate double slash + if(!preg_match("|^/|",$matches[2])) + $this->_redirectaddr .= "/".$matches[2]; + else + $this->_redirectaddr .= $matches[2]; + } + else + $this->_redirectaddr = $matches[2]; + } + + if(preg_match("|^HTTP/|",$currentHeader)) + { + if(preg_match("|^HTTP/[^\s]*\s(.*?)\s|",$currentHeader, $status)) + { + $this->status= $status[1]; + } + $this->response_code = $currentHeader; + } + + if (preg_match("/Content-Encoding: gzip/", $currentHeader) ) { + $is_gzipped = true; + } + + $this->headers[] = $currentHeader; + } + + # $results = fread($fp, $this->maxlength); + $results = ""; + while ( $data = fread($fp, $this->maxlength) ) { + $results .= $data; + if ( + strlen($results) > $this->maxlength ) { + break; + } + } + + // gunzip + if ( $is_gzipped ) { + // per http://www.php.net/manual/en/function.gzencode.php + $results = substr($results, 10); + $results = gzinflate($results); + } + + if ($this->read_timeout > 0 && $this->_check_timeout($fp)) + { + $this->status=-100; + return false; + } + + // check if there is a a redirect meta tag + + if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]+URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match)) + { + $this->_redirectaddr = $this->_expandlinks($match[1],$URI); + } + + // have we hit our frame depth and is there frame src to fetch? + if(($this->_framedepth < $this->maxframes) && preg_match_all("'<frame\s+.*src[\s]*=[\'\"]?([^\'\"\>]+)'i",$results,$match)) + { + $this->results[] = $results; + for($x=0; $x<count($match[1]); $x++) + $this->_frameurls[] = $this->_expandlinks($match[1][$x],$URI_PARTS["scheme"]."://".$this->host); + } + // have we already fetched framed content? + elseif(is_array($this->results)) + $this->results[] = $results; + // no framed content + else + $this->results = $results; + + return true; + } + +/*======================================================================*\ + Function: _httpsrequest + Purpose: go get the https data from the server using curl + Input: $url the url to fetch + $URI the full URI + $body body contents to send if any (POST) + Output: +\*======================================================================*/ + + function _httpsrequest($url,$URI,$http_method,$content_type="",$body="") + { + if($this->passcookies && $this->_redirectaddr) + $this->setcookies(); + + $headers = array(); + + $URI_PARTS = parse_url($URI); + if(empty($url)) + $url = "/"; + // GET ... header not needed for curl + //$headers[] = $http_method." ".$url." ".$this->_httpversion; + if(!empty($this->agent)) + $headers[] = "User-Agent: ".$this->agent; + if(!empty($this->host)) + $headers[] = "Host: ".$this->host; + if(!empty($this->accept)) + $headers[] = "Accept: ".$this->accept; + if(!empty($this->referer)) + $headers[] = "Referer: ".$this->referer; + if(!empty($this->cookies)) + { + if(!is_array($this->cookies)) + $this->cookies = (array)$this->cookies; + + reset($this->cookies); + if ( count($this->cookies) > 0 ) { + $cookie_str = 'Cookie: '; + foreach ( $this->cookies as $cookieKey => $cookieVal ) { + $cookie_str .= $cookieKey."=".urlencode($cookieVal)."; "; + } + $headers[] = substr($cookie_str,0,-2); + } + } + if(!empty($this->rawheaders)) + { + if(!is_array($this->rawheaders)) + $this->rawheaders = (array)$this->rawheaders; + while(list($headerKey,$headerVal) = each($this->rawheaders)) + $headers[] = $headerKey.": ".$headerVal; + } + if(!empty($content_type)) { + if ($content_type == "multipart/form-data") + $headers[] = "Content-type: $content_type; boundary=".$this->_mime_boundary; + else + $headers[] = "Content-type: $content_type"; + } + if(!empty($body)) + $headers[] = "Content-length: ".strlen($body); + if(!empty($this->user) || !empty($this->pass)) + $headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass); + + for($curr_header = 0; $curr_header < count($headers); $curr_header++) { + $cmdline_params .= " -H \"".$headers[$curr_header]."\""; + } + + if(!empty($body)) + $cmdline_params .= " -d \"$body\""; + + if($this->read_timeout > 0) + $cmdline_params .= " -m ".$this->read_timeout; + + $headerfile = uniqid(time()); + + # accept self-signed certs + $cmdline_params .= " -k"; + exec($this->curl_path." -D \"/tmp/$headerfile\"".escapeshellcmd($cmdline_params)." ".escapeshellcmd($URI),$results,$return); + + if($return) + { + $this->error = "Error: cURL could not retrieve the document, error $return."; + return false; + } + + + $results = implode("\r\n",$results); + + $result_headers = file("/tmp/$headerfile"); + + $this->_redirectaddr = false; + unset($this->headers); + + for($currentHeader = 0; $currentHeader < count($result_headers); $currentHeader++) + { + + // if a header begins with Location: or URI:, set the redirect + if(preg_match("/^(Location: |URI: )/i",$result_headers[$currentHeader])) + { + // get URL portion of the redirect + preg_match("/^(Location: |URI:)(.*)/",chop($result_headers[$currentHeader]),$matches); + // look for :// in the Location header to see if hostname is included + if(!preg_match("|\:\/\/|",$matches[2])) + { + // no host in the path, so prepend + $this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port; + // eliminate double slash + if(!preg_match("|^/|",$matches[2])) + $this->_redirectaddr .= "/".$matches[2]; + else + $this->_redirectaddr .= $matches[2]; + } + else + $this->_redirectaddr = $matches[2]; + } + + if(preg_match("|^HTTP/|",$result_headers[$currentHeader])) + { + $this->response_code = $result_headers[$currentHeader]; + if(preg_match("|^HTTP/[^\s]*\s(.*?)\s|",$this->response_code, $match)) + { + $this->status= $match[1]; + } + } + $this->headers[] = $result_headers[$currentHeader]; + } + + // check if there is a a redirect meta tag + + if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]+URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match)) + { + $this->_redirectaddr = $this->_expandlinks($match[1],$URI); + } + + // have we hit our frame depth and is there frame src to fetch? + if(($this->_framedepth < $this->maxframes) && preg_match_all("'<frame\s+.*src[\s]*=[\'\"]?([^\'\"\>]+)'i",$results,$match)) + { + $this->results[] = $results; + for($x=0; $x<count($match[1]); $x++) + $this->_frameurls[] = $this->_expandlinks($match[1][$x],$URI_PARTS["scheme"]."://".$this->host); + } + // have we already fetched framed content? + elseif(is_array($this->results)) + $this->results[] = $results; + // no framed content + else + $this->results = $results; + + unlink("/tmp/$headerfile"); + + return true; + } + +/*======================================================================*\ + Function: setcookies() + Purpose: set cookies for a redirection +\*======================================================================*/ + + function setcookies() + { + for($x=0; $x<count($this->headers); $x++) + { + if(preg_match("/^set-cookie:[\s]+([^=]+)=([^;]+)/i", $this->headers[$x],$match)) + $this->cookies[$match[1]] = $match[2]; + } + } + + +/*======================================================================*\ + Function: _check_timeout + Purpose: checks whether timeout has occurred + Input: $fp file pointer +\*======================================================================*/ + + function _check_timeout($fp) + { + if ($this->read_timeout > 0) { + $fp_status = socket_get_status($fp); + if ($fp_status["timed_out"]) { + $this->timed_out = true; + return true; + } + } + return false; + } + +/*======================================================================*\ + Function: _connect + Purpose: make a socket connection + Input: $fp file pointer +\*======================================================================*/ + + function _connect(&$fp) + { + if(!empty($this->proxy_host) && !empty($this->proxy_port)) + { + $this->_isproxy = true; + $host = $this->proxy_host; + $port = $this->proxy_port; + } + else + { + $host = $this->host; + $port = $this->port; + } + + $this->status = 0; + + if($fp = fsockopen( + $host, + $port, + $errno, + $errstr, + $this->_fp_timeout + )) + { + // socket connection succeeded + + return true; + } + else + { + // socket connection failed + $this->status = $errno; + switch($errno) + { + case -3: + $this->error="socket creation failed (-3)"; + case -4: + $this->error="dns lookup failure (-4)"; + case -5: + $this->error="connection refused or timed out (-5)"; + default: + $this->error="connection failed (".$errno.")"; + } + return false; + } + } +/*======================================================================*\ + Function: _disconnect + Purpose: disconnect a socket connection + Input: $fp file pointer +\*======================================================================*/ + + function _disconnect($fp) + { + return(fclose($fp)); + } + + +/*======================================================================*\ + Function: _prepare_post_body + Purpose: Prepare post body according to encoding type + Input: $formvars - form variables + $formfiles - form upload files + Output: post body +\*======================================================================*/ + + function _prepare_post_body($formvars, $formfiles) + { + settype($formvars, "array"); + settype($formfiles, "array"); + + if (count($formvars) == 0 && count($formfiles) == 0) + return; + + switch ($this->_submit_type) { + case "application/x-www-form-urlencoded": + reset($formvars); + while(list($key,$val) = each($formvars)) { + if (is_array($val) || is_object($val)) { + while (list($cur_key, $cur_val) = each($val)) { + $postdata .= urlencode($key)."[]=".urlencode($cur_val)."&"; + } + } else + $postdata .= urlencode($key)."=".urlencode($val)."&"; + } + break; + + case "multipart/form-data": + $this->_mime_boundary = "Snoopy".md5(uniqid(microtime())); + + reset($formvars); + while(list($key,$val) = each($formvars)) { + if (is_array($val) || is_object($val)) { + while (list($cur_key, $cur_val) = each($val)) { + $postdata .= "--".$this->_mime_boundary."\r\n"; + $postdata .= "Content-Disposition: form-data; name=\"$key\[\]\"\r\n\r\n"; + $postdata .= "$cur_val\r\n"; + } + } else { + $postdata .= "--".$this->_mime_boundary."\r\n"; + $postdata .= "Content-Disposition: form-data; name=\"$key\"\r\n\r\n"; + $postdata .= "$val\r\n"; + } + } + + reset($formfiles); + while (list($field_name, $file_names) = each($formfiles)) { + settype($file_names, "array"); + while (list(, $file_name) = each($file_names)) { + if (!is_readable($file_name)) continue; + + $fp = fopen($file_name, "r"); + $file_content = fread($fp, filesize($file_name)); + fclose($fp); + $base_name = basename($file_name); + + $postdata .= "--".$this->_mime_boundary."\r\n"; + $postdata .= "Content-Disposition: form-data; name=\"$field_name\"; filename=\"$base_name\"\r\n\r\n"; + $postdata .= "$file_content\r\n"; + } + } + $postdata .= "--".$this->_mime_boundary."--\r\n"; + break; + } + + return $postdata; + } +} + +?> Property changes on: trunk/website/extlib/Snoopy.class.inc ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/website/frame.php =================================================================== --- trunk/website/frame.php (rev 0) +++ trunk/website/frame.php 2006-12-09 19:27:09 UTC (rev 267) @@ -0,0 +1,20 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/xhtml1-frameset.dtd"> + +<body> + <?php + + require_once('layout.inc'); + echo "<br/><br/>"; + echo "<table width=\"90%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n"; + addFrameEntry("News", "news.php"); + addFrameEntry("About", "about.php"); + addFrameEntry("Downloads", "downloads.php"); + addFrameEntry("Screenshots", "screenshots.php"); + addFrameEntry("Links", "links.php"); + addFrameEntry("Contact", "contact.php"); + addFrameEntry("Project Page", "http://sourceforge.net/projects/opengate"); + echo "</table> + <br> + <a href=\"http://sourceforge.net\"><img src=\"http://sflogo.sourceforge.net/sflogo.php?group_id=163481&type=2\" width=\"125\" height=\"37\" border=\"0\" alt=\"SourceForge.net Logo\" /></a>"; + ?> +</body> Property changes on: trunk/website/frame.php ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/website/game/account.php =================================================================== --- trunk/website/game/account.php (rev 0) +++ trunk/website/game/account.php 2006-12-09 19:27:09 UTC (rev 267) @@ -0,0 +1,27 @@ +<?php + + echo "<h2>Account management</h2>\n"; + + if ((!isset($_SESSION['id'])) || (!isset($_SESSION['username']))) { + echo "<p>You need to <a href=\"index.php?module=register\">register</a> an account or login into an existing account to manage it.</p>\n"; + } else { + + echo "<h3>Account details for ".$_SESSION['username']."</h3>\n"; + + require_once("include/connect.php.inc"); + + $account_result = mysql_query("SELECT a.FACTION, u.REGISTRATION_DATE, a.LAST_LOGIN, s.NAME FROM ACCOUNT a INNER JOIN USER u ON a.USER_ID=u.ID INNER JOIN SHIP s ON s.ID=a.SHIP_ID WHERE USER_ID=".$_SESSION['id']); + + $row = mysql_fetch_object($account_result); + mysql_free_result($account_result); + echo "<p>Registered since: ".$row->REGISTRATION_DATE."</p>\n"; + echo "<p>Your faction: ".$row->FACTION."</p>\n"; + if (isset($row->LAST_LOGIN)) { + echo "<p>You already play the game. You chose you path. The rest of the options are disabled!</p>\n"; + } else { + echo "<p>You never played the game. So you still can change some things.</p>\n"; + } + echo "<p>Your Ship: ".$row->NAME."</p>\n"; + + } +?> \ No newline at end of file Property changes on: trunk/website/game/account.php ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/website/game/activate.php =================================================================== --- trunk/website/game/activate.php (rev 0) +++ trunk/website/game/activate.php 2006-12-09 19:27:09 UTC (rev 267) @@ -0,0 +1,24 @@ +<?php + + if (!isset($_REQUEST['code'])) { + echo "<p>No code given, sorry!</p>\n"; + return; + } + + require_once("include/connect.php.inc"); + + $active_query = mysql_query("SELECT ID, LOGIN_NAME FROM USER WHERE ACTIVATOR='".mysql_real_escape_string($_REQUEST['code'])."'"); + if (mysql_num_rows($active_query) <= 0) { + echo "<p>Invalid code, sorry!</p>\n"; + } + + $row = mysql_fetch_object($active_query); + + $active_query = mysql_query("UPDATE USER SET ACTIVATOR = '', STATUS = 1 WHERE ID = ".$row->ID); + $active_result = mysql_query($active_query); + + echo "<p>Successfully activated account</p>"; + $_SESSION['id'] = $row->ID; + $_SESSION['username'] = $row->LOGIN_NAME; + +?> \ No newline at end of file Property changes on: trunk/website/game/activate.php ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/website/game/admin.php =================================================================== --- trunk/website/game/admin.php (rev 0) +++ trunk/website/game/admin.php 2006-12-09 19:27:09 UTC (rev 267) @@ -0,0 +1,60 @@ +<?php + + function show_mask() { + echo " <h2>Account management administration login</h2> + <form name=\"login\" method=\"POST\" action=\"".$_SERVER['PHP_SELF']."?module=admin\"> + + <label style=\"font-size:10px; font-family: Verdana\">Admin-Passwort:</label> + <input type=\"password\" name=\"reg_password\" size=\"30\" style=\"font-size:10px; font-family: Verdana\" value=\"".$_POST['reg_password']."\"><br> + + <input type=\"submit\" value=\"Ok\" style=\"width:110px;\" name=\"Ok\"></p> + </form> + <br />\n"; + } + + function show_administration() { + echo " <h2>Account management administration</h2>"; + + if (isset($_REQUEST['admin_module'])) { + if ($_REQUEST['admin_module'] == "user") { + include("admin/admin_user.php"); + } + //TODO: switch available modules + } else { + echo "<ul> + <li><a href=\"".$_SERVER['PHP_SELF']."?module=admin&admin_module=user\">User administration</a> + </ul>\n"; + } + } + + if ((isset($_SESSION['id'])) && (isset($_SESSION['admin'])) && ($_SESSION['admin'] == true)) { + show_administration(); + return; + } + + if ((isset($_SESSION['id'])) && (isset($_POST['reg_password']))) { + + require_once("include/connect.php.inc"); + + // check password against database + $password_result = mysql_query("SELECT COUNT(ID) FROM DATA WHERE NAME='admin_password' AND VALUE='".sha1(mysql_real_escape_string($_POST['reg_password']))."'"); + if (mysql_num_rows($password_result) <= 0) { + show_mask(); + return; + } + mysql_free_result($password_result); + + // check if logged in user is really an administrator + $is_admin_result = mysql_query("SELECT STATUS FROM USER WHERE ID=".$_SESSION['id']); + $row = mysql_fetch_object($is_admin_result); + mysql_free_result($is_admin_result); + if ($row->STATUS == 9) { + $_SESSION['admin'] = true; + show_administration(); + } else { + show_mask(); + } + } else { + show_mask(); + } +?> Property changes on: trunk/website/game/admin.php ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/website/game/css/opengate.css =================================================================== --- trunk/website/game/css/opengate.css (rev 0) +++ trunk/website/game/css/opengate.css 2006-12-09 19:27:09 UTC (rev 267) @@ -0,0 +1,283 @@ +/* andreas08 - an open source xhtml/css website layout by Andreas Viklund - http://andreasviklund.com . Free to use in any way and for any purpose as long as the proper credits are given to the original designer. Version: 1.0, November 28, 2005 */ + +/**************** Body and tag styles ****************/ + +*{margin:0; padding:0;} + +body{ +font:76% Verdana,Tahoma,Arial,sans-serif; +line-height:1.4em; +text-align:center; +color:#303030; +background:#e8eaec; +} + +pre { + padding-top: 1.5em; + padding-bottom: 0em; + padding-left: 2em; + margin: 0.4em 0 0.4em 0; + font-size: medium; + font-family: monospace; + border: 1px solid #c0c0c0; + background-color: #fafbfc; +} + +code { + font-size: medium; + font-family: monospace; +} + +a{ +color:#467aa7; +font-weight:bold; +text-decoration:none; +background-color:inherit; +} + +a:hover{color:#2a5a8a; text-decoration:none; background-color:inherit;} +a img{border:none;} + +p{padding:0 0 1.6em 0;} +p form{margin-top:0; margin-bottom:20px;} + +img.left,img.center,img.right{padding:4px; border:1px solid #a0a0a0;} +img.left{float:left; margin:0 12px 5px 0;} +img.center{display:block; margin:0 auto 5px auto;} +img.right{float:right; margin:0 0 5px 12px;} + + + +h1,h2 { + margin-top: 10px; + margin-bottom: 15px; +} + +h3,h4,h5,h6 { + margin-top: 10px; + margin-bottom: 10px; +} + +/**************** Header and navigation styles ****************/ + +#container{ +width:1000px; +margin:20px auto; +padding:1px 0; +text-align:left; +background:#ffffff; +color:#303030; +border:2px solid #a0a0a0; +} + +#header{ +height:60px; +width:998px; +margin:0 1px 1px 1px; +background:#467aa7 url(images/logo.png) no-repeat left; +color:#ffffff; +} + +#header h1{ +padding:35px 0 0 20px; +font-size:2.4em; +background-color:inherit; +color:#ffffff; +letter-spacing:-2px; +font-weight:normal; +} + +#header h2{ +margin:10px 0 0 40px; +font-size:1.4em; +background-color:inherit; +color:#f0f2f4; +letter-spacing:-1px; +font-weight:normal; +} + +#navigation{ +height:2.2em; +line-height:2.2em; +width:998px; +margin:0 1px; +background:#578bb8; +color:#ffffff; +} + +#navigation li{ + float:left; + list-style-type:none; + border-right:1px solid #ffffff; + white-space:nowrap; +} + +#navigation li.selected{ + padding:0 10px; + display:block; + font-size:0.8em; + font-weight:normal; + text-transform:uppercase; + text-decoration:none; + color: #ffffff; +} + +#navigation li a{ +padding:0 10px; +display:block; +font-size:0.8em; +font-weight:normal; +text-transform:uppercase; +text-decoration:none; +background-color:inherit; +color: #ffffff; +} + +* html #navigation a {width:1%;} + +#navigation .selected,#navigation a:hover{ +background:#80b0da; +color:#ffffff; +text-decoration:none; +} + +/**************** Content styles ****************/ + +#content{ +float:left; +width:958px; +font-size:0.9em; +padding:20px 0 0 20px; +} + +#content h2{ +display:block; +margin:0 0 16px 0; +font-size:1.7em; +font-weight:normal; +letter-spacing:-1px; +color:#505050; +background-color:inherit; +} + +#content h2 a{font-weight:normal;} +#content h3{margin:0 0 5px 0; font-size:1.4em; letter-spacing:-1px;} +#content a:hover,#subcontent a:hover{text-decoration:underline;} +#content ul,#content ol{margin:0 5px 16px 35px;} +#content dl{margin:0 5px 10px 25px;} +#content dt{font-weight:bold; margin-bottom:5px;} +#content dd{margin:0 0 10px 15px;} + +/**************** Full-content styles ****************/ + +#fullcontent{ +font-size:0.9em; +padding:20px 20px 0 20px; +} + +#fullcontent h2{ +display:block; +margin:0 0 16px 0; +font-size:1.7em; +font-weight:normal; +letter-spacing:-1px; +color:#505050; +background-color:inherit; +} + +#fullcontent h2 a{font-weight:normal;} +#fullcontent h3{margin:0 0 5px 0; font-size:1.4em; letter-spacing:-1px;} +#fullcontent a:hover{text-decoration:underline;} +#fullcontent ul, +#fullcontent ol{margin:0 5px 16px 35px;} +#fullcontent dl{margin:0 5px 10px 25px;} +#fullcontent dt{font-weight:bold; margin-bottom:5px;} +#fullcontent dd{margin:0 0 10px 15px;} + +/**************** Sidebar styles ****************/ + +#subcontent{ +float:right; +width:170px; +padding:20px 20px 10px 0; +line-height:1.4em; +} + +#subcontent h2{ +display:block; +margin:0 0 15px 0; +font-size:1.6em; +font-weight:normal; +text-align:left; +letter-spacing:-1px; +color:#505050; +background-color:inherit; +} + +#subcontent p{margin:0 0 16px 0; font-size:0.9em;} + +/**************** Menublock styles ****************/ + +.menublock{margin:0 0 20px 8px; font-size:0.9em;} +.menublock li{list-style:none; display:block; padding:2px; margin-bottom:2px;} +.menublock li a{font-weight:bold; text-decoration:none;} +.menublock li a:hover{text-decoration:none;} +.menublock li ul{margin:3px 0 3px 15px; font-size:1em; font-weight:normal;} +.menublock li ul li{margin-bottom:0;} +.menublock li ul a{font-weight:normal;} + +/**************** Searchbar styles ****************/ + +#searchbar{margin:0 0 20px 0;} +#searchbar form fieldset{margin-left:10px; border:0 solid;} + +#searchbar #s{ +height:1.2em; +width:110px; +margin:0 5px 0 0; +border:1px solid #a0a0a0; +} + +#searchbar #searchbutton{ +width:auto; +padding:0 1px; +border:1px solid #808080; +font-size:0.9em; +text-align:center; +} + +/**************** Footer styles ****************/ + +#footer{ +clear:both; +width:998px; +padding:5px 0; +margin:0 1px; +font-size:0.9em; +color:#f0f0f0; +background:#467aa7; +} + +#footer p{padding:0; margin:0; text-align:center;} +#footer a{color:#f0f0f0; background-color:inherit; font-weight:bold;} +#footer a:hover{color:#ffffff; background-color:inherit; text-decoration: underline;} + +/**************** Misc classes and styles ****************/ + +.splitcontentleft{float:left; width:28%;} +.splitcontentright{float:right; width:68%;} +.clear{clear:both;} +.small{font-size:0.8em;} +.hide{display:none;} +.textcenter{text-align:center;} +.textright{text-align:right;} +.important{color:#f02025; background-color:inherit; font-weight:bold;} + +.box{ +margin:0 0 20px 0; +padding:10px; +border:1px solid #c0c0c0; +background-color:#fafbfc; +color:#505050; +line-height:1.5em; +} Property changes on: trunk/website/game/css/opengate.css ___________________________________________________________________ Name: svn:mime-type + text/css Name: svn:eol-style + native Added: trunk/website/game/database.php =================================================================== --- trunk/website/game/database.php (rev 0) +++ trunk/website/game/database.php 2006-12-09 19:27:09 UTC (rev 267) @@ -0,0 +1,114 @@ +<?php + + function crawl_dir($directory, $array, $array_ptr) { + + $dp = @opendir($directory); + if (!$dp) { + echo "<p>Could not find directory: ".$directory."</p>"; + return null; + } + + while (false !== ($file = readdir($dp))) { + if (($file != ".") && //drops curdir + ($file != "..")) { //drops updir + if (is_dir($directory."/".$file)) { + $array = crawl_dir($directory."/".$file, $array, $array_ptr); + $array_ptr = count($array); + } else { + if (substr($file, (strlen($file)-4)) == ".xml") { //drops non-.xml-files + $array[$array_ptr] = $directory."/".$file; + $array_ptr++; + } + } + } + } + closedir($dp); + return $array; + } + + echo "<h2>Opengate knowledge database</h2>\n"; + + // user decided to view a datafile + if (isset($_REQUEST['view'])) { + require_once("include/parse_xml.php"); + $xx = new u007xml(); + $xx->loadFile($_REQUEST['view']); + $xx->display_content(); + echo "<div style=\"text-align:center;\"><a rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc-sa/2.0/\"><img alt=\"Creative Commons License\" border=\"0\" src=\"http://creativecommons.org/images/public/somerights20.png\"/></a><br/>This work is licensed under a <a rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc-sa/2.0/\">Creative Commons Attribution-NonCommercial-ShareAlike 2.0 License</a>.</div>"; + return; + } + + // user decided to view data + if (isset($_REQUEST['view_data'])) { + require_once("include/parse_xml.php"); + parse_xml(find_xml($_REQUEST['view_data']), 'Name'); + return; + } + + // Folder for the database + $database_dir = "./data"; + $test = 0; + $file_list = crawl_dir($database_dir, $file_list, $test); + + if (count($file_list)) { + @sort($file_list); + echo "<ul>\n"; + foreach ($file_list as $index => $filename) { + echo "<li><a href=\"index.php?module=database&view=".$filename."\">".$filename."</a></li>\n"; + } + echo "</ul>\n"; + } + + echo "<div style=\"text-align:center;\"><a rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc-sa/2.0/\"><img alt=\"Creative Commons License\" border=\"0\" src=\"http://creativecommons.org/images/public/somerights20.png\"/></a><br/>This work is licensed under a <a rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc-sa/2.0/\">Creative Commons Attribution-NonCommercial-ShareAlike 2.0 License</a>.</div>"; + +/* + $database_dir_pointer = opendir($database_dir); + + // Count all directories and store them in a list + $directory_count = 0; + while (false !== ($file = readdir($database_dir_pointer))) { + if (($file != ".") && ($file != "..") && ($file != "index.html") && (!is_file($dir . "/" . $file))) { + $directory_list[$directory_count] = $file; + $directory_count++; + } + } + + // No directories found + if ($directory_count <= 0) { + echo "<p>Database is offline. No data available.</p>"; + return; + } + + sort($directory_list); + + // read each directory for their files + for ($j = 0; $j < $directory_count; $j++) { + $newdp = opendir($database_dir."/".$directory_list[$j]) or die("Directory not found"); + $file_count = 0; + + unset($file_list); + + // create a list of all files + while (false !== ($file = readdir($newdp))) { + if (($file != ".") && ($file != "..") && ($file != "index.html")) { + $file_list[$file_count] = $file; + $file_count++; + } + } + + echo "<h3>".$directory_list[$j].", ".$file_count." entries</h3> + <ul>\n"; + + if ($file_count > 0) { + sort($file_list); + for ($i = 0; $i < $file_count; $i++) { + echo "<li><a href=\"index.php?module=database&view=".$database_dir."/".$directory_list[$j]."/".$file_list[$i]."\">".$file_list[$i]."</a></li>\n"; + } + } + + echo "</ul>\n"; + + closedir($newdp); + } + closedir($database_dir_pointer);*/ +?> \ No newline at end of file Property changes on: trunk/website/game/database.php ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/website/game/download.php =================================================================== --- trunk/website/game/download.php (rev 0) +++ trunk/website/game/download.php 2006-12-09 19:27:09 UTC (rev 267) @@ -0,0 +1,7 @@ +<?php + + echo "<h2>Dowloads</h2>\n"; + + echo "<p>The game is currently in development and not yet meant to be played. So there are now downloads yet. Sorry for that.</p>\n"; + +?> \ No newline at end of file Property changes on: trunk/website/game/download.php ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/website/game/forum.php =================================================================== --- trunk/website/game/forum.php (rev 0) +++ trunk/website/game/forum.php 2006-12-09 19:27:09 UTC (rev 267) @@ -0,0 +1,10 @@ +<?php + + echo "<h2>Forum</h2>\n"; + + if (isset($_REQUEST['add'])) { + require_once("include/forum_add.php.inc"); + } else { + require_once("include/forum_browse.php.inc"); + } +?> \ No newline at end of file Property changes on: trunk/website/game/forum.php ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/website/game/game_login.php =================================================================== --- trunk/website/game/game_login.php (rev 0) +++ trunk/website/game/game_login.php 2006-12-09 19:27:09 UTC (rev 267) @@ -0,0 +1,6 @@ +<?php + + require_once("include/login_check.php.inc"); + + echo check_login(true); +?> Property changes on: trunk/website/game/game_login.php ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/website/game/images/logo.png =================================================================== (Binary files differ) Property changes on: trunk/website/game/images/logo.png ___________________________________________________________________ Name: svn:mime-type + image/png Added: trunk/website/game/images/logo.svg =================================================================== (Binary files differ) Property changes on: trunk/website/game/images/logo.svg ___________________________________________________________________ Name: svn:mime-type + image/svg+xml Added: trunk/website/game/include/connect.php.inc =================================================================== --- trunk/website/game/include/connect.php.inc (rev 0) +++ trunk/website/game/include/connect.php.inc 2006-12-09 19:27:09 UTC (rev 267) @@ -0,0 +1,6 @@ +<?php + $connection = mysql_connect("localhost","opengate","opengate") OR die("SQL-Server is offline!"); + mysql_select_db("opengate") OR die("Could not access database!"); +// $connection = mysql_connect("mysql4-o","o163481rw","opengateRW") OR die("SQL-Server is offline!"); +// mysql_select_db("o163481_opengate") OR die("Could not access database!"); +?> Property changes on: trunk/website/game/include/connect.php.inc ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/website/game/include/forum_add.php.inc =================================================================== --- trunk/website/game/include/forum_add.php.inc (rev 0) +++ trunk/website/game/include/forum_add.php.inc 2006-12-09 19:27:09 UTC (rev 267) @@ -0,0 +1,47 @@ +<?php + + if (!isset($_POST['comment'])) { + if (!isset($_REQUEST['thread'])) { + echo "<h3>Add thread to forum</h3>\n"; + echo "<form name=\"add\" method=\"post\" action=\"".$_SERVER['PHP_SELF']."?module=forum&add=true\">\n"; + } else { + echo "<h3>Add entry to forum</h3>\n"; + echo "<form name=\"add\" method=\"post\" action=\"".$_SERVER['PHP_SELF']."?module=forum&add=true&thread=".$_REQUEST['thread']."\">\n"; + } + + + if (!isset($_REQUEST['thread'])) { + echo " <label style=\"font-size:10px; font-family: Verdana\">Headline:</label> + <input type=\"text\" name=\"headline\" size=\"30\" style=\"font-size:10px; font-family: Verdana\" value=\"".$_POST['headline']."\" /><br />\n"; + } + + echo " <label style=\"font-size:10px; font-family: Verdana\">Comment:</label> + <textarea name=\"comment\" cols=\"60\" rows=\"15\" style=\"font-size:10px; font-family: Verdana\">".$_POST['comment']."</textarea><br /> + <input type=\"submit\" value=\"Ok\" style=\"width:110px;\" name=\"Submit\" /> +</form>"; + } else { + if (!isset($_REQUEST['thread'])) { + //TODO: validate the comment + require_once("include/connect.php.inc"); + $insert_query = "INSERT INTO FORUM_THREAD (USER_ID, HEADER, STATUS) VALUES (".$_SESSION['id'].",'".mysql_real_escape_string($_POST['headline'])."',0)"; + $insert_result = mysql_query($insert_query); + + $validate_query = mysql_query("SELECT ID FROM FORUM_THREAD WHERE HEADER='".mysql_real_escape_string($_POST['headline'])."'"); + $validate_result = mysql_fetch_object($validate_query); + $id = $validate_result->ID; + + $insert_query = "INSERT INTO FORUM_ENTRY (USER_ID, THREAD_ID, CONTENT, STATUS) VALUES (".$_SESSION['id'].",".$id.",'".mysql_real_escape_string($_POST['comment'])."',0)"; + $insert_result = mysql_query($insert_query); + + echo "<p>Sucessfully added entry to the <a href=\"".$_SERVER['PHP_SELF']."?module=forum&thread=".$id."\">forum</a></p>"; + } else { + //TODO: validate the comment + require_once("include/connect.php.inc"); + + $insert_query = "INSERT INTO FORUM_ENTRY (USER_ID, THREAD_ID, CONTENT, STATUS) VALUES (".$_SESSION['id'].",".$_REQUEST['thread'].",'".mysql_real_escape_string($_POST['comment'])."',0)"; + $insert_result = mysql_query($insert_query); + + echo "<p>Sucessfully added entry to the <a href=\"".$_SERVER['PHP_SELF']."?module=forum&thread=".$_REQUEST['thread']."\">forum</a></p>"; + } + } +?> \ No newline at end of file Property changes on: trunk/website/game/include/forum_add.php.inc ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/website/game/include/forum_browse.php.inc =================================================================== --- trunk/website/game/include/forum_browse.php.inc (rev 0) +++ trunk/website/game/include/forum_browse.php.inc 2006-12-09 19:27:09 UTC (rev 267) @@ -0,0 +1,72 @@ +<?php + + require_once("connect.php.inc"); + + if (isset($_REQUEST['thread'])) { + + $entry_header_result = mysql_query("SELECT HEADER FROM FORUM_THREAD WHERE ID = ".mysql_real_escape_string($_REQUEST['thread'])); + + $thread = mysql_fetch_object($entry_header_result); + $thread_name = $thread->HEADER; + + if (isset($_SESSION['id'])) { + $entry_result = mysql_query("SELECT e.*, u.LOGIN_NAME ". + "FROM FORUM_ENTRY e ". + "INNER JOIN USER u ON e.USER_ID = u.ID ". + "WHERE e.STATUS >= 0 ". + "AND e.THREAD_ID = ".mysql_real_escape_string($_REQUEST['thread'])." ". + "ORDER BY e.ID"); + } else { + $entry_result = mysql_query("SELECT e.*, u.LOGIN_NAME ". + "FROM FORUM_ENTRY e ". + "INNER JOIN USER u ON e.USER_ID = u.ID ". + "WHERE e.STATUS = 0 ". + "AND e.THREAD_ID = ".mysql_real_escape_string($_REQUEST['thread'])." ". + "ORDER BY e.ID"); + } + + if (mysql_num_rows($entry_result) == 0) { + echo "<p>No such thread.</p>\n"; + mysql_free_result($entry_result); + } else { + + echo "<h3>".$thread_name."</h3>"; + + while ($row = mysql_fetch_array($entry_result)) { + $date = substr($row['DATE'],0, 10); + echo "<p><b>".$row['CONTENT']."</b> - ".$date." - Written by ".$row['LOGIN_NAME']."</p>\n"; + } + mysql_free_result($entry_result); + } + + if ((isset($_SESSION['id'])) && (isset($_SESSION['username']))) { + echo "<a href=\"index.php?module=forum&add=true&thread=".$_REQUEST['thread']."\">Create answer<... [truncated message content] |