private static function runlevel2(){
     Logger::setup();
     Logger::enter_group('Runlevel 2');
     Logger::debug('Loggers loaded');
     Databases::setup();
     Logger::debug('Databases Loaded');
     SessionManager::start();
     Logger::debug('Session-Management Loaded');
     Logger::leave_group();
 }
Beispiel #2
0
 /**
  * Fungsi untuk men-set nilai option sesuai dengan nama / key nya
  * jika key sudah ada => update
  * jika key belum ada => insert
  *
  * @param $name
  * @param $value
  * @param string $object
  * @return bool
  */
 function set_option($name, $value, $object = '')
 {
     $query = 'SELECT * FROM `' . $this->table_name . '` WHERE name = "' . $name . '"';
     if ('' != $object) {
         $query .= ' AND object = "' . $object . '"';
     }
     $obj_option = mysql_fetch_object(mysql_query($query));
     if ($obj_option) {
         return parent::update($this->table_name, array('value'), array($value), array('id', $obj_option->id));
     } else {
         return parent::insert($this->table_name, array('name', 'value', 'object'), array(array($name, $value, $object)));
     }
 }
Beispiel #3
0
 public function update($id, $name, $color, $weight, $picture)
 {
     try {
         $conn = Databases::getConnection();
         $sql = "UPDATE product SET name=:name, color=:color, weight=:weight, 1, picture=:picture WHERE id=:id";
         $stm = $conn->prepare($sql);
         $stm->bindParam(":id", $id);
         $stm->bindParam(":name", $name);
         $stm->bindParam(":color", $color);
         $stm->bindParam(":weight", $weight);
         $stm->bindParam(":picture", $picture);
         $ret = $stm->execute();
     } catch (Exception $ex) {
         return;
     }
 }
Beispiel #4
0
 public function loginAction()
 {
     $connection = Databases::connect();
     $email = $this->getParametroTela('email');
     $senha = $this->getParametroTela('senha');
     $mensagem = $this->validarFormulario($connection, $email, $senha);
     if (substr($mensagem, 0, 1) == 'S') {
         $usuario = $this->efetuarLogin($connection, $email, $senha);
         $this->iniciarSessaoUsuario($usuario);
         $dados = $this->carregarDadosListar($connection);
         Databases::disconnect($connection);
         $this->exibirTelaListar($dados);
     } else {
         if (substr($mensagem, 0, 1) == 'N') {
             Databases::disconnect($connection);
             $dados = $this->trabalharDadosLogin($mensagem);
             $this->exibirTelaLogin($dados);
         }
     }
 }
