/**
  * Método principal del comando
  * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
  * @version 2015-09-30
  */
 public function main($ambiente = \sasco\LibreDTE\Sii::PRODUCCION)
 {
     // obtener conexión a la base de datos
     $db =& \sowerphp\core\Model_Datasource_Database::get();
     // obtener firma electrónica
     try {
         $Firma = new \sasco\LibreDTE\FirmaElectronica();
     } catch (\sowerphp\core\Exception $e) {
         $this->out('<error>No fue posible obtener la firma electrónica</error>');
         return 1;
     }
     // obtener contribuyentes de ambiente de producción
     $contribuyentes = \sasco\LibreDTE\Sii::getContribuyentes($Firma, $ambiente);
     if (!$contribuyentes) {
         $this->out('<error>No fue posible obtener los contribuyentes desde el SII</error>');
         return 2;
     }
     // procesar cada uno de los contribuyentes
     $registros = num(count($contribuyentes));
     $procesados = 0;
     foreach ($contribuyentes as $c) {
         // contabilizar contribuyente procesado
         $procesados++;
         if ($this->verbose >= 1) {
             $this->out('Procesando ' . num($procesados) . '/' . $registros . ': contribuyente ' . $c[1]);
         }
         // agregar y/o actualizar datos del contribuyente si no tiene usuario administrador
         list($rut, $dv) = explode('-', $c[0]);
         $Contribuyente = new \website\Dte\Model_Contribuyente($rut);
         if (!$Contribuyente->usuario) {
             $Contribuyente->dv = $dv;
             $Contribuyente->razon_social = substr($c[1], 0, 100);
             if (isset($c[3][9])) {
                 $aux = explode('-', $c[3]);
                 if (isset($aux[2])) {
                     list($d, $m, $Y) = $aux;
                     $Contribuyente->resolucion_fecha = $Y . '-' . $m . '-' . $d;
                 }
             }
             if (is_numeric($c[2])) {
                 $Contribuyente->resolucion_numero = (int) $c[2];
             }
             if (strpos($c[4], '@')) {
                 $Contribuyente->intercambio_user = substr($c[4], 0, 50);
             }
             $Contribuyente->modificado = date('Y-m-d H:i:s');
             try {
                 $Contribuyente->save();
             } catch (\sowerphp\core\Exception_Model_Datasource_Database $e) {
                 if ($this->verbose >= 2) {
                     $this->out('<error>Contribuyente ' . $c[1] . ' no pudo ser guardado en la base de datos</error>');
                 }
             }
         }
     }
     $this->showStats();
     return 0;
 }
예제 #2
0
function num($n, $len, $newNum)
{
    if ($len == 0) {
        if ($n === $newNum) {
            return $newNum . ' да.';
        } else {
            return $newNum . ' не.';
        }
    }
    $newNum = $newNum . $n[$len - 1];
    return num($n, $len - 1, $newNum);
}
예제 #3
0
/**
 * user_create
 * 
 * creates a new user in the database with the
 * given parameters
 * 
 * $data    -   an array of items to be JSON encoded in
 *              the data field
 * $options -   an array of options to be added to the
 *              options database table for the user
 * $mail    -   an array with the keys 'subject', 'message',
 *              for the users notification email         
 * 
 * @param string $name
 * @param string $email
 * @param string $password
 * @param array $groups
 * @param array $data optional
 * @param array $options optional
 * @param array $mail optional
 * @return int|bool $id
 */
function user_create($name, $email, $password, $groups, $data = array(), $options = array(), $mail = true)
{
    /**
     * if email is in use, return false
     * note; one account per email
     */
    if (num('select id from ' . DB_USERS . ' where email="' . $email . '"') != 0) {
        return false;
    }
    /**
     * add to users table
     */
    $hash = md5(mt_rand());
    query('insert into ' . DB_USERS . ' values (' . '"",' . '"' . $name . '",' . '"' . $email . '",' . '"' . md5($password) . '",' . '"' . $hash . '",' . '"",' . '"' . json_encode($data) . '"' . ')');
    $id = mysql_insert_id();
    /**
     * add to groups table for each group
     */
    foreach ($groups as $group) {
        query('insert into ' . DB_USERS_GROUPS . ' values( ' . $id . ', ' . $group . ' )');
    }
    /**
     * create user files directory
     */
    $FileManager = FileManager::getInstance();
    $FileManager->addDir('users/' . $id);
    /**
     * add options to options table if nessecary
     */
    if (!empty($options)) {
        foreach ($options as $name => $value) {
            query('insert into ' . DB_OPTIONS . ' values( "' . $name . '", "' . $value . '", "user_' . $id . '"');
        }
    }
    // default email
    if ($mail) {
        $mail = array();
        $mail['subject'] = 'User Activation - Furasta.Org';
        $mail['message'] = $name . ',<br/>
		<br/>
		Please activate your new user by clicking on the link below:<br/>
		<br/>
		<a href="' . SITE_URL . 'admin/users/activate.php?hash=' . $hash . '">' . $url . '/admin/users/activate.php?hash=' . $hash . '</a><br/>
		<br/>
		If you are not the person stated above please ignore this email.<br/>
		';
    }
    // send notification email to user
    email($email, $mail['subject'], $mail['message']);
    cache_clear('DB_USERS');
    return $id;
}
예제 #4
0
 /**
  * Comando que verifica el timbre del documento (sus datos)
  * @param ted String con el timbre electrónico
  * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
  * @version 2015-10-13
  */
 protected function _bot_timbre($timbre_xml = null)
 {
     // si no hay timbre se pide uno
     if (!$timbre_xml) {
         $this->Bot->send('Ahora envíame el XML del timbre');
         $this->setNextCommand('timbre');
     } else {
         $this->setNextCommand();
         $this->Bot->sendChatAction();
         $timbre_xml = implode(' ', func_get_args());
         $rest = new \sowerphp\core\Network_Http_Rest();
         $rest->setAuth(\sowerphp\core\Configure::read('api.default.token'));
         $response = $rest->post($this->request->url . '/api/dte/documentos/verificar_ted', json_encode(base64_encode($timbre_xml)));
         if ($response['status']['code'] != 200) {
             $this->Bot->send($response['body']);
             return;
         }
         $xml = new \SimpleXMLElement(utf8_encode($timbre_xml), LIBXML_COMPACT);
         list($rut, $dv) = explode('-', $xml->xpath('/TED/DD/RE')[0]);
         $this->Bot->send((new \website\Dte\Admin\Model_DteTipo($xml->xpath('/TED/DD/TD')[0]))->tipo . ' N° ' . $xml->xpath('/TED/DD/F')[0] . ' del ' . \sowerphp\general\Utility_Date::format($xml->xpath('/TED/DD/FE')[0]) . ' por $' . num($xml->xpath('/TED/DD/MNT')[0]) . '.-' . ' emitida por ' . $xml->xpath('/TED/DD/CAF/DA/RS')[0] . ' (' . num($rut) . '-' . $dv . ')' . ' a ' . $xml->xpath('/TED/DD/RSR')[0] . "\n\n" . $response['body']['ESTADO'] . ' - ' . $response['body']['GLOSA_ESTADO'] . "\n" . $response['body']['GLOSA_ERR']);
     }
 }
