From be4f83cd2a17a0ec05f5bce50c91befaafaa6e0c Mon Sep 17 00:00:00 2001 From: jhunkeler Date: Sun, 20 Dec 2009 18:38:08 +0000 Subject: Test. git-svn-id: http://svn.3rd-infantry-division.org/testing/branches/Bayonet CMS v2@376 c5b2fb0a-d05d-0410-98c8-828840a80ff6 --- blocks/donations/index.php | 13 ++ blocks/mini_calendar/functions.php | 301 +++++++++++++++++++++++++++++++++++++ blocks/mini_calendar/index.php | 3 + blocks/mini_calendar/scripts.js | 0 blocks/mini_calendar/style.css | 96 ++++++++++++ blocks/rss_agw/index.php | 29 ++++ blocks/rss_agw/rssreader.php | 161 ++++++++++++++++++++ blocks/rss_agw/style.css | 17 +++ blocks/server_monitor/index.php | 16 ++ blocks/soldier_info/index.php | 25 +++ blocks/tsviewer/index.php | 18 +++ 11 files changed, 679 insertions(+) create mode 100644 blocks/donations/index.php create mode 100644 blocks/mini_calendar/functions.php create mode 100644 blocks/mini_calendar/index.php create mode 100644 blocks/mini_calendar/scripts.js create mode 100644 blocks/mini_calendar/style.css create mode 100644 blocks/rss_agw/index.php create mode 100644 blocks/rss_agw/rssreader.php create mode 100644 blocks/rss_agw/style.css create mode 100644 blocks/server_monitor/index.php create mode 100644 blocks/soldier_info/index.php create mode 100644 blocks/tsviewer/index.php (limited to 'blocks') diff --git a/blocks/donations/index.php b/blocks/donations/index.php new file mode 100644 index 0000000..8695f68 --- /dev/null +++ b/blocks/donations/index.php @@ -0,0 +1,13 @@ + + +
+
+
+ + + + +
+
+
diff --git a/blocks/mini_calendar/functions.php b/blocks/mini_calendar/functions.php new file mode 100644 index 0000000..06ce910 --- /dev/null +++ b/blocks/mini_calendar/functions.php @@ -0,0 +1,301 @@ +. + */ + +/** + * 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 FROM `bayonet_events` WHERE `date` = '$sqlDate' LIMIT 1"); + while(($row = $db->Fetch($result))!=false) + { + $isEvent = true; + } + + 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.'
+
+ \ No newline at end of file diff --git a/blocks/mini_calendar/index.php b/blocks/mini_calendar/index.php new file mode 100644 index 0000000..6516646 --- /dev/null +++ b/blocks/mini_calendar/index.php @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/blocks/mini_calendar/scripts.js b/blocks/mini_calendar/scripts.js new file mode 100644 index 0000000..e69de29 diff --git a/blocks/mini_calendar/style.css b/blocks/mini_calendar/style.css new file mode 100644 index 0000000..72898ee --- /dev/null +++ b/blocks/mini_calendar/style.css @@ -0,0 +1,96 @@ +/* START>> CALENDAR STYLES*/ + .monthTitle{ + color:black; + text-align:center; + font-size:12px; + font-weight:bold; + font-family:arial; + } + td.weekday { + width:40px; + height:20px; + background-color:#cb2121; + color:green; + text-align:center; + font-size:10px; + font-weight:bold; + } + th.weekday { + width:40px; + height:29px; + background-color:white; + color:black; + text-align:center; + font-size:11px; + font-weight:bold; + } + .monthday { + width:40px; + height:20px; + background-color:#aea2a2; + color:white; + text-align:left; + font-size:10pt; + font-weight:bold; + + } + .monthtoday { + width:38px; + height:38px; + /* background-color:#3666ba; */ + color:#225eac; + text-align:center; + font-size:14px; + font-weight:bold; + border:1px solid #333333; + } + .event { + width:38px; + height:38px; + background-color:#225eac; + text-align:center; + border:1px solid #333333; + } + table.calendar a, table.calendar a:visited, table.calendar a:active, table.calendar a:hover { + color:white; + } + .eventtoday{ + width:38px; + height:38px; + background-color:#225eac; + color:#ef8e25; + text-align:center; + font-size:14px; + font-weight:bold; + border:1px solid #333333; + } + td.cal_weekday { + width:40px; + height:40px; + background-color:#a1a1a1; + vertical-align:top; + color:#eeeeee; + font-family:arial; + text-align:center; + font-size:14px; + } + td.cal_weekend { + width:40px; + height:40px; + background-color:#8f8f8f; + vertical-align:top; + color:#eeeeee; + font-family:arial; + text-align:center; + font-size:14px; + } + td.cal_notmonth { + width:40px; + height:40px; + background-color:#6e6e6e; + vertical-align:top; + color:#d4d4d4; + text-align:left; + font-size:11px; + } +/* END>> CALENDAR STYLES */ \ No newline at end of file diff --git a/blocks/rss_agw/index.php b/blocks/rss_agw/index.php new file mode 100644 index 0000000..83c3ff1 --- /dev/null +++ b/blocks/rss_agw/index.php @@ -0,0 +1,29 @@ + +load('http://www.armedglobalwarfare.com/index.php?type=rss;action=.xml;limit=30'); + + $items = $rss->getItems(); #returns all rss items + + $numFeeds = 0; + echo "
"; + foreach($items as $story){ + if($story['category']=="Tournament Announcements"){ + $numFeeds++; + echo "{$story['title']}
+ {$story['pubDate']}
+ {$story['description']}

"; + } + } + if(!$numFeeds){ + echo "No new updates for this news feed."; + } + echo "
"; + // echo "
";
+  //print_r($items);
+   // echo "
"; +?> diff --git a/blocks/rss_agw/rssreader.php b/blocks/rss_agw/rssreader.php new file mode 100644 index 0000000..41fa238 --- /dev/null +++ b/blocks/rss_agw/rssreader.php @@ -0,0 +1,161 @@ + + Published: 200801 :: blacknet :: via rssphp.net + + RSS_PHP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. + + Usage: + See the documentation at http://rssphp.net/documentation + Examples: + Can be found online at http://rssphp.net/examples +*/ + +class rss_php { + + public $document; + public $channel; + public $items; + +/**************************** + public load methods +***/ + # load RSS by URL + public function load($url=false, $unblock=true) { + if($url) { + if($unblock) { + $this->loadParser(file_get_contents($url, false, $this->randomContext())); + } else { + $this->loadParser(file_get_contents($url)); + } + } + } + # load raw RSS data + public function loadRSS($rawxml=false) { + if($rawxml) { + $this->loadParser($rawxml); + } + } + +/**************************** + public load methods + @param $includeAttributes BOOLEAN + return array; +***/ + # return full rss array + public function getRSS($includeAttributes=false) { + if($includeAttributes) { + return $this->document; + } + return $this->valueReturner(); + } + # return channel data + public function getChannel($includeAttributes=false) { + if($includeAttributes) { + return $this->channel; + } + return $this->valueReturner($this->channel); + } + # return rss items + public function getItems($includeAttributes=false) { + if($includeAttributes) { + return $this->items; + } + return $this->valueReturner($this->items); + } + +/**************************** + internal methods +***/ + private function loadParser($rss=false) { + if($rss) { + $this->document = array(); + $this->channel = array(); + $this->items = array(); + $DOMDocument = new DOMDocument; + $DOMDocument->strictErrorChecking = false; + $DOMDocument->loadXML($rss); + $this->document = $this->extractDOM($DOMDocument->childNodes); + } + } + + private function valueReturner($valueBlock=false) { + if(!$valueBlock) { + $valueBlock = $this->document; + } + foreach($valueBlock as $valueName => $values) { + if(isset($values['value'])) { + $values = $values['value']; + } + if(is_array($values)) { + $valueBlock[$valueName] = $this->valueReturner($values); + } else { + $valueBlock[$valueName] = $values; + } + } + return $valueBlock; + } + + private function extractDOM($nodeList,$parentNodeName=false) { + $itemCounter = 0; + foreach($nodeList as $values) { + if(substr($values->nodeName,0,1) != '#') { + if($values->nodeName == 'item') { + $nodeName = $values->nodeName.':'.$itemCounter; + $itemCounter++; + } else { + $nodeName = $values->nodeName; + } + $tempNode[$nodeName] = array(); + if($values->attributes) { + for($i=0;$values->attributes->item($i);$i++) { + $tempNode[$nodeName]['properties'][$values->attributes->item($i)->nodeName] = $values->attributes->item($i)->nodeValue; + } + } + if(!$values->firstChild) { + $tempNode[$nodeName]['value'] = $values->textContent; + } else { + $tempNode[$nodeName]['value'] = $this->extractDOM($values->childNodes, $values->nodeName); + } + if(in_array($parentNodeName, array('channel','rdf:RDF'))) { + if($values->nodeName == 'item') { + $this->items[] = $tempNode[$nodeName]['value']; + } elseif(!in_array($values->nodeName, array('rss','channel'))) { + $this->channel[$values->nodeName] = $tempNode[$nodeName]; + } + } + } elseif(substr($values->nodeName,1) == 'text') { + + $tempValue = trim(preg_replace('/\s\s+/',' ',str_replace("\n",' ', $values->textContent))); + if($tempValue) { + $tempNode = $tempValue; + } + } elseif(substr($values->nodeName,1) == 'cdata-section'){ + $tempNode = $values->textContent; + } + } + return $tempNode; + } + + private function randomContext() { + $headerstrings = array(); + $headerstrings['User-Agent'] = 'Mozilla/5.0 (Windows; U; Windows NT 5.'.rand(0,2).'; en-US; rv:1.'.rand(2,9).'.'.rand(0,4).'.'.rand(1,9).') Gecko/2007'.rand(10,12).rand(10,30).' Firefox/2.0.'.rand(0,1).'.'.rand(1,9); + $headerstrings['Accept-Charset'] = rand(0,1) ? 'en-gb,en;q=0.'.rand(3,8) : 'en-us,en;q=0.'.rand(3,8); + $headerstrings['Accept-Language'] = 'en-us,en;q=0.'.rand(4,6); + $setHeaders = 'Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5'."\r\n". + 'Accept-Charset: '.$headerstrings['Accept-Charset']."\r\n". + 'Accept-Language: '.$headerstrings['Accept-Language']."\r\n". + 'User-Agent: '.$headerstrings['User-Agent']."\r\n"; + $contextOptions = array( + 'http'=>array( + 'method'=>"GET", + 'header'=>$setHeaders + ) + ); + return stream_context_create($contextOptions); + } + +} + +?> \ No newline at end of file diff --git a/blocks/rss_agw/style.css b/blocks/rss_agw/style.css new file mode 100644 index 0000000..0bc6e81 --- /dev/null +++ b/blocks/rss_agw/style.css @@ -0,0 +1,17 @@ + .rss img { + display: none; + } + .rss span.title{ + font-size: 16px; + font-weight: bold; + /* text-decoration:underline; */ + } + + .rss span.date{ + font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; + font-size: 11px; + text-transform: uppercase; + font-weight:bold; + text-align: center; + letter-spacing: 2px; + } \ No newline at end of file diff --git a/blocks/server_monitor/index.php b/blocks/server_monitor/index.php new file mode 100644 index 0000000..791a5b2 --- /dev/null +++ b/blocks/server_monitor/index.php @@ -0,0 +1,16 @@ +\n +link}\">{$server->name}
\n +IP: {$server->ip}:{$server->port}
\n +Players: {$server->player}/{$server->maxplayer}
\n +\n +\n"; +CloseBlock(); + +?> \ No newline at end of file diff --git a/blocks/soldier_info/index.php b/blocks/soldier_info/index.php new file mode 100644 index 0000000..f40f528 --- /dev/null +++ b/blocks/soldier_info/index.php @@ -0,0 +1,25 @@ +
+ + Your IP:
+

'.$postnum.' post(s)

+
+ + + Welcome, '.$logged_username.'
+  Logout
'; + } + else{ + echo 'Welcome Guest.
+ +
'; + } + if ($logged_in == 'true'){ + echo'
+ Private Messages
+ Unread: '.$pm_unread.'
+ Total: '.$pm_total.'

'; + } +?> + \ No newline at end of file diff --git a/blocks/tsviewer/index.php b/blocks/tsviewer/index.php new file mode 100644 index 0000000..cee0be4 --- /dev/null +++ b/blocks/tsviewer/index.php @@ -0,0 +1,18 @@ +\n"; +////until it works again i'm going to have this here... +//echo "TSViewer is not working."; +//echo "\n"; +//CloseBlock(); +//return; //die + +?> + + + +\n"; +CloseBlock(); ?> -- cgit