Beispiel #5
0
ossim_valid($rp, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _('Rp'));
if (ossim_error()) {
    echo "<rows>\n<page>1</page>\n<total>0</total>\n</rows>\n";
    exit;
}
if (!empty($order)) {
    $order .= POST('sortorder') == 'asc' ? '' : ' desc';
} else {
    $order = "name";
}
$start = ($page - 1) * $rp;
$limit = "LIMIT {$start}, {$rp}";
$db = new ossim_db();
$conn = $db->connect();
$xml = '';
$db_list = Databases::get_list($conn, "ORDER BY {$order} {$limit}");
if ($db_list[0]) {
    $total = $db_list[0]->get_foundrows();
    if ($total == 0) {
        $total = count($db_list);
    }
} else {
    $total = 0;
}
$xml .= "<rows>\n";
$xml .= "<page>{$page}</page>\n";
$xml .= "<total>{$total}</total>\n";
foreach ($db_list as $db_server) {
    $id = $db_server->get_id();
    $name = $db_server->get_name();
    $ip = $db_server->get_ip();
Beispiel #6
0
 static function init()
 {
     if (self::$mode == self::PRODUCTION) {
         self::$useTurboSpeed = true;
     }
     $_ENV['dir.recess'] = self::$recessDir;
     $_ENV['dir.apps'] = self::$appsDir;
     $_ENV['dir.plugins'] = self::$pluginsDir;
     $_ENV['dir.temp'] = self::$dataDir . 'temp/';
     $_ENV['dir.test'] = self::$recessDir . 'test/';
     if (!isset($_ENV['url.assetbase'])) {
         $_ENV['url.assetbase'] = $_ENV['url.base'];
     }
     date_default_timezone_set(self::$defaultTimeZone);
     require_once $_ENV['dir.recess'] . 'recess/lang/Library.class.php';
     Library::addClassPath(self::$recessDir);
     Library::addClassPath(self::$pluginsDir);
     Library::addClassPath(self::$appsDir);
     if (self::$useTurboSpeed) {
         Library::$useNamedRuns = true;
         $cacheProvidersReversed = array_reverse(self::$cacheProviders);
         foreach ($cacheProvidersReversed as $provider) {
             $provider = $provider . 'CacheProvider';
             Cache::reportsTo(new $provider());
         }
     }
     Library::init();
     Library::beginNamedRun('recess');
     Library::import('recess.database.Databases');
     Library::import('recess.database.orm.ModelDataSource');
     if (empty(RecessConf::$defaultDatabase)) {
         $message = 'Congratulations, Recess is almost setup!<br />';
         $message .= '<strong>Next Step(s):</strong>';
         $message .= '<ul>';
         $pdoMessages = array();
         if (!extension_loaded('PDO')) {
             $pdoMessages[] = 'Install PHP\'s PDO Extension';
             $pdoMessages[] = 'Install Sqlite or MySQL PDO Driver';
         } else {
             $drivers = pdo_drivers();
             $hasMySql = in_array('mysql', $drivers);
             $hasSqlite = in_array('sqlite', $drivers);
             if (!$hasMySql && !$hasSqlite) {
                 $pdoMessages[] = 'Install Sqlite and/or MySQL PDO Driver';
             } else {
                 $databases = '';
                 if ($hasSqlite) {
                     $databases = 'Sqlite';
                 }
                 if ($hasMySql) {
                     if ($databases != '') {
                         $databases .= ', ';
                     }
                     $databases .= 'MySql';
                 }
                 $pdoMessages[] = 'You have drivers for the following databases: ' . $databases;
             }
         }
         $pdoMessages[] = 'Setup <strong>recess-conf.php</strong> to point to your database.';
         $pdoMessages[] = 'Checkout the <strong>README.textile</strong> file for instructions.';
         $pdoMessages = '<li>' . implode('</li><li>', $pdoMessages) . '</li>';
         $message .= $pdoMessages . '</ul>';
         die($message);
     }
     try {
         Databases::setDefaultSource(new ModelDataSource(RecessConf::$defaultDatabase));
     } catch (DataSourceCouldNotConnectException $e) {
         $databaseType = parse_url(RecessConf::$defaultDatabase[0], PHP_URL_SCHEME);
         if (!in_array($databaseType, pdo_drivers())) {
             $message = 'It looks like PHP could not load the driver needed to connect to <strong>' . RecessConf::$defaultDatabase[0] . '</strong><br />';
             $message .= 'Please install the <strong>' . ucfirst($databaseType) . '</strong> PDO driver and enable it in php.ini';
         } else {
             $message = 'Error connecting to data source: ' . $e->getMessage();
         }
         die($message);
     }
     if (!empty(RecessConf::$namedDatabases)) {
         foreach (RecessConf::$namedDatabases as $name => $sourceInfo) {
             Databases::addSource($name, new ModelDataSource($sourceInfo));
         }
     }
     Library::import('recess.framework.Application');
     foreach (self::$applications as $key => $app) {
         if (!Library::classExists($app)) {
             die('Application "' . $app . '" does not exist. Remove it from recess-conf.php, RecessConf::$applications array.');
         } else {
             $app = Library::getClassName($app);
             self::$applications[$key] = new $app();
         }
     }
     Library::import('recess.framework.DefaultPolicy');
     self::$policy = new DefaultPolicy();
 }
 /** !Route GET, model/gen/getTableProps/$sourceName/$tableName */
 public function getTableProps($sourceName, $tableName)
 {
     $source = Databases::getSource($sourceName);
     if ($source == null) {
         return $this->redirect($this->urlTo('home'));
     } else {
         $this->source = $source;
     }
     $this->sourceName = $sourceName;
     $this->table = $tableName;
     $this->columns = $this->source->getTableDescriptor($tableName)->getColumns();
 }
 public function relatorioApontamentosDiasDistintosAction()
 {
     $connection = Databases::connect();
     $model = new ApontamentosModel();
     $atividades = $model->loadApontamentosDiasDistintos($connection, "A");
     $chamados = $model->loadApontamentosDiasDistintos($connection, "C");
     Databases::disconnect($connection);
     $parametros = array('atividades' => $atividades, 'chamados' => $chamados);
     $view = new View('views/relatorioApontamentosDiasDistintos.phtml');
     $view->setParams($parametros);
     $view->showContents();
 }
<?php

include 'Class/Databases.php';
$db = new Databases();
if (isset($_POST["btn"])) {
    /* 
     * Here inserting row as an array paramiter, you should check out databases 
     * insert function there you can see sql syntax. why i am doing this because it's secure 
     * and more efficient way, it's called prepare statement or you 
     * can call binding parameter so that you can prevent sql injection.and also 
     * getting all the $_POST parameter and assigning to a different variables and passing 
     * variables into insertRow() function to achieve desiger result.
     */
    $username = $_POST["username"];
    $firstname = $_POST["firstname"];
    $lastname = $_POST["lastname"];
    $email = $_POST["email"];
    $db->insertRow($param = ["{$username}", "{$firstname}", "{$lastname}", "{$email}"]);
}
?>
<!--head html file into template/header.php file just include here-->
<?php 
$title = "Insert Information";
include 'template/header.php';
?>
<p>
<tr>
    <th>
        <label for="username">Username:</label>
    </th>
</tr>
Beispiel #10
0
 function getDataSet()
 {
     Databases::setDefaultSource($this->source);
     Object::clearDescriptors();
     return $this->createXMLDataSet('recess/database/orm/sample-data.xml');
 }
Beispiel #11
0
<?php 
if (POST('insert')) {
    if ($error == true) {
        $txt_error = "<div>" . _("We Found the following errors") . ":</div><div style='padding:10px;'>" . implode("<br/>", $message_error) . "</div>";
        Util::print_error($txt_error);
        Util::make_form("POST", "newdbsform.php?" . $get_param);
        die;
    }
    $db = new ossim_db();
    $conn = $db->connect();
    $icon = "";
    if (is_uploaded_file($HTTP_POST_FILES['icon']['tmp_name'])) {
        $icon = file_get_contents($HTTP_POST_FILES['icon']['tmp_name']);
    }
    Databases::insert($conn, $dbs_name, $ip, $port, $user, $pass, $icon);
    $db->close($conn);
    if (isset($_SESSION['_dbs'])) {
        unset($_SESSION['_dbs']);
    }
}
?>
    <p> <?php 
echo gettext("Database server succesfully inserted");
?>
 </p>
    
	<?php 
if ($_SESSION["menu_sopc"] == "DBs" && POST('withoutmenu') != "1") {
    ?>
<script type='text/javascript'>document.location.href="dbs.php";</script><?php 
Beispiel #12
0
 public function ajaxExibeContatosUsuarioAction()
 {
     $usuarioCodigo = $this->getParametroTela('usuarioCodigo');
     $connection = Databases::connect();
     $usuarioModel = new UsuariosModel();
     $usuario = $usuarioModel->loadById($connection, $usuarioCodigo);
     Databases::disconnect($connection);
     if (Functions::isEmpty($usuarioCodigo)) {
         $resultado = '
         <div class="modal-dialog">
             <div class="modal-content">
               <div class="modal-header">
                 <button type="button" class="close" data-dismiss="modal">&times;</button>
                 <h4 class="modal-title">Contatos de Usuário</h4>
               </div>
               <div class="modal-body">
                 <p>
                   Nenhum usuário foi selecionado.
                 <br />
                   Selecione um usuário para visualizar seus contatos.
                 </p>
               </div>
               <div class="modal-footer">
                 <button type="button" class="btn btn-default" data-dismiss="modal">Fechar</button>
               </div>
             </div>
         </div>';
     } else {
         $resultado = '
         <div class="modal-dialog">
             <div class="modal-content">
               <div class="modal-header">
                 <button type="button" class="close" data-dismiss="modal">&times;</button>
                 <h4 class="modal-title">Contatos de ' . $usuario->getNome() . '</h4>
               </div>
               <div class="modal-body">
                 <p>
                   <span class="glyphicon glyphicon-envelope"></span>&nbsp;&nbsp;' . $usuario->getEmail() . '<br />
                   <span class="glyphicon glyphicon-phone-alt"></span>&nbsp;&nbsp;' . $usuario->getFoneComercial() . '<br />
                   <span class="glyphicon glyphicon-phone"></span>&nbsp;&nbsp;' . $usuario->getFoneCelular() . '<br />
                 </p>
               </div>
               <div class="modal-footer">
                 <button type="button" class="btn btn-default" data-dismiss="modal">Fechar</button>
               </div>
             </div>
         </div>';
     }
     echo $resultado;
 }
Beispiel #13
0
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
require_once 'av_init.php';
Session::logcheck('analysis-menu', 'EventsForensics');
$db = new ossim_db();
$conn = $db->connect();
$db_id = GET('id');
$update = intval(GET('update'));
ossim_valid($db_id, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _('Database ID'));
if (ossim_error()) {
    die(ossim_error());
}
if ($db_id != '') {
    if ($db_list = Databases::get_list($conn, "WHERE id = '{$db_id}'")) {
        $db = array_shift($db_list);
        $db_name = $db->get_name();
        $ip = $db->get_ip();
        $port = $db->get_port();
        $user = $db->get_user();
        $pass = Util::fake_pass($db->get_pass());
        $icon = $db->get_html_icon();
        $pass2 = $pass;
    }
} else {
    $db_id = '';
    $db_name = '';
    $ip = '';
    $user = '';
    $pass = '';
<?php

include 'Class/Databases.php';
?>
        
<?php 
if (isset($_GET['id'])) {
    $db = new Databases();
    //catching the $_GET[id] variable and passing through get_row_from_databases()
    //function so that i can get spacific result set for updating the result.
    $id = $_GET['id'];
    $result_array = $db->get_row_from_databases($param = ["{$id}"]);
}
if (isset($_POST["btn"])) {
    //gatting all the post value
    $username = $_POST["username"];
    $firstname = $_POST["firstname"];
    $lastname = $_POST["lastname"];
    $email = $_POST["email"];
    $user_id = $_POST["user_id"];
    //assigned variable passing through the updateRow() function.
    //check out databases class updateRow() sql syntex WHERE
    //id = hidden field user_id.it's for updating spacific user row.
    $db->updateRow($param = ["{$username}", "{$firstname}", "{$lastname}", "{$email}", "{$user_id}"]);
}
?>
<!--head html file into template/header.php file just include here-->
<?php 
$title = "Update User Information";
include 'template/header.php';
?>
Beispiel #15
0
">
      <?php 
    echo gettext("Yes");
    ?>
 </a>
      &nbsp;&nbsp;&nbsp;<a href="server.php"> 
      <?php 
    echo gettext("No");
    ?>
 </a>
    </p>
<?php 
    exit;
}
require_once 'ossim_db.inc';
require_once 'classes/Databases.inc';
$db = new ossim_db();
$conn = $db->connect();
Databases::delete($conn, $name);
$db->close($conn);
?>

    <p> <?php 
echo gettext("Server deleted");
?>
 </p>
    <script>document.location.href="dbs.php"</script>
</body>
</html>

Beispiel #16
0
             $li = "title:'{$title}', tooltip:'{$tooltip}', icon:'{$icon}', h:'{$h}', url:'../server/newserverform.php?name=" . $server_url . "'";
             $buffer .= ($j > 0 ? "," : "") . "{ {$li} }";
             $j++;
         }
     } else {
         $buffer .= "{title:'" . _("No Servers Found") . "', noLink:true}";
     }
     $buffer .= "]";
     echo $buffer;
 } else {
     if (preg_match("/databases/", $key)) {
         $buffer = "[";
         if (Session::am_i_admin()) {
             require_once 'classes/Databases.inc';
             $j = 0;
             $databases = Databases::get_list($conn);
             foreach ($databases as $database) {
                 $icon = "../../pixmaps/database.png";
                 $db_name = $database->get_name();
                 $db_title = Util::htmlentities($db_name);
                 $title = strlen($db_name) > $length_name ? substr($db_name, 0, $length_name) . "..." : $db_name;
                 $title = Util::htmlentities($title);
                 $tooltip = $db_title;
                 $li = "title:'{$title}', tooltip:'{$tooltip}', icon:'{$icon}', h:'{$h}', url:'../server/newdbsform.php?name=" . urlencode($db_name) . "'";
                 $buffer .= ($j > 0 ? "," : "") . "{ {$li} }";
                 $j++;
             }
         } else {
             $buffer .= "{title:'" . _("No Databases Found") . "', noLink:true}";
         }
         $buffer .= "]";
Beispiel #17
0
</head>
<body>

<?php 
if (empty($data['data']['db_id'])) {
    if ($data['status'] == 'error') {
        $txt_error = '<div>' . _('We Found the following errors') . ":</div>\n\t\t\t\t\t  <div style='padding: 2px 10px 5px 10px;'>" . implode('<br/>', $validation_errors) . "</div>";
        $config_nt = array('content' => $txt_error, 'options' => array('type' => 'nf_error', 'cancel_button' => FALSE), 'style' => 'width: 80%; margin: 20px auto; text-align: left;');
        $nt = new Notification('nt_1', $config_nt);
        $nt->show();
        Util::make_form('POST', 'newdbsform.php?id=' . $db_id);
        exit;
    }
    $db = new ossim_db();
    $conn = $db->connect();
    Databases::update($conn, $db_id, $db_name, $ip, $port, $user, $pass, $icon);
    Util::memcacheFlush();
    $db->close();
    ?>
	<script type='text/javascript'>
        if (!parent.is_lightbox_loaded(window.name))
        {
            document.location.href="dbs.php?msg=updated";
        }
        else
        {
            document.location.href="newdbsform.php?id=<?php 
    echo $db_id;
    ?>
&update=1";
        }
Beispiel #18
0
 public function listarMinhaEmpresaAction($mensagem = "")
 {
     $empresaCodigo = $this->getParametroTela('empresaCodigo');
     $usuarioCodigo = $this->getParametroTela('usuarioCodigo');
     $situacaoCodigo = $this->getParametroTela('situacaoCodigo');
     $connection = Databases::connect();
     $model = new ChamadosModel();
     $registros = $model->listarMinhaEmpresa($connection, $empresaCodigo, $usuarioCodigo, $situacaoCodigo);
     Databases::disconnect($connection);
     $dados = $this->trabalharDadosListar($registros, $mensagem);
     $this->exibirTelaListar($dados);
 }
 public function excluirAction()
 {
     $id = $this->getParametroTela('id');
     $connection = Databases::connect();
     $mensagem = $this->validarExclusao($id);
     if (substr($mensagem, 0, 1) == 'S') {
         $this->excluirRegistro($connection, $id);
     }
     $dados = $this->carregarDadosListar($connection, $mensagem);
     Databases::disconnect($connection);
     $this->exibirTelaListar($dados);
 }
Beispiel #20
0
<?php

$connection = Databases::connect();
$model = new TiposSistemasModel();
$items = $model->loadByPerfil($connection, $_SESSION['perfilCodigo']);
Databases::disconnect($connection);
$quantidadeCadastros = 0;
foreach ($items as $item) {
    if (substr($item->getDescricao(), 0, 1) == "C") {
        $quantidadeCadastros++;
    }
}
$quantidadeLancamentos = 0;
foreach ($items as $item) {
    if (substr($item->getDescricao(), 0, 1) == "L") {
        $quantidadeLancamentos++;
    }
}
$quantidadeRelatorios = 0;
foreach ($items as $item) {
    if (substr($item->getDescricao(), 0, 1) == "R") {
        $quantidadeRelatorios++;
    }
}
?>

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
Beispiel #21
0
    $filename = $path;
    $handle = fopen($filename, "r");
    $contents = fread($handle, filesize($filename));
    fclose($handle);
    return $contents;
}
// Includes.
require_once 'classes/databases.php';
require_once 'classes/languages.php';
require_once 'classes/libs/Smarty.class.php';
require_once 'classes/templates.php';
require_once 'classes/modules.php';
require_once 'classes/blocks.php';
require_once 'includes/db_info.php';
// Establishing database connection.
$db = new Databases();
switch ($db_type) {
    case 'mysql':
        $db->connect('mysql', $db_host, $db_user, $db_pass, $db_name, $db_prefix);
        break;
    case 'sqlite':
        $db->connect('sqlite', $db_path);
        break;
}
// Setting global variables
$settings = $db->fetch('settings');
$settings = $settings[0];
// Establishing languages.
$lang = new Languages();
// Establishing Smarty and templates.
$smarty = new Smarty();
 public function ajaxExibeImpactoAction()
 {
     $prioridade = $this->getParametroTela('prioridade');
     $impacto = $this->getParametroTela('impacto');
     $exibeAberto = $this->getParametroTela('exibeAberto');
     $usuariosAfetados = $this->getParametroTela('usuariosAfetados');
     $areasAfetadas = $this->getParametroTela('areasAfetadas');
     $connection = Databases::connect();
     $prioridadeModel = new PrioridadesModel();
     $prioridadeVo = $prioridadeModel->loadById($connection, $prioridade);
     Databases::disconnect($connection);
     if ($prioridadeVo->getExibeImpacto() == 1) {
         echo '<label class="control-label col-sm-2" for="impacto">Impacto:</label>
               <div class="col-sm-3">
                 <label class="radio-inline"><input type="radio" id="impactoNao" name="impacto" value="0"' . ($exibeAberto == 1 ? '' : ' disabled="disabled" ') . ($impacto == 0 ? ' checked="checked" ' : '') . ' onchange="alteraImpacto(' . $exibeAberto . ',' . $usuariosAfetados . ',' . $areasAfetadas . ');">' . $prioridadeVo->getExibeImpactoExtensoParam(0) . '</label>
                 <label class="radio-inline"><input type="radio" id="impactoSim" name="impacto" value="1"' . ($exibeAberto == 1 ? '' : ' disabled="disabled" ') . ($impacto == 1 ? ' checked="checked" ' : '') . ' onchange="alteraImpacto(' . $exibeAberto . ',' . $usuariosAfetados . ',' . $areasAfetadas . ');">' . $prioridadeVo->getExibeImpactoExtensoParam(1) . '</label>
               </div>';
     } else {
         echo '<input type="hidden" id="impacto" name="impacto" value="0" />';
     }
 }
Beispiel #23
0
if (Token::verify('tk_db_form', POST('token')) == FALSE) {
    $data['status'] = 'error';
    $data['data'] = Token::create_error_message();
    echo json_encode($data);
    exit;
}
switch ($action) {
    case 'delete_db':
        $validate = array('id' => array('validation' => 'OSS_DIGIT', 'e_message' => 'illegal:' . _('Database ID')));
        $id = POST('id');
        $validation_errors = validate_form_fields('POST', $validate);
        if (is_array($validation_errors) && !empty($validation_errors)) {
            $data['status'] = 'error';
            $data['data'] = _('Error! Database ID not allowed.  Database could not be removed');
        } else {
            try {
                $db = new ossim_db();
                $conn = $db->connect();
                Databases::delete($conn, $id);
                $db->close();
                $data['status'] = 'OK';
                $data['data'] = _('Database removed successfully');
            } catch (Exception $e) {
                $data['status'] = 'error';
                $data['data'] = _('Error! Database could not be removed');
            }
        }
        break;
}
echo json_encode($data);
exit;
Beispiel #24
0
    fclose($handle);
    return $contents;
}
// Includes.
require_once '../classes/databases.php';
require_once '../classes/languages.php';
require_once '../classes/modules.php';
require_once '../classes/users.php';
require_once '../classes/libs/Smarty.class.php';
require_once '../classes/templates.php';
require_once '../includes/db_info.php';
// Defines.
define('FOXY_VERSION', '0.11 alpha');
$time = time();
// Establishing database connection.
$db = new Databases();
switch ($db_type) {
    case 'mysql':
        $db->connect('mysql', $db_host, $db_user, $db_pass, $db_name, $db_prefix);
        break;
    case 'sqlite':
        $db->connect('sqlite', $db_path);
        break;
}
// Setting global variables
$settings = $db->fetch('settings');
$settings = $settings[0];
// Establishing languages.
$lang = new Languages();
// Establishing modules.
$module_dev = new Modules();
Beispiel #25
0
    die(ossim_error());
}
if ($name == "local") {
    header("Content-type: image/png");
    $image = imagecreatefrompng("../forensics/images/home.png");
    if (imageistruecolor($image)) {
        imageAlphaBlending($image, false);
        imageSaveAlpha($image, true);
    }
    imagepng($image);
    imagedestroy($image);
    exit;
}
$db = new ossim_db();
$conn = $db->connect();
$server_list = Databases::get_list($conn, "WHERE name = '{$name}' or ip='{$name}'");
$db->close($conn);
if ($server_list[0]) {
    header("Content-type: image/png");
    $image = @imagecreatefromstring($server_list[0]->get_icon());
    if (!$image) {
        $image = @imagecreatefrompng("../forensics/images/server.png");
    }
    if (imageistruecolor($image)) {
        imageAlphaBlending($image, false);
        imageSaveAlpha($image, true);
    }
    imagepng($image);
    imagedestroy($image);
}
?>
$opensource = !preg_match("/pro|demo/i", $version) ? true : false;
if (!isset($_SESSION["_user"])) {
    $ossim_link = $conf->get_conf("ossim_link", FALSE);
    $login_location = $ossim_link . '/session/login.php';
    header("Location: {$login_location}");
    exit;
}
// Solera API
$_SESSION["_solera"] = $conf->get_conf("solera_enable", FALSE) ? true : false;
//
// Get Host names to translate IP -> Host Name
require_once "ossim_db.inc";
$dbo = new ossim_db();
// Multiple Database Server selector
$conn = $dbo->connect();
$database_servers = Databases::get_list($conn);
$dbo->close();
//
if (is_array($_SESSION["server"]) && $_SESSION["server"][0] != "") {
    $dbo->enable_cache();
    $conn = $dbo->custom_connect($_SESSION["server"][0], $_SESSION["server"][2], $_SESSION["server"][3]);
} else {
    $dbo->enable_cache();
    $conn = $dbo->connect();
}
include_once "{$BASE_path}/base_common.php";
$sensors = $hosts = $ossim_servers = array();
$sensors = Av_sensor::get_basic_list($conn, array(), TRUE);
list($hosts, $host_ids) = Asset_host::get_basic_list($conn, array(), TRUE);
$entities = Session::get_all_entities($conn);
$rep_activities = Reputation::get_reputation_activities($conn, "ORDER BY descr", $db_memcache);
        $_SESSION["ip_field_cnt"] = 1;
    }
}
//
// DATABASES
//
if ($_GET["server"] != "") {
    if ($_GET["server"] == "local") {
        unset($_SESSION["server"]);
    } else {
        $_server = intval($_GET["server"]);
        if ($_server > 0) {
            // Query DB server
            $dbo = new ossim_db();
            $conn = $dbo->connect();
            list($db_server) = Databases::get_list($conn, 'WHERE id = ' . $_server);
            $dbo->close();
            unset($dbo);
            if (is_object($db_server)) {
                $_SESSION["server"] = array($db_server->get_ip(), $db_server->get_port(), $db_server->get_user(), $db_server->get_pass(), $db_server->get_name());
            }
        }
    }
    Util::memcacheFlush(false);
}
if (is_array($_SESSION['server']) && $_SESSION["server"][0] != '') {
    // Change connect variables
    $alert_host = $_SESSION['server'][0];
    $alert_port = $_SESSION['server'][1];
    $alert_user = $_SESSION['server'][2];
    $alert_password = $_SESSION['server'][3];
Beispiel #28
0
 static function getParametro($nome)
 {
     $connection = Databases::connect();
     $model = new ParametrosModel();
     $parametroVo = $model->loadByName($connection, $nome);
     Databases::disconnect($connection);
     return $parametroVo->getValor();
 }
Beispiel #29
0
 function getSource()
 {
     if (!$this->source) {
         return Databases::getDefaultSource();
     } else {
         return Databases::getSource($this->source);
     }
 }
 /** !Route POST, source/$sourceName/table/$tableName/empty */
 public function emptyTablePost($sourceName, $tableName)
 {
     $source = Databases::getSource($sourceName);
     $source->emptyTable($tableName);
     return $this->forwardOk($this->urlTo('showTable', $sourceName, $tableName));
 }