}
     require_once PATH_FACEBOOK . "/pages/pageTeam.class.php";
     $db->log($userid);
     $code = pageTeam::fetchTeamFriendList($fb->db, $userid, $state, true);
     break;
 case 'fetchHomePage':
     // replace just storyList
     /*
      * 			  	if (isset($_GET['userid']))
     						$userid=$_GET['userid'];
     					else
     						$userid='default';		
     */
     require_once PATH_CORE . "/classes/home.class.php";
     $homeObj = new home();
     $code = $homeObj->fetchHomePage($currentPage);
     break;
 case 'dialogPublish':
     $error = false;
     if (isset($_GET['mode'])) {
         $mode = $_GET['mode'];
     } else {
         $mode = 'wire';
     }
     if (isset($_GET['itemid'])) {
         $itemid = $_GET['itemid'];
     } else {
         $itemid = 0;
     }
     if ($userid == 0) {
         $error = true;
 function fetch()
 {
     if (isset($_GET['currentPage'])) {
         $currentPage = $_GET['currentPage'];
     } else {
         $currentPage = 1;
     }
     // check for referral and log it
     $referid = $this->page->fetchReferral();
     if ($referid !== false) {
         $this->page->recordReferral($referid, 'referToSite');
     }
     // build the home page
     require_once PATH_CORE . '/classes/home.class.php';
     $homeObj = new home($this->db);
     require_once PATH_FACEBOOK . '/classes/actionTeam.class.php';
     $this->teamObj = new actionTeam($this->page);
     $inside .= '<div id="col_left"><!-- begin left side -->';
     $inside .= '<div id="featurePanel" class="clearfix">';
     $inside .= $this->page->buildPanelBar($this->common['FeaturedStoriesTitle'], '<a href="?p=stories&o=sponsor" onclick="switchPage(\'stories\',\'all\',\'sponsor\');return false;">More from ' . SITE_SPONSOR . ' editors</a>');
     $inside .= $homeObj->fetchFeature();
     $inside .= '</div><!--end "featurePanel"-->';
     if (defined('ADS_HOME_SMALL_BANNER')) {
         $inside .= str_replace("{ad}", '<fb:iframe src="' . URL_CALLBACK . '?p=cache&m=ad&locale=homeSmallBanner" frameborder="0" scrolling="no" style="margin:0px 5px 0px 0px;padding:0px;width:478px;height:70px;"/>', $this->common['adWrapSmallBanner']);
     }
     if (defined('ENABLE_MICRO')) {
         $inside .= $homeObj->fetchMicro($this->page);
     }
     // look for featured widget
     $this->initObjs();
     $featuredWidget = $this->fwtObj->lookupWidget('homeFeature');
     if ($featuredWidget != '') {
         $inside .= $featuredWidget;
     }
     if (defined('ENABLE_IMAGES')) {
         $inside .= $homeObj->fetchImages($this->page);
     }
     if (defined('ENABLE_STUFF')) {
         $inside .= $homeObj->fetchStuff($this->page);
     }
     if (defined('ENABLE_IDEAS')) {
         $inside .= $homeObj->fetchIdeas($this->page);
     }
     if (defined('ENABLE_ASK')) {
         $inside .= $homeObj->fetchAskQuestions($this->page);
     }
     $inside .= '<div class="panel_1">';
     $inside .= $this->page->buildPanelBar('Top News', '<a class="rss_link" onclick="quickLog(\'extLink\',\'home\',0,\'' . URL_RSS . '\');" target="_blank" href="' . URL_RSS . '">RSS</a><span class="pipe">|</span><a href="?p=postStory" onclick="switchPage(\'postStory\');return false;">Post a story</a>', 'The top stories as chosen by readers');
     $inside .= '<div id="storyList">';
     $inside .= $homeObj->fetchHomePage($currentPage);
     $inside .= '<input type="hidden" id="pagingFunction" value="fetchHomePage">';
     $inside .= '</div><!-- end storyList -->';
     $inside .= $this->page->buildPanelBar('', '<a href="#" onclick="switchPage(\'stories\');return false;">More stories</a><span class="pipe">|</span><a href="#" onclick="switchPage(\'postStory\');return false;">Post a story</a>');
     $inside .= '</div><!--end "panel_1"-->';
     $inside .= $this->teamObj->fetchLegend();
     $inside .= '</div><!-- end left side --><div id="col_right">';
     $usePromo = true;
     if ($this->page->session->isAppAuthorized == 1 or defined('REG_SIMPLE') and $this->session->isLoggedIn) {
         sscanf($this->page->session->u->dateRegistered, "%4u-%2u-%2u %2u:%2u:%2u", $year, $month, $day, $hour, $min, $sec);
         $tstampRegistered = mktime($hour, $min, $sec, $month, $day, $year);
         if ($tstampRegistered < time() - 7 * 24 * 60 * 60) {
             // after one week - use general announcement if available
             $this->initObjs();
             $annCode .= $this->wtObj->fetchWidgetsByTitle('coverAnnounce');
             if ($annCode != '') {
                 $inside .= $annCode;
                 $usePromo = false;
             }
         }
     }
     if ($usePromo) {
         $inside .= $homeObj->fetchPromo();
     }
     // display simple feedback
     if ($this->page->session->isLoaded and defined('ENABLE_SIMPLE_FEEDBACK')) {
         $inside .= $homeObj->buildFeedbackBox($this->page);
     }
     $inside .= $this->teamObj->fetchSidePanel('home');
     /*
     		if (defined('ENABLE_STORY_PANEL') AND ENABLE_STORY_PANEL===true) {
     			$cacheName='sideLeaders';
     			if ($this->templateObj->checkCache($cacheName,30)) {
     				// still current, get from cache
     				$temp=$this->templateObj->fetchCache($cacheName);
     			} else {
     				require_once(PATH_FACEBOOK.'/classes/storyPanels.class.php');
     				$this->spObj=new storyPanels($this->page);							
     				$temp=$this->spObj->fetchStoryList('rated','inside',5);
     				$temp.=$this->spObj->fetchStoryList('discussed','inside',5);				
     				$this->templateObj->cacheContent($cacheName,$temp);
     			}
     			$code.=$temp;		
     		}		
     * 
     */
     $inside .= '</div> <!-- end right side -->';
     if ($this->page->isAjax) {
         return $inside;
     }
     $code .= $this->page->constructPage('home', $inside);
     return $code;
 }