예제 #5
0
function compress_file($file, $tipo = 'js')
{
    global $root_dir;
    $result = file_get_contents($root_dir . 'img/' . $file);
    $len_antes = strlen($result);
    echo '<tr><td><b>' . strtoupper($tipo) . '</b></td><td>' . $file . '</td><td align="right"><b>' . num($len_antes) . '</b>bytes</td>';
    switch ($tipo) {
        case 'js':
            $result = minify_js($result);
            break;
        case 'css':
            $result = minify_css($result);
            $result = str_replace('url(img/', 'url(lib/kickstart/css/img/', $result);
            /* corrige URLs de kickstart (codigo malo) */
            $result = str_replace('url(\'img/', 'url(\'lib/kickstart/css/img/', $result);
            /* corrige URLs de kickstart (codigo malo) */
            break;
    }
    $len_ahora = strlen($result);
    echo '<td align="right">- <b>' . num($len_antes - $len_ahora) . '</b>bytes = </td><td align="right"><b>' . num($len_ahora) . '</b>bytes</td><td align="right">' . num(100 - $len_ahora * 100 / $len_antes, 1) . '%</td></tr>';
    $result = '/* ' . $file . ' */' . "\n" . $result . "\n";
    return $result;
}
function email_gen()
{
    $em = array();
    $em_ext = array("@gmail.com", "@yahoo.com", "@AOL.com");
    $back = rand(0, 2);
    //generates random email address
    for ($i = 0; $i < 10; $i++) {
        $guess = rand(0, 1);
        //returns num 0-9
        $num = num();
        //returns random letter
        $char = char();
        if ($guess == 0) {
            array_push($em, $char);
        } else {
            array_push($em, $num);
        }
    }
    //end for loop
    //converts array into string
    $email = implode($em) . $em_ext[$back];
    return $email;
}
예제 #7
0
<div role="tabpanel">
    <ul class="nav nav-tabs" role="tablist">
        <li role="presentation" class="active"><a href="#email" aria-controls="email" role="tab" data-toggle="tab">Email recibido</a></li>
        <li role="presentation"><a href="#documentos" aria-controls="documentos" role="tab" data-toggle="tab">Documentos</a></li>
    </ul>
    <div class="tab-content">

<!-- INICIO DATOS BÁSICOS -->
<div role="tabpanel" class="tab-pane active" id="email">

<?php 
$de = $DteIntercambio->de;
if ($DteIntercambio->de != $DteIntercambio->responder_a) {
    $de .= '<br/><span>' . $DteIntercambio->responder_a . '</span>';
}
new \sowerphp\general\View_Helper_Table([['Recibido', 'De', 'Emisor', 'Firma', 'DTEs', 'Estado', 'Usuario'], [$DteIntercambio->fecha_hora_email, $de, $DteIntercambio->getEmisor()->razon_social, $DteIntercambio->fecha_hora_firma, num($DteIntercambio->documentos), $DteIntercambio->getEstado()->estado, $DteIntercambio->getUsuario()->usuario]]);
?>

