forked from leonardoxc/leonardoxc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EXT_news.php
93 lines (80 loc) · 3.1 KB
/
EXT_news.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?
//************************************************************************
// Leonardo XC Server, http://www.leonardoxc.net
//
// Copyright (c) 2004-2010 by Andreadakis Manolis
//
// This program is free software. You can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License.
//
// $Id: EXT_news.php,v 1.4 2010/05/05 14:00:04 manolis Exp $
//
//************************************************************************
require_once dirname(__FILE__)."/EXT_config_pre.php";
require_once "config.php";
require_once "EXT_config.php";
require_once "FN_functions.php";
require_once "FN_waypoint.php";
require_once "FN_pilot.php";
/*require_once "CL_flightData.php";
require_once "FN_UTM.php";
require_once "FN_output.php";
require_once "FN_flight.php";
*/
// setDEBUGfromGET();
if ( ! $CONF['news']['config']['newsActive'] ) {
return;
}
if ( $CONF['news']['config']['showNews'] ) {
if ( count($CONF['news']['items']) ) {
foreach($CONF['news']['items'] as $newsItemID=>$newsItem) {
if (!$newsItem['active']) continue;
$link=$newsItem['link'];
if ($link==$newsItemID) {
$linkStr=" href='#' onclick='showNewsItem($newsItemID)' ";
} else {
$linkStr=" href='".$link."' ";
if ( $newsItem['target'] ) {
$linkStr.=" target='".$newsItem['target']."' ";
}
}
if ($newsItem['date']) {
$dateStr="<span>".$newsItem['date']."</span>";
} else {
$dateStr='';
}
echo "<span>$dateStr<a $linkStr>".$newsItem['text']."</a></span>\n";
}
}
}
if ( $CONF['news']['config']['showBestFlights'] ){
global $prefix, $db, $sitename, $user, $cookie, $flightsTable;
global $CONF_glider_types,$gliderCatList,$module_name;
$count = 1;
$content .="<span><b>Best scores for ".date("Y")."</b> </span>";
foreach ( $CONF_glider_types as $gl_id=>$gl_type) {
$query="SELECT * FROM $flightsTable
WHERE DATE_FORMAT( DATE, '%Y' ) =".date("Y")." AND cat =".$gl_id."
ORDER BY flight_points DESC
LIMIT 1 ";
$result1 = $db->sql_query($query);
// Listing Topics
while($row= $db->sql_fetchrow($result1)) {
$flightID=$row["ID"];
$name=getPilotRealName($row["userID"],$row["serverID"],0,0,0);
$takeoffName=getWaypointName($row["takeoffID"]);
$takeoffVinicity=$row["takeoffVinicity"];
$takeoffNameFrm= formatLocation($takeoffName,$takeoffVinicity,$takeoffRadious );
$flightDurationFrm=sec2Time($row['DURATION'],1);
$content .= "<span>:: <span>".$gliderCatList[$gl_id]."</span>";
$content .= "<a href='".getLeonardoLink(array('op'=>'show_flight','flightID'=>$flightID))."'>";
$content .= "$name</a> [ $takeoffName ] ".formatDate($row["DATE"]).
//" "._DURATION.": $flightDurationFrm".
" <a href='".getLeonardoLink(array('op'=>'show_flight','flightID'=>$flightID))."'>"._OLC_SCORING.":".formatOLCScore($row['FLIGHT_POINTS'])."</a> </span>";
$count = $count + 1;
}
}
echo $content;
}
?>