From: Hendrik B. <nh...@us...> - 2010-06-03 21:32:46
|
Update of /cvsroot/arianne/stendhal_website/content/scripts In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv19207/content/scripts Modified Files: event.php monster.php Log Message: code format, mostly fixed line endings Index: event.php =================================================================== RCS file: /cvsroot/arianne/stendhal_website/content/scripts/event.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** event.php 30 Nov 2009 21:59:23 -0000 1.8 --- event.php 3 Jun 2010 21:32:38 -0000 1.9 *************** *** 1,37 **** ! <?php class EventPage extends Page { ! private $event_id; ! private $eventss; ! ! public function __construct() { ! $this->event_id = $_REQUEST["event_id"]; ! $this->events=getEvents('where id='.mysql_real_escape_string($this->event_id)); ! } ! ! public function writeHtmlHeader() { ! if(sizeof($this->events) == 0) { ! echo '<title>Non existing event '.STENDHAL_TITLE.'</title>'; ! echo '<meta name="robots" content="noindex">'; ! } else { ! $choosen = $this->events[0]; ! echo '<title>Event '.htmlspecialchars($choosen->oneLineDescription).STENDHAL_TITLE.'</title>'; ! } ! } ! function writeContent() { ! $choosen = $this->events[0]; ! startBox(htmlspecialchars($choosen->oneLineDescription)); ! ?> ! <div> ! <div><b>Type: </b><?php echo $choosen->type; ?></div> ! <div><b>Place: </b><?php echo $choosen->location; ?></div> ! <div><b>Date: </b><?php echo $choosen->date; ?></div> ! </div> ! <?php ! echo $choosen->extendedDescription; ! ! foreach($choosen->images as $image) { ?> ! <img src="<?php echo $image; ?>" alt=""/> ! <?php } endBox(); --- 1,37 ---- ! <?php class EventPage extends Page { ! private $event_id; ! private $eventss; ! ! public function __construct() { ! $this->event_id = $_REQUEST["event_id"]; ! $this->events=getEvents('where id='.mysql_real_escape_string($this->event_id)); ! } ! ! public function writeHtmlHeader() { ! if(sizeof($this->events) == 0) { ! echo '<title>Non existing event '.STENDHAL_TITLE.'</title>'; ! echo '<meta name="robots" content="noindex">'; ! } else { ! $choosen = $this->events[0]; ! echo '<title>Event '.htmlspecialchars($choosen->oneLineDescription).STENDHAL_TITLE.'</title>'; ! } ! } ! function writeContent() { ! $choosen = $this->events[0]; ! startBox(htmlspecialchars($choosen->oneLineDescription)); ! ?> ! <div> ! <div><b>Type: </b><?php echo $choosen->type; ?></div> ! <div><b>Place: </b><?php echo $choosen->location; ?></div> ! <div><b>Date: </b><?php echo $choosen->date; ?></div> ! </div> ! <?php ! echo $choosen->extendedDescription; ! ! foreach($choosen->images as $image) { ?> ! <img src="<?php echo $image; ?>" alt=""/> ! <?php } endBox(); Index: monster.php =================================================================== RCS file: /cvsroot/arianne/stendhal_website/content/scripts/monster.php,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** monster.php 30 Apr 2010 00:29:44 -0000 1.29 --- monster.php 3 Jun 2010 21:32:38 -0000 1.30 *************** *** 1,184 **** ! <?php ! ! function printRespawn($turns) { ! return round($turns *0.3/60,2); ! } ! ! function renderAmount($amount) { ! $amount=str_replace("[","",$amount); ! $amount=str_replace("]","",$amount); ! list($min,$max)=explode(",",$amount); ! ! if($min!=$max) { ! return "between $min and $max."; ! } else { ! return "exactly $min."; ! } ! } class MonsterPage extends Page { ! private $name; ! private $monsters; ! private $isExact; ! private $found; ! ! public function __construct() { ! $this->name = preg_replace('/_/', ' ', $_REQUEST['name']); ! $this->isExact = isset($_REQUEST['exact']); ! $this->monsters = getMonsters(); ! ! // does this name exist? ! foreach($this->monsters as $m) { ! if($m->name==$this->name) { ! $this->found = true; ! } ! } ! ! } ! ! ! 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"; ! if (!$this->found) { ! echo '<meta name="robots" content="noindex">'."\n"; ! } ! } ! function writeContent() { ! ! if (!$this->found) { ! startBox("No such Creature"); ! ?> ! There is no such creature at Stendhal.<br> ! Please make sure you spelled it correctly. ! <?php ! endBox(); ! return; } ! ! foreach($this->monsters as $m) { ! /* If name of the creature match or contains part of the name.*/ ! if($m->name==$this->name || (!$this->isExact and strpos($m->name, $this->name) != false)) { ! startBox("Detailed information"); ! ?> ! <div class="creature"> ! <div class="name"><?php echo ucfirst($m->name); ?></div> ! <img class="creature" src="<?php echo $m->gfx; ?>" alt=""> ! <div class="level">Level <?php echo $m->level; ?></div> ! <div class="xp">Killing it will give you <?php echo $m->xp; ?> XP.</div> ! <div class="respawn">Respawns on average in <?php echo printRespawn($m->respawn); ?> minutes.</div> ! <div class="description"> ! <?php ! if($m->description=="") { ! echo 'No description. Would you like to <a href="http://sourceforge.net/tracker/?func=add&group_id=1111&atid=301111">write one</a>?'; ! } else { ! echo $m->description; ! } ! ?> ! </div> ! ! <div class="table"> ! <div class="title">Attributes</div> ! <?php ! foreach($m->attributes as $label=>$data) { ! ?> ! <div class="row"> ! <div class="label"><?php echo strtoupper($label); ?></div> ! <div class="data"><?php echo $data; ?></div> ! </div> ! <?php ! } ! ?> ! </div> ! ! <?php if (count($m->susceptibilities) > 0) {?> ! <div class="table"> ! <div class="title">Resistances</div> ! <?php ! foreach($m->susceptibilities as $label=>$data) { ! ?> ! <div class="row"> ! <div class="label"><?php echo strtoupper($label); ?></div> ! <div class="data"><?php echo $data; ?>%</div> ! </div> ! <?php ! } ! ?> ! </div> ! <?php }?> ! ! <div class="table"> ! <div class="title">Creature drops</div> ! <?php ! foreach($m->drops as $k) { ! ?> ! <div class="row"> ! <?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"]); ?>"/> ! <span class="block label"><?php echo ucfirst($k["name"]); ?></span> ! </a> ! <div class="data">Drops <?php echo renderAmount($k["quantity"]); ?></div> ! <div class="data">Probability: <?php echo $k["probability"]; ?>%</div> ! </div> ! <?php ! } ! ?> ! </div> ! </div> ! ! <?php ! endBox(); ! ! ! /* ! * Obtain data from database ! */ ! $m->fillKillKilledData(); ! ! startBox(ucfirst($m->name)." killed by players, per day"); ! $data=''; ! foreach($m->kills as $day=>$amount) { ! $date = date('M-d', time() - $day * 86400); ! $data .= $date . '_' . $amount . ','; ! } ! ?> ! <img style="padding: 4px; border: 1px solid black;" src="/bargraph.php?data=<?php echo $data; ?>" alt="<?php echo $data; ?>" title="Killed creature" > ! <?php ! endBox(); ! ! startBox("Players killed by ".$m->name.", per day"); ! $data=''; ! foreach($m->killed as $day=>$amount) { ! $date = date('M-d', time() - $day * 86400); ! $data.= $date . '_' . $amount . ','; ! } ! ?> ! <img style="padding: 4px; border: 1px solid black;" src="/bargraph.php?data=<?php echo $data; ?>" alt="<?php echo $data; ?>" title="Killed Players" > ! <?php ! endBox(); ! ?> ! <div style="margin-bottom: 48px;"></div> ! <?php ! } ! } ! } } --- 1,184 ---- ! <?php ! ! function printRespawn($turns) { ! return round($turns *0.3/60,2); ! } ! ! function renderAmount($amount) { ! $amount=str_replace("[","",$amount); ! $amount=str_replace("]","",$amount); ! list($min,$max)=explode(",",$amount); ! ! if($min!=$max) { ! return "between $min and $max."; ! } else { ! return "exactly $min."; ! } ! } class MonsterPage extends Page { ! private $name; ! private $monsters; ! private $isExact; ! private $found; ! ! public function __construct() { ! $this->name = preg_replace('/_/', ' ', $_REQUEST['name']); ! $this->isExact = isset($_REQUEST['exact']); ! $this->monsters = getMonsters(); ! ! // does this name exist? ! foreach($this->monsters as $m) { ! if($m->name==$this->name) { ! $this->found = true; ! } ! } ! ! } ! ! ! 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"; ! if (!$this->found) { ! echo '<meta name="robots" content="noindex">'."\n"; ! } ! } ! function writeContent() { ! ! if (!$this->found) { ! startBox("No such Creature"); ! ?> ! There is no such creature at Stendhal.<br> ! Please make sure you spelled it correctly. ! <?php ! endBox(); ! return; } ! ! foreach($this->monsters as $m) { ! /* If name of the creature match or contains part of the name.*/ ! if($m->name==$this->name || (!$this->isExact and strpos($m->name, $this->name) != false)) { ! startBox("Detailed information"); ! ?> ! <div class="creature"> ! <div class="name"><?php echo ucfirst($m->name); ?></div> ! <img class="creature" src="<?php echo $m->gfx; ?>" alt=""> ! <div class="level">Level <?php echo $m->level; ?></div> ! <div class="xp">Killing it will give you <?php echo $m->xp; ?> XP.</div> ! <div class="respawn">Respawns on average in <?php echo printRespawn($m->respawn); ?> minutes.</div> ! <div class="description"> ! <?php ! if($m->description=="") { ! echo 'No description. Would you like to <a href="http://sourceforge.net/tracker/?func=add&group_id=1111&atid=301111">write one</a>?'; ! } else { ! echo $m->description; ! } ! ?> ! </div> ! ! <div class="table"> ! <div class="title">Attributes</div> ! <?php ! foreach($m->attributes as $label=>$data) { ! ?> ! <div class="row"> ! <div class="label"><?php echo strtoupper($label); ?></div> ! <div class="data"><?php echo $data; ?></div> ! </div> ! <?php ! } ! ?> ! </div> ! ! <?php if (count($m->susceptibilities) > 0) {?> ! <div class="table"> ! <div class="title">Resistances</div> ! <?php ! foreach($m->susceptibilities as $label=>$data) { ! ?> ! <div class="row"> ! <div class="label"><?php echo strtoupper($label); ?></div> ! <div class="data"><?php echo $data; ?>%</div> ! </div> ! <?php ! } ! ?> ! </div> ! <?php }?> ! ! <div class="table"> ! <div class="title">Creature drops</div> ! <?php ! foreach($m->drops as $k) { ! ?> ! <div class="row"> ! <?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"]); ?>"/> ! <span class="block label"><?php echo ucfirst($k["name"]); ?></span> ! </a> ! <div class="data">Drops <?php echo renderAmount($k["quantity"]); ?></div> ! <div class="data">Probability: <?php echo $k["probability"]; ?>%</div> ! </div> ! <?php ! } ! ?> ! </div> ! </div> ! ! <?php ! endBox(); ! ! ! /* ! * Obtain data from database ! */ ! $m->fillKillKilledData(); ! ! startBox(ucfirst($m->name)." killed by players, per day"); ! $data=''; ! foreach($m->kills as $day=>$amount) { ! $date = date('M-d', time() - $day * 86400); ! $data .= $date . '_' . $amount . ','; ! } ! ?> ! <img style="padding: 4px; border: 1px solid black;" src="/bargraph.php?data=<?php echo $data; ?>" alt="<?php echo $data; ?>" title="Killed creature" > ! <?php ! endBox(); ! ! startBox("Players killed by ".$m->name.", per day"); ! $data=''; ! foreach($m->killed as $day=>$amount) { ! $date = date('M-d', time() - $day * 86400); ! $data.= $date . '_' . $amount . ','; ! } ! ?> ! <img style="padding: 4px; border: 1px solid black;" src="/bargraph.php?data=<?php echo $data; ?>" alt="<?php echo $data; ?>" title="Killed Players" > ! <?php ! endBox(); ! ?> ! <div style="margin-bottom: 48px;"></div> ! <?php ! } ! } ! } } |