<p><strong>Asunto</strong>: <?php 
echo $DteIntercambio->asunto;
?>
</p>
<p><?php 
echo str_replace("\n", '</p><p>', strip_tags(base64_decode($DteIntercambio->mensaje)));
?>
</p>
<?php 
if ($DteIntercambio->mensaje_html) {
    ?>
<a class="btn btn-default btn-lg btn-block" href="javascript:__.popup('<?php 
    echo $_base;
예제 #8
0
파일: index.php 프로젝트: sakuraliu/bbs
//验证管理员是否登录
$query = "select * from cfc_manage where id={$_SESSION['manage']['id']}";
$result_manage = execute($link, $query);
$data_manage = mysqli_fetch_assoc($result_manage);
$query = "select count(*) from cfc_father_module";
$count_father_module = num($link, $query);
$query = "select count(*) from cfc_son_module";
$count_son_module = num($link, $query);
$query = "select count(*) from cfc_content";
$count_content = num($link, $query);
$query = "select count(*) from cfc_reply";
$count_reply = num($link, $query);
$query = "select count(*) from cfc_member";
$count_member = num($link, $query);
$query = "select count(*) from cfc_manage";
$count_manage = num($link, $query);
if ($data_manage['level'] == '0') {
    $data_manage['level'] = '超级管理员';
} else {
    $data_manage['level'] = '普通管理员';
}
$template['title'] = '系统信息';
$template['css'] = array('style/public.css');
include 'inc/header.inc.php';
?>
<div id="main">
	<div class="title">系统信息</div>
	<div class="explain">
		<ul>
			<li>|- 您好,<?php 
echo $data_manage['name'];
예제 #9
0
                if ($r2['cargo'] == 'true') {
                    $activos[] = '<tr>
<td>' . ($asignador ? '<form action="/accion.php?a=cargo&b=del&ID=' . $r['cargo_ID'] . '" method="post">
<input type="hidden" name="user_ID" value="' . $r2['user_ID'] . '"  />' . boton('X', 'submit', '¿Seguro que quieres QUITAR el cargo a ' . strtoupper($r2['nick']) . '?', 'small red') . '</form>' : '') . '</td>
<td align="right">' . ++$activos_num . '.</td>
<td><img src="' . IMG . 'cargos/' . $r['cargo_ID'] . '.gif" alt="icono ' . $r['nombre'] . '" width="16" height="16" border="0" style="margin-bottom:-3px;" /> <b>' . crear_link($r2['nick']) . '</b></td>
<td align="right" class="gris">' . timer($r2['fecha_last']) . '</td>
</tr>';
                } else {
                    $candidatos[] = '<tr>
<td>' . ($asignador ? '<form action="/accion.php?a=cargo&b=add&ID=' . $r['cargo_ID'] . '" method="POST">
<input type="hidden" name="user_ID" value="' . $r2['user_ID'] . '"  />' . boton('Asignar', 'submit', false, 'small blue') . '</form>' : '') . '</td>
<td><b>' . crear_link($r2['nick']) . '</b></td>
<td align="right" class="gris">' . timer($r2['fecha_last']) . '</td>
<td align="right">' . confianza($r2['voto_confianza']) . '</td>
<td align="right"><b>' . num($r2['nota'], 1) . '</b></td>
</tr>';
                }
            }
        }
        $txt .= '<table border="0"><tr><td valign="top">

<table border="0">
<tr>
<th></th>
<th colspan="2" align="left">' . $r['nombre'] . ' <span style="font-weight:normal;">(' . count($activos) . ')</span></th>
<th style="font-weight:normal;">Último acceso</th>
</tr>
' . implode('', $activos) . '
</table>
예제 #10
0
echo $Emisor->razon_social;
?>
.</p>

<div class="text-right">
    <a href="<?php 
echo $_base;
?>
/dte/dte_recibidos/agregar" class="btn btn-default">
        <span class="fa fa-plus"></span>
        Agregar DTE recibido
    </a>
    <br/><br/>
</div>

<?php 
foreach ($documentos as &$d) {
    $acciones = '<a href="' . $_base . '/dte/dte_recibidos/modificar/' . $d['emisor'] . '/' . $d['dte'] . '/' . $d['folio'] . '" title="Modificar DTE" class="btn btn-default' . ($d['intercambio'] ? ' disabled' : '') . '"><span class="fa fa-edit"></span></a>';
    $acciones .= ' <a href="' . $_base . '/dte/dte_intercambios/pdf/' . $d['intercambio'] . '" title="Descargar PDF del DTE" class="btn btn-default' . (!$d['intercambio'] ? ' disabled' : '') . '" role="button"><span class="fa fa-file-pdf-o"></span></a>';
    $d[] = $acciones;
    $d['total'] = num($d['total']);
    unset($d['emisor'], $d['dte']);
}
$f = new \sowerphp\general\View_Helper_Form(false);
array_unshift($documentos, [$f->input(['type' => 'select', 'name' => 'dte', 'options' => ['' => 'Todos'] + $tipos_dte, 'value' => isset($search['dte']) ? $search['dte'] : '']), $f->input(['name' => 'folio', 'value' => isset($search['folio']) ? $search['folio'] : '', 'check' => 'integer']), $f->input(['name' => 'emisor', 'value' => isset($search['emisor']) ? $search['emisor'] : '', 'check' => 'integer', 'placeholder' => 'RUT sin dv']), $f->input(['type' => 'date', 'name' => 'fecha', 'value' => isset($search['fecha']) ? $search['fecha'] : '', 'check' => 'date']), $f->input(['name' => 'total', 'value' => isset($search['total']) ? $search['total'] : '', 'check' => 'integer']), $f->input(['name' => 'intercambio', 'value' => isset($search['intercambio']) ? $search['intercambio'] : '', 'check' => 'integer']), $f->input(['type' => 'select', 'name' => 'usuario', 'options' => ['' => 'Todos'] + $usuarios, 'value' => isset($search['usuario']) ? $search['usuario'] : '']), '<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button>']);
array_unshift($documentos, ['Documento', 'Folio', 'Emisor', 'Fecha', 'Total', 'Intercambio', 'Usuario', 'Acciones']);
// renderizar el mantenedor
$maintainer = new \sowerphp\app\View_Helper_Maintainer(['link' => $_base . '/dte/dte_recibidos', 'linkEnd' => $searchUrl]);
$maintainer->setId('dte_recibidos_' . $Emisor->rut);
$maintainer->setColsWidth([null, null, null, null, null, null, null, 100]);
echo $maintainer->listar($documentos, $paginas, $pagina, false);
예제 #11
0
/**
 * make sure ajax script was loaded and user is
 * logged in 
 */
