From a4f747c5de3b831ba3c1d387817fdc75be25e1cc Mon Sep 17 00:00:00 2001 From: gumi Date: Sat, 29 Jun 2019 17:04:09 +0000 Subject: move away from PHP, use static pages with the api --- includes/common.php | 40 ++++++++---- includes/conf/mysql.conf.php.example | 8 --- includes/email.php | 63 ------------------- includes/fetch-news.sh | 8 --- includes/libs/libmysql.php | 89 --------------------------- includes/models/account.php | 114 ----------------------------------- includes/news.php | 1 + 7 files changed, 30 insertions(+), 293 deletions(-) delete mode 100644 includes/conf/mysql.conf.php.example delete mode 100644 includes/email.php delete mode 100755 includes/fetch-news.sh delete mode 100644 includes/libs/libmysql.php delete mode 100644 includes/models/account.php (limited to 'includes') diff --git a/includes/common.php b/includes/common.php index ea8a63f..d1eec1e 100644 --- a/includes/common.php +++ b/includes/common.php @@ -13,6 +13,13 @@ function placeHeader($page_title) "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + + + The Mana World - <?php echo $page_title; ?> @@ -54,11 +61,10 @@ function placeHeader($page_title)
  • Downloads
  • News
  • About
  • -
  • Support (IRC)
  • +
  • Account Recovery
  • Wiki
  • Forums
  • FAQ
  • -
  • Servers
  • @@ -71,7 +77,26 @@ function placeHeader($page_title)
    Server status - + Online +
    @@ -153,16 +178,9 @@ function placeFooter() - + - - - \ No newline at end of file diff --git a/includes/email.php b/includes/email.php deleted file mode 100644 index 6184d56..0000000 --- a/includes/email.php +++ /dev/null @@ -1,63 +0,0 @@ - \____|____(______/__| \(______/ #\n"; - $data .= "# __ __ .__ .___ #\n"; - $data .= "# / \ / \___________| | __| _/ #\n"; - $data .= "# \ \/\/ / _ \_ __ \ | / __ | #\n"; - $data .= "# \ ( <_> ) | \/ |__/ /_/ | #\n"; - $data .= "# \__/\ / \____/|__| |____/\____ | #\n"; - $data .= "# \/ \/ #\n"; - $data .= "# #\n"; - $data .= "###############################################################\n"; - $data .= $emailText; - - $data .= "\r\n\r\n--" . $boundary . "\r\n"; - $data .= "Content-type: text/html;charset=utf-8\r\n\r\n"; - - $data .= ' - - -Home Page -Home Page -Official Client Mana Plus -The Mana World News -The Mana World Wiki -The Mana World Forums -The Mana World Support (IRC) -About The Mana World -Creative Commons -GNU General Public License -Open Source Initiative -The Mana World on Facebook -The Mana World on G+ -The Mana World on Youtube -Official Client Mana Plus -Mac OS Downloads -Windows Installer -Linux Versions -Image Map - -'.nl2br($emailText).' -
    - © 2004-2014 The Mana World -
    - -'; - $data .= "\r\n\r\n--" . $boundary . "--"; - return array($headers,$data); -} -?> diff --git a/includes/fetch-news.sh b/includes/fetch-news.sh deleted file mode 100755 index 5cc9ea5..0000000 --- a/includes/fetch-news.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# Fetches project news and saves it for local use. -# - -/usr/bin/wget -q -O /home/tmw/public_html/www/includes/rss2_projnews.tmp 'http://sourceforge.net/export/rss2_projnews.php?group_id=106790&rss_fulltext=1' > /dev/null -/bin/mv -f /home/tmw/public_html/www/includes/rss2_projnews.tmp \ - /home/tmw/public_html/www/includes/rss2_projnews.cache diff --git a/includes/libs/libmysql.php b/includes/libs/libmysql.php deleted file mode 100644 index 5a3a06c..0000000 --- a/includes/libs/libmysql.php +++ /dev/null @@ -1,89 +0,0 @@ -conn = mysql_connect( $conf['mysql_hostname'], - $conf['mysql_username'], - $conf['mysql_password'] ) - or die ("Connection to database failed!" . mysql_error()); - - mysql_select_db( $conf['mysql_database'], $this->conn ) - or die ("Selection of database failed! " . mysql_error()); - } - - private function checkConnect() - { - if (!isset($this->conn)) - { - die("Not connected to database"); - } - } - - // returns the value in the first row and column - public function getValue( $sql ) - { - $this->checkConnect(); - - $res = mysql_query( $sql, $this->conn ); - if (!$res) - { - die('Error while calling database: ' . mysql_error()); - } - $vals = mysql_fetch_row( $res ); - mysql_free_result( $res ); - return $vals[0]; - } - - // executes some sql and returns affected rows - public function exec( $sql ) - { - $this->checkConnect(); - - $res = mysql_query( $sql, $this->conn ); - if (!$res) - { - die('Error while calling database: ' . mysql_error()); - } - $numrows = mysql_affected_rows( $this->conn ); - return $numrows; - } - - public function escape( $string ) - { - $this->checkConnect(); - - return mysql_real_escape_string( $string, $this->conn ); - } - - public function disconnect() - { - if ( mysql_ping( $this->conn ) ) - { - mysql_close( $this->conn ); - } - } - -} - - -?> \ No newline at end of file diff --git a/includes/models/account.php b/includes/models/account.php deleted file mode 100644 index ef253c6..0000000 --- a/includes/models/account.php +++ /dev/null @@ -1,114 +0,0 @@ -getValue( $sql ); - } - - public static function existsUsername($str) - { - $db = Database::getInstance(); - $sql = sprintf("SELECT COUNT(*) FROM " . TMWAccount::ACCOUNT_TBL . - " WHERE USERNAME = '%s'", $db->escape($str)); - return ($db->getValue($sql) == 1); - } - - public function setUsername($name){ $this->username = $name; } - public function setPassword($pwd){ $this->password = $pwd; } - public function setEMail($email){ $this->email = $email; } - public function setGender($gender){ $this->gender = $gender; } - - public function validate() - { - $errors = array(); - - // check here for correct values.. - if (strlen($this->username) < 4) - $errors[] = "Username is too short"; - - if (strlen($this->username) >= 24) - $errors[] = "Username is too long"; - - if (strlen($this->password) < 4) - $errors[] = "Password is too short"; - - if (strlen($this->password) >= 24) - $errors[] = "Password is too long"; - - if (strlen($this->email) < 4) - $errors[] = "EMail is too short"; - - if (strlen($this->email) >= 40) - $errors[] = "EMail is too long"; - - if (!check_chars($this->username)) - $errors[] = 'Username contains invalid characters. ' . BAD_STRING_DESC; - - if (!check_chars($this->password)) - $errors[] = 'Password contains invalid characters. ' . BAD_STRING_DESC; - - if ($this->gender != TMWAccount::GENDER_MALE && - $this->gender != TMWAccount::GENDER_FEMALE ) - { - $errors[] = 'Gender has to be Male or Female!'; - } - - if (!filter_var($this->email, FILTER_VALIDATE_EMAIL)) - { - $errors[] = 'EMail has wrong format.'; - } - - - // returns true if everything is fine ( test with === true) - if (count($errors) == 0) - { - return true; - } - else - { - return $errors; - } - } - - - - public function storeAccount() - { - $db = Database::getInstance(); - $sql = sprintf( "INSERT INTO " . TMWAccount::ACCOUNT_TBL . - " (USERNAME, PASSWORD, EMAIL, GENDER) " . - "VALUES ('%s', '%s', '%s', %d) ", - $db->escape($this->username), - $db->escape($this->password), - $db->escape($this->email), - $this->gender); - - $rows = $db->exec( $sql ); - return ( $rows == 1 ); - } -} - -?> diff --git a/includes/news.php b/includes/news.php index 791e3c4..21e7f27 100644 --- a/includes/news.php +++ b/includes/news.php @@ -11,6 +11,7 @@ function printNews($num='all') { $content .= $buffer; if (preg_match('/<\/div>/',$buffer)) { $count++; + $content .= "
    "; } if ($count == $num && $num != 'all') { $content .= '
    More News >>
    '; -- cgit v1.2.3-70-g09d2