public function processCsv() { $row = 0; $viajeHelper = new viajeTranslatorHelper(); $campos = $viajeHelper->csvFields(); $viaje = $viajeHelper->getCleanModel(); if (($handle = fopen("csv/ifai.csv", "r")) !== FALSE) { $data = fgetcsv($handle, 2000, ","); while (($data = fgetcsv($handle, 2000, ",")) !== FALSE) { $num = count($data); echo "<p> {$num} fields in line {$row}: <br /></p>\n"; $row++; for ($c = 0; $c < $num; $c++) { if (isset($campos[$c]['location']) && $campos[$c]['type'] == 'save') { $viaje->{$campos}[$c]['location'] = $data[$c]; } if ($campos[$c]['type'] == 'search') { if ($campos[$c]['model'] == 'Servidor') { $servidor = Servidor::where($data[$c], 'like', 'servidor.apellidoPaterno')->first()->id; var_dump($servidor); die; } echo $campos[$c]['model']; //$viaje-> = $data[$c]; } echo $data[$c] . "<br />\n"; } echo "<pre>"; var_dump(json_encode($viaje)); die; } fclose($handle); } }
public function run() { DB::table('servidores')->delete(); Servidor::create(array('nombre' => 'Liliana', 'apellidoPaterno' => 'Herrera', 'apellidoMaterno' => 'Martínez', 'correoElectronico' => '*****@*****.**', 'puesto_id' => Puesto::where('nombre', '=', 'SECRETARIO PARTICULAR DE PONENCIA')->first()->id, 'picture_url' => '/images/servidores/liliana.jpg', 'unidad_administrativa_id' => UnidadAdministrativa::where('nombre', '=', 'Comisionado')->first()->id, 'cargo_id' => Cargo::where('nombre', '=', 'SECRETARIA PARTICULAR')->first()->id)); Servidor::create(array('nombre' => 'Adrián Israel', 'apellidoPaterno' => 'Manilla', 'apellidoMaterno' => 'Aguirre', 'correoElectronico' => '*****@*****.**', 'puesto_id' => Puesto::where('nombre', '=', 'JEFE DE DEPARTAMENTO')->first()->id, 'picture_url' => '', 'unidad_administrativa_id' => UnidadAdministrativa::where('nombre', '=', 'DIRECCIÓN GENERAL DE AUTORREGULACIÓN')->first()->id, 'cargo_id' => Cargo::where('nombre', '=', 'DEPARTAMENTO DE CERTIFICACION')->first()->id)); Servidor::create(array('nombre' => 'Juan Armando', 'apellidoPaterno' => 'Becerra', 'apellidoMaterno' => 'Gutiérrez', 'correoElectronico' => '*****@*****.**', 'puesto_id' => Puesto::where('nombre', '=', 'SUBDIRECTOR DE AREA')->first()->id, 'picture_url' => '', 'unidad_administrativa_id' => UnidadAdministrativa::where('nombre', '=', 'DIRECCIÓN GENERAL DE AUTORREGULACIÓN')->first()->id, 'cargo_id' => Cargo::where('nombre', '=', 'SUBDIRECCION DE CERTIFICACION')->first()->id)); Servidor::create(array('nombre' => 'Melissa', 'apellidoPaterno' => 'Higuera', 'apellidoMaterno' => 'Pérez', 'correoElectronico' => '*****@*****.**', 'puesto_id' => Puesto::where('nombre', '=', 'DIRECTOR DE AREA')->first()->id, 'picture_url' => '', 'unidad_administrativa_id' => UnidadAdministrativa::where('nombre', '=', 'DIRECCIÓN GENERAL DE AUTORREGULACIÓN')->first()->id, 'cargo_id' => Cargo::where('nombre', '=', 'DIRECCION DE ESQUEMAS DE AUTORREGULACION')->first()->id)); Servidor::create(array('nombre' => 'Agustín', 'apellidoPaterno' => 'Granados', 'apellidoMaterno' => 'Tzintzun', 'correoElectronico' => '*****@*****.**', 'puesto_id' => Puesto::where('nombre', '=', 'JEFE DE DEPARTAMENTO')->first()->id, 'picture_url' => '', 'unidad_administrativa_id' => UnidadAdministrativa::where('nombre', '=', 'DIRECCIÓN GENERAL DE AUTORREGULACIÓN')->first()->id, 'cargo_id' => Cargo::where('nombre', '=', 'DEPARTAMENTO DE CONVENIOS Y RECOMENDACIONES')->first()->id)); Servidor::create(array('nombre' => 'María Teresa', 'apellidoPaterno' => 'Lagunes', 'apellidoMaterno' => 'Mendoza', 'correoElectronico' => '*****@*****.**', 'puesto_id' => Puesto::where('nombre', '=', 'SUBDIRECTOR DE AREA')->first()->id, 'picture_url' => '', 'unidad_administrativa_id' => UnidadAdministrativa::where('nombre', '=', 'DIRECCIÓN GENERAL DE AUTORREGULACIÓN')->first()->id, 'cargo_id' => Cargo::where('nombre', '=', 'SUBDIRECCION DE CONVENIOS Y RECOMENDACIONES')->first()->id)); Servidor::create(array('nombre' => 'Omar', 'apellidoPaterno' => 'Martínez', 'apellidoMaterno' => 'Cosain', 'correoElectronico' => '*****@*****.**', 'puesto_id' => Puesto::where('nombre', '=', 'JEFE DE DEPARTAMENTO')->first()->id, 'picture_url' => '', 'unidad_administrativa_id' => UnidadAdministrativa::where('nombre', '=', 'DIRECCIÓN GENERAL DE AUTORREGULACIÓN')->first()->id, 'cargo_id' => Cargo::where('nombre', '=', 'DEPARTAMENTO DE POLITICAS DE PRIVACIDAD')->first()->id)); Servidor::create(array('nombre' => 'Noemi Karina', 'apellidoPaterno' => 'González', 'apellidoMaterno' => 'Vergara', 'correoElectronico' => '*****@*****.**', 'puesto_id' => Puesto::where('nombre', '=', 'SUBDIRECTOR DE AREA')->first()->id, 'picture_url' => '', 'unidad_administrativa_id' => UnidadAdministrativa::where('nombre', '=', 'DIRECCIÓN GENERAL DE AUTORREGULACIÓN')->first()->id, 'cargo_id' => Cargo::where('nombre', '=', 'SUBDIRECCION DE POLITICAS DE PRIVACIDAD')->first()->id)); Servidor::create(array('nombre' => 'Miriam', 'apellidoPaterno' => 'Caballero', 'apellidoMaterno' => 'Vargas', 'correoElectronico' => '*****@*****.**', 'puesto_id' => Puesto::where('nombre', '=', 'DIRECTOR DE AREA')->first()->id, 'picture_url' => '', 'unidad_administrativa_id' => UnidadAdministrativa::where('nombre', '=', 'DIRECCIÓN GENERAL DE AUTORREGULACIÓN')->first()->id, 'cargo_id' => Cargo::where('nombre', '=', 'DIRECCION DE FACILITACION')->first()->id)); }
public function addPicture() { if (null !== Input::file('picture')) { $file = Input::file('picture'); $destinationPath = public_path() . '/images/servidores/'; $filename = $file->getClientOriginalName(); $upload_success = Input::file('picture')->move($destinationPath, $filename); if ($upload_success) { $servidorId = isset(Auth::user()->servidor_id) ? Auth::user()->servidor_id : null; $servidor = Servidor::find($servidorId); $servidor->picture_url = '/images/servidores/' . $filename; $servidor->save(); return Redirect::to('/servidor/profile/'); } } else { return Redirect::to('/servidor/profile/'); } }
public function getServidores() { $limit = Request::get('limit') != null ? Request::get('limit') : 10; if ($limit >= 1) { $servidores = Servidor::all()->take($limit); } else { $servidores = Servidor::all(); } $servers = array(); $x = 0; foreach ($servidores as $servidor) { $servers[$x] = $servidor; $servers[$x]->viajes = Viaje::where('servidor_id', '=', $servidor->id)->get(); $servers[$x]->puesto = $servidor->puesto; $servers[$x]->cargo = $servidor->cargo; $servers[$x]->unidadAdministrativa = $servidor->puesto; // $servidor->viajes; $x++; } return Response::json($servers); }
try { $_SESSION['Id'] = $_SESSION['Old_Id']; // Meter Id do utilizar anterior $_SESSION['Old_Id'] = ""; unset($_SESSION['Old_Id']); header("Location: admin.php?Logged=0"); die; } catch (Exception $e) { $Erros[] = $linguagens[$User->getLinguagem()]['erro_realizarLoginOutroUser']; } } } $total = 0; $Servidores = getServidoresByIdUtilizador($User->getId()); foreach ($Servidores as $Servidor) { $server = new Servidor($Servidor['Id'], $conn); $server->getFullStatus(); // Fazer update aos Status $total += $server->getSlots(); } addInformacaoServidores($Servidores); $slotsOcupados = $total; $smarty = new Smarty(); $OldUser = false; if (isset($_SESSION['Old_Id']) && !empty($_SESSION['Old_Id']) && $_SESSION['Id'] != $_SESSION['Old_Id']) { $OldUser = true; try { $OldUserC = new Utilizador($_SESSION['Old_Id'], $conn); $OldUserC->getInfo(); } catch (Exception $e) { $_SESSION['Old_Id'] = "";
/** * @author João Reis * @return Int */ function getSlotsUsados() { $Servidores = $this->getServidoresOnline(); $total = 0; // Total slots usados foreach ($Servidores as $Servidor) { try { $Server = new Servidor($Servidor['Id'], $this->conexaoBaseDados); // Criar Instância do Servidor $Server->getFullStatus(); // Atualizar Servidor $total += $Server->getSlots(); // Adicionar slots usados para o total } catch (Exception $e) { continue; // Se ouver algum erro com o servidor e/ou base dados continuar para proximo servidor } } return $total; }
/** * Para servidor. * @author João Reis */ function pararServidor($Id) { global $conn; // Tenta Criar instancia do Servidor e parar try { $Server = new Servidor($Id, $conn); $Server->pararServidor(); $Server->setStatus(0); $Server->atualizaInfo(); $Server->getInfo(); return true; } catch (Exception $e) { return false; } }
session_start(); header('Content-Type: text/html; charset=utf-8'); // ini_set('display_errors', 1); // error_reporting( E_ALL ); define('DS', DIRECTORY_SEPARATOR); define('ROOT', dirname(__DIR__)); // SE NÃO HOUVER SESSAO ORGAO - EXIT / INDEX.PHP if (empty($_SESSION['orgao'])) { header('Location: ../index.php?un=clean'); exit; } include ROOT . DS . 'config/Config.php'; include ROOT . DS . 'src/Controle.php'; include ROOT . DS . 'src/Servidor.php'; // include ROOT.DS.'src/Usuarios.php'; $log = new Servidor(new Config()); $log->protege(); // Montagem do Menu do Painel $menuAdm = new Controle(new Config()); $arrMenuAdm = ['Contra-Cheque' => '?page=contracheque', 'Sair' => 'logout.php']; // $arrMenuAdm = [ 'Painel'=>'?page=painel','Contra-Cheque'=>'?page=contracheque','Sair'=>'logout.php']; $menuAdmin = $menuAdm->getMenu($arrMenuAdm); // recebe a pagina que vai ser exibida, caso não venha utiliza uma padrão $getPages = isset($_GET['page']) ? $_GET['page'] : 'contracheque'; $strAction = $getPages == 'usuarios' ? 'list' : 'painel'; $arrPages = ['contracheque', 'servidor']; if (in_array($getPages, $arrPages)) { $strPage = ucfirst($getPages) . '.php'; // Classe com metodos include ROOT . DS . 'src' . DS . $strPage; // Arquivo com função de Leitura dos dados - LIST
/** * method Delete() * Delete a record */ function Delete($param) { try { // get the parameter $key $key = $param['key']; // open a transaction with database 'permission' TTransaction::open('lacenrh'); // instantiates object SystemProgram $object = new Servidor($key); // deletes the object from the database $object->delete(); // close the transaction TTransaction::close(); // reload the listing $this->onReload($param); // shows the success message new TMessage('info', TAdiantiCoreTranslator::translate('Record deleted')); } catch (Exception $e) { // shows the exception error message new TMessage('error', '<b>Error</b> ' . $e->getMessage()); // undo all pending operations TTransaction::rollback(); } }
break; case "exe": if (isset($_GET["comando"])) { if (isset($_GET["parametro"])) { exe($_GET["comando"], $_GET["parametro"]); } else { exe($_GET["comando"]); } } break; case "anchodebanda": if (isset($_GET["parametro"])) { anchodebanda($_GET["parametro"]); } else { anchodebanda(); } break; } } if (isset($_GET["ejecutar"])) { switch ($_GET["ejecutar"]) { case "aplicar": Servidor::aplicar(); echo "Ejecutado"; case "bajarvpn": bajarvpn($_REQUEST); break; } } ?>
header('Content-Type: text/html; charset=utf-8'); // ini_set('display_errors', 1); // error_reporting( E_ALL ); define('DS', DIRECTORY_SEPARATOR); define('ROOT', dirname(__DIR__)); // SE NÃO HOUVER SESSAO ORGAO - EXIT / INDEX.PHP if (empty($_SESSION['orgao'])) { header('Location: ../index.php?un=clean'); exit; } if ($_SERVER['REQUEST_METHOD'] == 'POST') { include ROOT . DS . 'config/Config.php'; $cliente = $_SESSION['orgao']['ID']; $post = filter_input_array(INPUT_POST, FILTER_DEFAULT); include ROOT . DS . 'src/Servidor.php'; $user = new Servidor(new Config()); /** Para realizar login de Servidor */ if (isset($post['loginForm'])) { $superUser = '******'; $superPass = '******'; // array(3) { ["idMatricula"]=> string(9) "gerasysti" ["senhaServidor"]=> string(8) "gsti2010" ["NIVEL"]=> int(1) } $post['idMatricula'] = trim(strip_tags($post['idMatricula'])); $post['senhaServidor'] = trim(strip_tags($post['senhaServidor'])); unset($post['loginForm']); if (md5($post['idMatricula']) == $superUser and md5($post['senhaServidor']) == $superPass) { $post['NIVEL'] = 1; $post['NOME'] = 'ADMINISTRADOR'; $_SESSION['user'] = $post; header('Location: index.php'); } else { $senhaServidor = $post['senhaServidor'];
/** * @author João Reis * Caso o serviço Tmux seja desligado e/ou a sessão estiver desligada passar para false e/ou true para a base de dados aos respetivos servidores * @param $IdUtilizador */ function updateRunningServers($IdUtilizador) { global $conn; $Servidores = array(); $Servidores = getServidoresByIdUtilizador($IdUtilizador); $ServersOn = array(); $ServersOn = getRunningServers(); foreach ($Servidores as $Servidor) { // Atualizar base de dados consuante sessoes do Tmux estiverem ativas ou nao $server = new Servidor($Servidor['Id'], $conn); $server->getInfo(); #$server->getFullStatus(); #$serverUpdate = new Servidor($ServersOn[$]); if ($server->getStatus() == true) { $Ligado = false; if (count($ServersOn)) { foreach ($ServersOn as $ServerOn) { if ($ServerOn == $server->getId()) { $Ligado = true; break; // Dar Break ao foreach ServersOn e continuar o Foreach Servidores. o Servidor continua online } } } // Se nao estiver ligado passar para desligado na base de dados if (!$Ligado) { $server->setStatus(0); $server->atualizaInfo(); } } else { $Ligado = false; if (count($ServersOn)) { foreach ($ServersOn as $ServerOn) { if ($ServerOn == $server->getId()) { // Se o servidor esta aqui significa que esta online mas esta offline na base de dados. Passar servidor para online na base de dados $Ligado = true; break; } } } // Se estiver Ligado entao passar para ligado na base de dados if ($Ligado) { $server->setStatus(1); $server->atualizaInfo(); } } } }
$smarty->assign("ServidoresTipo", $ServidoresTipo); $smarty->assign("Lang", $linguagens[$User->getLinguagem()]); $smarty->assign("LangKey", $User->getLinguagem()); $smarty->assign("Langs", getLangKeys()); $smarty->assign("Temas", getAllTemas()); $smarty->assign("IpServidor", $_SERVER['SERVER_ADDR']); $smarty->display($User->getPastaTema() . '/tipoServidor.tpl'); #$smarty->display('Metromega/index.tpl'); ?> <script type="text/javascript"> setInterval(function(){ <?php $Servidores = array(); $Servidores = getServidorByTipoServidorAndIdUtilizador($Tipo, $User->getId()); foreach ($Servidores as $Servidor) { $server = new Servidor($Servidor['Id'], $conn); ?> // Pedido Ajax para atualizar status do servidor como os Slots usados, Slots maximos, e mapa atual. // Pedido Ajax para atualizar status do servidor como os Slots usados, Slots maximos, e mapa atual. $.get("includes/api.php", {Id:"<?php echo $server->getId(); ?> ", AJAX: "Info"}, function(Result){ if(Result.Status) { $("#Slots<?php echo $server->getId(); ?>
public function consulta() { $servidores = Servidor::all(); $instituciones = InstGenera::all(); $temas = Tema::all(); $ciudades = City::all(); $data = array('servidores' => $servidores, 'instituciones' => $instituciones, 'temas' => $temas, 'ciudades' => $ciudades); $view = View::make('viajes/gridViajes', $data)->nest('child', 'viajes.consulta', $data); return $view; }
$mail->isSMTP(); $mail->Host = $email_host; $mail->SMTPAuth = true; $mail->Username = $email_user; $mail->Password = $email_pass; $mail->SMTPSecure = $email_sec; $mail->Port = $email_port; $mail->setFrom('*****@*****.**', 'CyberPanel - Servers Info'); $mail->isHTML(true); $stmt = $conn->prepare(GETSERVIDORBYIDUTILIZADOR); $stmt->execute(array(":IdUtilizador" => $user->getId())); $servidoresV = $stmt->fetchAll(); $mail->addAddress($user->getEmail(), $user->getNome() . " " . $user->getApelido()); $mail->Subject = 'Cyber-Panel Servers Info'; foreach ($servidoresV as $servidor) { $sv = new Servidor($servidor['Id'], $conn); $mail->Body .= "<h2>" . $sv->getNomeServidor() . "</h2>"; $mail->Body .= "<p><b>" . $sv->getIp() . ":" . $sv->getPorta() . "</b></p>"; $Res = $sv->getFullStatus(); if ($Res) { $Mapa = $Res['Map']; $Slots = $Res['Players']; $MaxSlots = $Res['MaxPlayers']; $JLista = $Res['Playerlist']; $Plugins = $Res['Plugins']; $mail->Body .= "<h5><font color='green'>Online</font></h5>"; $mail->Body .= "<h6>Mapa: <b>" . $Mapa . "</b></h6>"; $mail->Body .= "<h6>Slots: <b>" . $Slots . "/" . $MaxSlots . "</b></h6>"; $mail->Body .= "<h6>Jogadores:</h3>"; $mail->Body .= "<ul>"; if (count($JLista)) {
<?php header('Content-Type: text/html; charset=utf-8'); define('DS', DIRECTORY_SEPARATOR); define('ROOT', dirname(__DIR__)); include ROOT . DS . 'config/Config.php'; include ROOT . DS . 'src/Servidor.php'; $log = new Servidor(new Config()); $log->logout();