Home About Us Ministries Staff Resources Silver Lake Churches News Calendar Links

FIDO*

| Headlines | Church News | Classifieds | This Week | This Month | ConnTact | Video | Blogs | ConferenceCast | Disaster Response | Archive | Submissions

News Briefs

What's New, and What's Brief

= CURDATE()) ORDER BY cnews_date DESC"; if($number != 0 and $number != '') $query .= " LIMIT $number"; # Run the query if(!($result = @ mysql_query($query, $connection))) showerror(); if(mysql_num_rows($result) == 0) $thereturn = '' . "\n\n"; else { $thereturn = ''; $thereturn .= "\n"; $thereturn .= '' . '

CT UCC Churches in the News

' . "\n"; $thereturn .= "\n\n"; while ($thisheadline = @ mysql_fetch_array($result)) { $churchid = $thisheadline['cnews_cid']; $churchinfo = sitefetchchurchinfo($churchid); $churchname = $churchinfo['church_shortname']; $thereturn .= '

'; $thereturn .= '' . $thisheadline['cnews_title'] . ' -- ' . $churchname . '

' . "\n\n"; } $thereturn .= '

More

' . "\n\n"; $thereturn .= "\n\n"; } echo $thereturn; } function sitefetchchurchinfo($churchid) { include '/Library/WebServer/Documents/fidodb.inc'; $query = "SELECT * FROM churches WHERE (church_number = $churchid)"; # Connect to DBMS if(!($connection = @ mysql_connect($hostName, $username, $password))) die("Could not connect to database"); if(!mysql_select_db($databaseName, $connection)) showerror(); # Run the query if(!($result = @ mysql_query($query, $connection))) showerror(); return mysql_fetch_array($result); } function clean($input, $maxlength) { $input = substr($input, 0, $maxlength); $input = EscapeShellCmd($input); return($input); } function fixdblquotes($input) { $input = preg_replace("/''/", "'", $input); $input = preg_replace('/""/', '"', $input); $input = preg_replace('//', '“', $input); $input = preg_replace('//', '”', $input); $input = preg_replace('//', '–', $input); $input = preg_replace('//', '’', $input); $output = preg_replace('/ /', '
', $input); return($output); } function siteprintnewsfeed($feed) { # Argument is a feed URL # Call between tags require 'XML/RSS.php'; $feeddisplay = ''; $rss =& new XML_RSS($feed); $rss->parse(); $channelinfo = $rss->getChannelInfo(); $channeltitle = $channelinfo['title']; $channellink = $channelinfo['link']; $channeldesc = $channelinfo['description']; $feeddisplay .= "\n\n\n\n\n\n\n"; return $feeddisplay; } function reformphone($phonenum) { # Argument is a ten digit phone number with or without existing punctuation # Returns number with period separators: xxx.xxx.xxxx $newnum = preg_replace('|\(?(\d\d\d)\)?[ -/]?(\d\d\d)-(\d\d\d\d)|', '$1.$2.$3', $phonenum); return $newnum; } function sitenewslist($pagekeys, $pagetitle) { include '/Library/WebServer/Documents/mscdb.inc'; $rightnow = time(); $comparedate = date('Y-m-d', $rightnow); if(!($connection = @ mysql_connect($hostName, $username, $password))) die("Could not connect to database"); if(!mysql_select_db($databaseName, $connection)) showerror(); $keycounter = 0; foreach($pagekeys as $keyword) { if ($keycounter > 0) $wherebuild .= " OR news_keywords LIKE '%$keyword%'"; else $wherebuild .= "news_keywords LIKE '%$keyword%'"; $keycounter ++; } $pagequery = "SELECT * FROM news WHERE(($wherebuild) AND news_archivedate >= CURDATE()) ORDER BY IF(news_frontpageindex IS NULL,1,0), news_frontpageindex ASC, news_date DESC"; # Run the query if(!($pageresult = @ mysql_query($pagequery, $connection))) showerror(); # If no stories found if(mysql_num_rows($pageresult) < 1) echo ""; else { echo "\n\n"; } } function siteeventslist($pagekeys, $pagetitle) { include '/Library/WebServer/Documents/mscdb.inc'; if(!($connection = @ mysql_connect($hostName, $username, $password))) die("Could not connnect to database"); if(!mysql_select_db($databaseName, $connection)) showerror(); $rightnow = time(); $comparedate = date('Y-m-d', $rightnow); $comparetime = date('H:i', $rightnow); $timequeryline = "ev_datetopull >= '" . $comparedate . "' AND ev_approved='1'"; $keycounter = 0; foreach($pagekeys as $keyword) { if ($keycounter > 0) $wherebuild .= " OR ev_keywords LIKE '%$keyword%'"; else $wherebuild .= "ev_keywords LIKE '%$keyword%'"; $keycounter ++; } $query = "SELECT ev_id, ev_textdate, ev_title, ev_contents FROM events WHERE ($timequeryline AND ($wherebuild)) ORDER BY ev_eventdate ASC, ev_eventtime ASC LIMIT 4"; # Run the query if(!($result = @ mysql_query($query, $connection))) showerror(); if(mysql_num_rows($result) < 1) echo "\n"; else { echo "\n"; echo "\n\n"; } } function siteresourceslist_1key($key, $title) { # Generate a list of resources for a single keyword include '/Library/WebServer/Documents/mscdb.inc'; if(!($connection = @ mysql_connect($hostName, $username, $password))) die("Could not connnect to database"); if(!mysql_select_db($databaseName, $connection)) showerror(); $query = "SELECT res_id, res_index, res_title, res_type, res_link FROM resources WHERE (res_keywords LIKE '%$key%') ORDER BY res_index"; # Run the query if(!($result = @ mysql_query($query, $connection))) showerror(); if(mysql_num_rows($result) < 1) echo "\n"; else { echo "\n"; echo "\n\n"; } } function genchurchoptlist_num() { # Generate a list of churches for the pull-down list # Connect to DBMS include 'fidodb.inc'; if(!($connection = @ mysql_connect($hostName, $username, $password))) die("Could not connect to database"); if(!mysql_select_db($databaseName, $connection)) showerror(); $churchlistquery = "SELECT church_number,church_shortname FROM churches ORDER BY church_shortname"; # Run the query if(!($churchlistresult = @ mysql_query($churchlistquery, $connection))) showerror(); $thechurchoptionlist = ""; while ($churchrow = @ mysql_fetch_array($churchlistresult)) { $thisoption = "\n"; $thechurchoptionlist .= $thisoption; } echo $thechurchoptionlist; } function genchurchoptlist_name() { # Generate a list of churches for the pull-down list # Connect to DBMS include 'fidodb.inc'; if(!($connection = @ mysql_connect($hostName, $username, $password))) die("Could not connect to database"); if(!mysql_select_db($databaseName, $connection)) showerror(); $churchlistquery = "SELECT church_number,church_shortname FROM churches ORDER BY church_shortname"; # Run the query if(!($churchlistresult = @ mysql_query($churchlistquery, $connection))) showerror(); $thechurchoptionlist = ""; while ($churchrow = @ mysql_fetch_array($churchlistresult)) { $thisoption = "\n"; $thechurchoptionlist .= $thisoption; } echo $thechurchoptionlist; } function sitestaffdisplay($keyword) { include 'mscdb.inc'; # Connect to DBMS if(!($connection = @ mysql_connect($hostName, $username, $password))) die("Could not connect to database"); if(!mysql_select_db($databaseName, $connection)) showerror(); $query = "SELECT * FROM staffdivs,staff WHERE (staffdivs.staffdivs_index = staff.staff_divisionindex AND staff.staff_keywords LIKE '%$keyword%') ORDER BY staff_divindex ASC"; # Run the query if(!($staffresult = @ mysql_query($query, $connection))) showerror(); # Display the results echo "\n\n"; $staffdisplay = ''; while($staffmember = @ mysql_fetch_array($staffresult)) { $staffnumber = $staffmember['staff_id']; if($staffmember['staff_middlename'] == '') $name = $staffmember['staff_firstname'] . ' ' . $staffmember['staff_lastname']; else $name = $staffmember['staff_firstname'] . ' ' . $staffmember['staff_middlename'] . ' ' . $staffmember['staff_lastname']; $staffphone = $staffmember['staff_officephone']; $staffofcphone = substr($staffphone,0,3) . '.' . substr($staffphone,3,3) . '.' . substr($staffphone,6,4); $staffext = $staffmember["staff_officeextension"]; if($staffext != '') $staffofcphone = $staffofcphone . ' x' . $staffext; $stafftitle = $staffmember['staff_title']; $staffemail = $staffmember['staff_email']; $staffline = "\n\n"; $staffdisplay .= $staffline; } echo $staffdisplay; } function sitenewsbriefs($count, $key) { # This function displays linked stories from newsbriefs # First parameter is how many to display # Second parameter is a single keyword for searching include 'mscdb.inc'; $rightnow = time(); $comparedate = date('Y-m-d', $rightnow); if(!($connection = @ mysql_connect($hostName, $username, $password))) die("Could not connect to database"); if(!mysql_select_db($databaseName, $connection)) showerror(); $briefquery = "SELECT * FROM newsbrief WHERE (newsb_datetopull >= '" . $comparedate . "' AND newsb_keywords LIKE '%$key%') ORDER BY newsb_date DESC LIMIT $count"; # Run the query if(!($briefresult = @ mysql_query($briefquery, $connection))) showerror(); # If no stories found if(mysql_num_rows($briefresult) == 0) echo "\n\n\n"; else { echo "\n\n"; } } function sitekeyednewslist($count, $key) { include 'mscdb.inc'; $rightnow = time(); $comparedate = date('Y-m-d', $rightnow); if(!($connection = @ mysql_connect($hostName, $username, $password))) die("Could not connect to database"); if(!mysql_select_db($databaseName, $connection)) showerror(); $newsquery = "SELECT * FROM news "; $newsquery .= "WHERE (news_keywords LIKE '%$key%') ORDER BY IF(news_frontpageindex IS NULL,1,0), news_frontpageindex ASC, news_date DESC"; if($count != '') $newsquery .= ' LIMIT ' . $count; # Run the query if(!($newsresult = @ mysql_query($newsquery, $connection))) showerror(); # If no stories found if(mysql_num_rows($newsresult) == 0) echo "\n\n\n"; else { while ($storyfound = @ mysql_fetch_array($newsresult)) { $storyheadline = fixdblquotes($storyfound["news_headline"]); $storydateline = $storyfound["news_dateline"]; $storyteaser = fixdblquotes($storyfound["news_teaser"]); $storyid = $storyfound["news_id"]; $storyrawdate = $storyfound["news_date"]; $storydate = substr($storyrawdate, 5, 2) . "/" . substr($storyrawdate, 8, 2) . "/" . substr($storyrawdate, 0, 4); ?>