if (!defined('AJAX_LOADED') || !defined('AJAX_VERIFIED')) {
    die;
}
$name = addslashes(@$_POST['name']);
$perms = addslashes(@$_POST['perms']);
/**
 * validate post info 
 */
if (empty($name)) {
    die('error');
}
/**
 * check if group name is used already 
 */
if (num('select name from ' . DB_GROUPS . ' where name="' . $name . '"') != 0) {
    die('error');
}
/**
 * add group to database 
 */
mysql_query('insert into ' . DB_GROUPS . ' values( "", "' . $name . '", "' . $perms . '" )');
$id = mysql_insert_id();
// make group dirs
Group::createGroupDirs($id);
// clear caches
cache_clear('DB_USERS');
die(print $id);
예제 #12
0
            $txt .= '<h1 class="quitar">Censo:</h1>';
        }
        if ($_GET['b'] == 'busqueda') {
            $busqueda = $_GET['c'];
        } else {
            $busqueda = '';
        }
        $txt .= '
<div style="float:right;">
<input name="qcmq" size="10" value="' . $busqueda . '" type="text" id="cmq">
<input value="Buscador de perfiles" type="submit" onclick="var cmq = $(\'#cmq\').attr(\'value\'); window.location.href=\'/info/censo/busqueda/\'+cmq+\'/\'; return false;">
</div>

<p>' . $p_paginas . '</p>

<p><abbr title="Numero de ciudadanos en la plataforma ' . PAIS . '"><b>' . num($pol['config']['info_censo']) . '</b> ciudadanos de ' . PAIS . '</abbr> (<abbr title="Ciudadanos -no nuevos- que entraron en las últimas 24h, en la plataforma ' . PAIS . '">activos <b>' . $censo_activos . '</b></abbr>,  <abbr title="Ciudadanos activos en todo VirtualPol">activos global <b>' . $censo_activos_vp . '</b></abbr>)

' . (ECONOMIA ? ' | <a href="/control/expulsiones" class="expulsado">Expulsados</a>: <b>' . $censo_expulsados . '</b> | <a href="/info/censo/riqueza" title="Los ciudadanos con m&aacute;s monedas.">Ricos</a>' : '') . ' | <a href="/info/censo/SC" title="Todos los ciudadanos registrados en VirtualPol globalmente">Censo de VirtualPol</a> &nbsp; 
</p>

<table border="0" cellspacing="2" cellpadding="0" class="pol_table">
<tr>
<th></th>
' . (ASAMBLEA ? '' : '<th style="font-size:18px;"><a href="/info/censo/nivel">Nivel</a></th>') . '
<th></th>
<th style="font-size:18px;"><a href="/info/censo/nombre">Nick</a></th>
<th style="font-size:18px;" colspan="2"><a href="/info/censo/confianza">Confianza</a></th>
' . (ASAMBLEA ? '' : '<th style="font-size:18px;"><a href="/info/censo/afiliacion">Afil</a></th>') . '
<th style="font-size:18px;"><a href="/info/censo/online">Online</a></th>
<th style="font-size:18px;"><a href="/info/censo/' . $old . '">Antigüedad</a></th>
<!--<th style="font-size:18px;"><a href="/info/censo/elec"><abbr title="Elecciones en las que ha participado">Elec</abbr></a></th>-->
예제 #13
0
</table>
</center>';
if (!$pol['nick']) {
    $txt .= '<p style="text-align:center;"><span class="amarillo" style="padding:17px 9px 13px 9px;"><input value="REGISTRAR CIUDADANO" onclick="window.location.href=\'' . REGISTRAR . '\';" type="button" style="font-size:18px;height:40px;" /></span></p>';
} elseif ($pol['pais'] == 'ninguno') {
    $txt .= '<p>' . boton('Solicitar ciudadania', REGISTRAR) . '</p>';
}
$time_pre = date('Y-m-d H:i:00', time() - 3600);
// 1 hora
$result = mysql_query("SELECT nick, pais, estado\r\nFROM users \r\nWHERE fecha_last > '" . $time_pre . "' AND estado != 'expulsado'\r\nORDER BY fecha_last DESC", $link);
while ($r = mysql_fetch_array($result)) {
    $li_online_num++;
    $gf['censo_online'][$r['pais']]++;
    $pais_url = strtolower($r['pais']);
    if ($pais_url == 'ninguno') {
        $pais_url = 'vp';
    }
    $li_online .= ' <a href="http://' . $pais_url . '.' . DOMAIN . '/perfil/' . $r['nick'] . '" class="nick redondeado ' . $r['estado'] . '" style="padding:2px;line-height:25px;background:' . $vp['bg'][$r['pais']] . ';">' . $r['nick'] . '</a>';
}
$txt .= '<br />

