Exemple #1
0
 /**
  * Returns the ISSN number.
  * 
  * @param bool $mask Mask number?
  * @return string
  */
 public function getISSN($mask = false)
 {
     $issn = $this->issn;
     if ($mask) {
         $issn = \mask('####-####', $issn);
     }
     return $issn;
 }
Exemple #2
0
 /**
  * Return the ISBN number, masked or not.
  * 
  * @param bool $mask Mask number?
  * @return string
  */
 public function getISBN($mask = false)
 {
     $isbn = $this->getData();
     if ($mask) {
         $isbn = \mask('###-##-###-####-#', $isbn);
     }
     return $isbn;
 }
Exemple #3
0
function send_message($msg)
{
    global $clients;
    $msgFormat = mask(json_encode($msg));
    $msgLength = strlen($msgFormat);
    echo "Send JSON: " . $msgFormat . "\n";
    echo "Length JSON: " . $msgLength . "\n";
    echo "\n*******************************\n";
    foreach ($clients as $changed_socket) {
        @socket_write($changed_socket, $msgFormat, $msgLength);
    }
    return true;
}
Exemple #4
0
function query_with_mask($sql)
{
    $mask_data = [];
    $result = query($sql);
    foreach ($result['data'] as $row) {
        $mask_row = [];
        foreach ($result['fields'] as $field) {
            $mask_row[$field->name] = mask($field->orgtable, $field->orgname, $row[$field->name]);
        }
        $mask_data[] = $mask_row;
    }
    $result['data'] = $mask_data;
    return $result;
}
Exemple #5
0
 public function createOrder($sort, $desc)
 {
     return mask($sort) . ($desc ? ' DESC' : ' ASC');
 }
        echo "Client[{$address}] connected to us on port {$port}\n";
        //make room for new socket
        unset($changed[$found_socket]);
    }
    //loop through all connected sockets
    foreach ($changed as $changed_socket) {
        //check for any incomming data
        while (socket_recv($changed_socket, $buf, 1024, 0) >= 1) {
            $received_text = unmask($buf);
            //unmask data
            $received = explode(',', $received_text);
            if (!empty($received[1])) {
                echo $received[0] . "\t" . $received[1] . "\n";
                if (array_search($received[0], $address_clients)) {
                    $found_socket = array_search($received[0], $address_clients);
                    socket_write($clients[$found_socket], mask($received[1]), strlen(mask($received[1])));
                }
            }
            break 2;
            //exit this loop
        }
        $buf = socket_read($changed_socket, 1024, PHP_NORMAL_READ);
        if ($buf === false) {
            // remove client for $clients array
            $found_socket = array_search($changed_socket, $clients);
            socket_getpeername($clients[$found_socket], $address);
            unset($clients[$found_socket]);
            echo "Client[{$address}] disconnected\n";
        }
    }
}
    echo "  " . $argv[0] . " HOST --auto\r\n";
    echo "  " . $argv[0] . " www.shopwaredemo.de --auto\r\n\r\n";
    echo "  " . $argv[0] . " HOST QUERY\r\n";
    echo "  " . $argv[0] . " www.shopwaredemo.de \"SELECT COUNT(`id`) FROM `s_user`\"\r\n";
    echo "  " . $argv[0] . " www.shopwaredemo.de \"SELECT `email` FROM `s_user` LIMIT 0,1\"\r\n\r\n";
    exit(1);
}
if ($argv[2] != '--auto') {
    $x = http_req($argv[1], $argv[2]);
    if (!($x = mask($x))) {
        exit("Your query failed!\r\n\r\n");
    }
    echo "Query:\r\n  " . $argv[2] . "\r\nReturn:\r\n  " . $x . "\r\n\r\n";
} else {
    $task = array(array('Amount of registered users', 'SELECT COUNT(`id`) FROM `s_user`', null), array('E- Mail from first user', 'SELECT `email` FROM `s_user` ORDER BY `id` LIMIT 0,1', null), array('Password from first user', 'SELECT `password` FROM `s_user` LIMIT 0,1', null), array('Amount of orders', 'SELECT COUNT(`id`) FROM `s_order`', null));
    for ($i = 0; $i < count($task); $i++) {
        echo "[ .. ] Task: \"" . $task[$i][0] . "\"";
        $x = http_req($argv[1], $task[$i][1]);
        if (!($x = mask($x))) {
            echo "\r[fail] Task: \"" . $task[$i][0] . "\"\r\n";
        } else {
            echo "\r[ ok ] Task: \"" . $task[$i][0] . "\"\r\n";
            $task[$i][2] = $x;
        }
    }
    echo "\r\n";
    for ($i = 0; $i < count($task); $i++) {
        echo $task[$i][0] . space(26 - strlen($task[$i][0])) . ' : ' . $task[$i][2] . "\r\n";
    }
    echo "\r\n";
}
// [69] => 840.40
// [tot_venctos] => 840.40
// [70] => 788.00
// [bc_sal_fam] => 788.00
// [71] => 724.96
// [bc_irrf] => 724.96
// [72] => 788.00
// [bc_previd] => 788.00
// [73] => PAGAMENTO/QUITAÇÃO NÃO INFORMADO
// [pagto_quitacao] => PAGAMENTO/QUITAÇÃO NÃO INFORMADO
$obj['cnpj_ug'] = mask($obj['cnpj_ug'], '##.###.###/####-##');
$strAnoMes = $obj['ano_mes'];
$obj['ano_mes'] = mes(substr($ano_mes, 4, 2)) . "/" . substr($ano_mes, 0, 4);
$obj['dt_admissao'] = dateFormat($obj['dt_admissao']);
$obj['cpf'] = mask($obj['cpf'], '###.###.###-##');
$obj['pis_pasep'] = mask($obj['pis_pasep'], '###.#####.##-#');
$obj['tot_venctos'] = valorM($obj['tot_venctos']);
$obj['sal_liquido'] = valorM($obj['sal_liquido']);
$obj['tot_descontos'] = valorM($obj['tot_descontos']);
$obj['vencto_base_cargo'] = valorM(substr($obj['vencto_base_cargo'], 0, -2));
$obj['tipo_salario'] = $obj['tipo_salario'] == 1 ? " MENSAL" : " HORA/AULA";
$obj['bc_previd'] = valorM($obj['bc_previd']);
$obj['bc_irrf'] = valorM($obj['bc_irrf']);
$obj['qtd_depend_irrf'] = valorM($obj['qtd_depend_irrf']);
$obj['tot_deduc_depend'] = valorM($obj['tot_deduc_depend']);
$obj['sal_liquido'] = valorM($obj['sal_liquido']);
$obj['vencimentoV'] = vencimento("V", $cli_id, $strAnoMes, 0, $id_servidor);
$obj['vencimentoD'] = vencimento("D", $cli_id, $strAnoMes, 0, $id_servidor);
$tplRelatorio = file_get_contents('relatorioTpl.html');
// echo 'Obj: <pre>';print_r( $obj );die;
$keys = getKeysDados($obj);
Exemple #9
0
        $clients[] = $socket_new;
        $header = socket_read($socket_new, 1024);
        //握手
        perform_handshaking($header, $socket_new, $host, $port);
        $found_socket = array_search($socket, $changed);
        unset($changed[$found_socket]);
    }
    foreach ($changed as $changed_socket) {
        $read = '';
        while (socket_recv($changed_socket, $buf, 1024, 0) > 0) {
            $read .= $buf;
        }
        if (!empty($read) && preg_match('/\\[socket_log_start\\]([\\s\\S]*)\\[socket_log_end\\]/', $read, $match)) {
            $read = $match[1];
            echo '#######get the log:' . PHP_EOL . $read . PHP_EOL . PHP_EOL;
            send_message(mask($read));
        }
        $buf = @socket_read($changed_socket, 1024, PHP_NORMAL_READ);
        if ($buf === false) {
            //断开连接
            $found_socket = array_search($changed_socket, $clients);
            unset($clients[$found_socket]);
        }
    }
}
socket_close($sock);
function send_message($msg)
{
    global $clients;
    foreach ($clients as $changed_socket) {
        @socket_write($changed_socket, $msg, strlen($msg));
Exemple #10
0
 function movePiece($playerNum, $from, $to)
 {
     // Verify player controls the piece
     echo "Player " . $playerNum . " making a move " . $from . " --> " . $to . "\n";
     //print_r($this->boardSpots);
     //$toIndex = $to[0] + $to[1]*10;
     $toY = floor($to / 10);
     $toX = $to - $toY * 10;
     $movedPiece = $this->boardSpots[$from];
     $trgPiece = $this->boardSpots[$to];
     if ($this->unitRanks[$movedPiece] > 10) {
         echo "invalid piece\n";
         $response_text = mask(json_encode(array('type' => 'gameMessage', 'message' => 'can\'t move this piece')));
         send_message_group($response_text, [$this->sockets[$playerNum]]);
         //send data
         return;
     }
     if ($this->turn != $playerNum) {
         echo "wront turn\n";
         $response_text = mask(json_encode(array('type' => 'gameMessage', 'message' => 'It is not your turn')));
         send_message_group($response_text, [$this->sockets[$playerNum]]);
         //send data
         return;
     }
     if (floor($movedPiece / 40) + 1 == $playerNum) {
         // Check target location to see if it is a valid move
         echo "You can move this one\n";
         if (abs($from - $to) == 10 || abs($from - $to) == 1) {
             // This is a valid one space move -> now verify that it is a move to able spot
             echo "valid move\n";
             $spotCheck = floor($trgPiece / 40) + 1;
             switch ($spotCheck) {
                 case $playerNum:
                     echo "Can't move onto your own piece(" . $movedPiece . " vs " . $trgPiece . ")\n";
                     break;
                 case $this->opponentSwitch[$playerNum]:
                     print_r($this->unitRanks);
                     echo "Move onto an opponents piece ID: (" . $movedPiece . " vs " . $trgPiece . ") ranks (" . $this->unitRanks[$movedPiece] . " vs " . $this->unitRanks[$trgPiece] . ")\n";
                     // Review outcome of piece collision
                     $outCome = resolveCollision($movedPiece, $trgPiece, $this->unitRanks);
                     $this->turn = $this->opponentSwitch[$playerNum];
                     switch ($outCome) {
                         case 1:
                             $this->kill($to, $trgPiece);
                             $this->processMove($from, $to, $movedPiece);
                             $response_text = mask(json_encode(array('type' => 'script', 'message' => 'killPiece(' . $to . ');showMove(' . $from . ', ' . $to . ', [' . $toX . ', ' . $toY . ']);')));
                             break;
                         case 2:
                             $this->kill($from, $movedPiece);
                             $response_text = mask(json_encode(array('type' => 'script', 'message' => 'killPiece(' . $from . ');')));
                             break;
                         case 3:
                             $this->kill($to, $trgPiece);
                             $this->kill($from, $movedPiece);
                             $response_text = mask(json_encode(array('type' => 'script', 'message' => 'killPiece(' . $to . ');killPiece(' . $from . ');sync([' . implode(",", $this->unitLocs) . '], [' . implode(",", $this->unitStatus) . ']);')));
                             break;
                         case 4:
                             echo "A winner is you!";
                             $response_text = mask(json_encode(array('type' => 'gameMessage', 'message' => 'Player ' . $playerNum . ' - A WINNER IS YOU!')));
                             send_message($response_text);
                             //send data
                             break;
                         default:
                             echo "an error has occured";
                             $response_text = mask(json_encode(array('type' => 'gameMessage', 'message' => 'it broke')));
                             send_message($response_text);
                             //send data
                             break;
                     }
                     send_message($response_text);
                     //send data
                     break;
                 case 3:
                     $this->turn = $this->opponentSwitch[$playerNum];
                     echo "move to an empty spot\n";
                     $this->processMove($from, $to, $movedPiece);
                     $response_text = mask(json_encode(array('type' => 'script', 'message' => 'showMove(' . $from . ', ' . $to . ', [' . $toX . ', ' . $toY . ']);')));
                     send_message($response_text);
                     //send data
                     break;
                 case 4:
                     echo "move to a closed tile\n";
                     break;
             }
         } else {
             echo "invalid move (" . ($from - $to) . ")\n";
             $response_text = mask(json_encode(array('type' => 'gameMessage', 'message' => 'invalid move')));
             send_message_group($response_text, [$this->sockets[$playerNum]]);
             //send data
         }
     } else {
         echo "you no control this one " . $movedPiece . " vs " . $playerNum . "\n";
     }
 }
Exemple #11
0
function sendMessage($msg, $user = null, $channel = null)
{
    terminal('MESSAGE OUT', $msg);
    //get global for users arrays
    global $clients, $users, $db;
    //Send for ALL
    if ($user == null) {
        foreach ($clients as $k => $v) {
            if (isset($users[$k]['channel']) && $users[$k]['channel'] == $channel && isset($users[$k]['userid'])) {
                $tmp = mask($db->encMSG(json_encode($msg), $users[$k]['userid']));
                socket_write($v, $tmp, strlen($tmp));
            }
        }
    } elseif (is_resource($clients[$user])) {
        $tmp = mask($db->encMSG(json_encode($msg), $users[$user]['userid']));
        socket_write($clients[$user], $tmp, strlen($tmp));
    }
}
Exemple #12
0
            //Cor da mensagem
            //Prepara a mensagem para enviar para os clients
            $response_text = mask(json_encode(array('type' => 'usermsg', 'name' => $user_name, 'message' => $user_message, 'color' => $user_color)));
            send_message($response_text);
            //Envia a mensagem
            break 2;
            //Sai do loop
        }
        $buf = @socket_read($changed_socket, 1024, PHP_NORMAL_READ);
        if ($buf === false) {
            //Remove o client do array $clients
            $found_socket = array_search($changed_socket, $clients);
            socket_getpeername($changed_socket, $ip);
            unset($clients[$found_socket]);
            //Notifica todos os usuários da conexão encerrada
            $response = mask(json_encode(array('type' => 'system', 'message' => $ip . ' desconectado')));
            send_message($response);
        }
    }
}
//Fecha o socket
socket_close($sock);
function send_message($msg)
{
    global $clients;
    foreach ($clients as $changed_socket) {
        @socket_write($changed_socket, $msg, strlen($msg));
    }
    return true;
}
//Decodifica uma mensagem
Exemple #13
0
 $Nome = $verifica['Nome'];
 $NomeArtistico = $verifica['Nome_Art'];
 $RG = $verifica['RG'];
 $CPF = $cpf_tbl;
 $CCM = $verifica['CCM'];
 $IdEstadoCivil = estadoCivil($verifica['Est_Civ']);
 //funcao para verificar
 if ($verifica['D_nasc'] == NULL) {
     $DataNascimento == NULL;
 } else {
     $DataNascimento = exibirDataMysql($verifica['D_nasc']);
     //funcao para data em mysql
 }
 $LocalNascimento = $verifica['Loc_Nasc'];
 $Nacionalidade = "Brasileiro(a)";
 $CEP = mask($verifica['Cep'], '#####-###');
 $Telefone1 = $verifica['Telefone'];
 $Telefone2 = $verifica['Telefon2'];
 $Telefone3 = $verifica['Telefon3'];
 $Email = $verifica['Email'];
 $DRT = $verifica['DRT'];
 $Pis = $verifica['Pis'];
 $DataAtualizacao = date('Y-m-d');
 $Observacao = $verifica['Endereco'] . "\n" . $verifica['Regiao'] . "\n" . $verifica['currric'] . "\n" . $verifica['Grau_Ins'] . "\n";
 $tipoDocumento = "1";
 $sql_insere_cpf = "INSERT INTO `sis_pessoa_fisica` \r\n\t\t(`Nome`, `NomeArtistico`, `RG`, `CPF`, `CCM`, `IdEstadoCivil`, `DataNascimento`, `LocalNascimento`, `Nacionalidade`, `CEP`,  `Telefone1`, `Telefone2`, `Telefone3`, `Email`, `DRT`,  `Pis`,  `DataAtualizacao`, `Observacao`) VALUES ('{$Nome}', '{$NomeArtistico}', '{$RG}', '{$cpf_tbl}', '{$CCM}', '{$IdEstadoCivil}' ,{$DataNascimento}, '{$LocalNascimento}', '{$Nacionalidade}','{$CEP}', '{$Telefone1}', '{$Telefone2}', '{$Telefone3}', '{$Email}', '{$DRT}', '{$Pis}',  '{$DataAtualizacao}', '{$Observacao}')";
 $query_insere_cpf = mysqli_query($con, $sql_insere_cpf);
 if ($query_insere_cpf) {
     $texto .= "O CPF {$cpf_tbl} foi inserido com sucesso no sistema.<br />";
 } else {
     $texto .= "Erro ao inserir CPF {$cpf_tbl} no sistema.<br />";
Exemple #14
0
                   for ($i = 0; $i < strlen($buffer); $i++) {
                       echo ord($buffer[$i]).',';
                   }
                   echo "\n";
                   */
                if ($bytes === false || (ord($buffer[0]) & 15) == 8) {
                    ## 연결종료 ###########################################
                    unset($socket_list[$addr_port]);
                    unset($handshake_check[$addr_port]);
                    socket_close($read_socket);
                    echo "<{$addr_port}>[Close]\n";
                    #####################################################
                } else {
                    ## 메시지전달 ##########################################
                    $msg = unmask($buffer);
                    $echo_msg = mask("ECHO: {$msg}");
                    socket_write($read_socket, $echo_msg);
                    echo "<{$addr_port}>: {$msg}\n";
                    #####################################################
                }
            }
            // end if
        }
        // end if
    }
    // end foreach
}
// end while
function parse_header($str)
{
    $str = preg_replace('/\\r/', '', $str);
Exemple #15
0
        socket_getpeername($socket_new, $ip);
        Log::writeLog("Client " . $ip . " connected\n", true);
        $response = mask(json_encode(array('server' => $ip . ' connected')));
        send_message($response);
        send_message(mask(json_encode($IO->generateNewClientPacket())));
        $found_socket = array_search($socket, $changed);
        unset($changed[$found_socket]);
    }
    foreach ($changed as $changed_socket) {
        while (socket_recv($changed_socket, $buf, 1024, 0) >= 1) {
            $received_text = unmask($buf);
            $jsonObject = json_decode($received_text);
            $createResponse = json_encode(array('server' => $ip . ' : ' . utf8_encode($received_text)));
            Log::writeLog($received_text . "\r\n", true);
            $IO->parse($received_text);
            $response_text = mask($createResponse);
            send_message($response_text);
            break 2;
        }
        $buf = @socket_read($changed_socket, 1024, PHP_NORMAL_READ);
        if ($buf === false) {
            $found_socket = array_search($changed_socket, $clients);
            socket_getpeername($changed_socket, $ip);
            unset($clients[$found_socket]);
            $response = mask(json_encode(array('server' => $ip . ' disconnected')));
            send_message($response);
        }
    }
}
Log::closeLog();
socket_close($socket);
Exemple #16
0
 /**
  * 
  * @return string
  */
 public function getDataToDisplay()
 {
     return \mask('# ## ##### ##### #', $this->data);
 }
