=getField('events','quantity',$event_id)) $return = true; return $return; } function isEventSeniorFull($event_id) { $return = false; if (getEventVolunteerCountSenior($event_id)>=getField('events','quantity_senior',$event_id)) $return = true; return $return; } function checkDateForEvent($day,$month,$year) { global $conn; $return = ''; $sql = "SELECT id FROM events WHERE thedate='$year-$month-$day'"; $rs = mysqli_query($conn,$sql); if ($row = mysqli_fetch_assoc($rs)) { $return = 'spaces'; if (isEventStandardFull($row['id']) && isEventSeniorFull($row['id'])) { $return = 'full'; } } mysqli_free_result($rs); return $return; } function displayCalendar($month_num,$year,$highlight_day=0) { $this_day=date("j"); //If today is September 29, $day_num=29 $this_month = date("m"); //If today is September 29, $month_num=9 $this_year = date("Y"); //4-digit year $date_today = getdate(mktime(0,0,0,$month_num,1,$year)); //Returns array of date info for 1st day of this month $month_name = $date_today["month"]; //Example: "September" - to label the Calendar $first_week_day = $date_today["wday"]; //"wday" is 0-6, 0 being Sunday. This is for day 1 of this month //Calculate how many days are in the month $cont = true; $today = 27; while (($today <= 32) && ($cont)) { $date_today = getdate(mktime(0,0,0,$month_num,$today,$year)); if ($date_today["mon"] != $month_num) { $lastday = $today - 1; $cont = false; } $today++; } ?> "; for ($i=1; $i<=$first_week_day; $i++) echo ""; $firstweek = false; } if ($wday==0) echo ""; echo ''; if ($wday==6) echo ""; $wday++; $wday = $wday % 7; $day++; } while($wday <=6 ) { echo ""; $wday++; } echo "
SuMTuWThFSa
'.$day.'
"; } function getTimeDifference() { global $time_difference; if (!isset($time_difference)) $time_difference = get_timezone_offset('Europe/London') / 3600; return $time_difference; } function get_timezone_offset($remote_tz, $origin_tz = null) { if($origin_tz === null) { if(!is_string($origin_tz = date_default_timezone_get())) { return false; // A UTC timestamp was returned -- bail out! } } $origin_dtz = new DateTimeZone($origin_tz); $remote_dtz = new DateTimeZone($remote_tz); $origin_dt = new DateTime("now", $origin_dtz); $remote_dt = new DateTime("now", $remote_dtz); $offset = $origin_dtz->getOffset($origin_dt) - $remote_dtz->getOffset($remote_dt); return $offset; } function getStateFromCode($code) { global $conn; $sql = 'SELECT title AS value FROM states WHERE code=\''.$code.'\''; $rs = mysqli_query($conn,$sql); if (!$rs) echo 'Problem finding state'; if (mysqli_num_rows($rs)>0){ $row = mysqli_fetch_assoc($rs); $return = stripslashes($row['value']); } mysqli_free_result($rs); return $return; } function getProvinceFromCode($code) { global $conn; $sql = 'SELECT title AS value FROM canadian_provinces WHERE code=\''.$code.'\''; $rs = mysqli_query($conn,$sql); if (!$rs) echo 'Problem finding province'; if (mysqli_num_rows($rs)>0){ $row = mysqli_fetch_assoc($rs); $return = stripslashes($row['value']); } mysqli_free_result($rs); return $return; } function getCountryFromCode($code) { global $conn; $sql = 'SELECT title AS value FROM countries WHERE code=\''.$code.'\''; $rs = mysqli_query($conn,$sql); if (!$rs) echo 'Problem finding country'; if (mysqli_num_rows($rs)>0){ $row = mysqli_fetch_assoc($rs); $return = stripslashes($row['value']); } mysqli_free_result($rs); return $return; } function nl2br2($string) { $string = str_replace(array("\r\n", "\r", "\n"), "
", $string); return $string; } function getPaginationI($tbname,$where_field='',$where_condition='',$records_on_page=8,$sortby='stp.pos',$ignore_gets = array("page")) { // create pagination $pagination_text = ''; $get_text = ''; $ignore_gets[] = "id"; foreach ($_GET as $key => $value) { if(!in_array($key,$ignore_gets)){ //$value = urlencode(stripslashes($value)); $value = stripslashes($value); $get_text .= rawurlencode("&$key=$value"); } } if ($where_field!='') $num_records = countRecords($tbname,$where_field,$where_condition,'active'); else $num_records = countRecords($tbname,'','','active'); $counter = 0; $current_page = 1; if ($_GET['page']!='') $current_page = $_GET['page']; $pages = $num_records / $records_on_page; if ($pages > (int)$pages) $pages = (int)$pages + 1; $start_counter = ($current_page * $records_on_page) - $records_on_page; $pagination_text = ''; //end pagination if ($num_records==0 || $pages==1) $pagination_text = ''; $return = array('records_on_page'=>$records_on_page,'start_counter'=>$start_counter,'pagination_text'=>$pagination_text); return $return; } function P(array $sources) { $result=array(); $cache=array(); foreach($sources as $node) { $cache=$result; $result=array(); foreach($node as $item) { if(empty($cache)) { $result[]=array($item); } else { foreach($cache as $line) { $line[]=$item; $result[]=$line; } } } } return $result; } function getField($tbname,$field,$id) { global $conn; $sql = 'SELECT '.$field.' AS value FROM '.$tbname.' WHERE id=\''.$id.'\''; $rs = mysqli_query($conn,$sql); if (mysqli_num_rows($rs)>0){ $row = mysqli_fetch_assoc($rs); $return = stripslashes($row['value']); } mysqli_free_result($rs); return $return; } function getSiteField($field) { global $conn; $sql = "SELECT $field AS value FROM website_details"; $rs = mysqli_query($conn,$sql); if (mysqli_num_rows($rs)>0) { $row = mysqli_fetch_assoc($rs); $return = stripslashes($row['value']); } mysqli_free_result($rs); return $return; } function formatcurrency($num) { return number_format($num,'2','.',''); } function guid($length=50) { $characters = '0123456789abcdefghijklmnopqrstuvwxyz'; $string = ''; for ($p = 0; $p < $length; $p++) { $string .= $characters[mt_rand(0, strlen($characters)-1)]; } return $string; } function displayText($text) { if ($text != '') { return nl2br(htmlentities(stripslashes($text))); } } function safeText($text,$wysiwyg=false) { global $conn; if ($wysiwyg) return mysqli_real_escape_string($conn,$text); else return mysqli_real_escape_string($conn,preg_replace("/[<>]/", "",$text)); } function getUrlContent($url) { set_time_limit(0); $curlHandle = curl_init(); if(substr($url,0,8)=='https://') { curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curlHandle, CURLOPT_SSL_VERIFYHOST, FALSE); } curl_setopt( $curlHandle, CURLOPT_URL, $url ); curl_setopt( $curlHandle, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt( $curlHandle, CURLOPT_TIMEOUT, 120 ); curl_setopt($curlHandle, CURLOPT_CONNECTTIMEOUT ,0); $result = curl_exec( $curlHandle ); if($result === false) echo '#'.curl_error($curlHandle).'#'; curl_close( $curlHandle ); return $result; } function pageName() { $page_array = explode('?',$_SERVER['REQUEST_URI']); return $page_array[0]; } function countRecords($tbname,$search_field='',$search_value='',$status='') { global $conn; if ($search_field!='') $search_text = " WHERE $search_field='$search_value'"; if ($status!='') { if ($search_text=='') $status_text = " WHERE status='".$status."'"; else $status_text = " AND status='".$status."'"; } $sql = "SELECT COUNT(*) AS count FROM $tbname $search_text$status_text"; $rs = mysqli_query($conn,$sql); if (mysqli_num_rows($rs)>0) { $row = mysqli_fetch_assoc($rs); $return = $row['count']; } mysqli_free_result($rs); return $return; } function getMasterId($table, $this_id, $level=1) { global $conn; $previous_id = ''; $c=0; $current_id = $this_id; while ($current_id!=0) { $wanted_id[] = $current_id; $sql = "SELECT parent_id FROM $table WHERE id='$current_id'"; $rs = mysqli_query($conn,$sql); if ($row = mysqli_fetch_assoc($rs)) { $current_id = $row['parent_id']; $c++; } mysqli_free_result($rs); } $position = count($wanted_id)-$level; $previous_id = $wanted_id[$position]; return $previous_id; } function getGeneratedImage($tbname,$record_id,$short_name,$options=array(),$field='image',$placeholdit=true) { global $conn, $websitedir; $return = ''; $file = ''; $image_title = ''; $image_alt = ''; $image_title_text = ''; $image_alt_text = ''; //get dimension $sql = "SELECT width, height FROM resize_options WHERE tablename='$tbname' AND short_name='$short_name'"; $rs = mysqli_query($conn,$sql); if ($row = mysqli_fetch_assoc($rs)) { $width = $row['width']; if($width>0) $width_text = ' width="'.$width.'"'; $height = $row['height']; if($height>0) $height_text = ' height="'.$height.'"'; } mysqli_free_result($rs); //get image fields $sql = "SELECT file, image_title, image_alt FROM images WHERE tablename='$tbname' AND short_name='$short_name' AND field='$field' AND id='$record_id' LIMIT 1"; $rs = mysqli_query($conn,$sql); if ($row = mysqli_fetch_assoc($rs)) { $file = stripslashes($row['file']); $image_title = stripslashes($row['image_title']); $image_alt = stripslashes($row['image_alt']); } mysqli_free_result($rs); if($image_title!='') $image_title_text = ' title="'.$image_title.'"'; if($image_alt!='') $image_alt_text = ' alt="'.$image_alt.'"'; else $image_alt_text = ' alt=""'; $file_path = $websitedir.'resized_images/'.$file; if($placeholdit && ($file == '' || !file_exists('edit/resized_images/'.$file))): $return = ''; else: $return = ''; endif; return $return; } function getGeneratedImageTitleText($tbname,$record_id,$short_name,$field='image') { global $conn; $return = ''; //get file path $sql = "SELECT image_title FROM images WHERE tablename='$tbname' AND short_name='$short_name' AND field='$field' AND id='$record_id'"; $rs = mysqli_query($conn,$sql); if ($row = mysqli_fetch_assoc($rs)) { $return = $row['image_title']; } mysqli_free_result($rs); return $return; } function getGeneratedImageAltText($tbname,$record_id,$short_name,$field='image') { global $conn; $return = ''; //get file path $sql = "SELECT image_alt FROM images WHERE tablename='$tbname' AND short_name='$short_name' AND field='$field' AND id='$record_id'"; $rs = mysqli_query($conn,$sql); if ($row = mysqli_fetch_assoc($rs)) { $return = $row['image_alt']; } mysqli_free_result($rs); return $return; } function getGeneratedImageURL($tbname,$record_id,$short_name,$field='image',$full_path=false) { global $conn,$websitedir; $return = ''; //get file path $sql = "SELECT file FROM images WHERE tablename='$tbname' AND short_name='$short_name' AND field='$field' AND id='$record_id'"; $rs = mysqli_query($conn,$sql); if ($row = mysqli_fetch_assoc($rs)) { $return = $row['file']; } mysqli_free_result($rs); if($full_path) $return = $websitedir.'resized_images/'.$return; return $return; } function getOriginalImageURL($tbname,$record_id,$short_name,$field='image') { global $conn,$websitedir; $return = ''; //get file path $sql = "SELECT original AS value FROM images WHERE tablename='$tbname' AND short_name='$short_name' AND field='$field' AND id='$record_id'"; $rs = mysqli_query($conn,$sql); if ($row = mysqli_fetch_assoc($rs)) { $return = $row['value']; } mysqli_free_result($rs); return $websitedir.'edit/files/'.$return; } function isGeneratedImage($tbname,$record_id,$short_name,$field='image') { global $conn; $return = false; $sql = "SELECT * FROM images WHERE tablename='$tbname' AND short_name='$short_name' AND field='$field' AND id='$record_id'"; $rs = mysqli_query($conn,$sql); if ($row = mysqli_fetch_assoc($rs)) { $return = true; } mysqli_free_result($rs); return $return; } function getGeneratedImageResizeOptions($tablename='default',$short_name='medium',$not_found=false){ global $conn; $image_options =''; $sql = 'SELECT width, height FROM resize_options WHERE tablename=\''.$tablename.'\' AND short_name=\''.$short_name.'\''; $rsgi = mysqli_query($conn,$sql); if (mysqli_num_rows($rsgi)>0){ $rowgi = mysqli_fetch_assoc($rsgi); $image_options['width'] = $rowgi['width']; $image_options['height'] = $rowgi['height']; }elseif($not_found==false){ /* $image_options = getGeneratedImageResizeOptions('default',$short_name,$not_found); return $image_options; */ }else{ /* $not_found==true; $image_options = getGeneratedImageResizeOptions('default','small',$not_found); return $image_options; */ } return $image_options; mysqli_free_result($rss); } function moduleInstalled($title) { global $conn; $return = false; $sql = "SELECT * FROM modules_installed WHERE title='$title'"; $rs = mysqli_query($conn,$sql); if ($row = mysqli_fetch_assoc($rs)) $return = true; mysqli_free_result($rs); return $return; } ?>0) { echo ''; while ($row = mysqli_fetch_assoc($rs)) { $title = $row['title']; $id = $row['id']; if(hasGroupActiveUsers($id)) echo '
  • '.stripslashes($title).'
  • '; } echo ''; } return $return; } function displayUserGroupsFull($ul_id='user_groups_full',$ul_class='group') { global $conn,$websitedir; $sql = 'SELECT id, title FROM user_groups WHERE status=\'active\' ORDER BY pos'; $rs = mysqli_query($conn,$sql); if (mysqli_num_rows($rs)>0) { echo ''; while ($row = mysqli_fetch_assoc($rs)) { $id = $row['id']; if(hasGroupActiveUsers($id)){ $title = $row['title']; echo '
  • '.stripslashes($title).'

    '; if(hasGroupActiveUsers($id)) displayUsers($id); echo '
  • '; } } echo ''; } return $return; } function displayUsers($group_id=0){ global $conn,$websiteaddress; $sql = 'SELECT id, title, image, first_name, surname, address1, address2, address3, postcode, tel, cell, email FROM users WHERE user_group_id=\''.$group_id.'\' AND status=\'active\''; $rs = mysqli_query($conn,$sql); if (mysqli_num_rows($rs)>0) { echo ''; } } function hasGroupActiveUsers($group_id){ global $conn; $return = false; $sql = 'SELECT id FROM users WHERE user_group_id=\''.$group_id.'\' AND status=\'active\''; $rs = mysqli_query($conn,$sql); if (mysqli_num_rows($rs)>0) { $return = true; } return $return; } ?> '; $generated_image_url = 'edit/resized_images/'.getGeneratedImageURL('blocks',$row['id'],'','image'); if($placeholdit && !file_exists($generated_image_url)): $return .= ''; else: $return .= ''; endif; $return .= ''; } elseif ($row['block_type']=='image' || ($row['block_type']=='imageurl' && $row['image_url']=='')){ $image_title = getGeneratedImageTitleText('blocks',$row['id'],'','image'); $image_alt = getGeneratedImageAltText('blocks',$row['id'],'','image'); if($image_title!='') $image_title_text = ' title="'.$image_title.'"'; if($image_alt!='') $image_alt_text = ' alt="'.$image_alt.'"'; else $image_alt_text = ' alt=""'; $generated_image_url = 'edit/resized_images/'.getGeneratedImageURL('blocks',$row['id'],'','image'); if($placeholdit && !file_exists($generated_image_url)): $return .= ''; else: $return = ''; endif; } elseif ($row['block_type']=='file'){ $return = stripslashes($row['file']); } elseif ($row['block_type']=='varchar') { $return = stripslashes($row['text']); } elseif ($row['block_type']=='textarea') { $return = nl2br(stripslashes($row['textarea'])); } elseif ($row['block_type']=='wysiwyg' || $row['block_type']=='wysiwygb') { $return = displayWYSIWYG($row['textarea']); } endif; return $return; mysqli_free_result($rs); } function getBlockField($block_id,$field='title') { global $conn,$websitedir; $sql = "SELECT $field AS field FROM blocks WHERE id='$block_id'"; $rs = mysqli_query($conn,$sql); if ($row = mysqli_fetch_assoc($rs)): return stripslashes($row['field']); endif; mysqli_free_result($rs); } ?>0) { echo '
    '; while ($row = mysqli_fetch_assoc($rs)) { echo '
    '.stripslashes($row['title']).'
    '; echo '
    '.stripslashes($row['text']).'... more
    '; } echo '
    '; } return $return; } function getPagesArray($pages_block_id,$parent_id=0,$active=true) { global $conn; $return = array(); if($active==true) $active_text = 'AND status=\'active\''; $sql = 'SELECT id,title,url FROM pages WHERE parent_id=\''.$parent_id.'\' AND pages_block_id=\''.$pages_block_id.'\' '.$active_text.' ORDER BY pos'; $rs = mysqli_query($conn,$sql); if (mysqli_num_rows($rs)>0) { while ($row = mysqli_fetch_assoc($rs)) { $return[] = array("id" => $row['id'], "title" => stripslashes($row['title']), "url" => stripslashes($row['url'])); } } return $return; } function displayPagesMenuTop($pages_block_id,$ul_id='pages_top',$ul_class='nav',$fixed=false) { displayPagesMenu($pages_block_id,$ul_id,$ul_class,1,$fixed); } function displayThisPagesMenu($ul_id='single_level_menu') { global $conn,$websitedir; $parent_id = getThisField('pages','parent_id'); $pages_block_id = getThisField('pages','pages_block_id'); if ($parent_id=='') $parent_id=0; echo ''; } function displayThisPagesSubPages($pages_block_id,$ul_id='single_level_menu',$ul_class='',$parent_id='',$pages_block_parent_id=1,$show_parent=true) { global $websitedir,$req_id,$req_url; if ($parent_id=='') $parent_id=0; if ($pages_block_parent_id=='') $pages_block_parent_id=0; $level = getPagesArray($pages_block_id,$pages_block_parent_id); if(count($level)>0){ echo ''; if($show_parent==true){ $parent_title = getField('pages','title',$parent_id); $parent_url = getField('pages','url',$parent_id); $class = ''; if($req_id!='fixed-page' && ($req_id.'.html'==$parent_url)){ $class='active'; } if($req_id=='fixed-page' && ($req_url==$parent_url)){ $class='active'; } echo '
  • '; echo getPagesLink($websitedir,$parent_url,$class,$parent_title,true); echo '
  • '; } foreach ($level as $record) { $class =''; if($req_id!='fixed-page' && ($req_id.'.html'==$record['url'])){ $class='active'; } if($req_id=='fixed-page' && ($req_url==$record['url'])){ $class='active'; } echo '
  • '; echo getPagesLink($websitedir,$record['url'],$class,$record['title'],true); echo '
  • '; } echo ''; } } function arePagesPresent($pages_block_id,$parent_id=0,$active=true) { global $conn; $return = false; if($active==true) $active_text = ' AND status=\'active\''; $sql = 'SELECT id FROM pages WHERE pages_block_id=\''.$pages_block_id.'\' AND parent_id=\''.$parent_id.'\''.$active_text; $rs = mysqli_query($conn,$sql); if (mysqli_num_rows($rs)>0) { $return = true; } return $return; } function getFirstSubPageUrl($pages_block_id,$parent_id=0) { global $conn; $return = ''; $sql = 'SELECT url FROM pages WHERE pages_block_id=\''.$pages_block_id.'\' AND parent_id=\''.$parent_id.'\' AND status=\'active\' ORDER BY pos ASC'; $rs = mysqli_query($conn,$sql); if (mysqli_num_rows($rs)>0) { $row = mysqli_fetch_assoc($rs); $return = stripslashes($row['url']); } return $return; } function getPagesLink($websitedir,$url,$class,$title,$fixed=false) { $this_pages_block_id = getFieldFromURL('pages','pages_block_id',$url); $class_text = ''; $title = htmlentities($title); if($class!='') { $class_text = ' class="'.$class.'"';} return ''.$title.''; } function getPagesURL($websitedir,$url,$fixed){ if ($url == 'home.html') { $return = $websitedir; } elseif (substr($url,0,1) == '#') { $return = $url; } elseif ($url == 'about.html' || $url == 'downloads.html' || $url == 'news.html' || $url == 'contact.html') { $return = $websitedir.$url; } elseif ($fixed) { $return = $websitedir.$url; } else { $return = $websitedir.'pages/'.$url; } return $return; } function displayPagesMenu($pages_block_id,$ul_id='pages_menu',$ul_class='',$max_levels=0,$fixed=false) { global $conn,$websitedir, $req_id, $req_url; if ($max_levels==0) $max_levels = getPageLevels(); //first level if ($max_levels>=1) { $level1 = getPagesArray($pages_block_id,0); $level1_count = count($level1); if ($level1_count>0) { echo ''; } $c1=0; foreach ($level1 as $record1) { $c1++; $class = ''; $class_text = ''; if (arePagesPresent($record1['id']) && $max_levels>=2) $class_text .= ' arrow'; if($c1==1) $class_text .= ' first'; //if($c1==$level1_count) $class_text .= ' last'; if($record1['url'] == $req_url || $record1['url'] == $req_id.'.html') $class_text .= ' active'; if($class_text!='') $class = ' class="'.ltrim($class_text).'"'; echo ''; echo getPagesLink($websitedir,$record1['url'],'',$record1['title'],$fixed); //second level if ($max_levels>=2) { $level2 = getPagesArray($pages_block_id,$record1['id']); $level2_count = count($level2); if ($level2_count>0) echo '
      '; $c2=0; foreach ($level2 as $record2) { $c2++; $class = ''; $class_text = ''; if (arePagesPresent($record2['id']) && $max_levels>=3) $class_text .= ' arrow'; if($c2==1) $class_text .= ' first'; if($c2==$level2_count) $class_text .= ' last'; if($class_text!='') $class = ' class="'.ltrim($class_text).'"'; echo ''; echo getPagesLink($websitedir,$record2['url'],'',$record2['title'],$fixed); //third level if ($max_levels>=3) { $level3 = getPagesArray($pages_block_id,$record2['id']); $level3_count = count($level3); if ($level3_count>0) echo '
        '; $c3=0; foreach ($level3 as $record3) { $c3++; $class = ''; $class_text = ''; if (arePagesPresent($record3['id']) && $max_levels>=4) $class_text .= ' arrow'; if($c3==1) $class_text .= ' first'; if($c3==$level3_count) $class_text .= ' last'; if($class_text!='') $class = ' class="'.ltrim($class_text).'"'; echo ''; echo getPagesLink($websitedir,$record3['url'],'',$record3['title'],$fixed); //fourth level if ($max_levels>=4) { $level4 = getPagesArray($pages_block_id,$record3['id']); $level4_count = count($level4); if ($level4_count>0) echo '
          '; $c4=0; foreach ($level4 as $record4) { $c4++; $class = ''; $class_text = ''; if (arePagesPresent($record4['id']) && $max_levels>=5) $class_text .= ' arrow'; if($c4==1) $class_text .= ' first'; if($c4==$level4_count) $class_text .= ' last'; if($class_text!='') $class = ' class="'.ltrim($class_text).'"'; echo ''; echo getPagesLink($websitedir,$record4['url'],'',$record4['title'],$fixed); //fifth level if ($max_levels>=5) { $level5 = getPagesArray($pages_block_id,$record4['id']); $level5_count = count($level5); if ($level5_count>0) echo '
            '; $c5=0; foreach ($level5 as $record5) { $c5++; $class = ''; $class_text = ''; if($c5==1) $class_text .= ' first'; if($c5==$level5_count) $class_text .= ' last'; if($class_text!='') $class = ' class="'.ltrim($class_text).'"'; echo ''; echo getPagesLink($websitedir,$record5['url'],'',$record5['title'],$fixed); echo ''; } if (count($level5)>0) echo '
          '; } echo ''; } if (count($level4)>0) echo '
        '; } echo ''; } if (count($level3)>0) echo '
      '; } echo ''; } if (count($level2)>0) echo '
    '; } echo ''; } if (count($level1)>0) echo '
  • Log Out
  • '; } } function displayPagesAsideMenu($pages_block_id,$ul_id='pages_menu',$ul_class='',$fixed=false) { global $conn,$websitedir, $req_id, $req_url; $level1 = getPagesArray($pages_block_id); if (count($level1)>0) { echo '
      '; } foreach ($level1 as $record1) { $class = ''; if (arePagesPresent($record1['id']) && $max_levels>=2) $class = ' class="arrow"'; if($record1['url'] == $req_url || $record1['url'] == $req_id.'.html') $class = ' active'; echo '
    • '; echo getPagesLink($websitedir,$record1['url'],$class,'› '.$record1['title'],$fixed); echo '
    • '; } if (count($level1)>0) echo '
    '; } ?>'; } function displayNewsSnippets($ul_id='news',$ul_class='',$text_limit=60,$view_more='no', $show=5) { global $conn,$websitedir; $sql = 'SELECT url,LEFT(clean_text,'.$text_limit.') AS text,title,summary_text,url FROM news WHERE status=\'active\' ORDER BY pos LIMIT '.$show; $rs = mysqli_query($conn,$sql); $total = mysqli_num_rows($rs); $c=0; if ($total>0) { echo ''; while ($row = mysqli_fetch_assoc($rs)) { $c++; $text = ''; if($row['summary_text']!='') $text = stripslashes($row['summary_text']); else $text = stripslashes($row['text']).'...'; if($c==$total) {echo '
  • ';}else{echo '
  • ';} echo '

    '.stripslashes($row['title']).'

    '; echo '

    '.$text.'

    '; echo '

    » More

    '; echo '
  • '; } echo ''; if ($total>0 & $view_more!='no') { echo '» View More';} } } function displayNewsSummaries($ul_id='news-items',$ul_class='',$resize_type='crop',$text_limit=200) { global $conn,$websitedir; $sql = 'SELECT title,url,LEFT(clean_text,'.$text_limit.') AS text,summary_text,url,thedate,id FROM news WHERE status=\'active\' ORDER BY pos DESC'; $rs = mysqli_query($conn,$sql); if (mysqli_num_rows($rs)>0) { echo ''; while ($row = mysqli_fetch_assoc($rs)) { $div_class = ''; $text = ''; if($row['summary_text']!='') $text = stripslashes($row['summary_text']); else $text = stripslashes($row['text']).'...'; echo '
  • '; echo $image_text = ''.getGeneratedImage('news',$row['id'],'small',stripslashes($row['title'])).''; echo ''; echo '

    '.stripslashes($row['title']).'

    '; if(isValidDate($row['thedate'])) echo ''.displayDate($row['thedate']).''; echo '

    '.$text.'

    '; echo '

    » Read The Full Story

    '; echo ''; echo '
  • '; } echo ''; } } function displayNewsSummariesPagination($ul_id='news-items',$ul_class='',$records_on_page=3,$text_limit=200) { global $conn,$websitedir; $pagination_array = getPagination('news','status','active',$records_on_page); echo $pagination_array['pagination_text']; $sql = 'SELECT id,title,url,summary_text,LEFT(clean_text,'.$text_limit.') AS text,url,thedate FROM news WHERE status=\'active\' ORDER BY pos LIMIT '.$pagination_array['start_counter'].','.$pagination_array['records_on_page']; $rs = mysqli_query($conn,$sql); if (mysqli_num_rows($rs)>0) { echo ''; while ($row = mysqli_fetch_assoc($rs)) { $li_class = ''; $text = ''; $image_text =''; if($row['summary_text']!='') $text = stripslashes($row['summary_text']); else $text = stripslashes($row['text']).'...'; if (isGeneratedImage('news',$row['id'],'news_listing')){ $image_text = ''.getGeneratedImage('news',$row['id'],'news_listing',stripslashes($row['title'])).''; }else{ $li_class = ' class="no-image"'; } echo ''; echo $image_text; echo '
    '; echo '

    '.stripslashes($row['title']).'

    '; echo '
    '; if(isValidDate($row['thedate'])) echo ''.displayDate($row['thedate']).''; echo '
    '; echo '
    '; echo '

    '.$text.'

    '; echo '
    '; echo '

    » Read The Full Story

    '; echo '
    '; echo ''; } echo ''; } } ?>0) { echo ''; while ($row = mysqli_fetch_assoc($rs)) { $div_class = ''; $image_text = ''; if($row['summary_text']!='') $text = stripslashes($row['summary_text']); else $text = stripslashes($row['text']).'...'; if (isGeneratedImage('case_study',$row['id'],'case_study_listing')){ $image_text = ''.getGeneratedImage('case_study',$row['id'],'case_study_listing',stripslashes($row['title'])).''; }else{ $li_class = ' class="no-image"'; } echo ''; echo $image_text; echo '
    '; echo '

    '.stripslashes($row['title']).'

    '; echo '
    '; if(isValidDate($row['thedate'])) echo ''.displayDate($row['thedate']).''; echo '
    '; echo '
    '; echo '

    '.$text.'

    '; echo '
    '; echo '

    » Read The Full Story

    '; echo '
    '; echo ''; } echo ''; } } function displayCaseStudySummariesPaginationOLD($ul_id='case-study-items',$ul_class='',$records_on_page=6) { global $conn,$websitedir; $pagination_array = getPagination('case_study','status','active',$records_on_page); echo $pagination_array['pagination_text']; $sql = 'SELECT title,url,summary_text,clean_text AS text,image,url,thedate FROM case_study WHERE status=\'active\' ORDER BY pos DESC LIMIT '.$pagination_array['start_counter'].','.$pagination_array['records_on_page']; $rs = mysqli_query($conn,$sql); if (mysqli_num_rows($rs)>0) { echo ''; while ($row = mysqli_fetch_assoc($rs)) { $div_class = ''; $text = ''; if($row['summary_text']!=''){ $text = $row['summary_text']; }else{ $text = substr(stripslashes($row['text']),0,100).'...'; } $url = $websitedir.'case-study/'.stripslashes($row['url']); echo '
  • '; echo ''; if ($row['image']!=''){ echo getGeneratedImage($row['image'],'case_study','case_study_listing','crop',$row['title']);} echo ''; echo '

    '.stripslashes($row['title']).'

    '; echo '

    '.$text.'

    '; echo '

    View Case Study ›

    '; echo '
  • '; } echo ''; } } ?> $val ) $url .= ' ' . $key . '="' . $val . '"'; $url .= ' />'; } return $url; } function displayBlogSummariesPagination($ul_id='blog-listing',$ul_class='entries row1 group',$text_limit=200,$pagination=true,$top=true,$bottom=true,$records_on_page=6,$show_images=true) { global $conn,$websitedir; if ($pagination) $pagination_array = getPagination('blog','','',$records_on_page); if ($pagination && $top) echo $pagination_array['pagination_text']; if ($pagination) $sql = 'SELECT title,thedate,author,url,LEFT(clean_text,'.$text_limit.') AS clean_text,summary_text,url,id FROM blog WHERE status=\'active\' ORDER BY pos ASC LIMIT '.$pagination_array['start_counter'].','.$pagination_array['records_on_page']; else $sql = 'SELECT title,image,thedate,author,url,summary_text,LEFT(clean_text,'.$text_limit.') AS clean_text,url,id FROM blog WHERE status=\'active\' ORDER BY pos ASC'; $rs = mysqli_query($conn,$sql); if (mysqli_num_rows($rs)>0) { echo '
      '; while ($row = mysqli_fetch_assoc($rs)) { $image_text = ''; $li_class = ''; $date = stripslashes($row['thedate']); if($row['summary_text']!=''){ $text = stripslashes($row['summary_text']); }else{ $text = stripslashes($row['clean_text']); } $url = $websitedir.'blog/'.stripslashes($row['url']); $title = stripslashes($row['title']); if ($show_images && isGeneratedImage('blog',$row['id'],'blog_listing')){ $image_text = ''.getGeneratedImage('blog',$row['id'],'blog_listing',$title).''; }else{ $li_class = ' class="no-image"'; } echo ''; echo $image_text; echo '
      '; echo '

      '.stripslashes($row['title']).'

      '; echo '
      '; if(isValidDate($date)) { echo ''; echo 'Posted on '.displayDate($date); echo ' '; if($row['author']!='') echo 'by '.stripslashes($row['author']).' '; echo getBlogCategoriesInText($row['id'],3); echo ''; } echo ''.countRecords('blog_comments','blog_id',$row['id'],'active').' Comments'; echo '
      '; echo '
      '; echo '

      '.stripslashes($text).'

      '; echo '

      View Full Article ›

      '; echo '
      '; echo '
      '; echo ''; } echo '
    '; } if ($pagination && $bottom) echo $pagination_array['pagination_text']; } function getThisBlogId() { return getThisField('blog','id'); } function getThisBlogAuthor() { return stripslashes(getThisField('blog','author')); } function getThisBlogTitle() { return stripslashes(getThisField('blog','title')); } function getThisBlogMetaKeywords() { return stripslashes(getThisField('blog','meta_keywords')); } function getThisBlogMetaDescription() { return stripslashes(getThisField('blog','meta_description')); } function getThisBlogDate() { return stripslashes(getThisField('blog','thedate')); } function getThisBlogText() { return displayWYSIWYG(getThisField('blog','text')); } function getThisBlogSummaryText() { return displayWYSIWYG(getThisField('blog','summary_text')); } function getThisBlogMetaTitle() { if(getThisField('blog','custom_title')!=''){ return stripslashes(getThisField('blog','custom_title')); }else{ return stripslashes(getThisField('blog','title')); } } function getBlogCommentText($name,$text) { if ($name=='Administrator') return displayWYSIWYG($text); else return displayText($text); } function displayThisBlogComments($ul_id='blog-comments',$ul_class='entries group') { global $conn; $blog_id = getThisBlogId(); $sql = "SELECT * FROM blog_comments WHERE blog_id='$blog_id' AND status='active' ORDER BY id DESC"; $rs = mysqli_query($conn,$sql); if (mysqli_num_rows($rs)>0) { echo ''; while ($row = mysqli_fetch_assoc($rs)) { echo '
  • '; echo ''.stripslashes($row['name']).''; echo '
    '; echo '

    By '.stripslashes($row['name']).' '.displayDate(stripslashes($row['thedate'])).'

    '; echo '

    '.getBlogCommentText($row['name'],$row['text']).'

    '; echo '
    '; echo '
  • '; } echo ''; } mysqli_free_result($rs); } function displayThisBlogWriteACommentRecaptcha() { global $conn,$websitedir; $blog_id = getThisBlogId(); if ($_GET['failed']=='no') echo '

    Your comment has been saved and is awaiting approval.

    '; if ($_GET['failed']=='yes') echo '

    Failed to post comment. Please try again.

    '; ?>

    Write a comment