本文整理汇总了PHP中finalize函数的典型用法代码示例。如果您正苦于以下问题:PHP finalize函数的具体用法?PHP finalize怎么用?PHP finalize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了finalize函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gravarPermissoes
function gravarPermissoes()
{
include '../dao/ConnectionHolder.php';
$idUsuario = $_POST["idUsuario"];
if (!$idUsuario) {
finalize("idUsuario não fornecido!");
}
$idList = $_POST["list"];
if (!$idList) {
finalize("Lista de permissões vazia!");
}
try {
$connection = ConnectionHolder::getConnection();
// PROBLEMA!!
// O postgres não trabalha com o conceito de transação, commit e rollback,
// ao invés disso, deve ser enviada uma query, sendo todo o script sql,
// e será executado todo, ou nada.
// Fonte: http://stackoverflow.com/questions/9704557/php-pgsql-driver-and-autocommit
// Apaga as permissoes existentes para o usuário
$query = "DELETE FROM permissoes WHERE idusuario = " . $idUsuario . "; ";
// Insere as operações recebidas por POST
foreach ($idList as $id) {
$query .= "INSERT INTO permissoes (idoperacaomodulo, idusuario) " . "VALUES (" . $id . ", " . $idUsuario . "); ";
}
$resultSet = pg_query($connection, $query);
if (!$resultSet) {
finalize("Query error");
}
done();
} catch (Exception $e) {
finalize("Exception: " . $e->getMessage());
}
}
示例2: getUsuarioPorId
function getUsuarioPorId()
{
include '../dao/Usuarios.php';
include '../dao/UsuariosDAO.php';
$usuariosDAO = new UsuariosDAO();
$idUsuario = $_POST["idUsuario"];
$usuarios = $usuariosDAO->selectRegistro($idUsuario);
if (!$usuarios) {
finalize("Usuário não encontrado!");
}
$json['success'] = 1;
$json['data'] = array("id" => $usuarios->getId(), "login" => $usuarios->getLogin(), "nome" => $usuarios->getNome(), "email" => $usuarios->getEmail(), "ativo" => $usuarios->isAtivo(), "senha" => $usuarios->getSenha());
echo json_encode($json);
}
示例3: getCRMPorId
function getCRMPorId()
{
include '../dao/Cliforn.php';
include '../dao/ClifornDAO.php';
$clifornDAO = new ClifornDAO();
$id = $_POST["idCRM"];
$cliforn = $clifornDAO->selectRegistro($id);
if (!$cliforn) {
finalize("Cliente/Fornecedor não encontrado!");
}
$json['success'] = 1;
$json['data'] = array("id" => $cliforn->getId(), "tipo" => $cliforn->getTipo(), "nome" => $cliforn->getNome(), "sexo" => $cliforn->getSexo(), "datanascimento" => $cliforn->getDatanascimento(), "cpf" => $cliforn->getCpf(), "rg" => $cliforn->getRg(), "razaosocial" => $cliforn->getRazaosocial(), "fantasia" => $cliforn->getFantasia(), "cnpj" => $cliforn->getCnpj(), "ie" => $cliforn->getIe(), "ativo" => $cliforn->isAtivo());
echo json_encode($json);
}
示例4: verificarLogin
function verificarLogin()
{
include '../dao/Usuarios.php';
include '../dao/UsuariosDAO.php';
$login = $_POST["login"];
$senha = $_POST["senha"];
$usuariosDAO = new UsuariosDAO();
$usuarios = $usuariosDAO->selectRegistroPorLogin($login);
if (!$usuarios) {
finalize(NULL);
}
if (strcmp($usuarios->getSenha(), $senha) != 0) {
finalize(NULL);
}
iniciarSessao($usuarios);
done();
}
示例5: done_testing
function done_testing()
{
global $t;
$funcs = get_defined_functions();
$initialize = false;
$finalize = false;
if (in_array('initialize', $funcs['user'])) {
$initialize = true;
}
if (in_array('finalize', $funcs['user'])) {
$finalize = true;
}
if (in_array('build', $funcs['user'])) {
build($t);
}
foreach ($funcs['user'] as $func) {
# 予約された function
if (in_array($func, array('build', 'destroy', 'initialize', 'finalize', 'done_testing'))) {
continue;
}
# _function( ) は skip
if (preg_match('/^_/', $func)) {
continue;
}
if ($initialize) {
initialize($t);
}
try {
$t->diag("in function '{$func}'");
$func($t);
} catch (Exception $e) {
$t->diag($e->getMessage() . " at {$func}( )");
$t->fail();
}
if ($finalize) {
finalize($t);
}
}
if (in_array('destroy', $funcs['user'])) {
destroy($t);
}
}
示例6: buscarPermissoesCRM
function buscarPermissoesCRM()
{
include '../dao/Operacaomodulos.php';
include '../dao/OperacaomodulosDAO.php';
include '../dao/Permissoes.php';
include '../dao/PermissoesDAO.php';
$operacaomodulosDAO = new OperacaomodulosDAO();
$permissoesDAO = new PermissoesDAO();
// Buscar as operações do módulo id=2 (CRM)
$operacoesList = $operacaomodulosDAO->selectListaRegistrosPorModulo(1);
if (!$operacoesList) {
finalize(NULL);
}
$list['success'] = 1;
$list['data'] = array();
foreach ($operacoesList as $op) {
$permissoes = $permissoesDAO->selectRegistro($op->getIdoperacaomodulo(), $_SESSION["id"]);
if (!$permissoes) {
continue;
}
$list['data'][] = $op->getDescricao();
}
echo json_encode($list);
}
示例7: array
<?php
/* config.js */
$params->PageBgColor = $params->PageBgColor ? $params->PageBgColor : "#d7d7d7";
$slideshow_css = '$CssPath$style.css';
$thumbs = (object) array('margin' => 3, 'padding' => 4);
array_push($files, (object) array('src' => 'backgnd/' . $params->TemplateName . '/bullet.png'));
array_push($files, (object) array('src' => 'backgnd/' . $params->TemplateName . '/arrows.png'));
array_push($files, (object) array('src' => 'backgnd/' . $params->TemplateName . '/play.png'));
array_push($files, (object) array('src' => 'backgnd/' . $params->TemplateName . '/pause.png'));
if ($params->ShowTooltips) {
$params->ThumbWidthHalf = round($params->ThumbWidth / 2);
array_push($files, (object) array('src' => 'backgnd/' . $params->TemplateName . '/triangle-' . $params->TooltipPos . '.png', 'dest' => '$ImgPath$triangle.png'));
array_push($files, (object) array('src' => 'backgnd/' . $params->TemplateName . '/style-tooltip.css', 'dest' => $slideshow_css, 'filters' => array('params')));
}
// call this function at the end of each template
finalize();
示例8: array
<?php
$json['data'] = array();
if (!isset($_POST) || !isset($_POST["operacao"])) {
finalize("Access denied!");
}
session_start();
if (isset($_SESSION["id"])) {
DEFINE("ID_USUARIO", $_SESSION["id"]);
}
function finalize($message)
{
if (!$message) {
$message = "No message suplied!";
}
$json['success'] = 0;
$json['message'] = $message;
echo json_encode($json);
exit;
}
function done()
{
$json['success'] = 1;
$json['data'] = array();
echo json_encode($json);
exit;
}
function iniciarSessao($usuarios)
{
$_SESSION['id'] = $usuarios->getId();
$_SESSION['login'] = $usuarios->getLogin();