$storyheadline

\n"; echo "

$storydateline -- $storyteaser $storydate

"; echo "\n\n"; } echo '

' . 'Click here for more stories

'; } } function sitecountdown($targetdate) { # $targetdate is an epoch timestamp $rightnow = mktime(); $diff_seconds = $targetdate - $rightnow; $diff_days = floor($diff_seconds/86400); if($diff_days > 0) return $diff_days; else return 0; } ?>
\n"; $feeddisplay .= "

News Feed: $channeltitle

"; $feeddisplay .= "
\n"; $feeddisplay .= "

$channeldesc

\n"; $storycount = 0; foreach ($rss->getItems() as $item) { $feeddisplay .= '

' . $item['title'] . "

\n"; $storycount++; if($storycount >= 6) break; } $feeddisplay .= "
\n"; echo "

$pagetitle News

"; echo "
\n"; while ($thisstory = @ mysql_fetch_array($pageresult)) { $storyheadline = $thisstory['news_headline']; $storydateline = $thisstory['news_dateline']; $storyid = $thisstory['news_id']; $storyrawdate = $thisstory["news_date"]; $storydate = substr($storyrawdate, 5, 2) . "/" . substr($storyrawdate, 8, 2) . "/" . substr($storyrawdate, 0, 4); echo "