Exemple #17
0
    if (mb_strlen($str_tel, "Big5") == strlen($str_tel)) {
        //不是中文
        $str_tel = mask($str_tel, 2, strlen($str_tel) - 2);
    } else {
        $str_tel = mask($str_tel, 1, mb_strlen($str_tel, "utf8") - 1);
    }
} else {
    $str_tel = O_SPACE($form['tel']);
}
if ($_SESSION['RootLayer'] == 3) {
    $str_mobile = $form['mobile'];
    if (mb_strlen($str_mobile, "Big5") == strlen($str_mobile)) {
        //不是中文
        $str_mobile = mask($str_mobile, 2, strlen($str_mobile) - 2);
    } else {
        $str_mobile = mask($str_mobile, 1, mb_strlen($str_mobile, "utf8") - 1);
    }
} else {
    $str_mobile = O_SPACE($form['mobile']);
}
?>
		<tr>
			<td align=right>聯絡人</td><td><?php 
echo $str_contact;
?>
</td><td align=right>公司地址</td><td><?php 
echo O_SPACE($form['address']);
?>
</td>
		</tr>
		<tr>
Exemple #18
0
    </tr>
    </thead>';
while ($client = mysql_fetch_array($clientes)) {
    $consulta_cpf = $client['TIPOFJ'];
    if ($consulta_cpf == 'F') {
        $mask_cpf = $client['CPFCNPJ'];
    } else {
        $mask_cnpj = $client['CPFCNPJ'];
    }
    $mask = $client['CPFCNPJ'];
    if (strlen($mask) == 11) {
        $mask = mask($mask, '###.###.###-##');
    }
    $mask2 = $mask_cnpj;
    if (strlen($mask2) == 14) {
        $mask = mask($mask_cnpj, '##.###.###/####-##');
    }
    //echo mask($cpf,'###.###.###-##');
    echo '<tr>
    <td>' . $client['CODIGO'] . '</td>
    <td>' . $mask . '</td>
    <td>' . $client['RAZAO'] . '</td>
    <td>' . $client['NOME'] . '</td>
    <td>' . $client['ENDERECO'] . '</td>
    <td>' . $client['NUMERO'] . '</td>';
    echo '</tr>';
}
echo '</table>';
echo '
<center>
<nav>
$countPedidosItens = count($listaPedido);
$smarty->assign('countPedidosItens', $countPedidosItens);
/**/
/*RETORNO PAGAMENTO MOIP*/
$query = "SELECT\r\n\t\t\t\tMAX(COD_MOIP) COD_MOIP,\r\n\t\t\t\tCASE IFNULL(SITUACAO, 'N') WHEN 'N' THEN DESCRICAO_PEDIDO_ITEM_SITUACAO ELSE SITUACAO END SITUACAO,\r\n\t\t\t\tID_PEDIDO_ITEM_SITUACAO\r\n\t\t\tFROM\r\n\t\t\t\te_PEDIDO LEFT JOIN e_RETORNO_PAGAMENTO_MOIP\r\n\t\t\t\t\t\t\t\tON NUMERO_PEDIDO = ID_TRANSACAO,\r\n\t\t\t\te_PEDIDO_ITEM_SITUACAO \r\n\t\t\tWHERE\r\n\t\t\t\tNUMERO_PEDIDO = '" . $numeroPedido . "'\r\n\t\t\tAND fn_situacao_pedido(ID_PEDIDO) = ID_PEDIDO_ITEM_SITUACAO\r\n\t\t\tGROUP BY\r\n\t\t\t\tSITUACAO,\r\n\t\t\t\tDESCRICAO_PEDIDO_ITEM_SITUACAO,\r\n\t\t\t\tID_PEDIDO_ITEM_SITUACAO\r\n\t\t\t\tLIMIT 1";
$listaRetornoPagamentoMoip = $mysqli->ConsultarSQL($query);
$Status = $_SESSION['sessionStatusMoIP'];
if (!$Status) {
    $Status = $listaRetornoPagamentoMoip[0]['SITUACAO'];
}
$smarty->assign('situacaoMoip', $Status);
$CodigoMoIP = $_SESSION['sessionCodigoMoIP'];
if (!$CodigoMoIP) {
    $CodigoMoIP = $listaRetornoPagamentoMoip[0]['COD_MOIP'];
}
$codMoip = mask($CodigoMoIP, '####.####.####');
$smarty->assign('codMoip', $codMoip);
if ($listaRetornoPagamentoMoip[0]['ID_PEDIDO_ITEM_SITUACAO'] == ID_SITUACAO_PEDIDO_ANALISE_CREDITO) {
    enviaEmail('situacaoPedido', $_SESSION['sessionNome'], $_SESSION['login'], null, $idPedido);
}
/**/
/*CONVERSAO FACEBOOK*/
//$arrayConversaoFacebook = array('6010232729684','6010236300884','6010236570684','6010236710284');
//$smarty->assign('arrayConversaoFacebook', $arrayConversaoFacebook);
/**/
/*BTG*/
$smarty->assign('valor_total', $totalPedidoFinal);
$smarty->assign('frete', $valorFretePedido);
$smarty->assign('dt_prevista_para_entrega', $prazoEntregaPedido);
$smarty->assign('metodo_de_pagamento', $listaPedidoPagamento[0]['DESCRICAO']);
$smarty->assign('banco1', $listaPedidoPagamento[0]['DESCRICAO_FORMA_PAGAMENTO']);
Exemple #20
0
    // laço de repetiçao que vai trazer todos os resultados da consulta
    ?>
      
        <tr>
            <td><?php 
    echo $campo['id'];
    // mostrando o campo NOME da tabela
    ?>