<div class="amarillo" style="width:90%;margin:0 auto;">
<table border="0">
<tr>
<td valign="top"><b style="font-size:34px;">' . num($li_online_num) . '</b></td>
<td>Ciudadanos online: ' . $li_online . '</td>
</tr>
</table></div>';
$txt_header .= '<style type="text/css">td b { font-size:15px; }</style>';
include 'theme.php';
예제 #14
0
파일: model_ajax.php 프로젝트: easelike/ego
 public function edit_staff($parametr)
 {
     $data = connectDb::db()->prepare("UPDATE staff SET " . $parametr['parametr'] . " = ? WHERE ID = ?");
     switch ($parametr['parametr']) {
         case 'Date_of_birth':
             $masTime = explode("/", $parametr['text']);
             $parametr['text'] = mktime(0, 0, 0, $masTime[1], $masTime[2], $masTime[0]);
             break;
         case 'ID_role':
             function num($param)
             {
                 $data = connectDb::db()->prepare('SELECT ID FROM role WHERE Name = ?');
                 $data->execute([$param]);
                 return $data->fetch(PDO::FETCH_COLUMN);
             }
             $var = num($parametr['text']);
             if (empty($var)) {
                 $data2 = connectDb::db()->prepare('INSERT INTO role(Name) VALUES(?)');
                 $data2->execute([$parametr['text']]);
             }
             $parametr['text'] = num($parametr['text']);
             break;
     }
     $data->execute([$parametr['text'], $parametr['id']]);
 }
예제 #15
0
        $result = mysql_query("SELECT pais FROM users WHERE ID = '" . $pol['user_ID'] . "' LIMIT 1", $link);
        while ($r = mysql_fetch_array($result)) {
            $user_pais = $r['pais'];
        }
        if ($pol['user_ID'] and $tiene_kick != true and $user_pais == 'ninguno' and $pol['estado'] == 'turista' and !in_array($_POST['pais'], $vp['paises_congelados'])) {
            mysql_query("UPDATE users SET estado = 'ciudadano', pais = '" . $_POST['pais'] . "' WHERE estado = 'turista' AND pais = 'ninguno' AND ID = '" . $pol['user_ID'] . "' LIMIT 1", $link);
            if ($pol['pols'] > 0 and $_POST['pais'] != '15M' and $_POST['pais'] != '15MBCN') {
                $trae = ', trayendo consigo: ' . pols($pol['pols']) . ' ' . MONEDA;
            } else {
                $trae = '';
            }
            $result2 = mysql_query("SELECT COUNT(*) AS num FROM users WHERE estado = 'ciudadano' AND pais = '" . $_POST['pais'] . "'", $link);
            while ($r2 = mysql_fetch_array($result2)) {
                $ciudadanos_num = $r2['num'];
            }
            evento_chat('<b>[#] Nuevo ciudadano</b> de <b>' . $_POST['pais'] . '</b> <span style="color:grey;">(<b>' . num($ciudadanos_num) . '</b> ciudadanos, <b><a href="http://' . strtolower($_POST['pais']) . '.' . DOMAIN . '/perfil/' . $pol['nick'] . '/" class="nick">' . $pol['nick'] . '</a></b>)</span>', 0, 0, false, 'e', $_POST['pais'], $r['nick']);
            mysql_query("INSERT INTO " . strtolower($_POST['pais']) . "_log \r\n(time, user_ID, user_ID2, accion, dato) \r\nVALUES ('" . date('Y-m-d H:i:s') . "', '" . $pol['user_ID'] . "', '" . $pol['user_ID'] . "', '2', '')", $link);
            unset($_SESSION);
            session_unset();
            session_destroy();
            redirect('http://' . strtolower($_POST['pais']) . '.' . DOMAIN . '/');
        } else {
            redirect(REGISTRAR);
        }
        break;
    default:
        $verror = ' ';
        break;
}
if ($pol['estado'] == 'ciudadano') {
    // load config full
예제 #16
0
<th>Hace...</th>
<th></th>
<th></th>
</tr>';
    $result = mysql_query("SELECT *,\r\n(SELECT COUNT(DISTINCT nick) FROM chats_msg WHERE chat_ID = chats.chat_ID AND user_ID = 0 AND tipo != 'e' AND time > '" . date('Y-m-d H:i:s', time() - 1800) . "') AS online\r\nFROM chats WHERE pais = '" . PAIS . "' ORDER BY estado ASC, online DESC, fecha_creacion ASC", $link);
    while ($r = mysql_fetch_array($result)) {
        $txt .= '<tr>
<td valign="top" align="right">' . ($r['estado'] == 'activo' ? '' : '<b style="color:#888;">#</b>') . '</td>
<td valign="top" align="right"><b>' . $r['online'] . '</b></td>
<td valign="top" nowrap="nowrap" style="background:' . $vp['bg'][$r['pais']] . ';" title="' . $r['pais'] . '">' . ($r['estado'] == 'activo' ? '<a href="http://' . strtolower($r['pais']) . '.' . DOMAIN . '/chats/' . $r['url'] . '"><b>' . $r['titulo'] . '</b></a>' : '<b>' . $r['titulo'] . '</b>') . '</td>

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

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

<td valign="top" align="right">' . num($r['stats_visitas']) . '</td>

<td valign="top">' . ($r['user_ID'] == 0 ? '<em>Sistema</em>' : $r['admin']) . '</td>

<td valign="top" align="right" nowrap="nowrap">' . timer($r['fecha_creacion']) . '</td>
<td valign="top" align="right"></td>
<td>';
        $txt .= (($r['estado'] != 'activo' and $pol['pais'] == $r['pais'] and $pol['nivel'] >= 95) ? boton('Activar', 'http://' . strtolower($r['pais']) . '.' . DOMAIN . '/accion.php?a=chat&b=activar&chat_ID=' . $r['chat_ID']) : '') . (($r['estado'] == 'bloqueado' and $pol['user_ID'] == $r['user_ID']) ? boton('Borrar', 'http://' . strtolower($r['pais']) . '.' . DOMAIN . '/accion.php?a=chat&b=eliminar&chat_ID=' . $r['chat_ID']) : '') . '</td>
</tr>';
    }
    $txt .= '</table>';
}
// Limpiar logs de 24h
mysql_query("DELETE FROM chats_msg WHERE time < '" . date('Y-m-d H:i:s', time() - 60 * 60 * 24) . "'", $link);
$txt_menu = 'comu';
if (!$externo) {
예제 #17
0
<h1>Documentos temporales</h1>
<p>Aquí se listan los documentos temporales del emisor <?php 
echo $Emisor->razon_social;
?>
 que ya están normalizados pero que aun no han sido generados oficialmente (no poseen folio, ni timbre, ni firma).</p>
<?php 
$documentos = [['RUT receptor', 'Razón social receptor', 'DTE', 'Fecha', 'Total', 'Acciones']];
foreach ($dtes as &$dte) {
    $acciones = '<a href="dte_tmps/eliminar/' . $dte->receptor . '/' . $dte->dte . '/' . $dte->codigo . '" title="Eliminar DTE temporal"><span class="fa fa-times-circle btn btn-default" onclick="return eliminar(\'DteTmp\', \'' . $dte->receptor . ', ' . $dte->dte . ', ' . $dte->codigo . '\')"></span></a>';
    $acciones .= ' <a href="dte_tmps/pdf/' . $dte->receptor . '/' . $dte->dte . '/' . $dte->codigo . '" title="Ver PDF de previsualización del DTE"><span class="fa fa-file-pdf-o btn btn-default"></span></a>';
    $acciones .= ' <a href="documentos/generar/' . $dte->receptor . '/' . $dte->dte . '/' . $dte->codigo . '" title="Generar DTE y enviar al SII"><span class="fa fa-send-o btn btn-default"></span></a>';
    $documentos[] = [$dte->getReceptor()->rut . '-' . $dte->getReceptor()->dv, $dte->getReceptor()->razon_social, $dte->getDte()->tipo, $dte->fecha, num($dte->total), $acciones];
}
new \sowerphp\general\View_Helper_Table($documentos);
예제 #18
0
<?php

assert(num("hi"), "'hi' is not a num and this test should fail");
예제 #19
0
            if (!$r2['ha_votado']) {
                $votar_num++;
                $txt_votaciones .= '<li><a href="http://' . strtolower($r2['pais']) . '.' . DOMAIN . '/votacion/' . $r2['ID'] . '"><b>' . $r2['pregunta'] . '</b></a> (' . ucfirst($r2['tipo']) . ')</li>';
            }
        }
        if ($votar_num > 0) {
            $txt_email = '<p>Hola ' . $r['nick'] . '!</p>
		
<p>Aún no has votado en las siguientes votaciones:</p>

<ol>
' . $txt_votaciones . '
</ol>

<p>Tu voto cuenta. Participamos en nuestra <a href="http://15m.virtualpol.com">sala de chat</a>.</p>

<p>¡Unidos somos fuertes!</p>

<p>_____<br />
<a href="http://15m.virtualpol.com">Asamblea Virtual 15M</a><br />
</p>';
            $txt_titulo = $r['nick'] . ', ' . ($votar_num > 1 ? '¡Tienes ' . $votar_num . ' votaciones pendientes!' : '¡Tienes una votación pendiente!');
            enviar_email($r['ID'], $txt_titulo, $txt_email);
            $emails_enviados++;
            $txt .= $votar_num . ' ' . $r['nick'] . '<br />';
        }
    }
    evento_chat('<b>[#] Terminado el envio de emails</b> de aviso <span style="color:grey;">(' . num($emails_enviados) . ' emails enviados, ' . round(microtime(true) - TIME_START) . ' seg de proceso)</span>.');
}
$txt .= '<hr />' . $contador;
include 'theme.php';
예제 #20
0
</table>
</center>

