\n"; while ($row=@mysql_fetch_assoc($result)) { $active = ($row['id'] == $main_id) ? "style=\"text-decoration: underline;\"" : ""; $last = ($row['id'] == $lastID) ? " style=\"border-right:none\"" : ""; $out .= "{$row['nav_title']}\n"; } $out .= "\n"; mysql_free_result($result); return $out; } // Top Sub Navigation function top_sub_nav($main_id) { $zones['source'] = getSource($main_id); $query="SELECT id , nav_title, name FROM content WHERE p_id = 0 AND stat ORDER BY nav_order"; if (!($result=@mysql_query($query))) die("Fatal Error: [top_sub_nav] " . mysql_error()); $out = "
\n"; while ($row=@mysql_fetch_assoc($result)) { $last = ($row['id'] == $lastID) ? " style=\"border-right:none\"" : ""; if ($row['id'] == $main_id) { $out .= "\n\n"; } } $out .= "
\n"; mysql_free_result($result); return $out; } // Left Navigation function left_nav($main_id) { $query="SELECT id ,nav_title, name FROM content WHERE p_id = 0 AND stat ORDER BY nav_order"; if (!($result=@mysql_query($query))) die("Fatal Error: " . mysql_error()); $out = "\n"; mysql_free_result($result); return $out; } function sections($parent, $deep) { global $content; $query="SELECT id, nav_title, name FROM content WHERE p_id='{$parent}' AND stat ORDER BY nav_order"; if (($deep < 2) && ($result=@mysql_query($query))) { while ($row=mysql_fetch_assoc($result)) { $active = (($row['id'] == $content['p_id']) || ($row['id'] == $content['id'])) ? " style=\"font-weight: bold; text-decoration: underline;\"" : ""; if ($deep == 1) $out .= "
  • " . $row['nav_title'] . "
  • \n"; else { $out .= "
  • " . $row['nav_title'] . "\n"; $out .= "\n
  • \n"; } mysql_free_result($result); } return $out; } function orphan($p_id) { return ($p_id == -1) ? true : false; } function get_articles($parent) { global $content; $query="SELECT id, nav_title, name FROM content WHERE p_id = {$parent} AND stat ORDER BY nav_order"; if (!($result=@mysql_query($query))) die("Fatal Error: [get_articles] Please contact the administrator."); while ($row=@mysql_fetch_assoc($result)) { $active = ($row['id'] == $content['id']) ? ' style="background-color:#de5362"' : ''; $out .= "
  • {$row[nav_title]}
  • \n"; } mysql_free_result($result); return $out; } // Wrap content with google box ads function wrap($content) { $google_article_top = file_get_contents('google/google_article_top.txt'); $google_article_bot = file_get_contents('google/google_article_bot.txt'); // Parse heading to insert NetSeer ad below it. $n = strpos($content,'')+6; $npre = substr($content,0,$n); $npost = substr($content,$n); $content = $npre.$npost; $s = strpos($content,'

    ',(strpos($content,'

    ')+1)); $pre = substr($content,0,$s); $post = substr($content,$s); // Parse content to allow chitika ad to display below the upper google adsense $i = strpos($post,'

    ',(strpos($post,'

    ')+1)); $mid = substr($post,0,$i); $end = substr($post,$i); $content = $pre.$google_article_top.$mid.$end.$google_article_bot; return $content; } // Get the main section id of the article function mainID($p_id) { $query = "SELECT id, p_id FROM content WHERE id = {$p_id} AND stat"; if (!($result=@mysql_query($query))) die("Fatal Error: [mainID] Please contact the administrator."); if (($row = mysql_fetch_assoc($result)) && $row['p_id'] != 0) { mysql_free_result($result); return(mainID($row['p_id'])); } mysql_free_result($result); return ($row['id']) ? $row['id'] : 0; } // Custom Form Validator function validateForm($data) { foreach($data as $key => $field) { list($type,$value) = split(':',$field); switch($type) { case 'required': if (empty($value)) return $key . ' is a required field'; break; case 'email': if(!is_email($value)) return 'You entered an invalid email address.'; break; } } } // Get source string for banners function getSource($id) { $sources = array( // Source Names ); return ($sources[$id]) ? $sources[$id] : 'womenshealth'; } // News function news($table,$threads,$limit) { $news = array(); $query = "SELECT * FROM {$table} WHERE stat ORDER BY `date` desc LIMIT {$threads}, {$limit}"; if (!($result = mysql_query($query)) || (mysql_num_rows($result) < 1)) _404(); while($row = mysql_fetch_assoc($result)) { $i = $row['id']; $news[$i]['id'] = $row['id']; $news[$i]['title'] = $row['url_title']; $news[$i]['content'] = $row['content']; $news[$i]['date'] = $row['date']; } return $news; } // Return Total Items in a news table function totalNewsItems($table) { $query = "SELECT COUNT(*) AS `totalitems` FROM {$table} WHERE stat"; $result = mysql_query($query); if($record=mysql_fetch_object($result)) return $record->totalitems; else return 0; } // Home page News function homePageNews() { $query = "SELECT * FROM gynob_news WHERE stat ORDER BY `date` desc LIMIT 6"; if (!($result = mysql_query($query)) || (mysql_num_rows($result) < 1)) _404(); $out .= "\n"; while ($row = mysql_fetch_assoc($result)) { $row['title'] = ucwords($row['title']); $row['date'] = date("M d, Y",$row['date']); $out .= " \n"; } $out .= "
    {$row[url_title]}{$row[date]}
    \n"; return $out; } // Forum Topics function getForumTopics() { $query="SELECT id, topic_title AS name, topic_url AS url, descr AS descr FROM forum_topics"; if(!($result=mysql_query($query))) _404(); else { $out = '

    '; } return $out; } // Get the number of posts in a topic function getTopicTotalPosts($topicID) { $query = "SELECT COUNT(*) AS total FROM forum_topics topics, forum_threads threads, forum_posts posts WHERE posts.thread_id = threads.id AND threads.topic_id = topics.id AND topics.id = {$topicID} GROUP BY topics.id"; $result=mysql_query($query); if (!($row = mysql_fetch_assoc($result))) return 0; else return $row['total']; } // List of pages that uses a generic template // Returns true if the page exists function isGenericPage($page) { $genericPages = array( 'searchresults.html', 'demographics.html', ); return (in_array($page,$genericPages)) ? true : false; } // Return the salt for crypting function salt() { return 'suite212preg_info004'; } // Return Top 7 Recent Articles function getRecentArticles() { $query="SELECT name, nav_title FROM content WHERE p_id != -1 AND stat ORDER BY id DESC LIMIT 7"; if(!($result=mysql_query($query))) _404(); else while ($record=mysql_fetch_object($result)) $out .= "

    name}\">{$record->nav_title}

    \n"; return $out; } // Pagination function getNewsPaginationString($page = 1, $totalitems, $limit = 15, $targetpage = '/', $pagestring) { // DEFAULTS $adjacents = 8; // VARS $prev = $page - 1; $next = $page + 1; $firstpage = 1; $lastpage = ceil($totalitems / $limit); $fiop = ($limit * $page) - $limit + 1; //# of first item displayed in current page $liop = min($limit * $page, $totalitems); //# of last item displayed in current page /* DRAW PAGINATOR */ //$pagination = "\n"; } $pagination = "
    $pagination
    \n"; return $pagination; } // Insert email to `emails` table. function addEmail($email) { $query = "SELECT * FROM emails WHERE email = '{$email}'"; $result = mysql_query($query); if ($row = mysql_fetch_assoc($result)) return false; else { $IP = getenv('REMOTE_ADDR'); $query = "INSERT INTO(email,ip,submitdate) VALUES('{$email}','{$IP}',unix_timestamp())"; $result = mysql_query($query); return true; } } ?>