isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer'); // Connect to DB //connectDb('mysql.ezd3.com','test','test','yabbsharedjourney'); $db_link = connectDb(DB_HOST,DB_USER,DB_PWD,DB_NAME); // Get page name $page = parseUrl($_SERVER['REQUEST_URI']); // Check if URL has an uppercase letter and redirect to lowercase URL's checkUpperURL($page); // Remove 'fb_xd_fragment' in URL and redirect (301) redirect_fb_fragment($_SERVER['REQUEST_URI'],$page); // Default template $template = (isGenericPage($page)) ? 'template/generic.tpl' : 'template/article.tpl'; // Proxy Exception proxyException($page); // For non-database content switch (true) { // Contact Form case ($page == 'contact_us.html'): include_once 'scripts/contact.php'; $tmp['notice'] = $notice; $tmp['captcha'] = recaptcha_get_html($publickey); $content['content'] = $row['content']; $content['content'] .= return_template($tmp,'template/contact.tpl'); break; // Add Links case ($page == 'add_link.html'): include_once 'scripts/add_link.php'; $content['content'] = $output; break; // View Links //case ($page == 'links.html'): // include_once 'scripts/links.php'; // $content['content'] = $output; // break; case (strstr($page,'forums') || strstr($page,'yabbse')): header("Cache-Control: no-cache, must-revalidate"); header("Expires: Wed, 26 Feb 1992 05:00:00 GMT"); $template = 'template/forum.tpl'; include_once 'forums/index.php'; break; case (strstr($page,'fertility_news')): header('Location: /',false,301); include_once 'scripts/news.php'; $content['title'] = "Fertility News: {$news_title}"; $tmp['navigation'] = left_nav($main_id,true); $content['content'] = wrap($output,$tmp); break; case ($page == 'definitions.html'): include_once 'scripts/infertility_definitions.php'; $content['title'] = 'Infertility Definitions Listing'; $content['content'] = return_template($tmp,'template/definitions.tpl'); break; case ($page == 'shared_experiences.html'): include_once 'scripts/shared_experiences.php'; $content['title'] = 'Shared Experiences'; $tmp['navigation'] = left_nav($main_id,true); $content['content'] = wrap(return_template($tmp,'template/shared_experiences.tpl'),$tmp); break; case (strstr($page,'shared_experiences/')): include_once 'scripts/shared_experience.php'; $tmp['navigation'] = left_nav($main_id,true); $content['content'] = wrap(return_template($tmp,'template/shared_experience.tpl'),$tmp); break; case ($page == 'add_your_experience.html'): include_once 'scripts/add_experience.php'; $content['title'] = 'Share Your Experience'; $tmp['navigation'] = left_nav($main_id,true); $content['content'] = (return_template($tmp,'template/add_experience.tpl')); break; case ($page == 'success_stories/first_attempt_at_ivf.htm'): _404(); break; case (strstr($page,'success_stories/')): include_once 'scripts/success_story.php'; $tmp['navigation'] = left_nav($main_id,true); $content['content'] = wrap(return_template($tmp,'template/success_story.tpl'),$tmp); break; case ($page == 'success_stories.html'): include_once 'scripts/success_stories.php'; $content['title'] = 'Success Stories'; $tmp['navigation'] = left_nav($main_id,true); $content['content'] = wrap(return_template($tmp,'template/success_stories.tpl'),$tmp); break; case ($page == 'add_your_story.html'): include_once 'scripts/add_story.php'; $content['title'] = 'Add Your Success Story'; $content['content'] = (return_template($tmp,'template/add_story.tpl')); break; // Comment Pages case ($level0 == 'comments'): include_once 'comments/comments.php'; break; default: // Get content from DB //$query = "SELECT * FROM content WHERE name = '$page' AND stat"; $query = "SELECT * FROM content WHERE name = '$page'"; $result = mysql_query($query); // If page does not exist, return 404 header if (!($row = @mysql_fetch_assoc($result))) { _404(); } else if( $row['stat'] == 0 ) { header('Location: '.$row['redirect_url'],true,301); } else { mysql_free_result($result); // Store data into hash array 'content' $content = array( 'id' => $row['id'], 'p_id' => $row['p_id'], 'title' => $row['title'], 'nav_title' => $row['nav_title'], 'keywords' => $row['keywords'], 'description' => $row['description'], ); } // Main Category ID if ($content['p_id'] == -1) $main_id = 0; else $main_id = ($content['p_id'] == 0) ? $content['id'] : mainID($content['p_id']); switch(true) { // Home Page case ($page == 'index.html'): $template = 'template/home.tpl'; $content['home-forum-topics'] = homeForumTopics(); $content['home-fertility-news'] = homeFertilityNews(); $content['content'] = $row['content']; break; default: $content['navigation'] = left_nav($main_id); if ($main_id == $content['id']) $content['related-articles'] = relatedArticles($content['id']); // 468x15 Article Link Units //$content['728x15-article-bot'] = file_get_contents('google/728x15_article_bot.txt'); // Comments at the bottom of article pages $content['comments'] = comments($content['id']); //second level links for left nav $content['navigation_2level'] = left_nav_second_level($main_id); // Breadcrumbs $content['breadcrumb'] = breadcrumb($content['p_id'],$breadcrumb); $content['forumThreads'] = forumThreads($main_id,$content['p_id']); // ih - Table of content in article $total_level_count = level_count($content['p_id'],$level_count); $total_count = explode("/", $total_level_count); if(count($total_count) == 4 ){ $curr = 1; $content['navigation_clevel'] = content_level($content['id'],$curr); } else if(count($total_count) == 5){ $curr = $content['id']; $content['navigation_clevel'] = content_level($content['p_id'],$curr); } // ih - end // Fertility Forms 300px //include_once('scripts/fertility_clinics.php'); //$content['fertility-form-small'] = return_template($tmp,'template/fertility_form_small.tpl'); $mobilecontent = $row['content']; function isMobile() { return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]); } if(isMobile()){ $content['content'] = mobileContent($mobilecontent); } else{ $content['content'] = (orphan($content['p_id'])) ? $row['content'] : wrap($row['content']); } //$content['content'] = ($content['p_id'] == -1) ? $row['content'] : wrap($row['content'],$tmp); break; } } // Main Category ID if ($content['p_id'] == -1) $main_id = 0; else $main_id = ($content['p_id'] == 0) ? $content['id'] : mainID($content['p_id']); // Top Navigation $content['top-nav'] = top_nav($main_id); // Sources used in the Ad Server $zones['source'] = getSource($main_id); // Copyright date $content['copyright-date'] = date('Y',time()); //get dfp ad code $content['dfp'] = getSectionAd($content['nav_title'], $main_id); // 160x250 Left Top $content['google-left-top'] = file_get_contents('google/google_left_top.tpl'); $content['160x90-left-nav'] = file_get_contents('google/160x90_left_nav.tpl'); // 160x600 Left ROS $content['160x600-left-openx'] = return_template($zones,'advertisement/zones/160x600_left_ros.tpl'); // 160x600 Left ROS $content['300x250-right-openx'] = return_template($zones,'advertisement/zones/300x250_right_ros.tpl'); // 160x600 Right ROS //$content['160x600-right-ros'] = return_template($zones,'advertisement/zones/160x600_right_ros.tpl'); // 160x600 Right Forum //$content['160x600-right-forum'] = return_template($zones,'advertisement/zones/160x600_forum_right.tpl'); // 160x600 Left Forum $content['160x600-left-forum'] = return_template($zones,'advertisement/zones/160x600_forum_left.tpl'); //*** START Sonobi Media Ads ***// // 728x90 Leaderboard Home $content['728x90-leaderboard-home'] = file_get_contents('advertisement/sonobi/728x90_leaderboard_home.tpl'); // 728x90 Leaderboard Home if ($deviceType == "tablet") $content['728x90-leaderboard-bottom'] = file_get_contents('advertisement/zones/728x90_bottom_ad_tablet.tpl'); else $content['728x90-leaderboard-bottom'] = file_get_contents('advertisement/zones/728x90_bottom_ad.tpl'); // 728x90 Leaderboard ROS $content['728x90-leaderboard-ros'] = file_get_contents('advertisement/sonobi/728x90_leaderboard_ros.tpl'); // 300x250 Right Home $content['300x250-right-home'] = file_get_contents('advertisement/sonobi/300x250_right_home.tpl'); // 300x250 Right ROS $content['300x250-right-ros'] = file_get_contents('advertisement/sonobi/300x250_right_ros.tpl'); // 300x250 Right ROS Down $content['300x250-right-ros-down'] = file_get_contents('advertisement/zones/300x250_right_ros_down.tpl'); // 160x600 Left Home $content['160x600-left-home'] = file_get_contents('advertisement/sonobi/160x600_left_home.tpl'); // 160x600 Left ROS $content['160x600-left-ros'] = file_get_contents('advertisement/sonobi/160x600_left_ros.tpl'); //*** END Sonobi Media Ads ***// $content['source'] = getSource($main_id); // Share This Buttons $content['addThis'] = file_get_contents('template/add-this.tpl'); $content['addThis'] = file_get_contents('template/addThis.tpl'); //forum most discussed $content['forumThreads'] = forumThreads($main_id,$content['p_id']); // merge data and template and return to $html for output $html = return_template($content,$template); // Output HTML page echo $html; ?>