</td>';
        }
        $txt .= '
<td class="amarillo" width="50%" align="center" valign="top"' . (ASAMBLEA ? ' colspan="2"' : '') . '>
<h1 style="color:blue;">' . (ASAMBLEA ? 'Elecciones a Coordinador en ' : 'Legislativas en ') . $queda['parl'] . '</h1>';
        $tabla = '';
        $chart_dato = '';
        $chart_nom = '';
        $tabla_final = '';
        $result = mysql_query("SELECT time, tipo, num_votantes, escrutinio, num_votos\r\nFROM " . SQL . "elec \r\nWHERE tipo = 'parl'\r\nORDER BY time DESC LIMIT 1", $link);
        while ($r = mysql_fetch_array($result)) {
            $votos_total = $r['num_votos'];
            $txt .= '<p style="text-align:center;margin-top:8px;"><b>' . num($votos_total) . '</b> votos de <em>' . num($r['num_votantes']) . '</em>, participación: <b>' . num($votos_total * 100 / $r['num_votantes'], 2) . '%</b></p>';
            if ($pol['config']['elecciones'] != 'parl') {
                $m = explode("|", $r['escrutinio']);
                $votos_total = 0;
                foreach ($m as $t) {
                    $t = explode(":", $t);
                    if ($t[1] != 'I') {
                        $votos_total += $t[0];
                    }
                }
                $count = 0;
                foreach ($m as $t) {
                    $t = explode(":", $t);
                    if ($t[1] == 'B') {
                        $tabla_final .= '<tr><td align="right" colspan="2"><b>En Blanco</b></td><td align="right">' . $t[0] . '</td><td align="right">' . number_format($t[0] * 100 / $votos_total, 2, ',', '') . '%</td></tr>';
                    } elseif ($t[1] == 'I') {
예제 #21
0
<h1>Usuario empresa <?php 
echo $Contribuyente->razon_social;
?>
</h1>
<p>Aquí podrá modificar los usuarios autorizados a operar con la empresa <?php 
echo $Contribuyente->razon_social;
?>
 RUT <?php 
echo num($Contribuyente->rut) . '-' . $Contribuyente->dv;
?>
, para la cual usted es el usuario administrador.</p>
<?php 
$f = new \sowerphp\general\View_Helper_Form();
echo $f->begin(['onsubmit' => 'Form.check() && Form.checkSend()']);
echo $f->input(['type' => 'js', 'id' => 'usuarios', 'label' => 'Usuarios autorizados', 'titles' => ['Usuario', 'Permiso'], 'inputs' => [['name' => 'usuario'], ['type' => 'select', 'name' => 'permiso', 'options' => $permisos_usuarios]], 'values' => $Contribuyente->getUsuarios(), 'help' => 'Debe ingresar el nombre del usuario que desea autorizar y el permiso. Si quiere asignar varios permisos a un usuario deberá agregarlo varias veces.']);
echo $f->end('Modificar usuarios autorizados');
예제 #22
0
    }
}
?>
</h1>
<article id="AllTags">
	<?php 
$tags = get_tags();
function num($a)
{
    if ($a < 2) {
        return "tags-normal";
    } elseif ($a < 4) {
        return "tags-big";
    } else {
        return "tags-larger";
    }
}
$html = '<div class="lotus-tags fn-clear">';
foreach ($tags as $tag) {
    //$tt = $tag->count;
    //echo $tt;
    $tag_link = get_tag_link($tag->term_id);
    $html .= "<a href='{$tag_link}' title='标签: {$tag->name}' class='" . num($tag->count) . "' rel='tag' >";
    $html .= "{$tag->name}</a>";
}
$html .= '</div>';
echo $html;
?>
</article>
<?php 
get_footer();
예제 #23
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';
예제 #24
0
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php 


$mysqli=mysqli_connect("localhost","root","root","logindb");
$name=$_POST["name"]; 
$passowrd=$_POST["password"]; 
//print_r($_COOKIE);

if ($name && $passowrd){ 
$sql = "SELECT * FROM test1 WHERE name='$name' and password='******'"; 
$res = mysqli_query($mysqli,$sql); 
$rows=mysqli_num_rows($res); 
if($rows){ 
//header("location:login1.php"); 
//exit; 
echo "登录成功";
//引入文件,登录成功写入文本文件记录次数
require_once"count.php";
$guestsnum=num();
echo" you are the ".$guestsnum." man";
//header("Location: http://192.168.2.57/gongji/login/jl.php");

}
 else{
echo "登录失败,请检查用户名和密码";
}
mysqli_free_result($res);
mysqli_close($mysqli);
}
?> 
<h1>Seleccionar empresa con que operar</h1>
<p>Aquí podrá seleccionar una empresa con la cual operar durante su sesión de LibreDTE. Todas las acciones que realice quedarán registradas a nombre de la empresa que seleccione.</p>
<?php 
foreach ($empresas as &$e) {
    // agregar acciones
    $acciones = '';
    if ($e['administrador']) {
        $acciones .= '<a href="modificar/' . $e['rut'] . '" title="Editar empresa ' . $e['razon_social'] . '"><span class="fa fa-edit btn btn-default"></span></a>';
        $acciones .= ' <a href="usuarios/' . $e['rut'] . '" title="Mantenedor usuarios autorizados a operar con la empresa ' . $e['razon_social'] . '"><span class="fa fa-users btn btn-default"></span></a> ';
    }
    $acciones .= '<a href="seleccionar/' . $e['rut'] . '" title="Operar con la empresa ' . $e['razon_social'] . '"><span class="fa fa-check btn btn-default"></span></a>';
    $e[] = $acciones;
    // modificar columnas
    $e['rut'] = num($e['rut']) . '-' . $e['dv'];
    $e['certificacion'] = $e['certificacion'] ? 'Certificación' : 'Producción';
    $e['administrador'] = $e['administrador'] ? 'Si' : 'No';
    unset($e['dv']);
}
array_unshift($empresas, ['RUT', 'Razón social', 'Giro', 'Ambiente', 'Administrador', 'Acciones']);
new \sowerphp\general\View_Helper_Table($empresas);
?>
<a class="btn btn-primary btn-lg btn-block" href="registrar" role="button">Registrar una nueva empresa y ser el administrador de la misma</a>
예제 #26
0
    $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 != '') {
                    $extras .= ocultar_IP($el_host, 'host') . '<br />';
                }
            }
