Plugin Directory

Changeset 3379179


Ignore:
Timestamp:
10/16/2025 02:01:55 AM (6 months ago)
Author:
thevisad
Message:

Database Corrections

Location:
hngamers-atavism-core
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • hngamers-atavism-core/tags/0.0.16/hngamerscore.php

    r3366147 r3379179  
    1212 * Plugin URI: https://hngamers.com/courses/atavism-wordpress-cms/
    1313 * Description: These are the Core Atavism Settings and are used in each of the addon plugins that will be coming.
    14  * Version: 0.0.14
     14 * Version: 0.0.16
    1515 * Author: thevisad
    1616 * Author URI: https://hngamers.com/
     
    2929        add_action('admin_init', array( $this,'hngamers_core_admin_init'));
    3030        add_action('wp_login', array( $this, 'hngamers_core_get_user_characters'), 10, 2);
    31     add_action('admin_enqueue_scripts', array( $this, 'hngamers_core_admin_styles'), 10, 2);
    32 
     31        add_action('admin_enqueue_scripts', array( $this, 'hngamers_core_admin_styles'), 10, 2);
    3332    }
    3433   
     
    5655       
    5756        if ($this->hngamers_core_check_server_port($db_test_options['hngamers_atavism_master_db_hostname_string'], $db_test_options['hngamers_atavism_master_db_port_string'])) {
    58             $mysqli_conn = new mysqli(
     57            $mysqli_conn = @new mysqli(
    5958                $db_test_options['hngamers_atavism_master_db_hostname_string'],
    6059                $db_test_options['hngamers_atavism_master_db_user_string'],
     
    6362                $db_test_options['hngamers_atavism_master_db_port_string']
    6463            );
     64            if ($mysqli_conn->connect_errno) {
     65                error_log("MySQLi Connection Error: " . $mysqli_conn->connect_error);
     66                return;
     67            }
    6568        } else {
    6669            echo "<font color='red'><b>Failure!</b></font><p>Unable to connect to the server on the specified port.</p>";
     
    8184                INNER JOIN admin.account_character ON `master`.account_character.character_id = admin.account_character.characterId
    8285                WHERE `master`.account.id = ?");
     86               
     87            $user_id = (int) get_current_user_id();
    8388            $stmt->bind_param("i", $user_id);
    8489            $stmt->execute();
     
    167172                    <?php $this->hngamers_core_database_connectivity(); ?>
    168173                </div>
    169                 <?php submit_button(); ?>
     174            </div> <!-- close .wrap if needed -->
     175
     176            <div style="margin-top: 20px;">
     177                <?php submit_button('Save All Settings'); ?>
     178            </div>
     179        </form>
    170180            </form>
    171181        </div>
     
    184194        <?php
    185195    }
     196   
    186197    function hngamers_core_admin_styles() {
    187         wp_enqueue_style('hngamers-admin-styles', plugin_dir_url(__FILE__) . 'hngamers-admin-styles.css');
    188     }
     198        $css_path = plugin_dir_path(__FILE__) . 'hngamers-admin-styles.css';
     199        $css_url  = plugin_dir_url(__FILE__)  . 'hngamers-admin-styles.css';
     200        if ( file_exists($css_path) ) {
     201            wp_enqueue_style('hngamers-admin-styles', $css_url, [], filemtime($css_path));
     202        }
     203    }
     204
    189205   
    190206    function hngamers_core_image_size_fn() {
     
    217233
    218234        if ($this->hngamers_core_check_server_port($hostname, $port)) {
    219             $mysqli_conn = new mysqli($hostname, $user, $password, $schema, $port);
     235            $mysqli_conn = @new mysqli($hostname, $user, $password, $schema, $port);
     236            if ($mysqli_conn->connect_errno) {
     237                error_log("MySQLi Connection Error: " . $mysqli_conn->connect_error);
     238                return;
     239            }
    220240            if ($mysqli_conn && $mysqli_conn->connect_errno) {
    221                 echo "<p class='hngamers-status-failure'><img src='" . $plugin_url . "images/offline$image_set.png' alt='Offline' width='$image_size' height='$image_size'> Failure! " . esc_html($mysqli_conn->connect_error, $domain = 'default') . "</p>";
     241                echo "<p class='hngamers-status-failure'><img src='" . $plugin_url . "images/offline$image_set.png' alt='Offline' width='$image_size' height='$image_size'> Failure! " . esc_html($mysqli_conn->connect_error) . "</p>";
    222242            } else {
    223243                echo "<div class='hngamers-status-row'><span class='label'>Master:</span>
     
    235255        for ($count = 1; $count <= $server_count; $count++) {
    236256            echo '<div class="hngamers-admin-box">';
    237             echo '<h3>Server ' . esc_html($count, $domain = 'default') . '  Database Status</h3>';
     257            echo '<h3>Server ' . esc_html( (string) $count ) . '  Database Status</h3>';
    238258
    239259            // Admin Database
     
    246266            if ($this->hngamers_core_check_server_port($admin_hostname, $admin_port)) {
    247267                echo '<p>Admin: ';
    248                 $mysqli_conn = new mysqli($admin_hostname, $admin_user, $admin_password, $admin_schema, $admin_port);
     268                $mysqli_conn = @new mysqli($admin_hostname, $admin_user, $admin_password, $admin_schema, $admin_port);
     269                if ($mysqli_conn->connect_errno) {
     270                    error_log("MySQLi Connection Error: " . $mysqli_conn->connect_error);
     271                    return;
     272                }
    249273                if ($mysqli_conn && $mysqli_conn->connect_errno) {
    250                     echo "<span class='hngamers-status-failure'><img src='" . $plugin_url . "images/offline$image_set.png' alt='Offline' width='$image_size' height='$image_size'> Failure! " . esc_html($mysqli_conn->connect_error, $domain = 'default') . "</span></p>";
     274                    echo "<span class='hngamers-status-failure'><img src='" . $plugin_url . "images/offline$image_set.png' alt='Offline' width='$image_size' height='$image_size'> Failure! " . esc_html($mysqli_conn->connect_error) . "</span></p>";
    251275                } else if (!$mysqli_conn) {
    252276                    echo "<span class='hngamers-status-failure'><img src='" . $plugin_url . "images/offline$image_set.png' alt='Offline' width='$image_size' height='$image_size'> Database Connection Failure!</span></p>";
     
    268292            if ($this->hngamers_core_check_server_port($atavism_hostname, $atavism_port)) {
    269293                echo '<p>Atavism: ';
    270                 $mysqli_conn = new mysqli($atavism_hostname, $atavism_user, $atavism_password, $atavism_schema, $atavism_port);
     294                $mysqli_conn = @new mysqli($atavism_hostname, $atavism_user, $atavism_password, $atavism_schema, $atavism_port);
     295                if ($mysqli_conn->connect_errno) {
     296                    error_log("MySQLi Connection Error: " . $mysqli_conn->connect_error);
     297                    return;
     298                }
    271299                if ($mysqli_conn && $mysqli_conn->connect_errno) {
    272                     echo "<span class='hngamers-status-failure'><img src='" . $plugin_url . "images/offline$image_set.png' alt='Offline' width='$image_size' height='$image_size'> Failure! " . esc_html($mysqli_conn->connect_error, $domain = 'default') . "</span></p>";
     300                    echo "<span class='hngamers-status-failure'><img src='" . $plugin_url . "images/offline$image_set.png' alt='Offline' width='$image_size' height='$image_size'> Failure! " . esc_html($mysqli_conn->connect_error) . "</span></p>";
    273301                } else if (!$mysqli_conn) {
    274302                    echo "<span class='hngamers-status-failure'><img src='" . $plugin_url . "images/offline$image_set.png' alt='Offline' width='$image_size' height='$image_size'> Database Connection Failure!</span></p>";
     
    291319            if ($this->hngamers_core_check_server_port($worldcontent_hostname, $worldcontent_port)) {
    292320                echo '<p>Content: ';
    293                 $mysqli_conn = new mysqli($worldcontent_hostname, $worldcontent_user, $worldcontent_password, $worldcontent_schema, $worldcontent_port);
     321                $mysqli_conn = @new mysqli($worldcontent_hostname, $worldcontent_user, $worldcontent_password, $worldcontent_schema, $worldcontent_port);
     322                if ($mysqli_conn->connect_errno) {
     323                    error_log("MySQLi Connection Error: " . $mysqli_conn->connect_error);
     324                    return;
     325                }
    294326                if ($mysqli_conn && $mysqli_conn->connect_errno) {
    295                     echo "<span class='hngamers-status-failure'><img src='" . $plugin_url . "images/offline$image_set.png' alt='Offline' width='$image_size' height='$image_size'> Failure! " . esc_html($mysqli_conn->connect_error, $domain = 'default') . "</span></p>";
     327                    echo "<span class='hngamers-status-failure'><img src='" . $plugin_url . "images/offline$image_set.png' alt='Offline' width='$image_size' height='$image_size'> Failure! " . esc_html($mysqli_conn->connect_error) . "</span></p>";
    296328                } else if (!$mysqli_conn) {
    297329                    echo "<span class='hngamers-status-failure'><img src='" . $plugin_url . "images/offline$image_set.png' alt='Offline' width='$image_size' height='$image_size'> Database Connection Failure!</span></p>";
  • hngamers-atavism-core/tags/0.0.16/readme.txt

    r3366147 r3379179  
    44Donate link: https://hngamers.com/support-and-thank-you/
    55Requires at least: 6.0
    6 Tested up to: 6.8.2
     6Tested up to: 6.8.3
    77Requires PHP: 7.4
    8 Stable tag: 0.0.14
     8Stable tag: 0.0.16
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    3131
    3232== Changelog ==
     33= 0.0.16 =
     34Corrected an issue with the database structure and menu layout. This created a potential for a blank page if the database failed and also prevented the save button from rendering.
     35
    3336= 0.0.14 =
     37
    3438Too Tired Release
    3539
  • hngamers-atavism-core/trunk/hngamerscore.php

    r3366147 r3379179  
    1212 * Plugin URI: https://hngamers.com/courses/atavism-wordpress-cms/
    1313 * Description: These are the Core Atavism Settings and are used in each of the addon plugins that will be coming.
    14  * Version: 0.0.14
     14 * Version: 0.0.16
    1515 * Author: thevisad
    1616 * Author URI: https://hngamers.com/
     
    2929        add_action('admin_init', array( $this,'hngamers_core_admin_init'));
    3030        add_action('wp_login', array( $this, 'hngamers_core_get_user_characters'), 10, 2);
    31     add_action('admin_enqueue_scripts', array( $this, 'hngamers_core_admin_styles'), 10, 2);
    32 
     31        add_action('admin_enqueue_scripts', array( $this, 'hngamers_core_admin_styles'), 10, 2);
    3332    }
    3433   
     
    5655       
    5756        if ($this->hngamers_core_check_server_port($db_test_options['hngamers_atavism_master_db_hostname_string'], $db_test_options['hngamers_atavism_master_db_port_string'])) {
    58             $mysqli_conn = new mysqli(
     57            $mysqli_conn = @new mysqli(
    5958                $db_test_options['hngamers_atavism_master_db_hostname_string'],
    6059                $db_test_options['hngamers_atavism_master_db_user_string'],
     
    6362                $db_test_options['hngamers_atavism_master_db_port_string']
    6463            );
     64            if ($mysqli_conn->connect_errno) {
     65                error_log("MySQLi Connection Error: " . $mysqli_conn->connect_error);
     66                return;
     67            }
    6568        } else {
    6669            echo "<font color='red'><b>Failure!</b></font><p>Unable to connect to the server on the specified port.</p>";
     
    8184                INNER JOIN admin.account_character ON `master`.account_character.character_id = admin.account_character.characterId
    8285                WHERE `master`.account.id = ?");
     86               
     87            $user_id = (int) get_current_user_id();
    8388            $stmt->bind_param("i", $user_id);
    8489            $stmt->execute();
     
    167172                    <?php $this->hngamers_core_database_connectivity(); ?>
    168173                </div>
    169                 <?php submit_button(); ?>
     174            </div> <!-- close .wrap if needed -->
     175
     176            <div style="margin-top: 20px;">
     177                <?php submit_button('Save All Settings'); ?>
     178            </div>
     179        </form>
    170180            </form>
    171181        </div>
     
    184194        <?php
    185195    }
     196   
    186197    function hngamers_core_admin_styles() {
    187         wp_enqueue_style('hngamers-admin-styles', plugin_dir_url(__FILE__) . 'hngamers-admin-styles.css');
    188     }
     198        $css_path = plugin_dir_path(__FILE__) . 'hngamers-admin-styles.css';
     199        $css_url  = plugin_dir_url(__FILE__)  . 'hngamers-admin-styles.css';
     200        if ( file_exists($css_path) ) {
     201            wp_enqueue_style('hngamers-admin-styles', $css_url, [], filemtime($css_path));
     202        }
     203    }
     204
    189205   
    190206    function hngamers_core_image_size_fn() {
     
    217233
    218234        if ($this->hngamers_core_check_server_port($hostname, $port)) {
    219             $mysqli_conn = new mysqli($hostname, $user, $password, $schema, $port);
     235            $mysqli_conn = @new mysqli($hostname, $user, $password, $schema, $port);
     236            if ($mysqli_conn->connect_errno) {
     237                error_log("MySQLi Connection Error: " . $mysqli_conn->connect_error);
     238                return;
     239            }
    220240            if ($mysqli_conn && $mysqli_conn->connect_errno) {
    221                 echo "<p class='hngamers-status-failure'><img src='" . $plugin_url . "images/offline$image_set.png' alt='Offline' width='$image_size' height='$image_size'> Failure! " . esc_html($mysqli_conn->connect_error, $domain = 'default') . "</p>";
     241                echo "<p class='hngamers-status-failure'><img src='" . $plugin_url . "images/offline$image_set.png' alt='Offline' width='$image_size' height='$image_size'> Failure! " . esc_html($mysqli_conn->connect_error) . "</p>";
    222242            } else {
    223243                echo "<div class='hngamers-status-row'><span class='label'>Master:</span>
     
    235255        for ($count = 1; $count <= $server_count; $count++) {
    236256            echo '<div class="hngamers-admin-box">';
    237             echo '<h3>Server ' . esc_html($count, $domain = 'default') . '  Database Status</h3>';
     257            echo '<h3>Server ' . esc_html( (string) $count ) . '  Database Status</h3>';
    238258
    239259            // Admin Database
     
    246266            if ($this->hngamers_core_check_server_port($admin_hostname, $admin_port)) {
    247267                echo '<p>Admin: ';
    248                 $mysqli_conn = new mysqli($admin_hostname, $admin_user, $admin_password, $admin_schema, $admin_port);
     268                $mysqli_conn = @new mysqli($admin_hostname, $admin_user, $admin_password, $admin_schema, $admin_port);
     269                if ($mysqli_conn->connect_errno) {
     270                    error_log("MySQLi Connection Error: " . $mysqli_conn->connect_error);
     271                    return;
     272                }
    249273                if ($mysqli_conn && $mysqli_conn->connect_errno) {
    250                     echo "<span class='hngamers-status-failure'><img src='" . $plugin_url . "images/offline$image_set.png' alt='Offline' width='$image_size' height='$image_size'> Failure! " . esc_html($mysqli_conn->connect_error, $domain = 'default') . "</span></p>";
     274                    echo "<span class='hngamers-status-failure'><img src='" . $plugin_url . "images/offline$image_set.png' alt='Offline' width='$image_size' height='$image_size'> Failure! " . esc_html($mysqli_conn->connect_error) . "</span></p>";
    251275                } else if (!$mysqli_conn) {
    252276                    echo "<span class='hngamers-status-failure'><img src='" . $plugin_url . "images/offline$image_set.png' alt='Offline' width='$image_size' height='$image_size'> Database Connection Failure!</span></p>";
     
    268292            if ($this->hngamers_core_check_server_port($atavism_hostname, $atavism_port)) {
    269293                echo '<p>Atavism: ';
    270                 $mysqli_conn = new mysqli($atavism_hostname, $atavism_user, $atavism_password, $atavism_schema, $atavism_port);
     294                $mysqli_conn = @new mysqli($atavism_hostname, $atavism_user, $atavism_password, $atavism_schema, $atavism_port);
     295                if ($mysqli_conn->connect_errno) {
     296                    error_log("MySQLi Connection Error: " . $mysqli_conn->connect_error);
     297                    return;
     298                }
    271299                if ($mysqli_conn && $mysqli_conn->connect_errno) {
    272                     echo "<span class='hngamers-status-failure'><img src='" . $plugin_url . "images/offline$image_set.png' alt='Offline' width='$image_size' height='$image_size'> Failure! " . esc_html($mysqli_conn->connect_error, $domain = 'default') . "</span></p>";
     300                    echo "<span class='hngamers-status-failure'><img src='" . $plugin_url . "images/offline$image_set.png' alt='Offline' width='$image_size' height='$image_size'> Failure! " . esc_html($mysqli_conn->connect_error) . "</span></p>";
    273301                } else if (!$mysqli_conn) {
    274302                    echo "<span class='hngamers-status-failure'><img src='" . $plugin_url . "images/offline$image_set.png' alt='Offline' width='$image_size' height='$image_size'> Database Connection Failure!</span></p>";
     
    291319            if ($this->hngamers_core_check_server_port($worldcontent_hostname, $worldcontent_port)) {
    292320                echo '<p>Content: ';
    293                 $mysqli_conn = new mysqli($worldcontent_hostname, $worldcontent_user, $worldcontent_password, $worldcontent_schema, $worldcontent_port);
     321                $mysqli_conn = @new mysqli($worldcontent_hostname, $worldcontent_user, $worldcontent_password, $worldcontent_schema, $worldcontent_port);
     322                if ($mysqli_conn->connect_errno) {
     323                    error_log("MySQLi Connection Error: " . $mysqli_conn->connect_error);
     324                    return;
     325                }
    294326                if ($mysqli_conn && $mysqli_conn->connect_errno) {
    295                     echo "<span class='hngamers-status-failure'><img src='" . $plugin_url . "images/offline$image_set.png' alt='Offline' width='$image_size' height='$image_size'> Failure! " . esc_html($mysqli_conn->connect_error, $domain = 'default') . "</span></p>";
     327                    echo "<span class='hngamers-status-failure'><img src='" . $plugin_url . "images/offline$image_set.png' alt='Offline' width='$image_size' height='$image_size'> Failure! " . esc_html($mysqli_conn->connect_error) . "</span></p>";
    296328                } else if (!$mysqli_conn) {
    297329                    echo "<span class='hngamers-status-failure'><img src='" . $plugin_url . "images/offline$image_set.png' alt='Offline' width='$image_size' height='$image_size'> Database Connection Failure!</span></p>";
  • hngamers-atavism-core/trunk/readme.txt

    r3366147 r3379179  
    44Donate link: https://hngamers.com/support-and-thank-you/
    55Requires at least: 6.0
    6 Tested up to: 6.8.2
     6Tested up to: 6.8.3
    77Requires PHP: 7.4
    8 Stable tag: 0.0.14
     8Stable tag: 0.0.16
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    3131
    3232== Changelog ==
     33= 0.0.16 =
     34Corrected an issue with the database structure and menu layout. This created a potential for a blank page if the database failed and also prevented the save button from rendering.
     35
    3336= 0.0.14 =
     37
    3438Too Tired Release
    3539
Note: See TracChangeset for help on using the changeset viewer.