Location: PHPKode > projects > TinyCMS > admin/admin.php
<?php
/**************************
* TinyCMS.net
* TinyCMS - Simple, quick CMS
* Admin Panel Scripts - We advise you do not modify this file unless you have good knowledge of PHP
**************************/
?>
<!DOCTYPE HTML>
<html>
<head>
<title><?php echo $title; ?> - Admin</title>
<link rel="stylesheet" type="text/css" href="../css/admin.css" />
<?php if ($_GET['do'] != "settings"){ ?>
<script type="text/javascript" src="<?php echo $url; ?>/js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="<?php echo $url; ?>/js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="<?php echo $url; ?>/js/qtip.js"></script>
<script type="text/javascript">
// Create the tooltips only on document load
$(document).ready(function() 
{
   // Notice the use of the each() method to acquire access to each elements attributes
   $('#box a[tooltip]').each(function()
   {
      $(this).qtip({
         content: $(this).attr('tooltip'), // Use the tooltip attribute of the element for the content
         style: 'cream' // Give it a crea mstyle to make it stand out
      });
   });
});
</script>
<script type="text/javascript">
	tinyMCE.init({
		// General options
		mode : "textareas",
		theme : "advanced",
		plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",

		// Theme options
		theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
		theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,

		// Example content CSS (should be your site CSS)
		content_css : "<?php echo $url; ?>css/content.css",

		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "<?php echo $url; ?>/admin/lists/template_list.js",
		external_link_list_url : "<?php echo $url; ?>/admin/lists/link_list.js",
		external_image_list_url : "<?php echo $url; ?>/admin/lists/image_list.js",
		media_external_list_url : "<?php echo $url; ?>/admin/lists/media_list.js",

		// Style formats
		style_formats : [
			{title : 'Bold text', inline : 'b'},
			{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
			{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
			{title : 'Table styles'},
			{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
		],
	});
</script>
<?php } ?>
</head>
<body>
  <div id="wrap">
<?php
if($_SESSION['security'] == md5($_SERVER['HTTP_USER_AGENT'])) {
if ($_SESSION['username'] != null){
  // Logged in
  if ($_GET['do'] == "logout"){
    unset($_SESSION['username']);
    unset($_SESSION['security']);
    echo "<meta http-equiv=\"REFRESH\" content=\"0;url=?view=admin&login=quit\">";
    exit();
  }
  ?>
  <div id="title"><a href="<?php echo $url; ?>/admin/"><?php echo $title; ?> Admin</a>  <span style="font-size:13px;">(<a href="../#home" style="color:#808080; text-decoration:none;" target="_blank">Visit</a>)</span></div>
  <div id="box">
    <?php if ($_GET['do'] == null){ ?>
    <h2 style="font-size:14px;">Admin Options</h2>
    <a href="?view=admin&do=pages&create=new" rel="modal" tooltip="Create a new page"><img src="<?php echo $url; ?>/admin/ico/new_page.png"></a>
    <a href="?view=admin&do=pages" rel="modal" tooltip="View a list of pages and manage site pages"><img src="<?php echo $url; ?>/admin/ico/pages.png"></a>
    <a href="?view=admin&do=settings" rel="modal" tooltip="Modify site settings"><img src="<?php echo $url; ?>/admin/ico/settings.png"></a>
    <br /><br />
    <h2 style="font-size:14px;">TinyCMS News</h2>
    <?php 
    // 1.1 administration panel updates
    /************************************/
    $timeouts = stream_context_create(array(
        'http' => array(
            'timeout' => 2 // Seconds to try and load the patch notes & version file
        )
    ));
    $version_check = @file_get_contents('http://tinycms.net/odc_news/versions.txt', 0, $timeouts);
    if ($version_check != $ver_num){ echo "<div id=\"error\" style=\"margin-bottom:3px; color:#BC4040;\">There's a new patch available for TinyCMS</div>"; }
    echo @file_get_contents('http://tinycms.net/odc_news/news.php', 0, $timeouts);
    /************************************/
    ?>
    <?php } elseif ($_GET['do'] == "pages"){
      adminPages();
    } elseif ($_GET['do'] == "settings"){
      showSettings();
    }
    ?>
  </div>
  <?php
}
} else {
// Check if the login form was submitted
if ($_GET['login'] == "1"){
  if (($_POST['username'] == $user) && ($_POST['password'] == $pass)){
    $_SESSION['username'] = "admin/true";
    $_SESSION['security'] = md5($_SERVER['HTTP_USER_AGENT']);
    echo "<meta http-equiv=\"REFRESH\" content=\"0;url=?view=admin\">";
    exit();

  } else {
    echo "<meta http-equiv=\"REFRESH\" content=\"0;url=?view=admin&login=false\">";
    exit();
  }
} else {
// Show a login form
?>
    <div id="login_title"><?php echo $title; ?> Admin</div>
    <div id="box">
      <?php
      if ($_GET['login'] == "false"){
        echo "<div id=\"error\">The username and/or password you entered was incorrect.</div>";
      }
      if ($_GET['login'] == "quit"){
        echo "<div id=\"success\">You are now logged out.</div>";
      }
      ?>
      <!-- Start the form -->
      <form action="?view=admin&login=1" method="post">
        Username<br />
        <input type="text" name="username" autocomplete="off" size="30">
        <br /><br />
        Password<br />
        <input type="password" name="password" autocomplete="off" size="30">
        <br /><br />
        <input type="submit" value="Login">
      </form>
      <!-- End the form -->
    </div>
<?php
} // End login form
} // End login form check
?>
  <div id="footer">
    <div id="left">
      <!-- Please support the development of TinyCMS by donating - Please do not remove the link from the back-end, you may remove the link from the front-end -->
      Powered by TinyCMS <?php echo $ver_num; ?>
    </div>  
    <?php
    if($_SESSION['security'] == md5($_SERVER['HTTP_USER_AGENT'])) {
    if ($_SESSION['username'] != null){
    ?>
    <div id="right">
      <a href="?view=admin&do=logout">Logout</a>
    </div>
    <?php
    }
    }
    ?>
  </div>
  </div>  
</body>
</html>
Return current item: TinyCMS