1 | <?php |
---|
2 | // current subversion revision |
---|
3 | if (file_exists('cache/svnrev.php')) |
---|
4 | { |
---|
5 | include('cache/svnrev.php'); |
---|
6 | } |
---|
7 | else |
---|
8 | { |
---|
9 | $svn_rev = '456'; |
---|
10 | } |
---|
11 | define('SVN_REV', $svn_rev); |
---|
12 | |
---|
13 | define('LATEST_DB_UPDATE',"011"); |
---|
14 | |
---|
15 | // current version: major.minor.sub |
---|
16 | // unpair numbers for minor = development version |
---|
17 | define('KB_VERSION', '2.0.4'); |
---|
18 | define('KB_RELEASE', '(Apocrypha)'); |
---|
19 | |
---|
20 | // set the running-server for id-syncs here |
---|
21 | define('KB_SYNCURL', 'http://sync.eve-dev.net/?a=sync_server'); |
---|
22 | |
---|
23 | // add new corporations here once you've added the logo to img/corps/ |
---|
24 | $corp_npc = array('Guristas', 'Serpentis Corporation', 'Sansha\'s Nation', 'CONCORD', |
---|
25 | 'Mordus Legion', 'Blood Raider', 'Archangels', 'Guardian Angels', 'True Power'); |
---|
26 | |
---|
27 | function shorten($shorten, $by = 22) |
---|
28 | { |
---|
29 | if (strlen($shorten) > $by) |
---|
30 | { |
---|
31 | $s = substr($shorten, 0, $by) . "..."; |
---|
32 | } |
---|
33 | else $s = $shorten; |
---|
34 | |
---|
35 | return $s; |
---|
36 | } |
---|
37 | |
---|
38 | function slashfix($fix) |
---|
39 | { |
---|
40 | return addslashes(stripslashes($fix)); |
---|
41 | } |
---|
42 | |
---|
43 | function roundsec($sec) |
---|
44 | { |
---|
45 | if ($sec <= 0) |
---|
46 | $s = 0.0; |
---|
47 | else |
---|
48 | $s = $sec; |
---|
49 | |
---|
50 | return number_format(round($s, 1), 1); |
---|
51 | } |
---|
52 | //! Check if a version of this template for the igb exists and return that if so. |
---|
53 | function get_tpl($name) |
---|
54 | { |
---|
55 | if (IS_IGB) |
---|
56 | { |
---|
57 | if (file_exists('./templates/igb_'.$name.'.tpl')) |
---|
58 | { |
---|
59 | return 'igb_'.$name.'.tpl'; |
---|
60 | } |
---|
61 | } |
---|
62 | return $name.'.tpl'; |
---|
63 | } |
---|
64 | |
---|
65 | // this is currently only a wrapper but might get |
---|
66 | // timestamp adjustment options in the future |
---|
67 | function kbdate($format, $timestamp = null) |
---|
68 | { |
---|
69 | if ($timestamp === null) |
---|
70 | { |
---|
71 | $timestamp = time(); |
---|
72 | } |
---|
73 | |
---|
74 | if (config::get('date_gmtime')) |
---|
75 | { |
---|
76 | return gmdate($format, $timestamp); |
---|
77 | } |
---|
78 | return date($format, $timestamp); |
---|
79 | } |
---|
80 | |
---|
81 | function getYear() |
---|
82 | { |
---|
83 | $test = kbdate('o'); |
---|
84 | if ($test == 'o') |
---|
85 | { |
---|
86 | $test = kbdate('Y'); |
---|
87 | } |
---|
88 | return $test; |
---|
89 | } |
---|
90 | |
---|
91 | //! Return start date for the given week, month, year or date. |
---|
92 | |
---|
93 | /*! |
---|
94 | * weekno > monthno > startWeek > yearno |
---|
95 | * weekno > monthno > yearno |
---|
96 | * startDate and endDate are used if they restrict the date range further |
---|
97 | * monthno, weekno and startweek are not used if no year is set |
---|
98 | */ |
---|
99 | function makeStartDate($week = 0, $year = 0, $month = 0, $startweek = 0, $startdate = 0) |
---|
100 | { |
---|
101 | $qstartdate=0; |
---|
102 | if(intval($year)>0) |
---|
103 | { |
---|
104 | if($week) |
---|
105 | { |
---|
106 | if ($week == 1) |
---|
107 | {$qstartdate = strtotime($year.'-1-1 00:00 UTC');} |
---|
108 | else |
---|
109 | {$qstartdate = strtotime('last Monday +'.($week-1).' weeks UTC', strtotime($year.'-1-1'));} |
---|
110 | } |
---|
111 | else if($month) |
---|
112 | {$qstartdate = strtotime($year.'-'.$month.'-1 00:00 UTC');} |
---|
113 | else if($startweek) |
---|
114 | { |
---|
115 | if ($startweek == 1) {$qstartdate = strtotime($year.'-1-1 00:00 UTC');} |
---|
116 | else{$qstartdate = strtotime('last Monday +'.($week-1).' weeks UTC', strtotime($year.'-1-1'));} |
---|
117 | } |
---|
118 | else |
---|
119 | {$qstartdate = strtotime($year.'-1-1 00:00 UTC');} |
---|
120 | } |
---|
121 | //If set use the latest startdate and earliest enddate set. |
---|
122 | if($startdate && $qstartdate < strtotime($startdate." UTC")) $qstartdate = strtotime($startdate." UTC"); |
---|
123 | return $qstartdate; |
---|
124 | } |
---|
125 | |
---|
126 | //! Return end date for the given week, month, year or date. |
---|
127 | |
---|
128 | /*! |
---|
129 | * Priority order of date filters: |
---|
130 | * weekno > monthno > startWeek > yearno |
---|
131 | * weekno > monthno > yearno |
---|
132 | * startDate and endDate are used if they restrict the date range further |
---|
133 | * monthno, weekno and startweek are not used if no year is set |
---|
134 | */ |
---|
135 | function makeEndDate($week = 0, $year = 0, $month = 0, $enddate = 0) |
---|
136 | { |
---|
137 | if($year) |
---|
138 | { |
---|
139 | if($week) |
---|
140 | { |
---|
141 | if ($week == 53) |
---|
142 | $qenddate = strtotime(($year).'-12-31 23:59 UTC'); |
---|
143 | else |
---|
144 | $qenddate = strtotime('last Monday +'.($week).' weeks -1 minute UTC', strtotime($year.'-1-1')); |
---|
145 | } |
---|
146 | else if($month) |
---|
147 | { |
---|
148 | if($month == 12) $qenddate = strtotime(($year).'-12-31 23:59 UTC'); |
---|
149 | else $qenddate = strtotime(($year).'-'.($month + 1).'-1 00:00 - 1 minute UTC'); |
---|
150 | } |
---|
151 | else |
---|
152 | $qenddate = strtotime(($year).'-12-31 23:59 UTC'); |
---|
153 | } |
---|
154 | //If set use the earliest enddate. |
---|
155 | if($enddate && (!$qenddate || ($qenddate && $qenddate > strtotime($enddate." UTC")))) $qenddate = strtotime($enddate." UTC"); |
---|
156 | |
---|
157 | return $qenddate; |
---|
158 | } |
---|