public function run($form)
 {
     $nome = $form->get('nome');
     $cnpj = $form->get('cnpj');
     $cep = $form->get('cep');
     $pais = $form->get('pais');
     $estado = $form->get('estado');
     $cidade = $form->get('cidade');
     $bairro = $form->get('bairro');
     $logradouro = $form->get('logradouro');
     $numero = $form->get('numero');
     $complemento = $form->get('complemento');
     $telefone_residencial = $form->get('telefone_residencial');
     $telefone_celular = $form->get('telefone_celular');
     $telefone_comercial = $form->get('telefone_comercial');
     $telefone_recado = $form->get('telefone_recado');
     $email = $form->get('email');
     $faixa_faturamento = $form->get('faixa_faturamento');
     $data_abertura = $form->get('data_abertura');
     $razao_social = $form->get('razao_social');
     $inscricao_estadual = $form->get('inscricao_estadual');
     $registro = $form->get('registro');
     $nome_fantasia = $form->get('nome_fantasia');
     $pessoas_ocupadas = $form->get('pessoas_ocupadas');
     $setor = $form->get('setor');
     $tipo = $form->get('tipo');
     $segmento = $form->get('segmento');
     $empreendimento = new Empreendimento($id, $tipo, $cnpj, $inscricao_estadual, $registro, $nome_fantasia, $razao_social, $pessoas_ocupadas, $data_abertura, $faixa_faturamento, $segmento, $cep, $pais, $estado, $cidade, $bairro, $logradouro, $numero, $complemento, $telefone_residencial, $telefone_celular, $telefone_comercial, $telefone_recado, $email, Constants::$_ATIVO, $setor);
     $fachada = Fachada::getInstance();
     $fachada->cadastroEmpreendimento()->cadastrar($empreendimento);
     $this->setMessage("Pessoa cadastrado com sucesso.", Constants::$_MSG_SUCCESS);
     $this->load('100%');
     $this->setForward(Forward::go(CadastrarEmpreendimentoPage::$NM_PAGINA . '&msg_cadastro=sucesso'));
 }
Пример #2
0
 public function run($form)
 {
     $img = new Securimage();
     try {
         $code = $form->get('code');
         if (!$img->check($code)) {
             throw new CaptchaIncorretoException();
         }
         $nome = $form->get('nome');
         $empresa = $form->get('empresa');
         $telefone = $form->get('telefone');
         $assunto = $form->get('assunto');
         $mensagem = $form->get('mensagem');
         $msg = new Mensagem(null, $nome, $empresa, $telefone, $assunto, $mensagem, Constants::$_ATIVO);
         $fachada = Fachada::getInstance();
         $fachada->cadastroMensagem()->cadastrar($msg);
         $this->setMessage("Mensagem cadastrada com sucesso.", Constants::$_MSG_SUCCESS);
         $this->load('100%');
         $this->setForward(Forward::go(FaleConoscoPage::$NM_PAGINA . '&msg_cadastro=sucesso'));
     } catch (CaptchaIncorretoException $e) {
         $this->setMessage("As letras não foram digitadas corretamente! Por favor, tente novamente...", Constants::$_MSG_ERROR);
         $this->load('100%');
         $this->setForward(Forward::$_BACK);
     }
 }
Пример #3
0
 public function run($form)
 {
     $nome = $form->get('nome');
     $cpf = $form->get('cpf');
     $cep = $form->get('cep');
     $pais = $form->get('pais');
     $estado = $form->get('estado');
     $cidade = $form->get('cidade');
     $bairro = $form->get('bairro');
     $logradouro = $form->get('logradouro');
     $numero = $form->get('numero');
     $complemento = $form->get('complemento');
     $telefone_residencial = $form->get('telefone_residencial');
     $telefone_celular = $form->get('telefone_celular');
     $telefone_comercial = $form->get('telefone_comercial');
     $email = $form->get('email');
     $sexo = $form->get('sexo');
     $data_nascimento = Datas::StringParaData($form->get('data_nascimento'));
     $escolaridade = $form->get('escolaridade');
     $segmento = $form->get('segmento');
     $pessoa = new Pessoa(null, $cpf, $nome, $cep, $pais, $estado, $cidade, $bairro, $logradouro, $numero, $complemento, $telefone_residencial, $telefone_celular, $telefone_comercial, $email, $sexo, $data_nascimento, $escolaridade, $segmento, Constants::$_ATIVO);
     $fachada = Fachada::getInstance();
     $fachada->cadastroPessoa()->cadastrar($pessoa);
     $this->setMessage("Pessoa cadastrado com sucesso.", Constants::$_MSG_SUCCESS);
     $this->load('100%');
     $this->setForward(Forward::go(CadastrarPessoaPage::$NM_PAGINA . '&msg_cadastro=sucesso'));
 }