</td>
            <td><?php 
    echo $campo['nome'];
    // mostrando o campo NOME da tabela
    ?>
</td>
            <td><?php 
    echo mask($campo['cpf'], '###.###.###-##');
    ?>
</td>
            <td><?php 
    echo $campo['email'];
    ?>
</td>                      
            <td><?php 
    echo $campo['descricao'];
    // mostrando o campo DESCRICAO da tabela
    ?>
</td>       
           
            <td>
                <button class="btn btn-primary"onclick="window.location.href='formulario.php?id=<?php 
    echo $campo['id'];
 public function exportarExcel()
 {
     $this->temPermissaoConsultar();
     $producaoModel = new ModelProducao();
     $produtoProducaoDAO = new ProdutoProducaoDAO();
     $produtoModel = new ModelProduto();
     $produtoDAO = new ProdutoDAO();
     $producaoModel->set('ativo', 1);
     $retornoFiltros = $this->filtrarProducao($producaoModel);
     $producoes = $this->producaoDAO->consultarPorPermissao($retornoFiltros['objeto']);
     $produtoModel->set('ativo', 1);
     $produtos = $produtoDAO->consultar($produtoModel);
     if ($producoes) {
         require LIBS . 'PHPExcel/Classes/PHPExcel.php';
         $phpExcel = new PHPExcel();
         $phpExcel->getProperties()->setCreator(ControleSessao::$nome_usuario)->setTitle('ProduçãoEmitidaEm-' . date('dd-mm-YYYY-HH-ii-ss'));
         $phpExcel->setActiveSheetIndex(0)->setCellValue('A1', 'Nome Base')->setCellValue('B1', 'Cod. Agência')->setCellValue('C1', 'Agência de Produção')->setCellValue('D1', 'Matrícula Orientador')->setCellValue('E1', 'Orientador')->setCellValue('F1', 'Matrícula Supervisor')->setCellValue('G1', 'Supervisor')->setCellValue('H1', 'Regional')->setCellValue('I1', 'Nome Cliente')->setCellValue('J1', 'CPF / CNPJ')->setCellValue('K1', 'Endereço')->setCellValue('L1', 'Complemento')->setCellValue('M1', 'Bairro')->setCellValue('N1', 'CEP')->setCellValue('O1', 'Cidade')->setCellValue('P1', 'UF')->setCellValue('Q1', 'Tipo de endereço')->setCellValue('R1', 'DDD Residencial')->setCellValue('S1', 'Telefone Residencial')->setCellValue('T1', 'DDD Comercial')->setCellValue('U1', 'Telefone Comercial')->setCellValue('V1', 'Data Assinatura Contrato')->setCellValue('W1', 'Tipo de Produto')->setCellValue('X1', 'Modalidade')->setCellValue('Y1', 'Status Contrato')->setCellValue('Z1', 'Status da Visita de Orientacao')->setCellValue('AA1', 'Motivo da não orientação')->setCellValue('AB1', 'Valor Solicitado')->setCellValue('AC1', 'Valor Concedido')->setCellValue('AD1', 'Qtd de Parcelas')->setCellValue('AE1', 'Dia do Vencimento')->setCellValue('AF1', 'Tipo de Aval')->setCellValue('AG1', 'Data da Última Parcela')->setCellValue('AH1', 'Origem do Cliente');
         $x = 2;
         foreach ($producoes as $producao) {
             $produtoProducaoModel = new ModelProdutoProducao();
             $produtoProducaoModel->set('id_producao', $producao->get('id_producao'));
             $produtosProducao = $produtoProducaoDAO->consultarProdutoProducao($produtoProducaoModel);
             if ($produtosProducao) {
                 //CASO ENTRE ou RETIRE ALGUM ITEM NA LINHA ACIMA, ALTERAR AQUI TAMBÉM.
                 if ($produtos) {
                     $p = 'I';
                     $c = 'J';
                     foreach ($produtos as $produto) {
                         $phpExcel->setActiveSheetIndex(0)->setCellValue('A' . $p . '1', 'Produto - ' . $produto->get('nome'))->setCellValue('A' . $c . '1', 'Número Contrato - ' . $produto->get('nome'));
                         foreach ($produtosProducao as $prodProd) {
                             $p1 = $p;
                             $c1 = $c;
                             if ($produto->get('id') == $prodProd->get('id_produto')) {
                                 $phpExcel->setActiveSheetIndex(0)->setCellValue('A' . $p1 . $x, $prodProd->get('nome_produto'))->setCellValue('A' . $c1 . $x, $prodProd->get('numero_contrato'));
                             } else {
                                 $p1++;
                                 $c1++;
                             }
                         }
                         $p++;
                         $p++;
                         $c++;
                         $c++;
                         $p1++;
                         $p1++;
                         $c1++;
                         $c1++;
                     }
                 }
             }
             $phpExcel->setActiveSheetIndex(0)->setCellValue('A' . $x, $producao->get('nome_centro_base'))->setCellValue('B' . $x, $producao->get('codigo_agencia_producao'))->setCellValue('C' . $x, $producao->get('nome_agencia_producao'))->setCellValue('D' . $x, $producao->get('mat_orientador'))->setCellValue('E' . $x, $producao->get('nome_orientador'))->setCellValue('F' . $x, $producao->get('mat_supervisor'))->setCellValue('G' . $x, $producao->get('nome_supervisor'))->setCellValue('H' . $x, $producao->get('nome_centro_regional'))->setCellValue('I' . $x, $producao->get('nome_cliente'));
             if ($producao->get('cpf')) {
                 $phpExcel->setActiveSheetIndex(0)->setCellValue('J' . $x, formataCPF($producao->get('cpf')));
             } elseif ($producao->get('cnpj')) {
                 $phpExcel->setActiveSheetIndex(0)->setCellValue('J' . $x, formataCNPJ($producao->get('cnpj')));
             }
             $phpExcel->setActiveSheetIndex(0)->setCellValue('K' . $x, $producao->get('endereco'))->setCellValue('L' . $x, $producao->get('complemento'))->setCellValue('M' . $x, $producao->get('bairro'))->setCellValue('N' . $x, mask($producao->get('cep'), '#####-###'))->setCellValue('O' . $x, $producao->get('cidade'))->setCellValue('P' . $x, $producao->get('nome_uf'))->setCellValue('Q' . $x, $this->retornarTipoEndereco($producao->get('id_tipo_endereco')))->setCellValue('R' . $x, substr($producao->get('telefone'), 0, 2))->setCellValue('S' . $x, substr($producao->get('telefone'), 2))->setCellValue('T' . $x, substr($producao->get('telefone_comercial'), 0, 2))->setCellValue('U' . $x, substr($producao->get('telefone_comercial'), 2))->setCellValue('V' . $x, formatDataWEB($producao->get('data_assinatura_contrato')))->setCellValue('W' . $x, $producao->get('tipo_mpo'))->setCellValue('X' . $x, $producao->get('nome_modalidade'))->setCellValue('Y' . $x, $producao->get('nome_status_contrato'))->setCellValue('Z' . $x, $producao->get('status_visita_orientacao') ? $producao->get('status_visita_orientacao') : null)->setCellValue('AA' . $x, $producao->get('motivo_nao_orientacao') ? $producao->get('motivo_nao_orientacao') : null)->setCellValue('AB' . $x, $producao->get('valor_solicitado') ? 'R$ ' . number_format($producao->get('valor_solicitado'), 2, ',', '.') : null)->setCellValue('AC' . $x, $producao->get('valor_aprovado') ? 'R$ ' . number_format($producao->get('valor_aprovado'), 2, ',', '.') : null)->setCellValue('AD' . $x, $producao->get('qtd_parcelas'))->setCellValue('AE' . $x, $producao->get('dia_vencimento'))->setCellValue('AF' . $x, $producao->get('nome_tipo_aval'))->setCellValue('AG' . $x, formatDataWEB($producao->get('data_ultima_parcela')))->setCellValue('AH' . $x, $producao->get('nome_origem_cliente'));
             $x++;
         }
         //_debug('die', 1);
         $phpExcel->getActiveSheet()->setTitle('Produção');
         $phpExcel->setActiveSheetIndex(0);
         header('Content-Type: application/vnd.ms-excel');
         header('Content-Disposition: attachment;filename="01simple.xls"');
         header('Cache-Control: max-age=0');
         header('Cache-Control: max-age=1');
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
         // Date in the past
         header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
         // always modified
         header('Cache-Control: cache, must-revalidate');
         // HTTP/1.1
         header('Pragma: public');
         // HTTP/1.0
         $objWriter = PHPExcel_IOFactory::createWriter($phpExcel, 'Excel5');
         $objWriter->save('php://output');
     }
 }
