/** * Get Nonce * * @since 2.03 * @author tankmiche * @uses $USR * @uses $SALT * * @param string $action Id of current page * @param string $file Optional, default is empty string * @param bool $last * @return string */ function get_nonce($action, $file = "", $last = false) { global $USR; global $SALT; // set nonce_timeout default and clamps include_once GSADMININCPATH . 'configuration.php'; clamp($nonce_timeout, 60, 86400, 3600); // min, max, default in seconds // $nonce_timeout = 10; if ($file == "") { $file = getScriptFile(); } // using user agent since ip can change on proxys $uid = $_SERVER['HTTP_USER_AGENT']; // set nonce time domain to $nonce_timeout or $nonce_timeout x 2 when last is $true $time = $last ? time() - $nonce_timeout : time(); $time = floor($time / $nonce_timeout); // Mix with a little salt $hash = sha1($action . $file . $uid . $USR . $SALT . $time); return $hash; }
/** * Myself * * Returns the page itself * * @since 2.04 * @author ccagle8 * * @param bool $echo * @return string */ function myself($echo = true) { if ($echo) { echo htmlentities(basename(getScriptFile()), ENT_QUOTES); } else { return htmlentities(basename(getScriptFile()), ENT_QUOTES); } }
/** * Create Navigation Tab * * This adds a top level tab to the control panel * * @since 2.0 * @uses $plugins * * @param string $id Id of current page * @param string $txt Text to add to tabbed link * @param string $klass class to add to a element */ function createNavTab($tabname, $id, $txt, $action = null) { global $plugin_info; $current = false; if (basename(getScriptFile()) == 'load.php') { $plugin_id = @$_GET['id']; if ($plugin_info[$plugin_id]['page_type'] == $tabname) { $current = true; } } echo '<li id="nav_' . $id . '" class="plugin_tab"><a href="load.php?id=' . $id . ($action ? '&' . $action : '') . '" ' . ($current ? 'class="current"' : '') . ' >' . $txt . '</a></li>'; }