function migrate()
 {
     global $MApp;
     // Get current counter
     $mlast = AppModel::getByStringId('migrations');
     if ($mlast == NULL) {
         $mlast = 0;
     } else {
         $mlast = $mlast['current'];
     }
     // Do migrations after counter
     $mcur = $mlast;
     $migrations = glob($GLOBALS['dirpre'] . 'migrations/*.php');
     natsort($migrations);
     foreach ($migrations as $m) {
         if (($mcur = str2int($m)) > $mlast) {
             require_once $m;
             echo "performed migration: {$mcur}<br />";
         }
     }
     if ($mcur > $mlast) {
         $MApp->save(array('_id' => 'migrations', 'current' => $mcur));
         echo "migrated from {$mlast} to {$mcur}";
     } else {
         echo "migrations up to date";
     }
 }
Пример #2
0
/** ****************************************************************************
 * 
 * @param type $campo
 * @param type $formatado
 * @return boolean
*******************************************************************************/
function formatarCPF_CNPJ($campo, $formatado = true)
{
    //retira formato
    $codigoLimpo = str2int($campo);
    // pega o tamanho da string menos os digitos verificadores
    $tamanho = strlen($codigoLimpo) - 2;
    //verifica se o tamanho do código informado é válido
    if ($tamanho != 9 && $tamanho != 12) {
        return false;
    }
    if ($formatado) {
        // seleciona a máscara para cpf ou cnpj
        $mascara = $tamanho == 9 ? '###.###.###-##' : '##.###.###/####-##';
        $indice = -1;
        for ($i = 0; $i < strlen($mascara); $i++) {
            if ($mascara[$i] == '#') {
                $mascara[$i] = $codigoLimpo[++$indice];
            }
        }
        //retorna o campo formatado
        $retorno = $mascara;
    } else {
        //se não quer formatado, retorna o campo limpo
        $retorno = $codigoLimpo;
    }
    return $retorno;
}
Пример #3
0
 public function monta_campos()
 {
     $ret = array();
     $ret['telefone'] = $this->telefone;
     $ret['tipo'] = $this->tipo;
     $ret['obs'] = str2int($this->obs);
     $ret['id_cliente'] = $this->id_cliente;
     return $ret;
 }
 public function monta_campos()
 {
     $ret = array();
     $ret['nome'] = $this->nome;
     $ret['rg'] = $this->rg;
     $ret['cpf'] = str2int($this->cpf);
     $ret['parentesco'] = $this->parentesco;
     $ret['id_cliente'] = $this->id_cliente;
     return $ret;
 }
Пример #5
0
 public function monta_campos()
 {
     $ret = array();
     $ret['nome'] = $this->nome;
     $ret['rg'] = $this->rg;
     $ret['cpf'] = str2int($this->cpf);
     $ret['parentesco'] = $this->parentesco;
     $ret['id_cliente'] = $this->id_cliente;
     $ret['curatela'] = $this->curatela;
     $ret['mandado_seguranca'] = $this->mandado_seguranca;
     $ret['tutela'] = $this->tutela;
     return $ret;
 }
Пример #6
0
 public function monta_campos()
 {
     $ret = array();
     $ret['id'] = $this->id;
     $ret['id_processo'] = $this->id_processo;
     $ret['valor'] = str2int($this->valor);
     $ret['data'] = $this->data;
     $ret['n_parcela'] = $this->n_parcela;
     $ret['quem_ira_pagar'] = $this->quem_ira_pagar;
     $ret['forma_pagamento'] = $this->forma_pagamento;
     $ret['numero'] = $this->numero;
     $ret['status'] = $this->status;
     $ret['dt_confirmacao'] = $this->dt_confirmacao;
     return $ret;
 }