Exemple #22
0
function send_user_list()
{
    global $user_list;
    $key_list = array_keys($user_list);
    for ($i = 0; $i < count($key_list); $i++) {
        echo "\n" . $i . " >>>>>>> " . $key_list[$i];
    }
    //	foreach($key_list as $name){
    //	}
    $key_list['num'] = count($key_list);
    //num is the number of user
    $key_list['type'] = 'list';
    $response_text = mask(json_encode($key_list));
    send_message($response_text, 'all', 'no');
    //send data
}
Exemple #23
0
            break 2;
            //exist this loop
        }
        $buf = @socket_read($changed_socket, 1024, PHP_NORMAL_READ);
        if ($buf === false) {
            // check disconnected client
            // remove client for $clients array
            $found_socket = array_search($changed_socket, $clients);
            socket_getpeername($changed_socket, $ip);
            unset($clients[$found_socket]);
            $key = array_search($changed_socket, $allClients);
            print $allClients[$key] . " DISCONNECT";
            unset($allClients[$key]);
            //notify all users about disconnected connection
            $keys = array_keys($allClients);
            $response = mask(json_encode(array('type' => 'system', 'message' => $ip . ' disconnected', 'online' => $keys)));
            send_message($response);
        }
    }
}
// close the listening socket
socket_close($sock);
function send_message($msg)
{
    global $clients;
    //print_r($clients);
    foreach ($clients as $changed_socket) {
        @socket_write($changed_socket, $msg, strlen($msg));
    }
    return true;
}
Exemple #24
0
     $node->text = "/";
     $node->expanded = true;
     $node->children = array();
     createTree($node, $arr);
     $output = json_encode(array("success" => empty($mysqli->error), "error" => $mysqli->error, "children" => $node->children));
     //$output = str_replace(",\"children\":[]", ",\"leaf\": true", $output);
     $output = str_replace(",\"children\":[]", ",\"children\":[],\"leaf\": true", $output);
     $output = str_replace(",\"children\":[", ",\"expanded\": true,\"children\":[", $output);
     echo $output;
     //print_r($arr);
     break;
 case "salvar":
     $tipoId = $_SESSION['temp_tipo_id'];
     $parent = addslashes($_POST['parent']) == -1 ? "null" : "'" . addslashes($_POST['parent']) . "' ";
     $classificacao = addslashes(str_replace(".", "", $_POST['id']));
     $mask = str_replace("..", "", mask($classificacao, "#.#.#.##.###.###"));
     if ($mask[strlen($mask) - 1] == '.') {
         $mask = substr($mask, 0, strlen($mask) - 1);
     }
     $descricao = addslashes($_POST['textNoMask']);
     $contacontabil = addslashes($_POST['contacontabil']);
     $tipo = addslashes($_POST['tipo']);
     $natureza = addslashes($_POST['natureza']);
     $inativo = addslashes($_POST['inativo']);
     $mode = addslashes($_POST['mode']);
     if ($mode == 'N') {
         $result = $mysqli->query("SELECT * FROM plano_contas WHERE tipo_id = '{$tipoId}' and cod = '{$classificacao}'") or die($mysqli->error());
         if (!$result->num_rows) {
             $query = "\n\t\t\t\t\t\tINSERT INTO plano_contas\n\t\t\t\t\t\t(tipo_id, mask, cod, parent, nome, tipo, natureza, contacontabil, inativo)\n\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t('{$tipoId}', '" . $mask . "', {$classificacao}, {$parent}, '{$descricao}', '{$tipo}', '{$natureza}', '{$contacontabil}', '{$inativo}')";
             $mysqli->query($query) or die($mysqli->error);
         } else {
Exemple #25
0
    if (in_array($socket, $changed)) {
        $newSocket = socket_accept($socket);
        $clients[] = $newSocket;
        $header = socket_read($newSocket, 1024);
        perform_handshaking($header, $newSocket, $host, $port);
        socket_getpeername($newSocket, $ip);
        $found_socket = array_search($socket, $changed);
        unset($changed[$found_socket]);
    }
    foreach ($changed as $changed_socket) {
        while (socket_recv($changed_socket, $buf, 1024, 0) >= 1) {
            $received_text = unmask($buf);
            $tst_msg = json_decode($received_text);
            $posx = $tst_msg->posx;
            $posy = $tst_msg->posy;
            $response_text = mask(json_encode(array('posx' => $posx, 'posy' => $posy)));
            send_message($response_text);
            break 2;
        }
        $buf = @socket_read($changed_socket, 1024, PHP_NORMAL_READ);
        if ($buf === false) {
            $found_socket = array_search($changed_socket, $clients);
            socket_getpeername($changed_socket, $ip);
            unset($clients[$found_socket]);
        }
    }
}
socket_close($sock);
function send_message($msg)
{
    global $clients;
Exemple #26
0
         break 2;
     } else {
         $maxlifetime = ini_get("session.gc_maxlifetime");
         // durée d'une session
         $lastseen = strtotime($sql[0]["LastTimeSeen"]);
         // derniere fois que l'user a chargé une page
         $now = time();
         // temps actuel
         //Si la derniere fois qu'il a chargé une page était il y a plus de temps qu'une session expire, par securité on ne traite pas son msg
         if ($now - $lastseen > $maxlifetime) {
             echo $lastseen;
             break 2;
         }
     }
     //prepare data to be sent to client
     $response_text = mask(json_encode(array('type' => 'usermsg', 'name' => $user_name, 'message' => $user_message, 'color' => $user_color)));
     send_message($response_text);
     //send data
     BaseDonnee::addToChat($bdd, time(), $user_name, $user_message);
     break 2;
     //exist this loop
 }
 $buf = @socket_read($changed_socket, 1024, PHP_NORMAL_READ);
 if ($buf === false) {
     // check disconnected client
     // remove client for $clients array
     $found_socket = array_search($changed_socket, $clients);
     socket_getpeername($changed_socket, $ip);
     unset($clients[$found_socket]);
     //notify all users about disconnected connection
     //$response = mask(json_encode(array('type'=>'system', 'message'=>$ip.' disconnected')));
    if (strlen($cliente['tel_fixo']) == 10) {
        echo mask('(##) ####-####', $cliente['tel_fixo']);
    } else {
        if (strlen($cliente['tel_fixo']) == 11) {
            echo mask('(##) #####-####', $cliente['tel_fixo']);
        }
    }
    ?>
				<strong>Celular:</strong>
				<?php 
    $cliente['celular'] = "" + $cliente['celular'];
    if (strlen($cliente['celular']) == 10) {
        echo mask('(##) ####-####', $cliente['celular']);
    } else {
        if (strlen($cliente['celular']) == 11) {
            echo mask('(##) #####-####', $cliente['celular']);
        }
    }
    ?>
			</span>
		</div>
		<?php 
}
?>
		<?php 
