Example #1
0
function acceso_check($chat_ID, $ac = null)
{
    global $link;
    if (isset($ac)) {
        $check = array($ac);
    } else {
        $check = array('leer', 'escribir', 'escribir_ex');
    }
    $result = mysql_query("SELECT HIGH_PRIORITY acceso_leer, acceso_escribir, acceso_escribir_ex, acceso_cfg_leer, acceso_cfg_escribir, acceso_cfg_escribir_ex, pais FROM chats WHERE chat_ID = '" . $chat_ID . "' LIMIT 1", $link);
    while ($r = mysql_fetch_array($result)) {
        foreach ($check as $a) {
            $acceso[$a] = nucleo_acceso($r['acceso_' . $a], $r['acceso_cfg_' . $a]);
        }
    }
    if (isset($ac)) {
        return $acceso[$ac];
    } else {
        return $acceso;
    }
}
Example #2
0
function boton_cargo($value, $url, $cargo)
{
    //boton_cargo('Crear examen', '/examenes/crear/', '7', $pol['cargos'])
    $text = '';
    if ($url) {
        $val = ' type="button" onclick="window.location.href=\'' . $url . '\';"';
    } else {
        $val = ' type="submit"';
    }
    if ($cargo) {
        global $pol, $vp;
        if ($cargo == 35 and nucleo_acceso($vp['acceso']['examenes_decano'])) {
        } elseif ($cargo == 34 and (nucleo_acceso($vp['acceso']['examenes_profesor']) or nucleo_acceso($vp['acceso']['examenes_decano']))) {
        } else {
            $val .= ' disabled="disabled"';
        }
        if ($cargo == 35) {
            $text = 'Decano';
        } elseif ($cargo == 34) {
            $text = 'Profesor';
        }
    }
    return '<span class="amarillo"><input' . $val . ' value="' . $value . '" /> Cargo requerido: <em>' . $text . '</em></span>';
}
Example #3
0
    }
    $acceso_leer = $r['acceso_leer'];
    $acceso_escribir = $r['acceso_escribir'];
    $acceso_cfg_leer = $r['acceso_cfg_leer'];
    $acceso_cfg_escribir = $r['acceso_cfg_escribir'];
}
// genera array js, nombres cargos
$result = mysql_query("SELECT cargo_ID, nombre FROM cargos WHERE pais = '" . PAIS . "' AND asigna != '-1' ORDER BY nivel DESC", $link);
while ($r = mysql_fetch_array($result)) {
    if ($array_cargos) {
        $array_cargos .= ', ';
    }
    $array_cargos .= $r['cargo_ID'] . ':"' . $r['nombre'] . '"';
}
// Muestra control de kicks.
if (nucleo_acceso($vp['acceso']['kick']) and $pol['pais'] == PAIS) {
    $js_kick = '<a href=\\"/control/kick/" + kick_nick  + "/" + chat_ID  + "/\\" target=\\"_blank\\"><img src=\\"' . IMG . 'varios/kick.gif\\" title=\\"Kickear\\" alt=\\"Kickear\\" border=\\"0\\" /></a> ';
} else {
    $js_kick = '';
}
$txt .= '
<div id="vp_c">

<h1 style="margin:0 0 18px 0;">';
if ($externo) {
    if ($_SESSION['pol']['user_ID']) {
        $txt .= '<span style="float:right;"><a href="http://www.' . DOMAIN . '/">Volver a VirtualPOL</a></span>' . $titulo;
    } else {
        $txt .= '<span style="float:right;"><a href="http://www.' . DOMAIN . '/registrar/">Crear ciudadano</a></span>' . $titulo;
    }
} else {
Example #4
0
' . boton('Editar', 'submit', false, 'blue') . '
</form></b></td></tr>
<tr><td align="right">
<form action="/accion.php?a=mercado&b=cederfrase" method="post">
Ceder al Ciudadano: <input type="text" name="nick" size="14" maxlength="20" value="" />
</td><td>
' . boton('Ceder', 'submit', false, 'small pill') . '
</form>

</td></tr></table>
</div><br />';
    }
    // ;ID:URL:TEXT;
    foreach (explode(";", $pol['config']['palabras']) as $num => $t) {
        $t = explode(":", $t);
        if ($t[0] == $pol['user_ID'] or nucleo_acceso($vp['acceso']['control_gobierno'])) {
            $txt .= '<div class="azul"><h2>"Palabra ' . ($num + 1) . '"</h2>
<form action="/accion.php?a=mercado&b=editarpalabra&ID=' . $num . '" method="post">

<table border="0"><tr>
<td>Texto: <input value="' . $t[2] . '" type="text" name="text" size="20" maxlength="20" /><br />
http://<input type="text" name="url" size="50" maxlength="150" value="' . $t[1] . '" /></td><td>
' . boton('Editar', 'submit', false, 'blue') . '
</form></b></td></tr>

<tr><td align="right">
<form action="/accion.php?a=mercado&b=cederpalabra&ID=' . $num . '" method="post">
Ceder al Ciudadano: <input type="text" name="nick" size="14" maxlength="20" value="" />
</td><td>
' . boton('Ceder', 'submit', false, 'small pill') . '
</form></td>
Example #5
0
<span style="color:#666;padding:3px 4px;border:1px solid #999;border-bottom:none;" class="redondeado"><b>
<input type="checkbox" onclick="ver_votacion(\'referendum\');" id="c_referendum" checked="checked" /> Referendums &nbsp; 
' . (ASAMBLEA ? '' : '<input type="checkbox" onclick="ver_votacion(\'parlamento\');" id="c_parlamento" checked="checked" /> Parlamento &nbsp; ') . ' 
<input type="checkbox" onclick="ver_votacion(\'sondeo\');" id="c_sondeo" checked="checked" /> Sondeos</b> &nbsp; 
<input type="checkbox" onclick="ver_votacion(\'cargo\');" id="c_cargo" /> Cargos &nbsp; 
<input type="checkbox" onclick="ver_votacion(\'privadas\');" id="c_privadas" /> <span style="color:red;">Privadas</span> &nbsp; 
</span>

<hr />
<table border="0" cellpadding="1" cellspacing="0" class="pol_table">
';
    $mostrar_separacion = true;
    $result = mysql_query("SELECT ID, pregunta, time, time_expire, user_ID, estado, num, tipo, acceso_votar, acceso_cfg_votar, acceso_ver, acceso_cfg_ver\r\nFROM votacion\r\nWHERE estado = 'end' AND pais = '" . PAIS . "'\r\nORDER BY time_expire DESC\r\nLIMIT 500", $link);
    while ($r = mysql_fetch_array($result)) {
        $time_expire = strtotime($r['time_expire']);
        if ($r['acceso_ver'] == 'anonimos' or nucleo_acceso($r['acceso_ver'], $r['acceso_cfg_ver'])) {
            $txt .= '<tr class="v_' . $r['tipo'] . ($r['acceso_ver'] != 'anonimos' ? ' v_privadas' : '') . '"' . (in_array($r['tipo'], array('referendum', 'parlamento', 'sondeo')) && $r['acceso_ver'] == 'anonimos' ? '' : ' style="display:none;"') . '>
<td width="100"' . ($r['tipo'] == 'referendum' ? ' style="font-weight:bold;"' : '') . '>' . ucfirst($r['tipo']) . '</td>
<td align="right"><b>' . num($r['num']) . '</b></td>
<td><a href="/votacion/' . $r['ID'] . '" style="' . ($r['tipo'] == 'referendum' ? 'font-weight:bold;' : '') . ($r['acceso_ver'] != 'anonimos' ? 'color:red;" title="Votación privada' : '') . '">' . $r['pregunta'] . '</a></td>
<td nowrap="nowrap" align="right" class="gris">' . timer($time_expire, true) . '</td>
<td></td>
</tr>';
        }
    }
    $txt .= '</table>';
}
//THEME
$txt_menu = 'demo';
include 'theme.php';
Example #6
0
		</ul>
	</li>
<?php 
}
echo '<div id="notif">' . notificacion('print') . '</div>';
?>

	</ul>

	<div id="menu-next">

		<p id="palabras">
