Skip to content

Commit

Permalink
add getUrl()
Browse files Browse the repository at this point in the history
  • Loading branch information
till committed Apr 13, 2012
1 parent 31171bc commit 807b0a8
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions memcache.php
Expand Up @@ -50,6 +50,20 @@

///////////MEMCACHE FUNCTIONS /////////////////////////////////////////////////////////////////////

/**
* Return the URL to this script so we can
* adjust it via configuration.
*
* @return string
*/
function getUrl() {
$url = MEMCACHE_SCRIPT;
if (substr($url, -1) != '?') {
$url .= '?';
}
return $url;
}

function sendMemcacheCommands($command){
global $MEMCACHE_SERVERS;
$result = array();
Expand Down Expand Up @@ -307,7 +321,7 @@ function bsize($s) {

// create menu entry
function menu_entry($ob,$title) {
global $PHP_SELF;
$PHP_SELF = getUrl();
if ($ob==$_GET['op']){
return "<li><a class=\"child_active\" href=\"$PHP_SELF&op=$ob\">$title</a></li>";
}
Expand Down Expand Up @@ -550,7 +564,7 @@ function getFooter(){

}
function getMenu(){
global $PHP_SELF;
$PHP_SELF = getUrl();
echo "<ol class=menu>";
if ($_GET['op']!=4){
echo <<<EOB
Expand All @@ -575,10 +589,9 @@ function getMenu(){

// TODO, AUTH

$_GET['op'] = !isset($_GET['op'])? '1':$_GET['op'];
$PHP_SELF= isset($_SERVER['PHP_SELF']) ? htmlentities(strip_tags($_SERVER['PHP_SELF'],'')) : '';
$PHP_SELF = getUrl();

$PHP_SELF=$PHP_SELF.'?';
$_GET['op'] = !isset($_GET['op'])? '1':$_GET['op'];
$time = time();
// sanitize _GET

Expand Down

0 comments on commit 807b0a8

Please sign in to comment.