Пример #4
0
 public function run($form)
 {
     $id = $form->get('id');
     $fachada = Fachada::getInstance();
     $fachada->cadastroMensagem()->remover($id);
     $this->setMessage("Mensagem removida com sucesso.", Constants::$_MSG_SUCCESS);
     $this->load('100%');
     $this->setForward(Forward::go(ListagemMensagemPage::$NM_PAGINA . '&msg_cadastro=sucesso'));
 }
 public function run($form)
 {
     $fachada = Fachada::getInstance();
     $usuario = SessionManager::getUser();
     $fachada->cadastroReserva()->fecharReserva($usuario->getId());
     $this->setMessage("Reservas confirmadas com sucesso.", Constants::$_MSG_SUCCESS);
     $this->load('100%');
     $this->setForward(Forward::go(HistoricoReservaPage::$NM_PAGINA . '&msg_reserva=ok'));
 }
 public function run($form)
 {
     //TODO
     $fachada = Fachada::getInstance();
     $id = $form->get('id');
     $fachada->cadastroProduto()->inativar($id);
     $this->setMessage("Produto removido com sucesso.", Constants::$_MSG_SUCCESS);
     $this->load('100%');
     $this->setForward(Forward::go(ManterProdutoPage::$NM_PAGINA));
 }
 public function init()
 {
     parent::init();
     if (!$this->application) {
         return;
     }
     $subject = $this->getSubject();
     $subject = substr($subject, 4);
     $this->setSubject($subject);
 }
 public function run($form)
 {
     //TODO
     $fachada = Fachada::getInstance();
     $id_produto = $form->get('id_produto');
     $id_usuario = SessionManager::getUser()->getId();
     $fachada->cadastroReserva()->remover($id_usuario, $id_produto);
     $this->setMessage("Produto removido com sucesso.", Constants::$_MSG_SUCCESS);
     $this->load('100%');
     $this->setForward(Forward::go(CarrinhoPage::$NM_PAGINA));
 }
Пример #9
0
 public static function go($nm_page)
 {
     if ($nm_page == Forward::$_BACK) {
         Forward::goBack();
     } else {
         if ($nm_page == Forward::$_BLOCK) {
             //fica parado
         } else {
             Forward::goURL(Proxy::page($nm_page));
         }
     }
 }
Пример #10
0
 public function run($form)
 {
     $arquivo = fopen("msg/arquivo.txt", "a");
     if ($arquivo) {
         $pessoa = $form->get('pessoa');
         $mensagem = "\n" . $pessoa . ": " . $form->get('mensagem');
         fputs($arquivo, $mensagem);
         fclose($arquivo);
     }
     $this->setMessage("Produto cadastrado com sucesso.", Constants::$_MSG_SUCCESS);
     $this->load('100%');
     $this->setForward(Forward::go(ChatPage::$NM_PAGINA));
 }