<?php 
foreach (explode(';', $pol['config']['palabras']) as $t) {
    $t = explode(':', $t);
    echo ($t[1] != '' ? '<a href="http://' . $t[1] . '"><b>' . $t[2] . '</b></a>' : $t[2]) . ($pol['user_ID'] == $t[0] || nucleo_acceso($vp['acceso']['control_gobierno']) ? ' <a href="/subasta/editar" style="float:right;color:#CCC;">#</a>' : '') . '<br />';
}
echo '</p>';
if (ECONOMIA) {
    echo '<a href="/mapa" class="gris" style="float:right;">Mapa</a><a href="/subasta" class="gris">Subasta</a>';
    if (!isset($cuadrado_size)) {
        $cuadrado_size = 12;
    }
    include 'inc-mapa.php';
    echo '<div style="margin:4px 0 0 6px;">' . $txt_mapa . '</div>';
}
?>

	</div>
</div>
Example #7
0
include 'inc-login.php';
$result = mysql_query("SELECT *, \r\n(SELECT siglas FROM " . SQL . "partidos WHERE ID = users.partido_afiliado LIMIT 1) AS partido,\r\n(SELECT COUNT(ID) FROM " . SQL . "foros_hilos WHERE user_ID = users.ID LIMIT 1) AS num_hilos,\r\n(SELECT COUNT(ID) FROM " . SQL . "foros_msg WHERE user_ID = users.ID LIMIT 1) AS num_msg\r\nFROM users \r\nWHERE nick = '" . $_GET['a'] . "'\r\nLIMIT 1", $link);
while ($r = mysql_fetch_array($result)) {
    $user_ID = $r['ID'];
    if (PAIS != $r['pais'] and $r['estado'] == 'ciudadano' and $r['pais'] != 'ninguno') {
        header('HTTP/1.1 301 Moved Permanently');
        header('Location: http://' . strtolower($r['pais']) . '.' . DOMAIN . '/perfil/' . $r['nick'] . '/');
        exit;
    } elseif ($user_ID) {
        //nick existe
        $nick = $r['nick'];
        if ($r['avatar'] == 'true') {
            $p_avatar = '<span width="120" height="120"><img src="' . IMG . 'a/' . $r['ID'] . '.jpg" alt="' . $nick . '" /></span>';
        }
        $extras = '';
        if (nucleo_acceso('supervisores_censo')) {
            $extras = '
<tr>
<td colspan="2"><div style="float:right;">' . boton('Expulsar', 'http://' . strtolower($pol['pais']) . '.' . DOMAIN . '/control/expulsiones/expulsar/' . $r['nick'], false, 'red') . '</div>(' . $r['ID'] . ', <span title="' . $r['avatar_localdir'] . '" style="font-size:12px;">' . $r['email'] . '</span>, ' . num($r['visitas']) . ' v, ' . num($r['paginas']) . ' pv,  <a href="http://www.geoiptool.com/es/?IP=' . ($r['IP'] + rand(-30, 30)) . '">' . ocultar_IP($r['host'], 'host') . '</a>)<br /><span style="font-size:9px;color:#666;">' . $r['nav'] . '</span></td></tr>
<tr><td colspan="3" align="right">

<form action="http://' . strtolower($pol['pais']) . '.' . DOMAIN . '/accion.php?a=SC&b=nota&ID=' . $r['ID'] . '" method="post">
Anotaci&oacute;n de SC: <input type="text" name="nota_SC" size="35" maxlength="255" value="' . $r['nota_SC'] . '" />
' . boton('OK', 'submit', false, 'pill small') . '
</form>

</td>

<td valign="top" align="right"><div style="font-size:12px;width:180px;max-height:100px;overflow:auto;">';
            foreach (explode('|', $r['hosts']) as $el_host) {
                if ($el_host != '') {
Example #8
0
<td valign="top"><b>Acceso escribir:</b><br />
' . $txt_li['escribir'] . ' <input type="text" name="acceso_cfg_escribir" size="25" maxlength="900" autocomplete="off" id="acceso_cfg_escribir_var" value="' . $r['acceso_cfg_escribir'] . '" /></td>

<td valign="top"><b>Acceso escribir extranjeros:</b><br />
' . $txt_li['escribir_ex'] . ' <input type="text" name="acceso_cfg_escribir_ex" size="25" maxlength="900" autocomplete="off" id="acceso_cfg_escribir_ex_var" value="' . $r['acceso_cfg_escribir_ex'] . '" /></td>

</tr>
<tr><td colspan="2" align="center"><input type="submit" style="font-size:24px;width:150px;" value="Editar"' . (nucleo_acceso('privado', $r['admin']) or ($r['user_ID'] == 0 and $pol['nivel'] >= 98) ? '' : ' disabled="disabled"') . ' /></td></tr>
</table>

</form>';
        if ($r['user_ID'] != 0) {
            $txt .= '<form action="/accion.php?a=chat&b=cambiarfundador" method="post">
<input type="hidden" name="chat_ID" value="' . $r['chat_ID'] . '" />
<p>Administradores: <input type="text" name="admin" size="40" maxlength="900" value="' . $r['admin'] . '" /> <input type="submit" value="Cambiar Administradores"' . ($r['user_ID'] == $pol['user_ID'] or nucleo_acceso('privado', $r['admin']) or ($r['user_ID'] == 0 and nucleo_acceso('nivel', 98)) ? '' : ' disabled="disabled"') . ' /></p></form>';
        }
        if ($r['estado'] == 'activo' and $r['user_ID'] != 0 and ($r['user_ID'] == $pol['user_ID'] or $pol['nivel'] >= 95 and $r['acceso_escribir'] == 'anonimos')) {
            $txt .= boton('Bloquear', 'http://' . strtolower($r['pais']) . '.' . DOMAIN . '/accion.php?a=chat&b=bloquear&chat_ID=' . $r['chat_ID'], '&iquest;Seguro que quieres BLOQUEAR este chat?');
        }
        $txt .= '<p>Codigo HTML: <input type="text" style="color:grey;font-weight:normal;" value="&lt;iframe width=&quot;730&quot; height=&quot;480&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; transparency=&quot;transparency&quot; src=&quot;http://' . strtolower($r['pais']) . '.' . DOMAIN . '/chats/' . $r['url'] . '/e/&quot;&gt;&lt;p&gt;&lt;a href=&quot;http://' . strtolower($r['pais']) . '.' . DOMAIN . '/chats/' . $r['url'] . '/&quot;&gt;&lt;b&gt;Entra al chat&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;&lt;/iframe&gt;" size="70" /></p>';
    }
} elseif ($_GET['a']) {
    // Chats
    include 'inc-chats.php';
} else {
    // Listado de chats
    $txt_title = 'Chats';
    $txt_nav = array('/chats' => 'Chats');
    $txt_tab = array('/chats/solicitar-chat' => 'Solicitar chat');
    $result = mysql_query("SELECT COUNT(*) AS num FROM chats_msg WHERE time > '" . date('Y-m-d H:i:s', time() - 600) . "'", $link);
Example #9
0
    $fecha_registro = $r['fecha_registro'];
}
$has_votado_elecciones = false;
if ($pol['config']['elecciones_estado'] == 'elecciones') {
    $result = mysql_query("SELECT user_ID FROM " . SQL . "elecciones WHERE user_ID = '" . $pol['user_ID'] . "' LIMIT 1", $link);
    while ($r = mysql_fetch_array($result)) {
        $has_votado_elecciones = true;
    }
}
$txt .= '<li>' . ($pol['config']['elecciones_estado'] == 'normal' ? '<img src="' . IMG . 'ico/ok.png" width="32" height="32" /> <b style="color:blue;">Quedan <span class="timer" value="' . strtotime($pol['config']['elecciones_inicio']) . '"></span> para las pr&oacute;ximas Elecciones.</b>' : ($has_votado_elecciones == true ? '<img src="' . IMG . 'ico/ok.png" width="32" height="32" /> <b style="color:blue;">Has votado correctamente en las elecciones.</b>' : ($fecha_registro >= $fecha_24_antes ? '<img src="' . IMG . 'ico/ok.png" width="32" height="32" /> <b style="color:blue;">Podr&aacute;s votar en las pr&oacute;ximas elecciones.</b>' : '<img src="' . IMG . 'ico/no.png" width="32" height="32" /> <b style="color:red;">No has votado en las elecciones Elecciones.</b>'))) . ' <a href="/elecciones/" target="_blank" style="font-size:19px;">Ver Elecciones</a>.<br />
Las Elecciones son un proceso democr&aacute;tico, peri&oacute;dico y autom&aacute;tico. De su resultado dependen los cargos principales de moderaci&oacute;n y gesti&oacute;n. Todos los participantes pueden votar y cualquiera puede postularse como candidato.<br /><br /></li>';
$hay_votaciones = 0;
if ($pol['config']['info_consultas'] > 0) {
    $result = mysql_query("SELECT ID, pregunta, acceso_votar, acceso_cfg_votar, acceso_ver, acceso_cfg_ver, (SELECT user_ID FROM votacion_votos WHERE ref_ID = votacion.ID AND user_ID = '" . $pol['user_ID'] . "' LIMIT 1) AS ha_votado FROM votacion WHERE estado = 'ok' AND pais = '" . PAIS . "'", $link);
    while ($r = mysql_fetch_array($result)) {
        if (!$r['ha_votado'] and nucleo_acceso($r['acceso_votar'], $r['acceso_cfg_votar']) and nucleo_acceso($r['acceso_ver'], $r['acceso_cfg_ver'])) {
            $hay_votaciones++;
            $votaciones_array[] = '<li><a href="/votacion/' . $r['ID'] . '/"><b>' . $r['pregunta'] . '</b></a></li>';
        }
    }
}
$txt .= '<li>' . ($pol['config']['info_consultas'] > 0 ? $hay_votaciones > 0 ? '<img src="' . IMG . 'ico/no.png" width="32" height="32" /> <b style="color:red;">Hay votaciones en las que a&uacute;n no has votado.</b>' : '<img src="' . IMG . 'ico/ok.png" width="32" height="32" /> <b style="color:blue;">Has votado en todas las votaciones en curso.</b>' : '<img src="' . IMG . 'ico/ok.png" width="32" height="32" /> <b style="color:blue;">No hay votaciones en curso.</b>') . ' <a href="/votacion/" target="_blank" style="font-size:19px;">Ver votaciones</a>.<br />
' . ($hay_votaciones > 0 ? '<ul>' . implode('', $votaciones_array) . '</ul>' : '') . '
Las votaciones (informativas o vinculantes) son el mecanismo democr&aacute;tico m&aacute;s habitual. Duran un tiempo determinado, configuraci&oacute;n espec&iacute;fica y puede haber varias simult&aacute;neas.<br /><br /></li>';
$votos_confianza = 0;
$result = mysql_query("SELECT COUNT(*) AS num FROM votos WHERE tipo = 'confianza' AND emisor_ID = '" . $pol['user_ID'] . "'", $link);
while ($r = mysql_fetch_array($result)) {
    $votos_confianza = $r['num'];
}
$txt .= '<li>' . ($votos_confianza < VOTO_CONFIANZA_MAX ? '<img src="' . IMG . 'ico/no.png" width="32" height="32" /> <b style="color:red;">Te quedan ' . (VOTO_CONFIANZA_MAX - $votos_confianza) . ' votos de confianza por repartir.</b>' : '<img src="' . IMG . 'ico/ok.png" width="32" height="32" /> <b style="color:blue;">Has repartido todos tus votos de confianza.</b>') . ' <a href="/info/censo/confianza/" target="_blank" style="font-size:19px;">Votar confianza</a>.<br />
El voto de confianza es una valoraci&oacute;n (+1 -1) que los usuarios se reparten entre s&iacute;. No implica que te guste ese usuario, si no que conf&iacute;as en &eacute;l. Tienes ' . VOTO_CONFIANZA_MAX . ' votos de confianza para repartir.<br /><br /></li>';
Example #10
0
    $result = mysql_query("SELECT ID, nombre, tipo FROM " . SQL . "cat WHERE tipo = 'docs' ORDER BY orden ASC", $link);
    while ($r = mysql_fetch_array($result)) {
        // CAT
        $txt .= '<div class="amarillo"><b style="font-size:20px;padding:15px;color:green;">' . $r['nombre'] . '</b></div>';
        $txt .= '<table border="0" cellspacing="0" cellpadding="4" class="pol_table" width="100%">
<tr>
<th></th>
<th>Lectura</th>
<th>Escritura</th>
<th align="right">Publicado</th>
</tr>';
        $result2 = mysql_query("SELECT title, url, time, estado, time_last, acceso_leer, acceso_escribir, acceso_cfg_leer, acceso_cfg_escribir\r\nFROM docs\r\nWHERE estado = 'ok' AND cat_ID = '" . $r['ID'] . "' AND pais = '" . PAIS . "'\r\nORDER BY title ASC", $link);
        while ($r2 = mysql_fetch_array($result2)) {
            if (nucleo_acceso($r2['acceso_leer'], $r2['acceso_cfg_leer'])) {
                $txt .= '<tr>
<td>' . (nucleo_acceso($r2['acceso_escribir'], $r2['acceso_cfg_escribir']) || nucleo_acceso($vp['acceso']['control_gobierno']) ? ' ' . boton('Editar', '/doc/' . $r2['url'] . '/editar', false, 'small') . ' ' : '') . '<a href="/doc/' . $r2['url'] . '">' . $r2['title'] . '</a></td>

<td width="90" valign="top" style="background:#5CB3FF;">' . ($r2['acceso_cfg_leer'] ? '<acronym title="[' . $r2['acceso_cfg_leer'] . ']">' : '') . ucfirst($r2['acceso_leer']) . ($r2['acceso_cfg_leer'] ? '</acronym>' : '') . '</td>

<td width="90" valign="top" style="background:#F97E7B;">' . ($r2['acceso_cfg_escribir'] ? '<acronym title="[' . $r2['acceso_cfg_escribir'] . ']">' : '') . ucfirst($r2['acceso_escribir']) . ($r2['acceso_cfg_escribir'] ? '</acronym>' : '') . '</td>

<td width="80" align="right" nowrap="nowrap">' . timer($r2['time_last']) . '</td>
</tr>' . "\n";
            }
        }
        $txt .= '</table>';
    }
    $txt .= '</div>';
}
//THEME
$txt_menu = 'info';
Example #11
0
<th style="font-weight:normal;">Último acceso</th>
<th style="font-weight:normal;">Confianza</th>
<th style="font-weight:normal;">Nota</th>
</tr>
' . implode('', $candidatos) . '
</table>



</td></tr></table>';
    }
} else {
    // VER CARGOS
    $txt_nav = array('Cargos');
    $txt_tab = array('/examenes' => 'Examenes');
    if (nucleo_acceso($vp['acceso']['examenes_decano']) or nucleo_acceso($vp['acceso']['examenes_profesor'])) {
        $editar_examen = true;
    } else {
        $editar_examen = false;
    }
    $result = mysql_query("SELECT *, \r\n(SELECT cargo FROM cargos_users WHERE pais = '" . PAIS . "' AND user_ID = '" . $pol['user_ID'] . "' AND cargo_ID = cargos.cargo_ID LIMIT 1) AS cargo,\r\n(SELECT aprobado FROM cargos_users WHERE pais = '" . PAIS . "' AND user_ID = '" . $pol['user_ID'] . "' AND cargo_ID = cargos.cargo_ID LIMIT 1) AS aprobado,\r\n(SELECT nota FROM cargos_users WHERE pais = '" . PAIS . "' AND user_ID = '" . $pol['user_ID'] . "' AND cargo_ID = cargos.cargo_ID LIMIT 1) AS nota,\r\n(SELECT ID FROM " . SQL . "examenes WHERE cargo_ID = cargos.cargo_ID LIMIT 1) AS examen_ID,\r\n(SELECT COUNT(ID) FROM cargos_users WHERE pais = '" . PAIS . "' AND cargo_ID = cargos.cargo_ID AND cargo = 'true') AS cargo_num,\r\n(SELECT COUNT(ID) FROM cargos_users WHERE pais = '" . PAIS . "' AND cargo_ID = cargos.cargo_ID AND aprobado = 'ok') AS candidatos_num\r\nFROM cargos WHERE pais = '" . PAIS . "' ORDER BY nivel DESC", $link);
    while ($r = mysql_fetch_array($result)) {
        switch ($r['asigna']) {
            case -2:
                $asigna = '<b title="Votacion Ejecutiva">Votacion Ejecutiva</b>';
                break;
            case 0:
                $asigna = '<a href="/elecciones"><b>Elecciones</b></a>';
                break;
            default:
                $asigna = '';
Example #12
0
<table border="0" cellspacing="1" cellpadding="" class="pol_table">
<tr>
<th colspan="2">Estado</th>
<th>Afectado</th>
<th>Autor</th>
<th>Cuando</th>
<th>Tiempo</th>
<th>Razón</th>
<th></th>
</tr>';
            mysql_query("UPDATE " . SQL . "ban SET estado = 'inactivo' WHERE estado = 'activo' AND expire < '" . $date . "'", $link);
            $margen_30dias = date('Y-m-d 20:00:00', time() - 2592000);
            //30dias
            $result = mysql_query("SELECT ID, razon, expire, estado, autor, tiempo, cargo, motivo, user_ID,\r\n(SELECT nick FROM users WHERE ID = " . SQL . "ban.user_ID LIMIT 1) AS expulsado,\r\n(SELECT estado FROM users WHERE ID = " . SQL . "ban.user_ID LIMIT 1) AS expulsado_estado,\r\n(SELECT nick FROM users WHERE ID = " . SQL . "ban.autor LIMIT 1) AS nick_autor\r\nFROM " . SQL . "ban\r\nWHERE expire > '" . $margen_30dias . "' AND estado != 'expulsado'\r\nORDER BY expire DESC", $link);
            while ($r = mysql_fetch_array($result)) {
                if (($r['autor'] == $pol['user_ID'] or nucleo_acceso($vp['acceso']['kick_quitar'])) and $r['estado'] == 'activo') {
                    $expulsar = boton('X', '/accion.php?a=kick&b=quitar&ID=' . $r['ID'], '&iquest;Seguro que quieres hacer INACTIVO este kick?');
                } else {
                    $expulsar = '';
                }
                $duracion = '<acronym title="' . $r['expire'] . '">' . duracion(time() + $r['tiempo'] - strtotime($r['expire'])) . '</acronym>';
                if ($r['estado'] == 'activo') {
                    $estado = '<span style="color:red;">Activo</span>';
                } elseif ($r['estado'] == 'cancelado') {
                    $estado = '<span style="color:grey;">Cancelado</span>';
                } else {
                    $estado = '<span style="color:grey;">Inactivo</span>';
                }
                if (!$r['expulsado_estado']) {
                    $r['expulsado_estado'] = 'expulsado';
                }
Example #13
0
<?php

if (nucleo_acceso('privado', 'gonzo zerocool bradduk ethos vara oportunista peny votaaotros lasarux')) {
    include 'theme2.php';
    exit;
}
if ($_SERVER['HTTP_HOST'] == 'ninguno.' . DOMAIN) {
    redirect('http://www.' . DOMAIN . '/');
}
if (isset($_GET['noti'])) {
    notificacion('visto', $_GET['noti']);
}
if (!isset($txt)) {
    header('HTTP/1.1 404 Not Found');
    $txt = '<p style="font-size:24px;">ERROR 404: <b>Página inexistente</b>.</p>';
}
if (isset($_GET['error'])) {
    header('HTTP/1.1 401 Unauthorized');
    $txt = '<p style="font-size:24px;color:red;">ERROR: <b>' . base64_decode($_GET['error']) . '</b>.</p>';
}
$kw = '';
if (isset($txt_title)) {
    $txt_title .= ' | ' . PAIS . ' | VirtualPol';
} else {
    //home
    $txt_title = isset($pol['config']['pais_des']) ? $pol['config']['pais_des'] . ' de ' . PAIS . ' ' . $kw . '| VirtualPol' : PAIS . ' ' . $kw . '| VirtualPol';
}
if (!isset($txt_description)) {
    $txt_description = $txt_title . ' - ' . $kw . PAIS . ' | VirtualPol';
}
if (isset($_GET['bg'])) {
Example #14
0
        $result = mysql_query("SELECT ID, nick, grupos FROM users WHERE pais = '" . PAIS . "' AND estado = 'ciudadano' AND grupos != ''", $link);
        while ($r = mysql_fetch_array($result)) {
            foreach (explode(' ', $r['grupos']) as $grupo_ID) {
                $users_array[$grupo_ID][] = $r['nick'];
            }
        }
        $result = mysql_query("SELECT url, title, acceso_cfg_leer FROM " . SQL . "foros WHERE estado = 'ok' AND acceso_leer = 'grupos'", $link);
        while ($r = mysql_fetch_array($result)) {
            foreach (explode(' ', $r['acceso_cfg_leer']) as $grupo_ID) {
                $foros_array[$grupo_ID][] = '<a href="/foro/' . $r['url'] . '"><b>' . $r['title'] . '</b></a>';
            }
        }
        $result = mysql_query("SELECT * FROM grupos WHERE pais = '" . PAIS . "' ORDER BY num DESC", $link);
        while ($r = mysql_fetch_array($result)) {
            $txt .= '<tr>
<td align="right"><input type="checkbox" name="grupo_' . $r['grupo_ID'] . '" value="true"' . (nucleo_acceso('grupos', $r['grupo_ID']) ? ' checked="checked"' : '') . ' /></td>
<td><b>' . $r['nombre'] . '</b></td>
<td align="right" style="font-size:18px;color:#777;" title="AFILIADOS: ' . (is_array($users_array[$r['grupo_ID']]) ? implode(' ', $users_array[$r['grupo_ID']]) : '') . '"><b>' . $r['num'] . '</b> (<span class="punteado">Ver</span>)</td>
<td>' . (is_array($foros_array[$r['grupo_ID']]) ? implode(' ', $foros_array[$r['grupo_ID']]) : '') . '</td>
<td width="100" align="right" style="color:#888;">' . $r['grupo_ID'] . '</td>
<td>' . (nucleo_acceso($vp['acceso']['control_grupos']) ? boton('Eliminar', '/accion.php?a=grupos&b=eliminar&grupo_ID=' . $r['grupo_ID'], false, 'red') : '') . '</td>
</tr>';
        }
        $txt .= '</table>

<p>' . boton('Guardar afiliación', 'submit', false, 'large blue') . '</p>
	
</form>';
}
$txt_menu = 'demo';
include 'theme.php';
Example #15
0
    while ($r = mysql_fetch_array($result)) {
        $num_lista = $r['num_lista'];
        if ($num_lista > 0) {
            if ($num_lista >= 1) {
                $num_lista = '<b>' . $num_lista . '</b>';
                $elecciones = '<b style="color:blue;">Si</b>';
            } else {
                $elecciones = '<b style="color:red;">No</b>';
            }
            if ($r['nick_candidato']) {
                $nick_candidato = '<b>' . crear_link($r['nick_candidato']) . '</b>';
            } else {
                $nick_candidato = '';
            }
            $txt .= '<tr><td align="right" valign="top"><b style="font-size:20px;">' . crear_link($r['siglas'], 'partido') . '</b></td><td>' . $r['nombre'] . '</td><td><b>' . $r['afiliados'] . '</b>/' . $num_lista . '</td><td>' . crear_link($r['nick_presidente']) . '</td><td>' . $nick_candidato . '</td><td align="right">' . duracion(time() - strtotime($r['fecha_creacion'])) . '</td><td>' . $elecciones . '</td><td align="right">' . $r['ID'] . '</td></tr>' . "\n";
        } else {
            $txt_otros .= '<span title="' . $r['afiliados'] . ' afiliados / ' . strip_tags($num_lista) . ' candidatos">' . crear_link($r['siglas'], 'partido') . '</span> ';
        }
    }
    $txt .= '</table><p style="width:700px;">' . NOM_PARTIDOS . ' que no participan en elecciones:<br />
<b>' . $txt_otros . '</b></p>';
    $txt .= ECONOMIA ? '<p>* Para poder participar en las Elecciones ha de tener al menos un candidato en su lista. Para poder a&ntilde;adir candidatos en la lista, se ha de ser el Presidente, el candidato ha de estar afiliado y con el examen de Diputado aprobado.</p>' : '';
    $txt_title = NOM_PARTIDOS;
    $txt_nav = array('/partidos' => 'Partidos');
    if (nucleo_acceso($vp['acceso']['crear_partido'])) {
        $txt_tab = array('/form/crear-partido' => 'Crear ' . NOM_PARTIDOS);
    }
}
//THEME
$txt_menu = 'demo';
include 'theme.php';
Example #16
0
 case 'afiliarse':
     if ($pol['config']['elecciones_estado'] != 'elecciones') {
         mysql_query("UPDATE users SET partido_afiliado = '" . $_POST['partido'] . "' WHERE ID = '" . $pol['user_ID'] . "' LIMIT 1", $link);
         mysql_query("DELETE FROM " . SQL . "partidos_listas WHERE user_ID = '" . $pol['user_ID'] . "'", $link);
         evento_log_OLD(9, $_POST['partido']);
     }
     $refer_url = 'perfil/' . $pol['nick'] . '/';
     break;
 case 'crear-partido':
     $_POST['siglas'] = preg_replace("/[^[a-z-]/i", "", $_POST['siglas']);
     $ya_es_presidente = false;
     $result = mysql_query("SELECT ID FROM " . SQL . "partidos WHERE ID_presidente = '" . $pol['user_ID'] . "'", $link);
     while ($r = mysql_fetch_array($result)) {
         $ya_es_presidente = true;
     }
     if ($pol['config']['elecciones_estado'] != 'elecciones' and strlen($_POST['siglas']) <= 12 and strlen($_POST['siglas']) >= 2 and nucleo_acceso($vp['acceso']['crear_partido']) and $_POST['nombre'] and $ya_es_presidente == false) {
         $_POST['descripcion'] = gen_text($_POST['descripcion']);
         mysql_query("INSERT INTO " . SQL . "partidos \r\n(ID_presidente, fecha_creacion, siglas, nombre, descripcion, estado) \r\nVALUES ('" . $pol['user_ID'] . "', '" . $date . "', '" . strtoupper($_POST['siglas']) . "', '" . $_POST['nombre'] . "', '" . $_POST['descripcion'] . "', 'ok')\r\n", $link);
         $result = mysql_query("SELECT ID FROM " . SQL . "partidos WHERE siglas = '" . $_POST['siglas'] . "' LIMIT 1", $link);
         while ($r = mysql_fetch_array($result)) {
             $partido_ID = $r['ID'];
         }
         evento_log_OLD(3, $partido_ID);
     }
     // actualizar info en theme
     $result = mysql_query("SELECT COUNT(ID) AS num FROM " . SQL . "partidos WHERE estado = 'ok'", $link);
     while ($r = mysql_fetch_array($result)) {
         mysql_query("UPDATE " . SQL . "config SET valor = '" . $r['num'] . "' WHERE dato = 'info_partidos' LIMIT 1", $link);
     }
     $refer_url = 'partidos/';
     break;
Example #17
0
function notificacion($user_ID, $texto = '', $url = '', $emisor = 'sistema')
{
    global $pol, $link;
    switch ($user_ID) {
        case 'print':
            if (isset($pol['user_ID'])) {
                $t = '';
                $total_num = 0;
                // NOTIFICACION ELECCIONES
                if ($pol['config']['elecciones_estado'] == 'elecciones' and $pol['estado'] == 'ciudadano') {
                    $result = mysql_query("SELECT ID FROM " . SQL . "elecciones WHERE user_ID = '" . $pol['user_ID'] . "' LIMIT 1", $link);
                    while ($r = mysql_fetch_array($result)) {
                        $havotado = $r['ID'];
                    }
                    if (!isset($havotado)) {
                        $nuevos_num++;
                    }
                    $total_num++;
                    $elecciones_quedan = strtotime($pol['config']['elecciones_inicio']) + $pol['config']['elecciones_duracion'];
                    if (!isset($havotado)) {
                        $t .= '<li><a href="/elecciones/votar" class="noti-nuevo">&iexcl;Elecciones en curso!<span class="md">Quedan ' . timer($elecciones_quedan, true) . '</span></a></li>';
                    }
                }
                // NOTIFICACION VOTACIONES
                $pol['config']['info_consultas'] = 0;
                $result = mysql_query("SELECT v.ID, pais, pregunta, acceso_votar, acceso_cfg_votar, acceso_ver, acceso_cfg_ver \r\n\t\t\t\tFROM votacion `v`\r\n\t\t\t\tLEFT OUTER JOIN votacion_votos `vv` ON v.ID = vv.ref_ID AND vv.user_ID = '" . $pol['user_ID'] . "'\r\n\t\t\t\tWHERE v.estado = 'ok' AND (v.pais = '" . PAIS . "' OR acceso_votar IN ('supervisores_censo', 'privado')) AND vv.ID IS null", $link);
                while ($r = mysql_fetch_array($result)) {
                    if (nucleo_acceso($r['acceso_votar'], $r['acceso_cfg_votar']) and nucleo_acceso($r['acceso_ver'], $r['acceso_cfg_ver'])) {
                        $pol['config']['info_consultas']++;
                        $nuevos_num++;
                        $total_num++;
                        $t .= '<li><a href="http://' . $r['pais'] . '.' . DOMAIN . '/votacion/' . $r['ID'] . '" class="noti-nuevo">Votación: ' . $r['pregunta'] . '</a></li>';
                    }
                }
                // NOTIFICACIONES
                $result = mysql_query("SELECT noti_ID, visto, texto, url, MAX(time) AS time_max, COUNT(*) AS num FROM notificaciones WHERE user_ID = '" . $pol['user_ID'] . "' GROUP BY visto, texto ORDER BY visto DESC, time_max DESC LIMIT 7", $link);
                while ($r = mysql_fetch_array($result)) {
                    $total_num += $r['num'];
                    if ($r['visto'] == 'false') {
                        $nuevos_num += $r['num'];
                    }
                    $t .= '<li><a href="' . ($r['visto'] == 'false' ? '/?noti=' . $r['noti_ID'] : $r['url']) . '"' . ($r['visto'] == 'false' ? ' class="noti-nuevo"' : '') . (substr($r['url'], 0, 4) == 'http' ? ' target="_blank"' : '') . '>' . $r['texto'] . ($r['num'] > 1 ? '<span class="md">' . $r['num'] . '</span>' : '') . '</a></li>';
                }
            } else {
                $t = '<li><a href="' . REGISTRAR . '?p=' . PAIS . '" class="noti-nuevo">Primer paso: Crea tu ciudadano</a></li>';
                $total_num = 1;
                $nuevos_num = 1;
            }
            global $txt_elec_time;
            return '<li id="menu-noti"' . ($nuevos_num != 0 ? ' class="menu-sel"' : '') . '><a href="/hacer">Notificaciones<span class="md">' . $nuevos_num . '</span></a><ul><li style="border-bottom:1px dotted #DDD;"><a href="/elecciones">' . (isset($txt_elec_time) ? 'Elecciones en <b>' . $txt_elec_time . '</b>, ' : '') . 'proceso ' . (time() > strtotime(date('Y-m-d 20:00:00')) ? 'hace' : 'en') . ' <b>' . timer(date('Y-m-d 20:00:00')) . '</b></a></li>' . $t . ($total_num == 0 ? '<li>No hay notificaciones</li>' : '') . '<li style="text-align:right;"><a href="/hacer"><b>¿Qué hacer?</b></a></li></ul></li>' . ($nuevos != 0 ? '' : '<script type="text/javascript">p_scroll = true;</script>');
            break;
        case 'visto':
            $result = mysql_query("SELECT noti_ID, visto, texto, url FROM notificaciones WHERE noti_ID = '" . $texto . "' LIMIT 1", $link);
            while ($r = mysql_fetch_array($result)) {
                if ($r['visto'] == 'false') {
                    mysql_query("UPDATE notificaciones SET visto = 'true' WHERE visto = 'false' AND user_ID = '" . $pol['user_ID'] . "' AND texto = '" . $r['texto'] . "'", $link);
                }
                redirect($r['url']);
            }
            break;
        default:
            mysql_query("INSERT INTO notificaciones (user_ID, texto, url, emisor) VALUES ('" . $user_ID . "', '" . $texto . "', '" . $url . "', '" . $emisor . "')", $link);
            return true;
    }
}
Example #18
0
function foro_enviar($subforo, $hilo = null, $edit = null, $citar = null)
{
    global $pol, $link, $return_url, $vp;
    $referer = explode('/', $_SERVER['HTTP_REFERER'], 4);
    $referer = '/' . $referer[3];
    if ($pol['estado'] == 'ciudadano' or $pol['estado'] == 'extranjero') {
        if ($edit) {
            //editar
            $return_url = 'foro/';
            if ($hilo) {
                //msg
                $result = mysql_query("SELECT text, cargo FROM " . SQL . "foros_msg WHERE ID = '" . $hilo . "' AND estado = 'ok' AND user_ID = '" . $pol['user_ID'] . "' LIMIT 1", $link);
                while ($r = mysql_fetch_array($result)) {
                    $edit_text = $r['text'];
                    $edit_cargo = $r['cargo'];
                }
            } else {
                //hilo
                $result = mysql_query("SELECT sub_ID, text, cargo, title, user_ID, ID FROM " . SQL . "foros_hilos WHERE ID = '" . $subforo . "' AND estado = 'ok' AND (user_ID = '" . $pol['user_ID'] . "' OR 'true' = '" . (nucleo_acceso($vp['acceso']['foro_borrar']) ? 'true' : 'false') . "') LIMIT 1", $link);
                while ($r = mysql_fetch_array($result)) {
                    $sub_ID = $r['sub_ID'];
                    $edit_ID = $r['ID'];
                    $edit_user_ID = $r['user_ID'];
                    $edit_title = $r['title'];
                    $edit_text = $r['text'];
                    $edit_cargo = $r['cargo'];
                }
            }
            $edit_text = strip_tags($edit_text);
        }
        if ($citar != null) {
            //citar
            if ($citar > 0) {
                //msg
                $result = mysql_query("SELECT text, user_ID FROM " . SQL . "foros_msg WHERE ID = '" . $citar . "' AND estado = 'ok'  LIMIT 1", $link);
                while ($r = mysql_fetch_array($result)) {
                    $edit_text = $r['text'];
                    $user_ID = $r['user_ID'];
                }
            } else {
                $result = mysql_query("SELECT text, user_ID FROM " . SQL . "foros_hilos WHERE ID = '" . abs($citar) . "' AND estado = 'ok' LIMIT 1", $link);
                while ($r = mysql_fetch_array($result)) {
                    $edit_text = $r['text'];
                    $user_ID = $r['user_ID'];
                }
            }
            $result = mysql_query("SELECT nick FROM users WHERE ID = '" . $user_ID . "' LIMIT 1", $link);
            while ($r = mysql_fetch_array($result)) {
                $edit_text = '[quote=' . $r['nick'] . '] ' . $edit_text . ' [/quote]';
            }
            $edit_text = strip_tags($edit_text);
        }
        if ($pol['nivel'] > 1) {
            $result = mysql_query("SELECT cargo_ID, \n(SELECT nombre FROM cargos WHERE pais = '" . PAIS . "' AND cargos_users.cargo_ID = cargo_ID LIMIT 1) AS nombre,\n(SELECT nivel FROM cargos WHERE pais = '" . PAIS . "' AND cargos_users.cargo_ID = cargo_ID LIMIT 1) AS nivel\nFROM cargos_users  \nWHERE cargo = 'true' AND pais = '" . PAIS . "' AND user_ID = '" . $pol['user_ID'] . "'\nORDER BY nivel DESC", $link);
            while ($r = mysql_fetch_array($result)) {
                $select_cargos .= '<option value="' . $r['cargo_ID'] . '"' . ($edit_cargo == $r['cargo_ID'] ? ' selected="selected"' : '') . '>' . $r['nombre'] . '</option>' . "\n";
            }
        }
        if ($pol['estado'] == 'extranjero') {
            $select_cargos = '<option value="99">Extranjero</option>';
        } else {
            $select_cargos = '<option value="0">Ciudadano</option>' . $select_cargos;
        }
        if (!$hilo) {
            if ($edit) {
                $get = 'editar';
            } else {
                $get = 'hilo';
            }
            // <input type="hidden" name="return_url" value="' . $return_url . '"  />
            $html .= '<div id="enviar" class="redondeado">

<hr />

<h2>Nuevo hilo</h2>


<form action="/accion.php?a=foro&b=' . $get . '" method="post">
<input type="hidden" name="subforo" value="' . $subforo . '"  />
<input type="hidden" name="return_url" value="' . $return_url . '"  />';
            if ($edit) {
                $html .= '<p>Foro: <select name="sub_ID">';
                $result = mysql_query("SELECT ID, url, title, acceso_escribir, acceso_cfg_escribir FROM " . SQL . "foros WHERE estado = 'ok' ORDER BY time ASC", $link);
                while ($r = mysql_fetch_array($result)) {
                    $html .= '<option value="' . $r['ID'] . '"' . ($r['ID'] == $sub_ID ? ' selected="selected"' : '') . (nucleo_acceso($r['acceso_escribir'], $r['acceso_cfg_escribir']) ? '' : ' disabled="disabled"') . '>' . $r['title'] . '</option>';
                }
                $html .= '</select></p>';
            }
            $html .= '
<p>Título:<br />
<input name="title" size="60" maxlength="80" type="text" value="' . str_replace('"', '&#34;', $edit_title) . '" /></p>

<p' . ($edit && $edit_user_ID != $pol['user_ID'] ? ' style="display:none;"' : '') . '>Mensaje:<br />
<textarea name="text" style="width:600px;height:260px;">' . $edit_text . '</textarea><br />
<span style="color:grey;font-size:12px;">Etiquetas: [b]...[/b] [em]...[/em] [quote]...[/quote] [img]url[/img] [youtube]url-youtube[/youtube], auto-enlaces.</span></p>

<p>' . boton('Enviar', 'submit', false, 'large blue') . ' En calidad de: <select name="encalidad">' . $select_cargos . '
</select></p>
</form>

' . ($edit ? '<hr /><p style="text-align:right;">' . boton('Eliminar hilo', '/accion.php?a=foro&b=eliminarhilo&ID=' . $edit_ID, '¿Estás seguro de querer ELIMINAR este HILO DE FORMA IRREVOCABLE?') . '</p>' : '') . '

</div>';
        } else {
            if ($edit) {
                $get = 'editar';
            } else {
                $get = 'reply';
            }
            $html .= '<div id="enviar" class="redondeado">
<form action="/accion.php?a=foro&b=' . $get . '" method="post">
<input type="hidden" name="subforo" value="' . $subforo . '"  />
<input type="hidden" name="hilo" value="' . $hilo . '"  />
<input type="hidden" name="return_url" value="' . $return_url . '"  />

<hr />

<p>Mensaje en hilo:<br />
<textarea name="text" style="width:570px;height:250px;">' . $edit_text . '</textarea><br />
<span style="color:grey;font-size:12px;">Etiquetas: [b]...[/b] [em]...[/em] [quote]...[/quote] [img]url[/img] [youtube]url-youtube[/youtube], auto-enlaces.</span></p>

<p>' . boton('Enviar', 'submit', false, 'blue large') . ' En calidad de: <select name="encalidad">' . $select_cargos . '
</select></p>

</form>
</div>';
        }
        return $html;
    } else {
        return '<p class="azul"><b>Debes ser Ciudadano para participar, <a href="' . REGISTRAR . '?p=' . PAIS . '">regístrate aquí!</a></b></p>';
    }
}