From 6b07955476a9932b247df678ec19a6b0ddaf440d Mon Sep 17 00:00:00 2001 From: jhunkeler Date: Mon, 28 Dec 2009 17:12:53 +0000 Subject: (OC) phased out BBCode() and added the extras to bbcode_format() condensed the style sheets. git-svn-id: http://svn.3rd-infantry-division.org/testing/branches/Bayonet CMS v2@406 c5b2fb0a-d05d-0410-98c8-828840a80ff6 --- blocks/mini_calendar/functions.php | 618 ++++++++++++++++++------------------- includes/functions.php | 22 +- modules/news/functions.php | 28 +- modules/newsreel/index.php | 9 +- style.css | 224 +++----------- 5 files changed, 367 insertions(+), 534 deletions(-) diff --git a/blocks/mini_calendar/functions.php b/blocks/mini_calendar/functions.php index 0dee840..968c7af 100644 --- a/blocks/mini_calendar/functions.php +++ b/blocks/mini_calendar/functions.php @@ -1,310 +1,310 @@ -. - */ - -/** - * Note to anyone feeling the need to edit this file... - * You MUST declare $db as global inside your functions in order access MySQL from here. - */ - - /** - * SelectDate($date) - * Function for outputing an html form for selecting a month day and year - * @param date - formatted date string yyyy-mm-dd (optional) - */ - function SelectDate($date = NULL){ - - //function for adding to the db in sql 'datetime' format - //$date = date("Y-m-d h:i:s", mktime(8, 30, 0, 10, 26, 2009)); - //$date = "2009-11-2"; - //echo $date."
"; - //function for parsing our date format into an array - //echo "
";
-	$date_arr = date_parse($date); //returns an associative array $array['year']
-	//print_r($date_arr);
-	//echo "
"; - //echo $date_arr['year']." ".$date_arr['month']." ".$date_arr['day']."
";; - - //List Months - echo '"; - - //List Days - echo '"; - - //List Years [CurYear, CurYear+5] - echo '"; - - } - - function ListEvents($date){ - - global $db; - -?> -
-

Events for:

-
- Add New Event -
-"; - - $result = $db->Query("SELECT * FROM bayonet_events WHERE `date` = '$date' ORDER BY `time`"); - while(($row = $db->Fetch($result))!=false) - { - $tmp = true; - - $datetime = date_create($date.' '.$row['time']); - $time = date_format($datetime, 'g:ia'); //gets time in hour:minutes am|pm -?> - - - -      - - Edit -  |  - Delete - - - -

