]> git.mxchange.org Git - mailer.git/blobdiff - surfbar.php
Amount of points displayed in surfbar, more fixes
[mailer.git] / surfbar.php
index a5dd72bd508c8a2087edb1eb5da503c2c5afd1a8..703e39be1f498a0abbf9a2f517e7521147d672fd 100644 (file)
@@ -55,10 +55,13 @@ if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_install
        if (!IS_LOGGED_IN()) {
                // Redirect
                LOAD_URL(URL."/modules.php?module=index");
-       } // END - if
+       } elseif (!EXT_IS_ACTIVE("surfbar")) {
+               // Surfbar deactivated
+               LOAD_URL(URL."/modules.php?module=login&msg=".CODE_EXTENSION_PROBLEM);
+       }
 
        // Is there a check value?
-       if (SURFBAR_CHECK_RELOAD_FULL()) {
+       if ((SURFBAR_CHECK_RELOAD_FULL()) || ((isset($_GET['frame'])) && (($_GET['frame'] == "stop") || ($_GET['frame'] == "stop2")))) {
                // Reload-lock is full, surfbar stopped so...
                // Load header
                require_once(PATH."inc/header.php");
@@ -77,8 +80,9 @@ if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_install
                } else {
                        // Prepare content
                        $content = array(
-                               'restart' => $_CONFIG['surfbar_restart_time'],
-                               'start'   => str_repeat("X", strlen($_CONFIG['surfbar_restart_time']))
+                               'restart'   => $_CONFIG['surfbar_restart_time'],
+                               'start'     => str_repeat("X", strlen($_CONFIG['surfbar_restart_time'])),
+                               'autostart' => ($_CONFIG['surfbar_autostart'] == "Y") ? "true" : "false"
                        );
 
                        // Load template for stopped surfbar
@@ -122,6 +126,9 @@ if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_install
 
                        // Is there a valid id?
                        if ($nextId > 0) {
+                               // Get total points amount
+                               $points = GET_TOTAL_DATA($GLOBALS['userid'], "user_points", "points") - GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points");
+
                                // Then prepare other content
                                $content = array(
                                        'id'          => $nextId,
@@ -131,15 +138,19 @@ if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_install
                                        'url'         => SURFBAR_GET_URL($nextId),
                                        'curr_reload' => SURFBAR_GET_USER_RELOAD_LOCK(),
                                        'max_urls'    => SURFBAR_GET_TOTAL_URLS(),
-                                       'reload'      => SURFBAR_GET_RELOAD_TIME($nextId)
-                       );
+                                       'reload'      => SURFBAR_GET_RELOAD_TIME($nextId),
+                                       'points'      => TRANSLATE_COMMA($points)
+                               );
 
                                // Update salt (double-call lock!)
                                SURFBAR_UPDATE_SALT();
                        } else {
-                               // Change template name
-                               $templateName = "surfbar_stopped";
+                               // Load new URL
+                               LOAD_URL("surfbar.php?frame=stop2");
                        }
+               } elseif ((isset($_GET['frame'])) && ($_GET['frame'] == "start")) {
+                       // Starter frame found so let the footer display
+                       unset($_GET['frame']);
                } else {
                        // Load header in frameset mode
                        $isFrameset = true;
@@ -149,6 +160,7 @@ if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_install
                require_once(PATH."inc/header.php");
 
                // Load that template
+               //* DEBUG: */ die("templateName={$templateName}<br />\n<strong>content</strong>=<pre>".print_r($content, true)."</pre>");
                LOAD_TEMPLATE($templateName, false, $content);
        }