예제 #27
0
" role="button">Enviar DTE al SII</a></p>
<?php 
}
?>
        </div>
    </div>
</div>
<!-- INICIO DATOS BÁSICOS -->

<!-- INICIO ENVIAR POR EMAIL -->
<div role="tabpanel" class="tab-pane" id="email">
<?php 
if ($emails) {
    $asunto = 'EnvioDTE: ' . num($Emisor->rut) . '-' . $Emisor->dv . ' - ' . $DteEmitido->getTipo()->tipo . ' N° ' . $DteEmitido->folio;
    $mensaje = $Receptor->razon_social . ',' . "\n\n";
    $mensaje .= 'Se adjunta ' . $DteEmitido->getTipo()->tipo . ' N° ' . $DteEmitido->folio . ' del día ' . $DteEmitido->fecha . ' por un monto total de $' . num($DteEmitido->total) . '.-' . "\n\n";
    $mensaje .= 'Saluda atentamente,' . "\n\n";
    $mensaje .= '-- ' . "\n" . $Emisor->razon_social . "\n";
    $mensaje .= $Emisor->giro . "\n";
    $contacto = [];
    foreach (['telefono', 'email', 'web'] as $c) {
        if (!empty($Emisor->{$c})) {
            $contacto[] = $Emisor->{$c};
        }
    }
    if ($contacto) {
        $mensaje .= implode(' - ', $contacto) . "\n";
    }
    $mensaje .= $Emisor->direccion . ', ' . $Emisor->getComuna()->comuna . "\n";
    $table = [];
    $checked = [];
예제 #28
0
    ?>
        <li role="presentation"><a href="#detalle" aria-controls="detalle" role="tab" data-toggle="tab">Detalle</a></li>
        <li role="presentation"><a href="#estadisticas" aria-controls="estadisticas" role="tab" data-toggle="tab">Estadísticas</a></li>
<?php 
}
?>
        <li role="presentation"><a href="#revision" aria-controls="revision" role="tab" data-toggle="tab">Subir revisión</a></li>
    </ul>
    <div class="tab-content">

