Location: PHPKode > projects > Globber > globber-1.4/admin.php
<?php
session_start();
if($_GET['task']=='logout'){
  unset($_SESSION);
  session_destroy();
  header('location: index.php');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de-de" lang="de-de">
<head>
	<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
	<link rel="stylesheet" media="screen" href="include/admin/css/style.css" type="text/css" />
	<link rel="shortcut icon" href="include/admin/favicon.ico" type="image/x-icon" />
	<link rel="icon" href="include/admin/favicon.ico" type="image/x-icon" />

	
<?php
require('include/blog.class.php');
$blog = new BLOG(false);
if($_POST['secretword']){
  $_SESSION['pass'] = md5($_POST['secretword']);
}
if($_SESSION['pass']!=md5($blog->config['secretword'])){
?>
<title>Globber - Login</title>
</head>
<body>
<div id="login">
<form action="admin.php" method="post">
<h2>Please enter your secret word:</h2>
<input type="password" name="secretword" />
<input type="submit" value="login" />
</form>
</div>
</body>
</html>
<?php
die;
}
?>
<?php
if($_GET['showimages']){
  if($_FILES['img']){
    if(false!==getimagesize($_FILES['img']['tmp_name'])){
      move_uploaded_file($_FILES['img']['tmp_name'], 'images/'.$_FILES['img']['name']);
    }
  }
?>
<style type="text/css" media="screen"> 
<!-- 
  body { margin: 5px; }
  img { max-width: 100%; max-height: 150px; }
  input { padding: 1px; font-size: 8pt; width: 175px; }
--> 
</style>
</head>
<body>
<form action="admin.php?showimages=1" method="post" enctype="multipart/form-data">
<input type="file" name="img" size="8" /><input type="submit" value="upload" />
</form>
<?php
  $img = array();
  $fh = opendir('images');
  while(false !== ($file = readdir($fh))){
    if(is_file('images/'.$file)){
      $img[filemtime('images/'.$file)] = 'images/'.$file;
    }
  }
  krsort($img);
  foreach($img as $key => $val){
    echo "<img src=\"$val\" onclick=\"insert('$val','')\" />";
  }
?>
<script type="text/javascript">
/* <![CDATA[ */

input = parent.document.getElementById('form-content');
var refCounter = 0;

function insert(aTag, eTag, ref) {
	var scrollTop = input.scrollTop; 
	if(typeof input.selectionStart != 'undefined'){
		var start = input.selectionStart;
		var end = input.selectionEnd;
		var insText = input.value.substring(start, end);
		if(ref){
			refCounter++;
			var addRef = '][' + refCounter + ']';
			insText = insText + addRef;
			input.value = input.value + '\n[' + refCounter + ']: ';
			end = end + addRef.length;
		}
		insText = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
		input.value = insText;
	}
	input.focus();
    input.selectionStart = start;
    input.selectionEnd = end + aTag.length + eTag.length;
	input.scrollTop = scrollTop;
}

/* ]]> */
</script>
</body>
</html>
<?php
exit();
}
?>
<?php
if(!$_GET['task']){
  $_GET['task'] = 'articles';
}
?>
<script type="text/javascript" src="include/admin/jscripts/showdown.js"></script>

<title><?php echo $blog->blogname ?> - Administration</title>
</head>
<body>
<div id="header">
<h1><?php echo $blog->blogname ?></h1>
<ul>
<li><a href="admin.php?task=articles"<?php if($_GET['task']=='articles'){echo' class="active"';} ?>>Articles</a></li>
<li><a href="admin.php?task=comments"<?php if($_GET['task']=='comments'){echo' class="active"';} ?>>Comments</a></li>
<li><a href="admin.php?task=flushcache"<?php if($_GET['task']=='flushcache'){echo' class="active"';} ?>>Flush cache</a></li>
<li><a href="admin.php?task=rebuild"<?php if($_GET['task']=='rebuild'){echo' class="active"';} ?>>Rebuild</a></li>
<li><a href="index.php" target="_blank">Preview</a></li>
<li><a href="admin.php?task=logout">Logout</a></li>
</ul>
</div>
<div id="content">
<?php
if($_GET['task']){
  $_EXEC = true;
  require('include/admin/'.$_GET['task'].'.inc.php');
}
else{
  echo 'start';
}
?>
</div>
</body>
</html>
Return current item: Globber