if (!$aux->pagamento_fulso) {
    ?>
		<h4 style="font-size: 16px"><strong>
			<?php 
    if ($venda['venda_confirmada'] == 1) {
        echo 'Itens da Venda';
Exemple #28
0
  <?php 
function mask($val, $mask)
{
    $maskared = '';
    $k = 0;
    for ($i = 0; $i <= strlen($mask) - 1; $i++) {
        if ($mask[$i] == '#') {
            if (isset($val[$k])) {
                $maskared .= $val[$k++];
            }
        } else {
            if (isset($mask[$i])) {
                $maskared .= $mask[$i];
            }
        }
    }
    return $maskared;
}
?>

  <?php 
$cnpj = "11222333000199";
$cpf = "00100200300";
$cep = "08665110";
$data = "10102010";
echo mask($cnpj, '##.###.###/####-##');
echo mask($cpf, '###.###.###-##');
echo mask($cep, '#####-###');
echo mask($data, '##/##/####');
Exemple #29
0
function formataCNPJ($cnpj)
{
    $cnpj = preg_replace('/[^0-9]/is', '', $cnpj);
    $cnpj = str_pad($cnpj, 14, "0", STR_PAD_LEFT);
    $cnpj = mask($cnpj, '##.###.###/####-##');
    return $cnpj;
}
Exemple #30
0
function handle_recevied_message($message)
{
    $action = isset($message['action']) ? $message['action'] : false;
    $data = isset($message['data']) ? $message['data'] : false;
    $response = array();
    switch ($action) {
        case 'addupdateuser':
            $flag = call_system_api($action, $data);
            if ($flag) {
                $response['action'] = 'userdata';
                $response['payload'] = call_system_api('getuser');
            }
            break;
        case 'getuser':
            $response['action'] = 'userdata';
            $response['payload'] = call_system_api('getuser');
            break;
    }
    $response = mask(json_encode($response));
    send_message($response);
}