Пример #7
0
$this->form_validation->set_rules('tipo_usurio', 'Tipo Usuario', 'required');
$this->form_validation->set_message('required', '%s, Por favor o campo não pode ser vazio');
$this->form_validation->set_message('valid_email', '%s, esta com erro!');
//RECEBE OS CAMPOS
$post = $this->input->post();
$dados['mensagem_form'] = 0;
$dados['mensagem_erro'] = '';
if ($post) {
    //debug($post['cpf'],true);
    //if(valida_cpf($post['cpf']) == 'false'){
    //    $dados['mensagem_form'] = 1;
    //    $dados['mensagem_erro'] = 'O CPF Não é valido, não pode prosegir';
    //}
    if ($this->form_validation->run() == FALSE) {
        $dados['mensagem_form'] = 1;
    } else {
        //$salvar['razao_social'] 	= strtoupper($post['razao_social']);
        if ($this->uri->segment(3) == "") {
            $post['senha'] = md5($post['senha']);
            $post['cpf'] = str2int($post['cpf']);
            //debug($post,true);
            $this->usuarios_model->inserir($post);
        } else {
            $post['senha'] = md5($post['senha']);
            $post['cpf'] = str2int($post['cpf']);
            //debug($post,true);
            $alterar = $this->usuarios_model->atualizar($post, array('id' => $this->uri->segment(3)));
        }
        redirect('usuarios');
    }
}
Пример #8
0
 public function monta_campos()
 {
     $ret = array();
     $ret['nome'] = $this->nome;
     $ret['email'] = $this->email;
     $ret['cpf'] = str2int($this->cpf);
     $ret['senha'] = md5($this->senha);
     $ret['status'] = $this->status;
     $ret['tipo_usurio'] = $this->tipo_usuario;
     $ret['resp_cnh'] = $this->resp_cnh;
     $ret['resp_laudos'] = $this->resp_laudos;
     $ret['resp_rodizio'] = $this->resp_rodizio;
     $ret['resp_defis'] = $this->resp_defis;
     $ret['resp_icms'] = $this->resp_icms;
     $ret['resp_ipi'] = $this->resp_ipi;
     $ret['resp_ipva'] = $this->resp_ipva;
     return $ret;
 }