" . "$storyheadline

\n"; } echo "
\n"; echo "

$pagetitle Events

\n"; echo "
\n"; while($eventfound = @ mysql_fetch_array($result)) { $eventtitle = fixdblquotes($eventfound["ev_title"]); $eventdatetime = $eventfound["ev_textdate"]; $eventdesc = fixdblquotes($eventfound["ev_contents"]); $eventwords = explode(" ", $eventdesc); for($wordcount=0; $wordcount<10; $wordcount++) { $eventteaserwords[$wordcount] = $eventwords[$wordcount]; } $eventteaser = implode($eventteaserwords, " "); $eventteaser = chop($eventteaser); $eventid = $eventfound["ev_id"]; echo "

$eventtitle
\n"; echo "$eventdatetime

"; echo "\n\n"; } echo "
\n"; echo "

$title Resources

\n"; echo "
\n"; while($resource = @ mysql_fetch_array($result)) { $restitle = $resource['res_title']; $resid = $resource['res_id']; $restype = $resource['res_type']; $reslink = $resource['res_link']; // echo "

" // . $restitle . ": " . $restype // . "

\n"; // if(substr($reslink,0,7) == 'http://') $resourcelinked = '' . $restitle . ': ' . $restype . ''; else $resourcelinked = '' . $restitle . ': ' . $restype . ''; echo "

" . $resourcelinked . "

\n"; } echo "

Staff

\n"; $staffline .= "$name" . "
\n"; $staffline .= "$stafftitle
\n"; $staffline .= "$staffofcphone
\n"; $staffline .= "$staffemail\n"; $staffline .= "
\n"; while ($storyfound = @ mysql_fetch_array($briefresult)) { $storyheadline = fixdblquotes($storyfound["newsb_headline"]); $storydateline = $storyfound["newsb_dateline"]; $storyteaser = fixdblquotes($storyfound["newsb_content"]); $storyid = $storyfound["newsb_id"]; $storyrawdate = $storyfound["newsb_date"]; $storydate = substr($storyrawdate, 5, 2) . "/" . substr($storyrawdate, 8, 2) . "/" . substr($storyrawdate, 0, 4); echo "

$storyheadline

\n"; echo "\n\n"; } echo "