function getCurrentVersion($fields) { $base_si_path = realpath(dirname(__FILE__) . '/../'); require_once $base_si_path . '/includes/DBConn.php'; // Check for version using db settings provided by user $DB_SERVER = ''; $DB_DATABASE = ''; $DB_USER = ''; $DB_PASSWORD = ''; if (file_exists($base_si_path . '/includes/global_config.php')) { if (include $base_si_path . '/includes/global_config.php') { if (defined('DB_SERVER') && defined('DB_USER') && defined('DB_PASSWORD') && defined('DB_DATABASE')) { $this->field_values['db_server'] = DB_SERVER; $this->field_values['db_user'] = DB_USER; $this->field_values['db_password'] = DB_PASSWORD; $this->field_values['db_database'] = DB_DATABASE; $DB_SERVER = DB_SERVER; $DB_DATABASE = DB_DATABASE; $DB_USER = DB_USER; $DB_PASSWORD = DB_PASSWORD; } } } if (empty($DB_SERVER) || empty($DB_DATABASE) || empty($DB_USER)) { for ($i = 0; $i < count($fields); $i++) { if ($fields[$i]->name == 'db_server') { $DB_SERVER = $fields[$i]->value; } if ($fields[$i]->name == 'db_database') { $DB_DATABASE = $fields[$i]->value; } if ($fields[$i]->name == 'db_user') { $DB_USER = $fields[$i]->value; } if ($fields[$i]->name == 'db_password') { $DB_PASSWORD = $fields[$i]->value; } } } $db_conn = new DBConn($DB_SERVER, $DB_DATABASE, $DB_USER, $DB_PASSWORD, TRUE); if ($db_conn->connect() == FALSE) { return FALSE; } return $this->_getVersionNumberFromDB($db_conn); }
function fetch_form_list($uid) { global $form_list; global $form_list_size; // permissions should be incorporated here $sql_str = "SELECT " . "tng_form.form_id, " . "tng_form.form_name " . "FROM " . "tng_form " . "INNER JOIN tng_process_form_permissions ON tng_form.form_id = tng_process_form_permissions.form_id " . "WHERE " . "tng_process_form_permissions.uid = " . $_SESSION['obj_login']->uid . " "; $dbconn = new DBConn(); $dbconn->connect(); $result = pg_query($dbconn->conn, $sql_str); if (!$result) { echo "An error occurred while executing the query " . pg_last_error($dbconn->conn); $dbconn->disconnect(); } else { // successfuly ran the query $form_list_size = pg_num_rows($result); // fill the array with the form ids and form names. // each element in the form_list array is an array // of two elements. for ($i = 0; $i < $form_list_size; $i++) { $form_list[$i] = array(pg_fetch_result($result, $i, 0), pg_fetch_result($result, $i, 1)); } } $dbconn->disconnect(); }
$invoices[$row['invoice']]['ids'][] = $ta->id; $checks[$row['check']]['user_id'] = $row['user_id']; $checks[$row['check']]['ids'][] = $ta->cost_trans_id; if ($ta->end_ts > $checks[$row['check']]['timestamp']) { $checks[$row['check']]['timestamp'] = $ta->end_ts; } $checks[$row['check']]['amount'] += $ta->cost; } $task_activity_result->free(); debug('Added task activities to sureinvoice!'); } $si_db = new DBConn(DB_SERVER, DB_DATABASE, DB_USER, DB_PASSWORD); assert_die($si_db->connect(TRUE), "Could not connect to sureinvoice database!\n" . $si_db->getLastError()); debug('Connected to sureinvoice database ' . DB_DATABASE); $dt_db = new DBConn($phpdt_server, $phpdt_database, $phpdt_username, $phpdt_password); assert_die($dt_db->connect(TRUE), "Could not connect to phpdt database!\n" . $dt_db->getLastError()); debug('Connected to phpdt database ' . $phpdt_database); // Migrate companies $companies = array(); $company_rates = array(); $company_sql = "\nSELECT `id`, `name`, `address1`, `address2`, `city`, `state`,\n`zip`, `phone`, `fax`, `hourly_rate`, `created_ts`, `updated_ts`\nFROM `companies`\n"; $company_result = $dt_db->query($company_sql, TRUE); assert_die($company_result, "Could not get company list!\n" . $dt_db->getLastError()); debug('Got ' . $company_result->numRows() . ' company rows from phpdt.'); while ($row = $company_result->fetchArray(MYSQL_ASSOC)) { $company_insert_sql = "\nINSERT INTO companies (id, name, address1, address2, city,\nstate, zip, phone, fax, hourly_rate,created_ts, updated_ts)\nVALUES(" . $row['id'] . ", '" . $si_db->escapeString($row['name']) . "', '" . $row['address1'] . "', \n'" . $row['address2'] . "', '" . $row['city'] . "', '" . $row['state'] . "', \n'" . $row['zip'] . "', '" . $row['phone'] . "', '" . $row['fax'] . "', \n" . $row['hourly_rate'] . ", " . $row['created_ts'] . ", " . $row['updated_ts'] . ")\n\t"; assert_die($si_db->query($company_insert_sql, TRUE), "Error adding company!\n" . $si_db->getLastError(), FALSE); debug('Added ' . $row['name'] . ' to sureinvoice'); $company_rates[$row['id']] = $row['hourly_rate']; $companies[$row['id']] = $row; }
<?php //~ ini_set('display_errors', 0); require_once "servicios.php"; require_once "configuration.php"; set_include_path(get_include_path() . PATH_SEPARATOR . $cscwebPath_g); require_once "dbconn.php"; $dbconn_g = new DBConn($dbConfig_g); $dbconn_g->connect(); $link_g = $dbconn_g->getConnection(); $myws = new Servicios(); $idwsname = isset($_GET['wsname']) ? $_GET['wsname'] : NULL; if (isset($_GET['wsname'])) { $idwsname = $_GET['wsname']; $record = $_GET; } else { if (isset($_POST['wsname'])) { $idwsname = $_POST['wsname']; $record = $_POST; } else { $xml = '<?xml version="1.0"?>'; $xml .= '<result>'; $xml .= '<response>KO</response>'; $xml .= '<description>No existe servicio</description>'; $xml .= '</result>'; } } if ($idwsname != NULL) { $record = isset($_GET['wsname']) ? $_GET : $_POST; if (method_exists($myws, $idwsname)) { $xml = $myws->{$idwsname}($record);
// Installer checks $include_path = realpath(dirname(__FILE__)); if (!file_exists($include_path . '/global_config.php') || filesize($include_path . '/global_config.php') < 10) { if (file_exists(realpath(dirname(__FILE__) . '/../installer') . '/index.php')) { $url = WEB_ROOT . 'installer/'; header("Location: " . $url . "\r\n"); exit; } else { print "No configuration file found: " . $include_path . '/global_config.php' . "<BR>\n"; exit; } } require_once 'DBConn.php'; require_once 'global_config.php'; $db_conn = new DBConn(DB_SERVER, DB_DATABASE, DB_USER, DB_PASSWORD, TRUE); if ($db_conn->connect() == FALSE) { trigger_error("Could not connect to database!\n" . $db_conn->getLastError(), E_USER_ERROR); } $GLOBALS['CONFIG'] = SI_Config::getAppConfig(); require_once 'html.php'; require_once 'SI_User.php'; require_once 'SI_Config.php'; require_once 'SI_TimeImport.php'; require_once 'version.php'; require_once 'SureInvoice.php'; session_start(); ob_start(); // Error handling functions function site_error_handler($errno, $errstr, $errfile, $errline) { $today = date("D M j G:i:s T Y");
<?php require_once '../src/db.php'; require_once '../src/Db.php'; $conn = new DBConn(); $c = $conn->connect(); //SELECT grupo_curso3 . * , curso . * //FROM `curso` //INNER JOIN `grupo_curso3` ON `curso`.`cur_gcu3_id` = `grupo_curso3`.`gcu3_id` //INNER JOIN `grupo_curso2` ON `grupo_curso3`.`gcu3_gcu2_id` = `grupo_curso2`.`gcu2_id` //INNER JOIN `grupo_curso` ON `grupo_curso`.`gcu_id` = `grupo_curso2`.`gcu2_gcu_id` //->leftJoin('grupo_curso3_grupo_curso2', 'grupo_curso3_grupo_curso2.gcu32_id', '=', 'curso.cur_gcu32_id') $query = "SELECT * \nFROM curso \nLEFT JOIN grupo_curso3_grupo_curso2 ON grupo_curso3_grupo_curso2.gcu32_id = curso.cur_gcu32_id\nLEFT JOIN grupo_curso3 ON curso.cur_gcu3_id = grupo_curso3.gcu3_id \nLEFT JOIN grupo_curso2 ON grupo_curso3.gcu3_gcu2_id = grupo_curso2.gcu2_id \nLEFT JOIN grupo_curso ON grupo_curso.gcu_id = grupo_curso2.gcu2_gcu_id \nWHERE curso.cur_ecu_id =1 ORDER BY cur_fechaInicio"; $query = "select * from curso\n inner join grupo_curso3_grupo_curso2 on (gcu32_id = cur_gcu32_id)\n inner join grupo_curso3 on (gcu3_id = gc32_gcu3_id)\n inner join grupo_curso2 on (gcu2_id = gc32_gcu2_id)\n inner join grupo_curso on (gcu_id = gcu2_gcu_id)\nWHERE curso.cur_ecu_id =1 ORDER BY cur_fechaInicio"; //$query = "SELECT * FROM curso INNER JOIN grupo_curso3 ON curso.cur_gcu3_id = grupo_curso3.gcu3_id WHERE curso.cur_ecu_id =1 ORDER BY cur_fechaInicio"; $r = mysqli_query($c, $query); $cursos_activos = array(); $cursos_actuales = array(); while ($row = mysqli_fetch_assoc($r)) { $row['cur_fechaInicio'] = date("d-m-Y", strtotime($row['cur_fechaInicio'])); $row['cur_fechaFin'] = date("d-m-Y", strtotime($row['cur_fechaFin'])); $cursos_activos[] = $row; if (strtotime(date("d-m-Y")) >= strtotime($row['cur_fechaInicio'])) { $cursos_actuales[] = $row; } } $cant_cursos_activos = sizeof($cursos_activos); $cant_cursos_actuales = sizeof($cursos_actuales); //Usuarios para validar $query = "SELECT count(*) as validar FROM usuario_sitio WHERE usi_validado = '-'"; $r = mysqli_query($c, $query);
function get_form_id($submission_id) { $sql_str = "SELECT " . "form_id " . "FROM " . "tng_form_submission " . "WHERE form_submission_id = " . $submission_id; $dbconn = new DBConn(); if ($dbconn == NULL) { die('Could not create connection object'); } $dbconn->connect(); $result = pg_query($dbconn->conn, $sql_str); if (!$result) { echo "An error occurred while executing the query - " . $sql_str . " - " . pg_last_error($dbconn->conn); $dbconn->disconnect(); return false; } $form_id = pg_fetch_result($result, 0, 0); $dbconn->disconnect(); return $form_id; }
$src_layer = OGR_DS_GetLayer($src_ds, 0); if ($src_layer == NULL) { echo "could not open source layer"; return; } $feature_defn = OGR_L_GetLayerDefn($src_layer); /*---------------------------------------------------------------------------------------*/ /* this is done to find out the geometry type only - should be moved to its own function */ $feature = OGR_L_GetNextFeature($src_layer); $geometry = OGR_F_GetGeometryRef($feature); $geom_type = strtolower(OGR_G_GetGeometryName($geometry)); // execute sql command using form id to find out spatial table name and attribute table // namme $sql_str = "SELECT " . "tng_spatial_data.table_name, " . "tng_spatial_attribute_table.attr_table_name " . "FROM " . "tng_form_spatial_data " . "INNER JOIN tng_spatial_data ON tng_form_spatial_data.spatial_table_id = tng_spatial_data.spatial_table_id " . "INNER JOIN tng_spatial_attribute_table on tng_form_spatial_data.spatial_table_id = tng_spatial_attribute_table.spatial_table_id " . "WHERE " . "tng_form_spatial_data.form_id = 1 " . "AND " . "tng_spatial_data.geometry_type = '" . $geom_type . "'"; $dbconn = new DBConn(); $dbconn->connect(); $result = pg_query($dbconn->conn, $sql_str); if (!$result) { echo "An error occurred while executing the query - class_form.php:47 " . pg_last_error($dbconn->conn); $dbconn->disconnect(); } else { $dst_layer_name = pg_fetch_result($result, 0, 0); $dst_attr_table_name = pg_fetch_result($result, 0, 1); $dbconn->disconnect(); } /* end find geometry type */ /*---------------------------------------------------------------------------------------*/ /* get the handle for the destination layer */ $dst_layer = OGR_DS_GetLayerByName($dst_ds, $dst_layer_name); if ($dst_layer == NULL) { echo "could not create a handle for " . $dst_layer_name;