output .= $text; } function out($output = true) { if ($output) { output($this->output, true); } return appoencode($this->output, true); } function comment($text, $author, $section, $emote = 0) { $sql = "INSERT INTO `commentary` SET `author`=" . $author . ", `section`='" . $section . "', `postdate`=NOW(), `comment`='"; if (class_exists("commentary")) { // Commentary Much-In-One Bundle $sql .= $text . "', `emote`=" . ((int) $emote); } else { // Stadndardkommentarversion $sql .= "/me " . $text . "'"; } dying_query($sql, 'Fehler beim Eintragen eines Kommentars', __FILE__, __LINE__, $this); } function getOwner(){ $sql = 'SELECT `acctid` FROM `'.HAUS_KEY_TABLE.'` WHERE `owner`=1 AND `house_id`='.$this->get('house_id'); $res = dying_query($sql,'Fehler bei der Bestimmung des Besitzer dieses Hauses',__FILE__,__LINE__); $row = db_fetch_assoc($res); return $row['acctid']; } function inLink($text='',$makelink=true) { global $wvnav; $ret = 'cat=inside&house_id='.$this->get(HAUS_ID_FIELD).'&'.$text; return $makelink ? $wvnav->getLink($ret,true) : $ret; } function isUserOwner($userid=false){ if($userid === false) { global $session; $userid = $session['user']['acctid']; } return $this->getOwner() == $userid; } function inNavCat($catname) { global $wvnav; $wvnav->addCategory($catname); } function inNav($navname,$text='',$category='default') { global $wvnav; $link = $this->inLink($text,false); if (substr($category,0,8) != 'nav_cat_') $category = 'nav_cat_'.$category; $wvnav->addCategory($category); $wvnav->addNav($navname,$link,$category); } /** * Hier kann später noch wunderbar caching angesetzt werden * @cache */ function loadRooms(){ $wvnav = & sysTxt::instance(); $wvnav->save('file'); $this->rooms = array(); $sql = 'SELECT `r`.* FROM `'.HAUS_ROOMS_TABLE.'` `r` INNER JOIN `'.HAUS_EXT_TABLE.'` `e` USING (`room_id`) WHERE `e`.`'.HAUS_ID_FIELD.'` = '.$this->get(HAUS_ID_FIELD); $res = dying_query($sql,'Fehler beim Einlesen der Zimmer eines Hauses',__FILE__,__LINE__); for($i=0,$max=db_num_rows($res);$i<$max;$i++) { $row = db_fetch_assoc($res); $this->rooms[$row['room_id']] = wvRoom::_loadRoom($row,$this); } // Obligatorische Räume hinzuziehen $i = HAUS_DEFEXT_OFFSET; foreach(explode(',',HAUS_DEFEXT) as $defroom) { $this->rooms[$i] = wvRoom::_loadRoom(array('classname' =>$defroom,'room_id' =>$i),$this); $i++; } } function generateRoomNavs($excepts=array()) { $wvtxt = & sysTxt::instance(); // Nur gewünschte Räumer filtern => $rooms if(empty($this->rooms)) $this->loadRooms(); $rooms = $this->rooms; foreach($excepts as $except) { if(isset($rooms[$except])) unset($rooms[$except]); } $wvtxt->restore('file'); $this->inNavCat($wvtxt->get('nav_cat_default')); foreach($rooms as $room) { $navdata = $room->getNavData(); $this->inNav($navdata['name'],$navdata['linktxt'],$navdata['category']); } } } ?>