forked from JavierGonzalez/POL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
poderes.php
executable file
·173 lines (131 loc) · 5.91 KB
/
poderes.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
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
<?php # POL.VirtualPol.com — Copyright (c) 2008 Javier González González <[email protected]> — MIT License
$p['jefegabinete'] = ' ';
$p['vice'] = ' ';
function get_cargo($cargo_ID, $salto=', ', $reicon=false) {
global $link;
$html = '';
$limit = '';
if ($num != false) { $limit = ' LIMIT ' . $num; }
$result = mysql_query_old("SELECT
(SELECT nick FROM users WHERE ID = cargos_users.user_ID LIMIT 1) AS nick
FROM cargos_users WHERE pais = '".PAIS."' AND cargo_ID = '" . $cargo_ID . "' AND cargo = 'true'" . $limit);
while ($row = mysqli_fetch_array($result)) {
if ($html) { $html .= $salto; if ($reicon) { $html .= '<img src="'.IMG.'cargos/' . $cargo_ID . '.gif" /> '; } }
$html .= crear_link($row['nick']);
}
return '<img src="'.IMG.'cargos/' . $cargo_ID . '.gif" /> '.$html;
}
if ($pol['paises']) {
foreach ($pol['paises'] AS $pais) {
if ($pais != PAIS) {
if ($mas_paises) { $mas_paises .= ', '; }
$mas_paises .= '<a href="http://'.strtolower($pais).'.'.DOMAIN.'/">'.$pais.'</a>';
}
}
if ($mas_paises) { $mas_paises = ' <span style="color:grey;font-size:12px;">(Ver otros países: '.$mas_paises.')</span>'; }
}
echo '
<div id="poderes"><table border="0" width="100%" cellspacing="10" cellpadding="0">
<tr><td class="amarillo" valign="top" width="33%"><h1>Poder Ejecutivo</h1>
<p class="gris">El Gobierno</p>
<center>
<table border="0" width="100%" cellpadding="0" cellspacing="3">
<tr><td align="right"><b>Presidente</b></td><td valign="top"><b>' . get_cargo(7) . '</b></td></tr>
<tr><td align="right">Vicepesidente</td><td valign="top">' . get_cargo(19) . '</td></tr>
<tr><td align="right" valign="top">Ministro</td><td valign="top">' . get_cargo(16) . '</td></tr>
<tr><td align="right" valign="top">Comisario</td><td valign="top">' . get_cargo(13) . '</td></tr>
<tr><td align="right" valign="top">Policía</td><td valign="top">' . get_cargo(12) . '</td></tr>
<tr><td align="left" valign="top" colspan="2"><br /><p class="gris">Ejército de '.PAIS.'</p></td></tr>
<tr><td align="right">General</td><td valign="top"><b>' . get_cargo(58) . '</b></td></tr>
<tr><td align="right">Capitán</td><td valign="top">' . get_cargo(57) . '</td></tr>
<tr><td align="right" valign="top">Soldado</td><td valign="top">' . get_cargo(55) . '</td></tr>
</table>
</center>
</td><td class="amarillo" valign="top" width="33%"><h1>Poder Legislativo</h1>
<p class="gris">El Parlamento</p>
<center>
<table border="0" cellpadding="0" cellspacing="3" width="100%">
<tr><td align="right"><b>Presidente</b></td><td valign="top">' . get_cargo(22) . '</td></tr>
<tr><td align="right" valign="top">Diputados</td><td valign="top"><b>' . get_cargo(6, '<br />', true) . '</b></td></tr>
<!--<tr><td align="right" valign="top">Defensor Pueblo</td><td valign="top">' . get_cargo(20) . '</td></tr>-->
</table>
</center>
</td><td class="amarillo" valign="top" width="33%"><h1>Poder Judicial</h1>
<p class="gris">La Justicia</p>
<center>
<table border="0" width="100%" cellpadding="0" cellspacing="3">
<tr><td align="right" valign="top" width="50%"><b>Juez Supremo</b></td><td width="50%" valign="top"><b>' . get_cargo(9, '<br />', true) . '</b></td></tr>
<tr><td align="right" valign="top">Juez de Paz</td><td valign="top">' . get_cargo(8, '<br />', true) . '</td></tr>
<tr><td align="right" valign="top">Fiscal</td><td valign="top">' . get_cargo(11, '<br />', true) . '</td></tr>
</table>
</center>
</td></tr>';
if (ECONOMIA) {
echo '
<tr><td colspan="4"></td></tr>
<tr><td class="amarillo" valign="top" colspan="2" width="50%"><h1>Economía</h1>
<p class="gris">Los más ricos</p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td><ol>';
$result = mysql_query_old("SELECT nick, cargo,
(pols + IFNULL((SELECT SUM(pols) FROM cuentas WHERE pais = '".PAIS."' AND user_ID = users.ID GROUP BY user_ID),0)) AS pols_total
FROM users
WHERE pais = '".PAIS."'
ORDER BY pols_total DESC
LIMIT 15");
echo mysqli_error($link);
while ($row = mysqli_fetch_array($result)) {
if (!$first) {
$first = true;
echo '<li><img src="'.IMG.'cargos/' . $row['cargo'] . '.gif" /> <b>' . crear_link($row['nick']) . '</b></li>';
} else {
echo '<li><img src="'.IMG.'cargos/' . $row['cargo'] . '.gif" /> ' . crear_link($row['nick']) . '</li>';
}
}
echo '</ol></td><td valign="top"><ol>';
$first = '';
$result = mysql_query_old("SELECT nombre, ID
FROM cuentas WHERE pais = '".PAIS."' AND nivel <= 5 AND gobierno = 'false' ORDER BY pols DESC LIMIT 15");
while ($row = mysqli_fetch_array($result)) {
if (!$first) {
$first = true;
echo '<li><a href="/pols/cuentas/' . $row['ID'] . '/"><b>' . $row['nombre'] . '</b></a></li>';
} else {
echo '<li><a href="/pols/cuentas/' . $row['ID'] . '/">' . $row['nombre'] . '</a></li>';
}
}
echo '</ol></td></tr></table>
</td><td class="amarillo" valign="top" width="50%"><h1>Terratenientes</h1>
<p class="gris">Con más propiedades</p><ol>';
$first = '';
$result = mysql_query_old("SELECT SUM(superficie) AS superficie,
(SELECT nick FROM users WHERE ID = mapa.user_ID LIMIT 1) AS nick,
(SELECT cargo FROM users WHERE ID = mapa.user_ID LIMIT 1) AS cargo
FROM mapa
WHERE pais = '".PAIS."' AND estado != 'e'
GROUP BY user_ID
ORDER BY superficie DESC
LIMIT 15");
echo mysqli_error($link);
while ($row = mysqli_fetch_array($result)) {
if (!$first) {
$first = true;
// (' . ($row['s'] - $row['num']) . ')
echo '<li><img src="'.IMG.'cargos/' . $row['cargo'] . '.gif" /> <b>' . crear_link($row['nick']) . ' (' . $row['superficie'] . ')</b></li>';
} else {
echo '<li><img src="'.IMG.'cargos/' . $row['cargo'] . '.gif" /> ' . crear_link($row['nick']) . ' (' . $row['superficie'] . ')</li>';
}
}
echo '</ol></td></tr>';
}
echo '</table></div>';
$txt_header .= '
<style type="text/css">
#poderes p { margin:3px 0 0 0; padding:0; }
#poderes a { font-size:18px; }
</style>';
//THEME
$txt_title = 'Poderes de '.PAIS.': Ejecutivo, Legislativo, Judicial, Economico, Terratenientes';
$txt_nav = array('Poderes');
$txt_menu = 'info';
?>