From: Hendrik B. <nh...@us...> - 2010-04-15 14:43:26
|
Update of /cvsroot/arianne/stendhal_website/content/scripts In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv11307/content/scripts Modified Files: monster.php Log Message: use 404 error on unknown npcs Index: monster.php =================================================================== RCS file: /cvsroot/arianne/stendhal_website/content/scripts/monster.php,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** monster.php 14 Apr 2010 18:43:37 -0000 1.22 --- monster.php 15 Apr 2010 14:43:18 -0000 1.23 *************** *** 38,41 **** --- 38,56 ---- + public function writeHttpHeader() { + if (!$this->found) { + header('HTTP/1.0 404 Not Found'); + return true; + } + + if ($this->isExact && strpos($_REQUEST['name'], ' ') !== FALSE) { + header('HTTP/1.0 301 Moved permanently.'); + header('Location: '.preg_replace('/[ +]/', '_', $_SERVER['PHP_SELF'])); + return false; + } + + return true; + } + public function writeHtmlHeader() { echo '<title>Creature '.htmlspecialchars($this->name).STENDHAL_TITLE.'</title>'."\n"; *************** *** 102,106 **** <?php $item = getItem($k["name"]); ! echo '<a href="'.rewriteURL('/item/'.urlencode($item->class).'/'.urlencode($k["name"]).'.html').'">'; ?> <img src="<?php echo $item->showImage(); ?>" alt="<?php echo ucfirst($k["name"]); ?>"/> --- 117,121 ---- <?php $item = getItem($k["name"]); ! echo '<a href="'.rewriteURL('/item/'.surlencode($item->class).'/'.surlencode($k["name"]).'.html').'">'; ?> <img src="<?php echo $item->showImage(); ?>" alt="<?php echo ucfirst($k["name"]); ?>"/> |