Phase 1: Update database configuration and schema (OGP to GSP)

Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-09-08 15:45:27 +00:00
parent ea665c34d5
commit 7f19731158
82 changed files with 730 additions and 730 deletions

View file

@ -6,6 +6,6 @@ $db_host="localhost";
$db_user="localuser";
$db_pass="Pkloyn7yvpht!";
$db_name="panel";
$table_prefix="ogp_";
$table_prefix="gsp_";
$db_type="mysql";
?>

View file

@ -3,9 +3,9 @@
* Database connection and query functions
*/
define("OGP_DB_PREFIX", "OGP_DB_PREFIX");
define("GSP_DB_PREFIX", "GSP_DB_PREFIX");
abstract class OGPDatabase {
abstract class GSPDatabase {
protected $queries_ = 0;

View file

@ -12,7 +12,7 @@ function real_escape_string_recursive(&$item, $key, $link){
$item = $this->realEscapeSingle($item);
}
class OGPDatabaseMySQL extends OGPDatabase
class GSPDatabaseMySQL extends GSPDatabase
{
protected $link;
@ -1144,7 +1144,7 @@ class OGPDatabaseMySQL extends OGPDatabase
{
if ( !$this->link ) return FALSE;
$query = str_replace( "OGP_DB_PREFIX", $this->table_prefix, $query );
$query = str_replace( "GSP_DB_PREFIX", $this->table_prefix, $query );
++$this->queries_;
mysqli_query($this->link,$query);
@ -1159,7 +1159,7 @@ class OGPDatabaseMySQL extends OGPDatabase
/// \brief This query return array of values or false on failure.
public function resultQuery( $query ) {
$query = str_replace( "OGP_DB_PREFIX", $this->table_prefix, $query );
$query = str_replace( "GSP_DB_PREFIX", $this->table_prefix, $query );
return $this->listQuery($query);
}
@ -3370,7 +3370,7 @@ class OGPDatabaseMySQL extends OGPDatabase
$user_id = isset($_SESSION['user_id']) ? $_SESSION['user_id'] : 0;
$client_ip = getClientIPAddress();
$message = $this->realEscapeSingle($message);
$this->query("INSERT INTO OGP_DB_PREFIXlogger (date, user_id, ip, message) VALUE (FROM_UNIXTIME(UNIX_TIMESTAMP(), '%d-%m-%Y %H:%i:%s'), $user_id, '$client_ip', '$message');");
$this->query("INSERT INTO GSP_DB_PREFIXlogger (date, user_id, ip, message) VALUE (FROM_UNIXTIME(UNIX_TIMESTAMP(), '%d-%m-%Y %H:%i:%s'), $user_id, '$client_ip', '$message');");
}
public function get_logger_count($search_field) {

View file

@ -34,7 +34,7 @@ function createDatabaseConnection($db_type,$db_host,$db_user,$db_pass,$db_name,$
require_once("includes/database_mysqli.php");
else
die("<p class='failure'>OGP requires the <a href='http://php.net/manual/en/book.mysqli.php' target='_blank'>mysqli PHP extension</a>. Please install it, and then try again.</p>");
$database = new OGPDatabaseMysql();
$database = new GSPDatabaseMysql();
$connect_value = $database->connect($db_host,$db_user,$db_pass,$db_name,$table_prefix);
if ($connect_value === TRUE)
@ -51,7 +51,7 @@ function createDatabaseConnection($db_type,$db_host,$db_user,$db_pass,$db_name,$
function get_db_error_text ($db_retval, &$error_text)
{
if (is_a($db_retval,"OGPDatabase"))
if (is_a($db_retval,"GSPDatabase"))
return FALSE;
switch ($db_retval) {

View file

@ -31,7 +31,7 @@ class OGPView {
function printView($cleared = false, $dataType = "html") {
global $db, $OGPLangPre;
if ( is_object($db) && array_key_exists( "OGPDatabase", class_parents($db) ) ) {
if ( is_object($db) && array_key_exists( "GSPDatabase", class_parents($db) ) ) {
$panel_settings = $db->getSettings();
}
@ -110,7 +110,7 @@ class OGPView {
$javascript .= '</script>' . "\n";
// Include global JS for modules
if(is_object($db) && array_key_exists("OGPDatabase", class_parents($db))){
if(is_object($db) && array_key_exists("GSPDatabase", class_parents($db))){
foreach($db->getInstalledModules() as $m)
{
$global_js_file = 'js/' . MODULES . "{$m['folder']}_global.js";
@ -194,7 +194,7 @@ class OGPView {
$footer = "";
if ( is_object($db) && array_key_exists( "OGPDatabase", class_parents($db) ) ) {
if ( is_object($db) && array_key_exists( "GSPDatabase", class_parents($db) ) ) {
$footer .= "<div class=\"footer center\">";
$footer .= get_lang_f('cur_theme', !empty($_SESSION['users_theme']) ? $_SESSION['users_theme'] : @$panel_settings['theme']) . " - " . $db->getNbOfQueries()." ".get_lang('queries_executed');
$footer .= "<br />".get_lang('copyright')." &copy; <a href=\"http://www.opengamepanel.org\">Open Game Panel</a> " . date("Y") . " - ".get_lang('all_rights_reserved')." - <span class='versionInfo'>".get_lang('show_version')."</span><br /><div class='inline-block OGPVersionArea'><span class='version hide'>" . get_lang('version') . ":</span>&nbsp; <span class='hide versionNumber'>".@$panel_settings['ogp_version']."</span> <span class='copyVersionResult' lang='" . get_lang('copied') . "'></span></div></div>";