Пример #11
0
 public function run($form)
 {
     $lang = Messages::$PT_br;
     $email = $form->get('email');
     $senha = $form->get('senha');
     $fachada = Fachada::getInstance();
     try {
         $usuario = $fachada->cadastroUsuario()->logar($email, $senha);
         SessionManager::setUser($usuario);
         $this->load('100%');
         $this->setForward(Forward::go(HomePage::$NM_PAGINA));
     } catch (EmailSenhaIncorretaException $e) {
     }
 }
 public function run($form)
 {
     //TODO
     $fachada = Fachada::getInstance();
     $id = $form->get('id');
     $nome = $form->get('nome');
     $senha = $form->get('senha');
     $usuario = $fachada->cadastroUsuario()->buscarId($id);
     $usuario->setNome($nome);
     $usuario->setSenha($senha);
     $fachada->cadastroUsuario()->atualizar($usuario);
     $this->setMessage("Usuario atualizado com sucesso.", Constants::$_MSG_SUCCESS);
     $this->load('100%');
     $this->setForward(Forward::go(ManterClientePage::$NM_PAGINA));
 }
 public function run($form)
 {
     //TODO
     $fachada = Fachada::getInstance();
     $id = $form->get('id');
     $descricao = $form->get('descricao');
     $valor = $form->get('valor');
     $quantidade = $form->get('quantidade');
     $produto = $fachada->cadastroProduto()->buscarId($id);
     $produto->setDescricao($descricao);
     $produto->setValor($valor);
     $produto->setQuantidadeEstoque($quantidade);
     $fachada->cadastroProduto()->atualizar($produto);
     $this->setMessage("Produto atualizado com sucesso.", Constants::$_MSG_SUCCESS);
     $this->load('100%');
     $this->setForward(Forward::go(ManterProdutoPage::$NM_PAGINA));
 }
 public function run($form)
 {
     //TODO
     $fachada = Fachada::getInstance();
     $idProduto = $form->get('id');
     $usuario = SessionManager::getUser();
     $reserva = new Reserva(null, $usuario->getId(), date("Y-m-d"), Situacao::$_ABERTO, Constants::$_ATIVO);
     try {
         $fachada->cadastroReserva()->cadastrar($reserva, $idProduto);
         $this->setMessage("Produto reservado com sucesso.", Constants::$_MSG_SUCCESS);
         $this->load('100%');
         $this->setForward(Forward::go(HomePage::$NM_PAGINA . '&msg_carrinho=ok'));
     } catch (QuantidadeInsuficienteException $e) {
         $this->setMessage("Quantidade insuficiente no estoque.", Constants::$_MSG_SUCCESS);
         $this->load('100%');
         $this->setForward(Forward::go(ReservarProdutoPage::$NM_PAGINA));
     }
 }
 public function run($form)
 {
     //pega valores do form preenchido
     $nome = $form->get('nome');
     $cpf = $form->get('cpf');
     $rg = $form->get('rg');
     $cep = $form->get('cep');
     $rua = $form->get('rua');
     $numero = $form->get('numero');
     $bairro = $form->get('bairro');
     $complemento = $form->get('complemento');
     $cidade = $form->get('cidade');
     $estado = $form->get('estado');
     $telefone = $form->get('telefone');
     $celular = $form->get('celular');
     $senha = $form->get('senha');
     //atualiza o usuario da sessão
     $usuario = SessionManager::getUser();
     $usuario->setNome($nome);
     $usuario->setCpf($cpf);
     $usuario->setRg($rg);
     $usuario->setCep($cep);
     $usuario->setRua($rua);
     $usuario->setNumero($numero);
     $usuario->setBairro($bairro);
     $usuario->setComplemento($complemento);
     $usuario->setCidade($cidade);
     $usuario->setEstado($estado);
     $usuario->setTelefone($telefone);
     $usuario->setCelular($celular);
     $usuario->setSenha($senha);
     //persiste o usuario atualizado
     $fachada = Fachada::getInstance();
     $fachada->cadastroUsuario()->atualizar($usuario);
     //limpa sessão e adiciona o usuario atualizado
     SessionManager::cleanUser();
     SessionManager::setUser($usuario);
     //mensagem de sucesso
     $this->setMessage("Perfil atualizado com sucesso.", Constants::$_MSG_SUCCESS);
     $this->load('100%');
     $this->setForward(Forward::go(HomePage::$NM_PAGINA));
 }
 public function run($form)
 {
     $fachada = Fachada::getInstance();
     $descricao = $form->get('descricao');
     $arquivos = $form->get('pic');
     $valor = $form->get('valor');
     $quantidade = $form->get('quantidade');
     $categoria = $form->get('categoria');
     $genero = $form->get('genero');
     $tamanho = $form->get('tamanho');
     $cor = $form->get('cor');
     $situacao = $form->get('situacao');
     $produto = new Produto(null, $quantidade, $descricao, $valor, $categoria, $genero, $tamanho, $cor, $situacao, Constants::$_ATIVO);
     $idProduto = $fachada->cadastroProduto()->proximoId();
     $fachada->cadastroProduto()->cadastrar($produto);
     $fachada->cadastroFotoProduto()->cadastrarFotos($arquivos, $idProduto);
     $this->setMessage("Produto cadastrado com sucesso.", Constants::$_MSG_SUCCESS);
     //$this->load('100%');
     $this->setForward(Forward::go(CadastrarProdutoPage::$NM_PAGINA));
 }
 public function run($form)
 {
     //TODO
     $img = new Securimage();
     try {
         $code = $form->get('code');
         if (!$img->check($code)) {
             throw new CaptchaIncorretoException();
         }
         //pega valores do form preenchido
         $nome = $form->get('nome');
         $cpf = $form->get('cpf');
         $rg = $form->get('rg');
         $cep = $form->get('cep');
         $rua = $form->get('rua');
         $numero = $form->get('numero');
         $bairro = $form->get('bairro');
         $complemento = $form->get('complemento');
         $cidade = $form->get('cidade');
         $estado = $form->get('estado');
         $telefone = $form->get('telefone');
         $celular = $form->get('celular');
         $email = $form->get('email');
         $senha = $form->get('senha');
         //cria o objeto
         $usuario = new Usuario(null, null, $nome, $cpf, $rg, $cep, $rua, $numero, $bairro, $complemento, $cidade, $estado, $telefone, $celular, $email, $senha, Constants::$_ATIVO);
         //persiste objeto
         $fachada = Fachada::getInstance();
         $fachada->cadastroUsuario()->cadastrarCliente($usuario);
         SessionManager::setUser($usuario);
         //mensagem de sucesso
         $this->setMessage("Usuário cadastrado com sucesso.", Constants::$_MSG_SUCCESS);
         $this->load('100%');
         $this->setForward(Forward::go(HomePage::$NM_PAGINA . '&msg_cadastro=ok'));
     } catch (CaptchaIncorretoException $e) {
         $this->setMessage("As letras não foram digitadas corretamente! Por favor, tente novamente...", Constants::$_MSG_ERROR);
         $this->load('100%');
         $this->setForward(Forward::$_BACK);
     }
 }
