//type 1 home page $arr = array('lang' => $lang, 'type_id' => $typeId, 'limit' => 1); $row = $this->_model->_headerData($arr); $row = $row[0]; $typeMenu = $this->webType($typeId); if ($row['img'] == '') { $img = CONS_BASE_URL . '/' . CONS_IMAGE_DEFAULT; } else { $img = CONS_BASE_URL . '/' . IMAGE_URL . $row['img']; } $arr = array('id' => $row['id'], 'name' => strip_tags($row['name']), 'title' => strip_tags($row['title']), 'description' => strip_tags($row['description']), 'tags' => $row['tags'], 'url' => $row['url'], 'img' => $img, 'lang' => $row['lang'], 'typeID' => $typeMenu['id'], 'typeName' => $typeMenu['name'], 'rootID' => $row['id']); return $arr; } } $lang = CONS_DEFAULT_LANG; $c = new pageHome(); //$cache = $c->cacheBegin(); //if($cache==true) return true; $config = $c->_model->_config($lang); $lang_var = $c->_model->_language_var($lang); $currentPage = $c->currentHome($lang); $tagHead = $c->tagHead($currentPage['title'], $currentPage['description'], $currentPage['tags'], $currentPage['img'], $currentPage['url']); $logo = $c->logo($lang); $logoStevbros = $logo[0]; $logoPMI = $logo[1]; $logoStevbrosWhite = $logo[2]; $viewData = ob_start(); include_once 'view/web_home.php'; $viewData = ob_get_clean(); include_once 'view/web.php'; //$c->cacheEnd(); /*luu cache*/
function fetch($page = 'home', $option = '', $arg3 = '') { //$before = memory_get_usage(); // to do - most all be pared down with a function that requires file, instantiates and fetches switch ($page) { default: require_once PATH_FACEBOOK . '/pages/pageHome.class.php'; $homeObj = new pageHome($this); $code = $homeObj->fetch(); break; case 'read': require_once PATH_FACEBOOK . '/pages/pageRead.class.php'; $readObj = new pageRead($this); $code = $readObj->fetch($option, $arg3); break; case 'stories': require_once PATH_FACEBOOK . '/pages/pageStories.class.php'; $storiesObj = new pageStories($this); $code = $storiesObj->fetch($option, $arg3); break; case 'team': case 'rewards': case 'challenges': case 'challengeSubmit': case 'redeem': case 'rules': case 'winners': case 'leaders': case 'wall': $code = $this->fetchTeam('fullPage', $page, $option); break; case 'static': require_once PATH_FACEBOOK . '/pages/pageStatic.class.php'; $staticObj = new pageStatic($this); $code = $staticObj->fetch($option); break; case 'invite': // check auth for signed in, if not redirect to login require_once PATH_FACEBOOK . '/pages/pageInvite.class.php'; $inviteObj = new pageInvite($this); $code = $inviteObj->fetch(); break; case 'stuff': require_once PATH_FACEBOOK . '/pages/pageStuff.class.php'; $stuffObj = new pageStuff($this); $code = $stuffObj->fetch($option); break; case 'cards': require_once PATH_FACEBOOK . '/pages/pageCards.class.php'; $cardsObj = new pageCards($this); $code = $cardsObj->fetch($option); break; case 'media': require_once PATH_FACEBOOK . '/pages/pageMedia.class.php'; $mediaObj = new pageMedia($this); $code = $mediaObj->fetch($option); break; case 'ask': require_once PATH_FACEBOOK . '/pages/pageAsk.class.php'; $aObj = new pageAsk($this); $code = $aObj->fetch($option); break; case 'ideas': require_once PATH_FACEBOOK . '/pages/pageIdeas.class.php'; $iObj = new pageIdeas($this); $code = $iObj->fetch($option); break; case 'micro': require_once PATH_FACEBOOK . '/pages/pageMicro.class.php'; $pObj = new pageMicro($this); $code = $pObj->fetch($option, $arg3); break; case 'predict': require_once PATH_FACEBOOK . '/pages/pagePredict.class.php'; $pObj = new pagePredict($this); $code = $pObj->fetch($option, $arg3); break; case 'signup': // check auth for not anonymous require_once PATH_FACEBOOK . '/pages/pageSignup.class.php'; $signupObj = new pageSignup($this); $code = $signupObj->fetch($option); break; case 'account': require_once PATH_FACEBOOK . '/pages/pageAccount.class.php'; $accountObj = new pageAccount($this); $code = $accountObj->fetch($option); break; case 'profile': require_once PATH_FACEBOOK . '/pages/pageProfile.class.php'; $proObj = new pageProfile($this); $code = $proObj->fetch(); break; case 'links': // check auth for not anonymous require_once PATH_FACEBOOK . '/pages/pageLinks.class.php'; $linksObj = new pageLinks($this); $code = $linksObj->fetch(); break; case 'postStory': // check auth for not anonymous require_once PATH_FACEBOOK . '/pages/pagePostStory.class.php'; $psObj = new pagePostStory($this); $code = $psObj->fetch($option); break; case 'orders': // check auth for member require_once PATH_FACEBOOK . '/pages/pageOrders.class.php'; $ordersObj = new pageOrders($this); $code = $ordersObj->fetch(); break; case 'completed': // check auth for member require_once PATH_FACEBOOK . '/pages/pageCompletedChallenges.class.php'; $completedObj = new pageCompletedChallenges($this); $code = $completedObj->fetch(); break; case 'shareStory': require_once PATH_FACEBOOK . '/pages/pageShareStory.class.php'; $shareObj = new pageShareStory($this); // always a submit $code = $shareObj->process(); break; case 'contact': require_once PATH_FACEBOOK . '/pages/pageContact.class.php'; $contactObj = new pageContact($this); if ($option == 'submit') { $code = $contactObj->process($_POST); } else { $code = $contactObj->fetch(); } break; case '404': require_once PATH_FACEBOOK . '/pages/page404.class.php'; $pObj = new page404($this); $code = $pObj->fetch($_GET['msg']); break; case 'design': // for testing the design require_once PATH_FACEBOOK . '/pages/pageDesign.class.php'; $pObj = new pageDesign($this); $code = $pObj->fetch($option); exit; break; case 'admin': // for testing the design require_once PATH_FACEBOOK . '/pages/pageAdmin.class.php'; $pObj = new pageAdmin($this); $code = $pObj->fetch($option); break; /* case 'dbtest': require_once(PATH_FACEBOOK.'/pages/pageDBTest.class.php'); $dbtestObj=new pageDBTest($this); $code=$dbtestObj->fetch(); break; */ } //$after = memory_get_usage(); //$this->db->log("pages: fetch($page): memory bytes before: $before, after: $after, delta: ". ($after-$before)); return $code; }
} public function currentHome() { $typeId = 1; //type 1 home page $arr = array('lang' => $this->_lang, 'type_id' => $typeId, 'limit' => 1); $row = $this->_model->_headerData($arr); $row = $row[0]; $typeMenu = $this->webType($typeId); if ($row['img'] == '') { $img = CONS_BASE_URL . '/' . CONS_IMAGE_DEFAULT; } else { $img = CONS_BASE_URL . '/' . $typeMenu['url_img'] . $row['img']; } $arr = array('id' => $row['id'], 'name' => strip_tags($row['name']), 'title' => strip_tags($row['title']), 'description' => strip_tags($row['description']), 'tags' => strip_tags($row['tags']), 'url' => $row['url'], 'img' => $img, 'lang' => strip_tags($row['lang']), 'typeID' => $typeMenu['id'], 'typeName' => $typeMenu['name'], 'url_img' => $typeMenu['url_img'], 'url_img_thumb' => $typeMenu['url_img_thumb'], 'rootID' => $row['id']); return $arr; } } if (!isset($lang)) { $lang = CONS_DEFAULT_LANG; } $c = new pageHome($lang); $config = $c->config($lang); $language_var = $c->_model->_language_var($lang); $currentPage = $c->currentHome(); $tagHead = $c->tagHead($currentPage['title'], $currentPage['description'], $currentPage['tags'], $currentPage['img'], $currentPage['url']); $urlImg = $c->webType(); $viewData = ob_start(); include_once 'view/web_home.php'; $viewData = ob_get_clean(); include_once 'view/web.php';