<!-- INICIO DATOS BÁSICOS -->
<div role="tabpanel" class="tab-pane active" id="datos">
    <div class="row">
        <div class="col-md-9">
<?php 
new \sowerphp\general\View_Helper_Table([['Período', 'Guías emitidas', 'Guías envíadas'], [$Libro->periodo, num($n_guias), num($Libro->documentos)]]);
?>
        <div class="row">
            <div class="col-md-6">
                <a class="btn btn-default btn-lg btn-block<?php 
echo !$n_guias ? ' disabled' : '';
?>
" href="<?php 
echo $_base;
?>
/dte/dte_guias/csv/<?php 
echo $Libro->periodo;
?>
" role="button">
                    <span class="fa fa-file-excel-o" style="font-size:24px"></span>
                    Descargar detalle en archivo CSV
예제 #29
0
                     while ($r = mysql_fetch_array($result)) {
                         mysql_query("INSERT INTO " . SQL . "elecciones (ID_partido, user_ID, nav, IP, time) VALUES ('" . $ID_partido . "', '" . $pol['user_ID'] . "', '" . $nav . "', '" . $IP . "', '" . $time . "')", $link);
                         mysql_query("UPDATE users SET num_elec = num_elec + 1 WHERE ID = '" . $pol['user_ID'] . "' LIMIT 1", $link);
                         mysql_query("UPDATE " . SQL . "elec SET num_votos = num_votos + 1 ORDER BY time DESC LIMIT 1", $link);
                     }
                 }
             }
             $result = mysql_query("SELECT num_votantes FROM " . SQL . "elec ORDER BY time DESC LIMIT 1", $link);
             while ($r = mysql_fetch_array($result)) {
                 $num_votantes = $r['num_votantes'];
             }
             $result = mysql_query("SELECT COUNT(ID) AS num FROM " . SQL . "elecciones", $link);
             while ($r = mysql_fetch_array($result)) {
                 $num_votos = $r['num'];
             }
             evento_chat('<b>[ELECCIONES]</b> <a href="/elecciones/">Nuevo voto</a> <span style="color:grey;">(<b>' . num($num_votos) . '</b> votos, ' . num($num_votos * 100 / $num_votantes, 2) . '%, ' . $pol['nick'] . ')</span>', '0', '0', true);
         }
     }
     $refer_url = '';
     break;
 case 'partido-lista':
     $b = $_GET['b'];
     $ID_partido = $_GET['ID'];
     if ($b and $ID_partido and $pol['config']['elecciones_estado'] != 'elecciones') {
         $result = mysql_query("SELECT ID_presidente, siglas FROM " . SQL . "partidos WHERE ID = '" . $ID_partido . "' AND ID_presidente = '" . $pol['user_ID'] . "' LIMIT 1", $link);
         while ($r = mysql_fetch_array($result)) {
             $siglas = $r['siglas'];
             if ($b == 'edit') {
                 mysql_query("UPDATE " . SQL . "partidos SET descripcion = '" . gen_text($_POST['text']) . "' WHERE ID = '" . $ID_partido . "' LIMIT 1", $link);
             } elseif ($b == 'add' and $_POST['user_ID']) {
                 mysql_query("INSERT INTO " . SQL . "partidos_listas (ID_partido, user_ID) VALUES ('" . $ID_partido . "', '" . $_POST['user_ID'] . "')", $link);
예제 #30
0
    ?>
        <li role="presentation"><a href="#detalle" aria-controls="detalle" role="tab" data-toggle="tab">Detalle</a></li>
        <li role="presentation"><a href="#estadisticas" aria-controls="estadisticas" role="tab" data-toggle="tab">Estadísticas</a></li>
<?php 
}
?>
        <li role="presentation"><a href="#revision" aria-controls="revision" role="tab" data-toggle="tab">Subir revisión</a></li>
    </ul>
    <div class="tab-content">

<!-- INICIO DATOS BÁSICOS -->
<div role="tabpanel" class="tab-pane active" id="datos">
    <div class="row">
        <div class="col-md-9">
<?php 
new \sowerphp\general\View_Helper_Table([['Período', 'DTE emitidos', 'DTE envíados'], [$Libro->periodo, num($n_ventas), num($Libro->documentos)]]);
?>
        <div class="row">
            <div class="col-md-6">
                <a class="btn btn-default btn-lg btn-block<?php 
echo !$n_ventas ? ' disabled' : '';
?>
" href="<?php 
echo $_base;
?>
/dte/dte_ventas/csv/<?php 
echo $Libro->periodo;
?>
" role="button">
                    <span class="fa fa-file-excel-o" style="font-size:24px"></span>
                    Descargar detalle en archivo CSV