Пример #18
0
 /**
  * 
  * Método que imprime a mensagem de página inexistente, 
  * caso alguma página inexistente seja acessada.
  *  
  */
 private static function paginaInexistente()
 {
     SessionManager::setKey('bodymsg', "Página Inexistente! A página que você tentou acessar não está disponível neste servidor.");
     SessionManager::setKey('bodymsgtype', Constants::$_MSG_ERRO);
     Forward::go(Forward::$_BACK);
 }
function appendForwards()
{
    global $INTERNAL;
    $users = explode(POST_ACTION_VALUE_SPLITTER, utf8_decode($_POST[POST_INTERN_PROCESS_FORWARDS . "_va"]));
    $receivers = explode(POST_ACTION_VALUE_SPLITTER, $_POST[POST_INTERN_PROCESS_FORWARDS . "_vb"]);
    $additions = explode(POST_ACTION_VALUE_SPLITTER, slashesStrip($_POST[POST_INTERN_PROCESS_FORWARDS . "_vc"]));
    $conversations = explode(POST_ACTION_VALUE_SPLITTER, slashesStrip($_POST[POST_INTERN_PROCESS_FORWARDS . "_vd"]));
    $targetgroups = explode(POST_ACTION_VALUE_SPLITTER, slashesStrip($_POST[POST_INTERN_PROCESS_FORWARDS . "_ve"]));
    foreach ($users as $key => $user) {
        $parts = explode("~", $user);
        $forward = new Forward($parts[0], $parts[1], $INTERNAL[CALLER_SYSTEM_ID]->SystemId);
        $forward->TargetSessId = $receivers[$key];
        $forward->TargetGroupId = $targetgroups[$key];
        if (strlen($additions[$key]) > 0) {
            $forward->Text = $additions[$key];
        }
        if (strlen($conversations[$key]) > 0) {
            $forward->Conversation = $conversations[$key];
        }
        $forward->Save();
    }
}
 function CreateAutoForward($_user)
 {
     $this->LoadForward(false, false);
     if (!($this->Forward != null && !$this->Forward->Processed)) {
         $allForwards = $this->GetForwards();
         $targets = array();
         $this->FindOperator(VisitorChat::$Router, $_user, false, false, array($this->DesiredChatPartner => $this->DesiredChatPartner), false);
         $isTargetAvailable = count(VisitorChat::$Router->OperatorsAvailable) >= 2 || count(VisitorChat::$Router->OperatorsAvailable) == 1 && !empty($this->DesiredChatPartner) && !isset(VisitorChat::$Router->OperatorsAvailable[$this->DesiredChatPartner]);
         if ($isTargetAvailable) {
             $forwardedToCount = array();
             foreach (VisitorChat::$Router->OperatorsAvailable as $opsysId => $ccount) {
                 $lastForwardToTime = $ccount;
                 foreach ($allForwards as $forward) {
                     if ($forward->TargetSessId == $opsysId) {
                         $lastForwardToTime = max($forward->Created, $lastForwardToTime);
                         if (!isset($forwardedToCount[$opsysId])) {
                             $forwardedToCount[$opsysId] = 0;
                         }
                         $forwardedToCount[$opsysId]++;
                     }
                 }
                 $targets[$opsysId] = $lastForwardToTime;
             }
             if (count($forwardedToCount) > 0) {
                 $forwardedToCount = min($forwardedToCount);
             } else {
                 $forwardedToCount = 0;
             }
             if (!empty(Server::$Configuration->File["gl_mcfc"]) && is_numeric(Server::$Configuration->File["gl_mcfc"])) {
                 if (Server::$Configuration->File["gl_mcfc"] <= $forwardedToCount) {
                     return false;
                 }
             }
             if (!empty($targets)) {
                 asort($targets);
                 foreach ($targets as $targetsysid => $time) {
                     if ($targetsysid != $this->DesiredChatPartner) {
                         $forward = new Forward($this->ChatId, $this->DesiredChatPartner);
                         $forward->InitiatorSystemId = $this->DesiredChatPartner;
                         $forward->ReceiverUserId = $this->UserId;
                         $forward->ReceiverBrowserId = $this->BrowserId;
                         $forward->TargetSessId = $targetsysid;
                         $forward->TargetGroupId = $this->DesiredChatGroup;
                         $forward->Invite = false;
                         $forward->Auto = true;
                         $forward->Save();
                         $this->ArchiveCreated = 2;
                         Chat::Destroy($this->ChatId);
                         return true;
                     }
                 }
             }
         }
     }
     return true;
 }
 function CreateAutoForward()
 {
     global $INTLIST, $CONFIG;
     $this->LoadForward(false, false);
     if (!($this->Forward != null && !$this->Forward->Processed)) {
         $allForwards = $this->GetForwards();
         $targets = array();
         setOperator();
         if (count($INTLIST) >= 2) {
             $forwardedToCount = array();
             foreach ($INTLIST as $opsysId => $ccount) {
                 $lastForwardToTime = $ccount;
                 foreach ($allForwards as $forward) {
                     if ($forward->TargetSessId == $opsysId) {
                         $lastForwardToTime = max($forward->Created, $lastForwardToTime);
                         if (!isset($forwardedToCount[$opsysId])) {
                             $forwardedToCount[$opsysId] = 0;
                         }
                         $forwardedToCount[$opsysId]++;
                     }
                 }
                 $targets[$opsysId] = $lastForwardToTime;
             }
             if (count($forwardedToCount) > 0) {
                 $forwardedToCount = min($forwardedToCount);
             } else {
                 $forwardedToCount = 0;
             }
             if (!empty($CONFIG["gl_mcfc"]) && is_numeric($CONFIG["gl_mcfc"])) {
                 if ($CONFIG["gl_mcfc"] <= $forwardedToCount) {
                     return false;
                 }
             }
             if (!empty($targets)) {
                 asort($targets);
                 foreach ($targets as $targetsysid => $time) {
                     if ($targetsysid != $this->DesiredChatPartner) {
                         $forward = new Forward($this->ChatId, $this->DesiredChatPartner);
                         $forward->InitiatorSystemId = $this->DesiredChatPartner;
                         $forward->ReceiverUserId = $this->UserId;
                         $forward->ReceiverBrowserId = $this->BrowserId;
                         $forward->TargetSessId = $targetsysid;
                         $forward->TargetGroupId = $this->DesiredChatGroup;
                         $forward->Invite = false;
                         $forward->Auto = true;
                         $forward->Save();
                         Chat::Destroy($this->ChatId);
                         return true;
                     }
                 }
             }
         } else {
             if (!empty($CONFIG["gl_mcfc"])) {
                 return false;
             }
         }
     }
     return true;
 }
