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.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
177.
178.
179.
180.
181.
182.
183.
184.
185.
186.
187.
188.
189.
190.
191.
192.
193.
194.
195.
196.
197.
198.
199.
200.
201.
202.
203.
204.
205.
206.
207.
208.
209.
210.
211.
212.
213.
214.
215.
216.
217.
218.
219.
220.
| 1. / 2. / ...
<?php
// ClanSphere 2006 - www.clansphere.net
// $Id: view.php 267 2006-08-27 09:02:48Z duRiel $
$cs_lang = cs_translate('wars');
$wars_id = empty($_REQUEST['where']) ? $_REQUEST['id'] : $_REQUEST['where'];
settype($wars_id,'integer');
$cs_wars = cs_sql_select(__FILE__,'wars','*',"wars_id = '" . $wars_id . "'");
$wars['head']['topline'] = $cs_lang['body_view'];
$gameicon = 'uploads/games/'.$cs_wars['games_id'].'.gif';
$where = "games_id = '" . $cs_wars['games_id'] . "'";
$cs_game = cs_sql_select(__FILE__,'games','games_name, games_id',$where);
$wars['game']['icon'] = file_exists($gameicon) ? cs_html_img($gameicon) : '';
$wars['game']['link'] = cs_link($cs_game['games_name'],'games','view','id=' . $cs_game['games_id']);
$where = "categories_id = '" . $cs_wars['categories_id'] . "'";
$cs_cat = cs_sql_select(__FILE__,'categories','categories_name, categories_id',$where);
$wars['lang']['category'] = $cs_lang['category'];
$wars['category']['link'] = cs_link($cs_cat['categories_name'],'categories','view','id=' . $cs_cat['categories_id']);
$where = "clans_id = '" . $cs_wars['clans_id'] . "'";
$cs_clan = cs_sql_select(__FILE__,'clans','clans_name, clans_id',$where);
$wars['enemy']['link'] = cs_link($cs_clan['clans_name'],'clans','view','id=' . $cs_clan['clans_id']);
$wars['wars']['opponents'] = cs_secure($cs_wars['wars_opponents'],0,0,0);
$where = "squads_id = '" . $cs_wars['squads_id'] . "'";
$cs_squad = cs_sql_select(__FILE__,'squads','squads_name, squads_id',$where);
$wars['squad']['link'] = cs_link($cs_squad['squads_name'],'squads','view','id=' . $cs_squad['squads_id']);
$cells = 'pl.users_id AS users_id, usr.users_nick AS users_nick, usr.users_picture AS users_picture';
$tables = 'players pl INNER JOIN {pre}_users usr ON pl.users_id = usr.users_id';
$cond = 'pl.wars_id = ''.$wars_id.'' AND pl.players_played = '1'';
$players = cs_sql_select(__FILE__,$tables,$cells,$cond,'usr.users_nick',0,0);
$wars['players']['links'] = '';
if (!empty($players)) {
$pcount = count($players);
$run = 0;
foreach ($players AS $player) {
$run++;
$wars['players']['links'] .= cs_link(cs_html_img('uploads/users/'.$player['users_picture']).cs_html_br(1).$player['users_nick'],'users','view','id='.$player['users_id']);
$wars['players']['links'] .= $run != $pcount ? ', ' : '';
}
}
if (empty($cs_wars['wars_players1']) && empty($cs_wars['wars_players2'])) {
$wars['lang']['on'] = '';
$wars['wars']['players1'] = '-';
$wars['wars']['players2'] = '';
} else {
$wars['wars']['players1'] = $cs_wars['wars_players1'];
$wars['wars']['players2'] = $cs_wars['wars_players2'];
}
$wars['date']['show'] = cs_date('unix',$cs_wars['wars_date'],1);
$wars_status = empty($cs_wars['wars_status']) ? 'upcoming' : $cs_wars['wars_status'];
$wars['war']['status'] = $cs_lang[$wars_status];
$wars['war']['score1'] = $cs_wars['wars_score1'];
$wars['war']['score2'] = $cs_wars['wars_score2'];
$result = $cs_wars['wars_score1'] - $cs_wars['wars_score2'];
$icon = $result >= 1 ? 'green' : 'red';
$icon = empty($result) ? 'grey' : $icon;
$wars['result']['img'] = cs_html_img('symbols/clansphere/' . $icon . '.gif');
$wars_url = cs_secure($cs_wars['wars_url']);
$wars['url']['link'] = empty($wars_url) ? '-' : cs_html_link('http://' . $wars_url,$wars_url);
$wars['pictures']['show'] = '';
if(empty($cs_wars['wars_pictures'])) {
$wars['pictures']['show'] = '-';
} else {
$wars_pics = explode("n",$cs_wars['wars_pictures']);
foreach($wars_pics AS $pic) {
$link = cs_html_img('uploads/wars/thumb-' . $pic);
$wars['pictures']['show'] .= cs_html_link('uploads/wars/picture-' . $pic,$link) . ' ';
}
}
$wars['war']['report'] = empty($cs_wars['wars_report']) ? '-' : cs_secure($cs_wars['wars_report'],1,1);
echo cs_subtemplate(__FILE__,$wars,'wars','view');
echo cs_html_br(1);
$tables2 = 'rounds rnd INNER JOIN {pre}_maps mps ON rnd.maps_id = mps.maps_id';
$cells2 = 'rnd.rounds_score1 AS rounds_score1, rnd.rounds_score2 AS rounds_score2, '
. 'rnd.rounds_description AS rounds_description, mps.maps_name AS maps_name, '
. 'rnd.maps_id AS maps_id';
$rounds = cs_sql_select(__FILE__,$tables2,$cells2,'rnd.wars_id = ''.$wars_id.''','rnd.rounds_order ASC',0,0);
if(!empty($rounds)) {
echo cs_html_table(1,'forum',1);
echo cs_html_roco(1,'headb',0,4);
echo $cs_lang['rounds'];
echo cs_html_roco(0);
echo cs_html_roco(1,'leftc',0,0,'10%');
echo $cs_lang['map'];
echo cs_html_roco(2,'leftc',0,2,'10%');
echo $cs_lang['result'];
echo cs_html_roco(3,'leftc',0,0,'80%');
echo $cs_lang['comment'];
echo cs_html_roco(0);
foreach ($rounds AS $round) {
echo cs_html_roco(1,'leftb');
echo cs_link($round['maps_name'],'maps','view','id='.$round['maps_id']);
echo cs_html_roco(2,'leftb');
echo $round['rounds_score1'] . ' : ' . $round['rounds_score2'];
echo cs_html_roco(3,'leftb');
$result2 = $round['rounds_score1'] - $round['rounds_score2'];
$icon2 = $result2 >= 1 ? 'green' : 'red';
if (empty($result2)) {
$icon2 = 'grey';
}
echo cs_html_img('symbols/clansphere/' . $icon2 . '.gif');
echo cs_html_roco(4,'leftb');
echo cs_secure($round['rounds_description'],1,1);
echo cs_html_roco(0);
}
echo cs_html_table(0);
}
if ($wars_status == 'upcoming') {
$condition = 'users_id = ''.$account['users_id'].'' AND squads_id = ''.$cs_squad['squads_id'].''';
$squadmember = cs_sql_count(__FILE__,'members',$condition);
$wars_access = empty($account['wars_access']) ? 0 : $account['wars_access'];
if (!empty($squadmember) OR $wars_access >= 3) {
echo cs_html_br(1);
echo cs_html_table(1,'forum',1);
echo cs_html_roco(1,'headb',0,3);
echo $cs_lang['players'];
echo cs_html_roco(0);
echo cs_html_roco(1,'leftc');
echo $cs_lang['player'];
echo cs_html_roco(2,'leftc');
echo $cs_lang['plays'];
echo cs_html_roco(3,'leftc');
echo $cs_lang['date'];
echo cs_html_roco(0);
$tables = 'players ply INNER JOIN {pre}_users usr ON ply.users_id = usr.users_id';
$cells = 'ply.users_id AS users_id, ply.players_status AS players_status, '
.'ply.players_time AS players_time, usr.users_nick AS users_nick';
$players = cs_sql_select(__FILE__,$tables,$cells,'ply.wars_id = ''.$wars_id.''','ply.players_status DESC',0,0);
if (empty($players)) {
echo cs_html_roco(1,'leftb',0,3);
echo $cs_lang['no_players'];
echo cs_html_roco(0);
} else {
$in_list = 0;
foreach ($players AS $player) {
echo cs_html_roco(1,'leftb');
echo cs_link($player['users_nick'],'users','view','id='.$player['users_id']);
echo cs_html_roco(2,'leftb');
echo $cs_lang[$player['players_status']];
echo cs_html_roco(3,'leftb');
echo cs_date('unix',$player['players_time'],1);
echo cs_html_roco(0);
if ($player['users_id'] == $account['users_id']) {
$in_list = 1;
}
}
}
if (!empty($squadmember)) {
echo cs_html_roco(1,'centerc',0,3);
if (empty($in_list)) {
echo cs_link($cs_lang['join_war'],'wars','join','id='.$wars_id);
} else {
echo cs_link($cs_lang['edit_status'],'wars','statusedit','id='.$wars_id);
}
echo cs_html_roco(0);
}
echo cs_html_table(0);
}
}
$where_com = "comments_mod = 'wars' AND comments_fid = '" . $cs_wars['wars_id'] . "'";
$count_com = cs_sql_count(__FILE__,'comments',$where_com);
include_once('mods/comments/functions.php');
if(!empty($count_com)) {
echo cs_html_br(1);
echo cs_comments_view($wars_id,'wars','view',$count_com);
}
if(empty($cs_wars['wars_close'])) {
echo cs_html_br(1);
echo cs_comments_add($wars_id,'wars');
}
?> |