- - - -
- -There are no events posted for this day."; - - echo ""; - - } - - - /** - * PrintCalendar() - prints the calendar with events - */ - function PrintCalendar(){ - - $date = time(); - date_default_timezone_set("America/New_York"); //EASTERN TIME ZONE - - //GET values for month and year - $month = ""; - $year = ""; - //$month = $_GET['month']; - //$year = $_GET['year']; - - $useCurDate = true; - - //check to makes sure month and year are in the desired ranges - if(!empty($month) && !empty($year) && $month > 0 && $month < 13 && $year > 1990){ - $useCurDate = false; - } - //check to see if the get variables are for todays month - if($month == date('n', $date) && $year == date('Y', $date)){ - $useCurDate = true; - } - - //use current date unless GET values are set - if($useCurDate) - { - $day = date('d', $date); - $today = date('j', $date); - $month = date('m', $date); - $monthNum = date('n', $date); - $year = date('Y', $date); - } - else - { - $monthNum = $month; - //if GET values are equal to curdate, set $today - if($year == date('Y', $date) && $monthNum == date('n', $date)) - $today = date('j', $date); - else - $today = 0; - } - - /* Accounts for the last couple days from the previous months */ - $first_day = mktime(0,0,0,$monthNum, 1, $year); - - $title = date('F', $first_day); - - $day_of_week = date('D', $first_day); - - switch($day_of_week){ - case "Sun": $blank = 0; break; - case "Mon": $blank = 1; break; - case "Tue": $blank = 2; break; - case "Wed": $blank = 3; break; - case "Thu": $blank = 4; break; - case "Fri": $blank = 5; break; - case "Sat": $blank = 6; break; - } - - /* calculates the days in the current month */ - $days_in_month = cal_days_in_month(0, $monthNum, $year); - - //makes sure that previous year is not year 0 - if($monthNum == 1){ - $previous_month = 12; - $previous_year = $year-1; - }else{ - $previous_month = $monthNum-1; - $previous_year = $year; - } - //makes sure the next year is not year 13 - if($monthNum == 12){ - $next_month = 1; - $next_year = $year+1; - }else{ - $next_month = $monthNum+1; - $next_year = $year; - } - ?> -
- - - - - - - - - - - - 0){ - $blank = $blank-1; - $days_before = $days_monthbefore-$blank; - echo ''; //'.$days_before.''; - $day_count++; - } - - //loop printing each day of the CURRENT month ONLY - while($day_num <= $days_in_month){ - - if($day_count==1 || $day_count==7){ - echo ''; - - $day_num++; - $day_count++; - - if($day_count > 7){ - echo ''; - $day_count = 1; - } - } - - $days_after = 1; - //loop for printing the days for the next month - while($day_count > 1 && $day_count <=7){ - echo ''; //'.$days_after.''; - $days_after++; - $day_count++; - } - - ?> - - -
- - -      - -
SunMonTueWedThuFriSat
'.$days_before.''; //weekends - }else{ - echo ''; //weekdays - } - - $sqlDate = $year.'-'.$monthNum.'-'.$day_num; //old way NOT unix - - //checks to see if the current day has events - $isEvent=false; - - global $db; - $result = $db->Query("SELECT title,color,date,time FROM `bayonet_events` WHERE `date` = '$sqlDate' ORDER BY `date` DESC"); - while(($row = $db->Fetch($result))!=false) - { - $isEvent = true; - if($day_num == $today){ - $todaysEvents[] = $row; - } - } - if($day_num == $today && $isEvent==true){ - echo '
'.$day_num.'
'; - }else if($day_num == $today && $isEvent==false){ - echo '
'.$day_num.'
'; - }else if($day_num != $today && $isEvent==true){ - echo '
'; - echo $day_num; - echo '
'; - }else{ - echo $day_num; - } - - echo '
'.$days_after.'
-
-0){ - echo "

Today's Events

"; - foreach($todaysEvents as $event){ - $time = date("g:i a", strtotime($event['date']." ".$event['time'])); - echo "   {$event['title']} @ {$time}
"; - } - } - } - +. + */ + +/** + * Note to anyone feeling the need to edit this file... + * You MUST declare $db as global inside your functions in order access MySQL from here. + */ + + /** + * SelectDate($date) + * Function for outputing an html form for selecting a month day and year + * @param date - formatted date string yyyy-mm-dd (optional) + */ + function SelectDate($date = NULL){ + + //function for adding to the db in sql 'datetime' format + //$date = date("Y-m-d h:i:s", mktime(8, 30, 0, 10, 26, 2009)); + //$date = "2009-11-2"; + //echo $date."
"; + //function for parsing our date format into an array + //echo "
";
+	$date_arr = date_parse($date); //returns an associative array $array['year']
+	//print_r($date_arr);
+	//echo "
"; + //echo $date_arr['year']." ".$date_arr['month']." ".$date_arr['day']."
";; + + //List Months + echo '"; + + //List Days + echo '"; + + //List Years [CurYear, CurYear+5] + echo '"; + + } + + function ListEvents($date){ + + global $db; + +?> +
+

Events for:

+
+ Add New Event +
+"; + + $result = $db->Query("SELECT * FROM bayonet_events WHERE `date` = '$date' ORDER BY `time`"); + while(($row = $db->Fetch($result))!=false) + { + $tmp = true; + + $datetime = date_create($date.' '.$row['time']); + $time = date_format($datetime, 'g:ia'); //gets time in hour:minutes am|pm +?> + + + +      + + Edit +  |  + Delete + + + +

+ + + +
+ +There are no events posted for this day."; + + echo ""; + + } + + + /** + * PrintCalendar() - prints the calendar with events + */ + function PrintCalendar(){ + + $date = time(); + date_default_timezone_set("America/New_York"); //EASTERN TIME ZONE + + //GET values for month and year + $month = ""; + $year = ""; + //$month = $_GET['month']; + //$year = $_GET['year']; + + $useCurDate = true; + + //check to makes sure month and year are in the desired ranges + if(!empty($month) && !empty($year) && $month > 0 && $month < 13 && $year > 1990){ + $useCurDate = false; + } + //check to see if the get variables are for todays month + if($month == date('n', $date) && $year == date('Y', $date)){ + $useCurDate = true; + } + + //use current date unless GET values are set + if($useCurDate) + { + $day = date('d', $date); + $today = date('j', $date); + $month = date('m', $date); + $monthNum = date('n', $date); + $year = date('Y', $date); + } + else + { + $monthNum = $month; + //if GET values are equal to curdate, set $today + if($year == date('Y', $date) && $monthNum == date('n', $date)) + $today = date('j', $date); + else + $today = 0; + } + + /* Accounts for the last couple days from the previous months */ + $first_day = mktime(0,0,0,$monthNum, 1, $year); + + $title = date('F', $first_day); + + $day_of_week = date('D', $first_day); + + switch($day_of_week){ + case "Sun": $blank = 0; break; + case "Mon": $blank = 1; break; + case "Tue": $blank = 2; break; + case "Wed": $blank = 3; break; + case "Thu": $blank = 4; break; + case "Fri": $blank = 5; break; + case "Sat": $blank = 6; break; + } + + /* calculates the days in the current month */ + $days_in_month = cal_days_in_month(0, $monthNum, $year); + + //makes sure that previous year is not year 0 + if($monthNum == 1){ + $previous_month = 12; + $previous_year = $year-1; + }else{ + $previous_month = $monthNum-1; + $previous_year = $year; + } + //makes sure the next year is not year 13 + if($monthNum == 12){ + $next_month = 1; + $next_year = $year+1; + }else{ + $next_month = $monthNum+1; + $next_year = $year; + } + ?> +
+ + + + + + + + + + + + 0){ + $blank = $blank-1; + $days_before = $days_monthbefore-$blank; + echo ''; //'.$days_before.''; + $day_count++; + } + + //loop printing each day of the CURRENT month ONLY + while($day_num <= $days_in_month){ + + if($day_count==1 || $day_count==7){ + echo ''; + + $day_num++; + $day_count++; + + if($day_count > 7){ + echo ''; + $day_count = 1; + } + } + + $days_after = 1; + //loop for printing the days for the next month + while($day_count > 1 && $day_count <=7){ + echo ''; //'.$days_after.''; + $days_after++; + $day_count++; + } + + ?> + + +
+ + +      + +
SunMonTueWedThuFriSat
'.$days_before.''; //weekends + }else{ + echo ''; //weekdays + } + + $sqlDate = $year.'-'.$monthNum.'-'.$day_num; //old way NOT unix + + //checks to see if the current day has events + $isEvent=false; + + global $db; + $result = $db->Query("SELECT title,color,date,time FROM `bayonet_events` WHERE `date` = '$sqlDate' ORDER BY `date` DESC"); + while(($row = $db->Fetch($result))!=false) + { + $isEvent = true; + if($day_num == $today){ + $todaysEvents[] = $row; + } + } + if($day_num == $today && $isEvent==true){ + echo '
'.$day_num.'
'; + }else if($day_num == $today && $isEvent==false){ + echo '
'.$day_num.'
'; + }else if($day_num != $today && $isEvent==true){ + echo '
'; + echo $day_num; + echo '
'; + }else{ + echo $day_num; + } + + echo '
'.$days_after.'
+
+0){ + echo "

Today's Events

"; + foreach($todaysEvents as $event){ + $time = date("g:i a", strtotime($event['date']." ".$event['time'])); + echo "   {$event['title']} @ {$time}
"; + } + } + } + ?> \ No newline at end of file diff --git a/includes/functions.php b/includes/functions.php index 4db70c5..05d6457 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -35,45 +35,51 @@ function bbcode_format ($str) '/\[b\](.*?)\[\/b\]/is', '/\[i\](.*?)\[\/i\]/is', '/\[u\](.*?)\[\/u\]/is', + '/\[s\](.+?)\[\/s\]/is', '/\[hr\]/is', '/\[pi\](.*?)\[\/pi\]/is', - '/\[center\](.*?)\[\/center\]/is', '/\[title\](.*?)\[\/title\]/is', '/\[article\](.*?)\[\/article\]/is', '/\[section\](.*?)\[\/section\]/is', '/\[code\](.*?)\[\/code\]/is', '/\[quote\](.*?)\[\/quote\]/is', '/\[quote\=(.*?)\](.*?)\[\/quote\]/is', + '/\[url\](.*?)\[\/url\]/is', '/\[url\=(.*?)\](.*?)\[\/url\]/is', '/\[align\=(.*?)\](.*?)\[\/align\]/is', '/\[size\=(.*?)\](.*?)\[\/size\]/is', - '/\[img\=(.*?)\](.*?)\[\/img\]/is' + '/\[img\=(.*?)\](.*?)\[\/img\]/is', + '/\[img align\=(.+?)\](.+?)\[\/img\]/is', + '/\[mail\](.*?)\[\/mail\]/is', + '/\[mail\=(.*?)\](.*?)\[\/mail\]/is' ); $simple_replace = array( '$1', '$1', '$1', + '$1', '
', '

$1

', - '
$1
', '

$1

', '

$1

', '

$1

', '
$1
', '
$1
', '$1 wrote:
$2
', + '$1', '$2', - '$2', + '
$2', '$2', - '$2' + '$2', + '', + '$1', + '$2' ); - $order = array("\r\n", "\n", "\r"); - $replace = "\n
"; $str = preg_replace ($simple_search, $simple_replace, $str); - $str = str_ireplace($order,$replace,$str); + $str = nl2br($str); return $str; } diff --git a/modules/news/functions.php b/modules/news/functions.php index bd901aa..22952af 100644 --- a/modules/news/functions.php +++ b/modules/news/functions.php @@ -93,7 +93,7 @@ function displayComments($data){
-

+

@@ -145,17 +145,6 @@ function getNews($id = NULL){ $result = $db->Query($query); $data = $db->Fetch($result); - //decho($data); - // {{{ XXX: FIXME -- Re-write - /* - while(($row = $db->Fetch($result)) != false) - { - $data[] = $row; - } - - $db->Free($result); - */ - // }}} return $data; } @@ -173,7 +162,7 @@ function displayNews($data){ foreach($data as $news) { $numComments = getNumOfComments($news['news_id']); - //echo "
".print_r($news,true)."
"; + OpenContent(); ?>
@@ -186,7 +175,7 @@ function displayNews($data){
<?php echo $news['catname']; ?> - +