function processForwards($count = 0, $double = false)
{
    global $STATS;
    while (isset($_POST[POST_INTERN_PROCESS_FORWARDS . "_va_" . $count])) {
        if (STATS_ACTIVE) {
            $STATS->ProcessAction(ST_ACTION_FORWARDED_CHAT);
        }
        $forward = new Forward($_POST[POST_INTERN_PROCESS_FORWARDS . "_va_" . $count], $_POST[POST_INTERN_PROCESS_FORWARDS . "_vd_" . $count]);
        $forward->InitiatorSystemId = CALLER_SYSTEM_ID;
        $forward->ReceiverUserId = $_POST[POST_INTERN_PROCESS_FORWARDS . "_vf_" . $count];
        $forward->ReceiverBrowserId = $_POST[POST_INTERN_PROCESS_FORWARDS . "_vg_" . $count];
        $forward->TargetSessId = $_POST[POST_INTERN_PROCESS_FORWARDS . "_vb_" . $count];
        $forward->TargetGroupId = $_POST[POST_INTERN_PROCESS_FORWARDS . "_ve_" . $count];
        $forward->Invite = !empty($_POST[POST_INTERN_PROCESS_FORWARDS . "_vh_" . $count]);
        $chat = new VisitorChat($_POST[POST_INTERN_PROCESS_FORWARDS . "_vf_" . $count], $_POST[POST_INTERN_PROCESS_FORWARDS . "_vg_" . $count]);
        $chat->ChatId = $_POST[POST_INTERN_PROCESS_FORWARDS . "_va_" . $count];
        $chat->Load();
        foreach ($chat->Members as $sysid => $member) {
            if ($member->Status == 0 && $forward->TargetSessId == $sysid) {
                $double = true;
            }
        }
        if (!$double) {
            if (strlen($_POST[POST_INTERN_PROCESS_FORWARDS . "_vc_" . $count]) > 0) {
                $forward->Text = $_POST[POST_INTERN_PROCESS_FORWARDS . "_vc_" . $count];
            }
            $forward->Save();
        }
        $count++;
    }
}
function buildExtern()
{
    global $VISITOR, $INTERNAL, $GROUPS, $RESPONSE;
    $RESPONSE->Tracking = "";
    $result = queryDB(true, "SELECT * FROM `" . DB_PREFIX . DATABASE_CHAT_FORWARDS . "` WHERE `auto`=0 AND `closed`=0 AND `received`=0 ORDER BY `created` ASC;");
    while ($row = DBManager::FetchArray($result)) {
        $forward = new Forward($row);
        $RESPONSE->Forwards .= $forward->GetXml();
        if (!empty($VISITOR[$forward->ReceiverUserId]) && $VISITOR[$forward->ReceiverUserId]->GetBrowser($forward->ReceiverBrowserId) != null) {
            if (!$forward->Invite) {
                $VISITOR[$forward->ReceiverUserId]->GetBrowser($forward->ReceiverBrowserId)->Forward = $forward;
            } else {
                if (CALLER_SYSTEM_ID == $forward->TargetSessId) {
                    $forward->Save(true, false);
                }
            }
        }
    }
    $isex = !empty($INTERNAL[CALLER_SYSTEM_ID]->Groups) && $GROUPS[$INTERNAL[CALLER_SYSTEM_ID]->Groups[0]]->IsExternal;
    $builder = new ExternalXMLBuilder($INTERNAL[CALLER_SYSTEM_ID], $VISITOR, NO_CLIPPING || isset($_POST[POST_INTERN_RESYNC]), $isex);
    $builder->SessionFileSizes = $INTERNAL[CALLER_SYSTEM_ID]->VisitorFileSizes;
    $builder->StaticReload = $INTERNAL[CALLER_SYSTEM_ID]->VisitorStaticReload;
    //$base = (!empty($INTERNAL[CALLER_SYSTEM_ID]->VisitorFileSizes["discarded"])) ? $INTERNAL[CALLER_SYSTEM_ID]->VisitorFileSizes["discarded"] : array();
    $base = array();
    $builder->SetDiscardedObject($base);
    $builder->Generate();
    $RESPONSE->Tracking = $builder->XMLCurrent;
    foreach ($builder->DiscardedObjects as $uid => $list) {
        $RESPONSE->Tracking .= "<cd id=\"" . base64_encode($uid) . "\">\r\n";
        if ($list != null) {
            foreach ($list as $bid) {
                $RESPONSE->Tracking .= " <bd id=\"" . base64_encode($bid) . "\" />\r\n";
            }
        }
        $RESPONSE->Tracking .= "</cd>\r\n";
    }
    $RESPONSE->Typing .= $builder->XMLTyping;
    $INTERNAL[CALLER_SYSTEM_ID]->VisitorFileSizes = $builder->SessionFileSizes;
    $INTERNAL[CALLER_SYSTEM_ID]->VisitorStaticReload = $builder->StaticReload;
    if ($builder->GetAll && !LOGIN) {
        $RESPONSE->Tracking .= "<resync />\r\n";
    }
    if (count($VISITOR) == 0) {
        $INTERNAL[CALLER_SYSTEM_ID]->VisitorFileSizes = array();
    }
}
Пример #24
0
 public function parse_class()
 {
     $class_annotation = $this->last_annotation;
     $this->last_annotation = null;
     // abstract class
     $abstract = false;
     $final = false;
     while ($this->at(array(T_ABSTRACT, T_FINAL))) {
         if ($this->at(T_ABSTRACT)) {
             $abstract = true;
         } else {
             $final = true;
         }
         $this->accept();
         $this->s();
     }
     // class
     $this->accept(T_CLASS);
     $this->s();
     $class = new ClassDef($this->parse_ident());
     $class->set_abstract($abstract);
     $class->set_namespace($this->namespace);
     if ($class_annotation) {
         $class->set_annotation($class_annotation);
     }
     $this->s();
     // superclass
     if ($this->at(T_EXTENDS)) {
         $this->accept();
         $this->s();
         $class->extend($this->parse_ident());
         $this->s();
     }
     // interfaces
     $req = T_IMPLEMENTS;
     while ($this->at($req)) {
         $this->accept();
         $this->s();
         $class->implement($this->parse_ident());
         $this->s();
         $req = ',';
     }
     $this->s();
     $this->accept('{');
     // forward declarations: before
     Forward::apply('before', $class);
     // const, var, methods, eval, mixin
     $this->s();
     while ($this->at_class_part()) {
         if ($this->at(T_CONST)) {
             $this->accept();
             $this->s();
             $ident = $this->parse_ident();
             $this->s();
             $this->accept('=');
             $this->s();
             $class->define_constant($ident, $this->parse_value());
             $this->s();
             $this->accept(';');
         } elseif ($this->at_qualifier()) {
             $member_annotation = $this->last_annotation;
             $this->last_annotation = null;
             $access = 'public';
             $static = false;
             $abstract = false;
             $final = false;
             while ($this->at_qualifier()) {
                 switch ($this->current_token()) {
                     case T_PUBLIC:
                         $access = 'public';
                         break;
                     case T_PRIVATE:
                         $access = 'private';
                         break;
                     case T_PROTECTED:
                         $access = 'protected';
                         break;
                     case T_STATIC:
                         $static = true;
                         break;
                     case T_FINAL:
                         $final = true;
                         break;
                     case T_ABSTRACT:
                         $abstract = true;
                         break;
                 }
                 $this->accept();
                 $this->s();
             }
             if ($this->at(T_VARIABLE)) {
                 $variable = $this->parse_variable($access, $static);
                 if ($member_annotation) {
                     $variable->set_annotation($member_annotation);
                 }
                 $class->add_variable($variable);
                 $this->s();
                 if ($this->at(T_IMPLEMENTS)) {
                     $this->accept();
                     $this->s();
                     $this->write_interface_delegate($class, $variable->get_name(), $this->parse_absolute_namespaced_ident());
                     $this->s();
                     while ($this->at(',')) {
                         $this->accept();
                         $this->s();
                         $this->write_interface_delegate($class, $variable->get_name(), $this->parse_absolute_namespaced_ident());
                         $this->s();
                     }
                 } else {
                     while ($this->at(',')) {
                         $this->accept();
                         $this->s();
                         $class->add_variable($this->parse_variable($access, $static));
                         $this->s();
                     }
                 }
                 $this->accept(';');
             } elseif ($this->at(T_FUNCTION)) {
                 $this->accept();
                 $this->s();
                 if ($this->at('&')) {
                     $reference = true;
                     $this->accept();
                     $this->s();
                 } else {
                     $reference = false;
                 }
                 if ($this->at(T_CONSTANT_ENCAPSED_STRING)) {
                     if ($access != 'public') {
                         $this->error("pattern matched methods must be public");
                     }
                     if ($final) {
                         $this->error("pattern matched methods cannot be final");
                     }
                     if ($abstract) {
                         $this->error("pattern matched methods cannot be abstract");
                     }
                     if ($reference) {
                         $this->error("pattern matched methods cannot return by reference");
                     }
                     $pattern = $this->current_text();
                     $this->accept();
                     $this->s();
                     $args = $this->parse_arg_list();
                     $this->s();
                     $body = substr($this->parse_block(), 1, -1);
                     if ($static) {
                         $class->add_static_pattern(new Literal($pattern), $args, $body);
                     } else {
                         $class->add_pattern(new Literal($pattern), $args, $body);
                     }
                 } else {
                     $ident = $this->parse_ident();
                     $this->s();
                     $args = $this->parse_arg_list();
                     $this->s();
                     if ($this->at(';')) {
                         $body = '';
                         $this->accept();
                     } else {
                         $body = substr($this->parse_block(), 1, -1);
                     }
                     $method = new Method($ident);
                     $method->set_access($access);
                     $method->set_static($static);
                     $method->set_final($final);
                     $method->set_abstract($abstract);
                     $method->set_reference_returned($reference);
                     $method->set_arg_list($args);
                     $method->set_body($body);
                     $class->add_method($method);
                     if ($member_annotation) {
                         $method->set_annotation($member_annotation);
                     }
                 }
             }
         } elseif ($this->at(T_EVAL)) {
             $this->accept();
             $this->s();
             $code = $this->parse_block();
             class_eval_without_scope($class, $code);
         } elseif ($this->at(T_INCLUDE)) {
             $this->accept();
             $this->s();
             $mixin_method = 'mixin';
             if ($this->at(T_CONST)) {
                 $mixin_method .= '_constants';
                 $this->accept();
                 $this->s();
             } elseif ($this->at(T_STATIC)) {
                 $mixin_method .= '_static';
                 $this->accept();
                 $this->s();
             }
             $module = $this->parse_absolute_namespaced_ident();
             $this->s();
             $this->accept(';');
             $class->{$mixin_method}($module);
         }
         $this->s();
     }
     $this->s();
     $this->accept('}');
     // forward declarations: after
     Forward::apply('after', $class);
     return $class;
 }
