function db_exists($prefix = '') { $exists = false; $db = db_connect($config, "", "", "information_schema", $prefix); if ($db) { $stmt = new db_stmt_select("schemata"); $stmt->addColumn("count(*)"); $stmt->setWhereClause("schema_name = '" . $config->get("database.dbname") . "'"); $s = $stmt->getStatement(); $rs = $db->Execute($s); if ($rs) { $exists = $rs->fields[0] == "1"; } } return $exists; }
function reload($config, $prefix = '') { $db = db_connect($config, "", "", "", $prefix); if ($db) { $stmt = new db_stmt_select("users"); $stmt->addColumn("*"); $whereclause = "id='" . $this->id . "'"; $stmt->setWhereClause($whereclause); $s = $stmt->getStatement(); $rs = $db->Execute($s); if ($rs) { if ($rs->RecordCount() == 1) { $this->password = decrypt($rs->fields["user_password"]); $this->email = $rs->fields["user_email"]; $this->level = $rs->fields["user_level"]; $this->expiry = $rs->fields["subscription_date_end"]; $this->plan = $rs->fields["subscription_type"]; $this->postal_address = $rs->fields["invoice_address"]; $this->country_code = $rs->fields["invoice_country_code"]; $this->enabled = $rs->fields["enabled"]; $this->paiment_status = $rs->fields["paiment_status"]; $this->paiment_price_due = $rs->fields["paiment_price_due"]; $this->renew_plan = $rs->fields["renew_type"]; $this->renew_date_end = $rs->fields["renew_date_end"]; $this->tva_intra = $rs->fields["invoice_tva_intra"]; return true; } } } return false; }
function getInstanceList($db, $user, $config, $where) { $stmt = new db_stmt_select("instances"); $stmt->addColumn("*"); $stmt->setWhereClause($where); $stmt->setOrderBy("name"); $s = $stmt->getStatement(); $rs = $db->Execute($s); if (!$rs) { return ""; } $rs->MoveFirst(); $count = 0; $res2 = ""; while (!$rs->EOF) { $count++; $core_url = concatPath($rs->fields["solr_php_ws_root"], "/core_" . $rs->fields["uuid"] . "/"); //$url_search = "index.php?core=" . urlencode($core_url); //if ($search_php_config!="") //$url_search .= "&config=" . $search_php_config; //$key = base64_encode ($core_url . "|" . $config_file); $key = base64_encode($core_url); $res2 .= "<tr>"; $res2 .= "<td>"; $res2 .= "<a href='index.php?key=" . $key . "' title='Search'>"; $res2 .= $rs->fields["name"]; // . " (id=" . $rs->fields["id"] . ")"; $res2 .= "</a>"; $res2 .= "</td>"; if ($user->getPlan() != "perso") { $res2 .= "<td width='20%'>"; $res2 .= "<img src='images/" . getSolrTypeMnemo($rs->fields["type"]) . "_icone.png' class='img_icone'> "; $res2 .= getSolrTypeLabel($rs->fields["type"]); $res2 .= "</td>"; } $res2 .= "</tr>"; $rs->MoveNext(); } if ($count == 0) { $res = "<br /><div style='text-align: center;'>no instance yet !</div>"; } else { $res = "<center>Choose an instance<br /><table border='0' cellspacing='0' cellpadding='0'>"; if ($user->getPlan() != "perso") { $res .= "<tr><th>Name</th><th>Type</th></tr>"; } else { $res .= "<tr><th>Name</th></tr>"; } $res .= $res2; $res .= "</table></center>"; } return $res; }