Пример #9
0
             if (!isset($slider_images['name'][$i])) {
                 $slider_images['name'][$i] = '';
             }
             $i++;
         }
     }
 }
 if (count($slider_images['img']) == 1) {
     $slide = array();
     $slide_dir = first_par_url($slider_images['img'][0]);
     $slidefiles = glob($_SERVER['DOCUMENT_ROOT'] . generate_unknown($slide_dir) . '*.{jpeg,gif,png,jpg,JPG,PNG,GIF,JPEG}', GLOB_BRACE);
     $slicount = count($slidefiles);
     // echo generate_unknown($_SERVER['DOCUMENT_ROOT'].$slide_dir);
     if ($slicount > 0) {
         foreach ($slidefiles as $fs) {
             if (str2int(last_par_url($fs)) > 0) {
                 $slide['img'][] = 'http://funtime.ge:80' . $slide_dir . last_par_url($fs);
                 $slide['name'][] = '';
             }
         }
     }
     $slide = base64_encode(serialize(array('img' => $slide['img'], 'name' => $slide['name'])));
 } else {
     $slide = base64_encode(serialize($slider_images));
 }
 $operation = intval($_POST['op']);
 $comments = intval($_POST['comments']);
 $favorit_news = intval($_POST['favorit_news']);
 $text = str_replace("'", "`", PHP_slashes($_POST['textarea1']));
 if (!empty($_POST['sakimg'])) {
     $sak_dir = first_par_url($_POST['sakimg']);
function getPorts($object_id, $portCount, $portStart)
{
    global $portLinkerPortTypes;
    $record = getObjectPortsAndLinks($object_id);
    $foundPorts = array();
    foreach ($record as $aPort) {
        if (in_array($aPort['oif_id'], $portLinkerPortTypes) && strlen($aPort['reservation_comment']) == 0 && $aPort['remote_id'] == 0) {
            $num = str2int($aPort['name']);
            if ($num >= $portStart && $num < $portStart + $portCount) {
                $foundPorts[$num] = array();
                $foundPorts[$num]['id'] = $aPort['id'];
                $foundPorts[$num]['name'] = $aPort['name'];
            }
        }
    }
    ksort($foundPorts);
    return $foundPorts;
}
Пример #11
0
require_once 'includes/common.php';
require_once 'includes/settings.php';
if (strlen($paintcolor) == 40) {
    $requested_image = str_replace('.png', '.' . $paintcolor . '.png', $requested_image);
    $paintcolor = 0;
}
//$bits = explode('/',$_REQUEST['page']);
//array_shift($bits);
//$dir = array_shift($bits);
//$args = array_pop($bits);
//$requested_image = implode('/',$bits);
// args
$as = explode('.', $query);
$images_ignore = array('teampaint.png');
foreach ($as as $arg) {
    $max = str2int($arg);
    if (stripos($arg, 'xy') !== false) {
        $width = $height = $max;
    }
    if (stripos($arg, 'y') !== false) {
        $height = $max;
    }
    if (stripos($arg, 'x') !== false) {
        $width = $max;
    }
}
//die($requested_image." -- ".$color);
if ($width == $height) {
    $args = 'xy' . $width;
} else {
    $args = sprintf("x%s.y%s", $width, $height);
Пример #12
0
        $this->email->to("*****@*****.**");
        $this->email->subject('SHAMAH - Contato Site - ' . date("d/m/Y"));
        $this->email->message($mensagem);
        $this->email->send();
        echo '
                 <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
                    alert("Enviado com Sucesso!");
                    location.href="' . site_url() . '";           
                 </SCRIPT>;
             ';
    }
    if (isset($post['cpf']) && isset($post['senha'])) {
        //debug($post,true);
        $login = new Query_model();
        $login->SetCampos("*");
        $login->SetTabelas("usuarios");
        $login->SetTipoRetorno(1);
        $login->SetCondicao(" cpf = '" . str2int($post['cpf']) . "' AND senha = '" . md5($post['senha']) . "' ");
        $dados_login = $login->get();
        if (count($dados_login) == 0) {
            $dados['mensagem_login'] = '******';
        } else {
            if ($dados_login->status == 0) {
                $dados['mensagem_login'] = '******';
            } else {
                $this->session->set_userdata(array("usuario" => $dados_login));
                redirect('processos/proc');
            }
        }
    }
}
Пример #13
0
     $preco_cartas->SetCampos("valor");
     $preco_cartas->SetTabelas("servicos");
     $preco_cartas->SetTipoRetorno(1);
     $preco_cartas->SetCondicao(" id = '1'");
     $servico = $preco_cartas->get();
     $valor = str2decimal($servico->valor);
     $valor = substr($valor, 0, -2);
     if ($post['data_conc'] != "") {
         $dt = data_banco($post['data_conc']);
     } else {
         $dt = date('Y-m-d', strtotime("+ 30 day", strtotime(date("Y-m-d"))));
     }
     //Monta o vetor para inserir
     $pagamentos = new Pagamentos_model();
     $pagamentos->SetCampo('id_processo', $this->uri->segment(4));
     $pagamentos->SetCampo('valor', str2int($valor));
     $pagamentos->SetCampo('data', $dt);
     $pagamentos->SetCampo('n_parcela', '1');
     $pagamentos->SetCampo('quem_ira_pagar', 1);
     $pagamentos->SetCampo('forma_pagamento', 4);
     $pagamentos->SetCampo('numero', "");
     $pagamentos->SetCampo('status', 0);
     $pagamentos->SetCampo('dt_confirmacao', "");
     //INSERE NA TABELA
     $pag_inserir_concessionaria = new Query_model();
     $pag_inserir_concessionaria->SetTabelas('pagamentos');
     $pag_inserir_concessionaria->SetCampos($pagamentos->monta_campos());
     $pag_inserir_concessionaria->inserir();
 }
 //$dados['quem_paga_cartas'];
 if ($post['n_parcela'] > 0 && count($dados['servicos']) > 0) {
Пример #14
0
 public function monta_campos()
 {
     $ret = array();
     $ret['nome'] = $this->nome;
     $ret['dt_nasc'] = data_banco($this->dt_nasc);
     $ret['sexo'] = $this->sexo;
     $ret['cpf'] = str2int($this->cpf);
     $ret['rg'] = str2int($this->rg);
     $ret['rg_uf'] = $this->rg_uf;
     $ret['email'] = $this->email;
     $ret['inss'] = $this->inss;
     $ret['tem_cnh'] = $this->tem_cnh;
     $ret['cnh_numero'] = $this->cnh_numero;
     $ret['cnh_tipo'] = $this->cnh_tipo;
     $ret['possui_cnpj'] = $this->possui_cnpj;
     $ret['possui_carro_automatico'] = $this->possui_carro_automatico;
     $ret['atividade'] = $this->atividade;
     $ret['end_logradouro'] = $this->end_logradouro;
     $ret['end_n'] = $this->end_n;
     $ret['end_complemento'] = $this->end_complemento;
     $ret['end_bairro'] = $this->end_bairro;
     $ret['end_cep'] = str2int($this->end_cep);
     $ret['end_cidade'] = $this->end_cidade;
     $ret['end_estado'] = $this->end_estado;
     $ret['incapaz'] = $this->incapaz;
     $ret['ajuda_finaceira'] = $this->ajuda_finaceira;
     $ret['condutor'] = $this->condutor;
     return $ret;
 }
Пример #15
0
     // Posting big blind
     MQuery("UPDATE mpp_players SET bet=bet+" . $bet . ", balance = balance-" . $bet . ", ready_for_next_round = 'no' WHERE gid='" . GAMEID . "' AND uid='" . USERID . "';");
     MQuery("UPDATE mpp_games SET pot=pot+" . $bet . " WHERE id='" . GAMEID . "' AND player_turn='" . USERID . "';");
     // Beurt naar volgende speler
     beurt_naar_volgende_speler(USERID);
     Header("Location: " . BASEPAGE);
     exit;
 } else {
     if (isset($_POST['normal_bet']) && UID_AAN_DE_BEURT == USERID && READY_GAME) {
         $poker = new PokerTexasHoldem();
         // Posting a normal Bet OR a Fold
         if (isset($_POST['i_fold'])) {
             // This guy Folds
             MQuery("UPDATE mpp_players SET in_or_out='out' WHERE gid='" . GAMEID . "' AND uid='" . USERID . "';");
         } else {
             $bet = (int) str2int($_POST['normal_bet']);
             // If the bet is less than $tocall, dont even post it
             $tocall = max(get_bets()) - $USER['bet'];
             // The bet cannot be higher than the bet of a player who has gone All-In (IF any!)
             $allinq = MQuery("SELECT bet FROM mpp_players WHERE balance='0' AND bet>0 AND in_or_out='in';");
             $iAllIn = mysql_num_rows($allinq);
             // The bet cannot be higher than `lowest max bet`-`uid's current bet`
             $maxbet = max($GAMEINFO['big_blind'], mysql_result(MQuery("SELECT (bet+balance) AS sa FROM mpp_players WHERE gid='" . GAMEID . "' AND (bet>0 OR balance>0) ORDER BY (bet+balance) ASC LIMIT 1;"), 0, 'sa')) - $USER['bet'];
             if ($tocall > $bet || $USER['balance'] < $bet || $iAllIn && mysql_result($allinq, 0, 'bet') < $bet || $maxbet < $bet) {
                 Header("Location: " . BASEPAGE);
                 exit;
             }
             MQuery("UPDATE mpp_players SET bet=bet+" . $bet . ", balance=balance-" . $bet . ", ready_for_next_round='yes' WHERE gid='" . GAMEID . "' AND uid='" . USERID . "';");
             MQuery("UPDATE mpp_games SET pot=pot+" . $bet . " WHERE id='" . GAMEID . "' AND player_turn='" . USERID . "';");
         }
         // $players_still_in = mysql_result(MQuery("SELECT COUNT(*) AS a FROM mpp_players WHERE gid='".$GAME_ID."' AND in_or_out='in';"),0,'a');