function processForwards($count = 0)
{
    global $INTERNAL, $STATS;
    while (isset($_POST[POST_INTERN_PROCESS_FORWARDS . "_va_" . $count])) {
        if (STATS_ACTIVE) {
            $STATS->ProcessAction(ST_ACTION_FORWARDED_CHAT);
        }
        $forward = new Forward($_POST[POST_INTERN_PROCESS_FORWARDS . "_va_" . $count], $INTERNAL[CALLER_SYSTEM_ID]->SystemId);
        $forward->ReceiverUserId = $_POST[POST_INTERN_PROCESS_FORWARDS . "_vf_" . $count];
        $forward->ReceiverBrowserId = $_POST[POST_INTERN_PROCESS_FORWARDS . "_vg_" . $count];
        $forward->TargetSessId = $_POST[POST_INTERN_PROCESS_FORWARDS . "_vb_" . $count];
        $forward->TargetGroupId = $_POST[POST_INTERN_PROCESS_FORWARDS . "_ve_" . $count];
        if (strlen($_POST[POST_INTERN_PROCESS_FORWARDS . "_vc_" . $count]) > 0) {
            $forward->Text = $_POST[POST_INTERN_PROCESS_FORWARDS . "_vc_" . $count];
        }
        if (strlen($_POST[POST_INTERN_PROCESS_FORWARDS . "_vd_" . $count]) > 0) {
            $forward->Conversation = $_POST[POST_INTERN_PROCESS_FORWARDS . "_vd_" . $count];
        }
        $forward->Save();
        $count++;
    }
}
function buildExtern()
{
    Server::$Response->Tracking = "";
    $result = DBManager::Execute(true, "SELECT * FROM `" . DB_PREFIX . DATABASE_CHAT_FORWARDS . "` WHERE `auto`=0 AND `closed`=0 AND `received`=0 ORDER BY `created` ASC;");
    while ($row = DBManager::FetchArray($result)) {
        $forward = new Forward($row);
        Server::$Response->Forwards .= $forward->GetXml();
        if (!empty(Server::$Visitors[$forward->ReceiverUserId]) && Server::$Visitors[$forward->ReceiverUserId]->GetBrowser($forward->ReceiverBrowserId) != null) {
            if (!$forward->Invite) {
                Server::$Visitors[$forward->ReceiverUserId]->GetBrowser($forward->ReceiverBrowserId)->Forward = $forward;
            } else {
                if (CALLER_SYSTEM_ID == $forward->TargetSessId) {
                    $forward->Save(true, true);
                }
            }
        }
    }
    $isex = !empty(Server::$Operators[CALLER_SYSTEM_ID]->Groups) && Server::$Groups[Server::$Operators[CALLER_SYSTEM_ID]->Groups[0]]->IsExternal;
    $builder = new ExternalXMLBuilder(Server::$Operators[CALLER_SYSTEM_ID], Server::$Visitors, NO_CLIPPING || isset($_POST[POST_INTERN_RESYNC]), $isex);
    $builder->SessionFileSizes = Server::$Operators[CALLER_SYSTEM_ID]->VisitorFileSizes;
    $builder->StaticReload = Server::$Operators[CALLER_SYSTEM_ID]->VisitorStaticReload;
    $base = array();
    $builder->SetDiscardedObject($base);
    $builder->Generate();
    Server::$Response->Tracking = $builder->XMLCurrent;
    foreach ($builder->DiscardedObjects as $uid => $list) {
        Server::$Response->Tracking .= "<cd id=\"" . base64_encode($uid) . "\">\r\n";
        if ($list != null) {
            foreach ($list as $bid) {
                Server::$Response->Tracking .= " <bd id=\"" . base64_encode($bid) . "\" />\r\n";
            }
        }
        Server::$Response->Tracking .= "</cd>\r\n";
    }
    Server::$Response->Typing .= $builder->XMLTyping;
    Server::$Operators[CALLER_SYSTEM_ID]->VisitorFileSizes = $builder->SessionFileSizes;
    Server::$Operators[CALLER_SYSTEM_ID]->VisitorStaticReload = $builder->StaticReload;
    if ($builder->GetAll && !LOGIN) {
        Server::$Response->Tracking .= "<resync />\r\n";
    }
    if (count(Server::$Visitors) == 0) {
        Server::$Operators[CALLER_SYSTEM_ID]->VisitorFileSizes = array();
    }
}