Initial commit

This commit is contained in:
Felix Förtsch
2020-10-20 14:39:50 +02:00
commit 648ded8896
1225 changed files with 216511 additions and 0 deletions

View File

@@ -0,0 +1,254 @@
<?php
/**
* Log Viewer
*
* @package Log_Viewer_Admin
* @author Markus Fischbacher <fischbacher.markus@gmail.com>
* @license GPL-2.0+
* @link http://wordpress.org/extend/plugins/log-viewer/
* @copyright 2013 Markus Fischbacher
*/
/**
* Class Log_Viewer_Admin
*
* Main class for admin functionality
*/
class Log_Viewer_Admin
{
/**
* Plugin version ( long with timestamp ).
*
* @since 13.11.10
*
* @var string
*/
const VERSION = '14.05.04-1559';
/**
* Plugin version, used for cache-busting of style and script file references.
*
* @since 13.11.11
*
* @var string
*/
const VERSION_SHORT = '14.05.04';
/**
* Unique identifier for your plugin.
*
* The variable name is used as the text domain when internationalizing strings
* of text. Its value should match the Text Domain file header in the main
* plugin file.
*
* @since 13.11.10
*
* @var string
*/
protected $plugin_slug = 'log-viewer';
/**
* Instance of this class.
*
* @since 13.11.10
*
* @var Log_Viewer_Admin
*/
protected static $instance = null;
/**
* Slug of the plugin screen.
*
* @since 13.11.10
*
* @var string
*/
protected $plugin_screen_hook_suffix = null;
/**
*
*
* @since 13.11.10
*
* @var Files_View_Page
*/
private $_files_view_page = null;
/**
* Initialize the plugin by loading admin scripts & styles and adding a
* settings page and menu.
*
* @since 13.11.10
*/
private function __construct()
{
if( !is_super_admin() ) {
return;
}
// Add menu entries
add_action( 'admin_menu', array( $this, 'add_plugin_admin_menu' ) );
}
/**
* Return an instance of this class or false on error.
*
* @since 13.11.10
*
* @return bool|Log_Viewer_Admin A single instance of this class.
*/
public static function get_instance()
{
if( !is_super_admin() ) {
return false;
}
// If the single instance hasn't been set, set it now.
if( null == self::$instance ) {
self::$instance = new self;
}
return self::$instance;
}
/**
* Make sure that the file that was requested to edit, is allowed to be edited
*
* Function will die if if you are not allowed to edit the file
*
* ToDo: pasted from wordpress core. other solution?
*
* @since 14.04.21
*
* @param $file
* @param string $allowed_files
*
* @return mixed
*/
public static function validate_file_to_edit( $file, $allowed_files = '' ) {
$code = validate_file( $file, $allowed_files );
if (!$code )
return $file;
switch ( $code ) {
case 1 :
wp_die( __('Sorry, can&#8217;t edit files with &#8220;..&#8221; in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.' ));
case 3 :
wp_die( __('Sorry, that file cannot be edited.' ));
}
}
/**
* Wrapper for getting Files View Page
*
* @since 14.04.21
*
* @return Files_View_Page
*/
public function get_Files_View_Page() {
if( $this->_files_view_page === null ) {
/**
* Add a tools page for viewing the log files
*/
require_once 'includes/class-user-options.php';
require_once 'includes/class-files-view-page.php';
$this->_files_view_page = new Files_View_Page( realpath( __DIR__ . DIRECTORY_SEPARATOR . 'views' ) );
}
return $this->_files_view_page;
}
/**
* Register and enqueue admin-specific style sheet.
*
* @since 13.11.10
*
* @return null Return early if no settings page is registered.
*/
public function enqueue_admin_styles()
{
if( !isset( $this->plugin_screen_hook_suffix ) ) {
return;
}
$screen = get_current_screen();
if( $this->plugin_screen_hook_suffix == $screen->id ) {
wp_enqueue_style( $this->plugin_slug . '-admin-styles', plugins_url( 'assets/css/admin.css', __FILE__ ), array(), Log_Viewer_Admin::VERSION );
}
}
/**
* Register and enqueue admin-specific JavaScript.
*
* @since 13.11.10
*
* @return null Return early if no settings page is registered.
*/
public function enqueue_admin_scripts()
{
if( !isset( $this->plugin_screen_hook_suffix ) ) {
return;
}
$screen = get_current_screen();
if( $this->plugin_screen_hook_suffix == $screen->id ) {
wp_enqueue_script( $this->plugin_slug . '-admin-script', plugins_url( 'assets/js/admin.js', __FILE__ ), array( 'jquery' ), Log_Viewer_Admin::VERSION );
}
}
/**
* Register the administration menu for this plugin into the WordPress Dashboard menu.
*
* @since 13.11.10
*/
public function add_plugin_admin_menu()
{
$this->get_Files_View_Page();
}
/**
* Returns an array with filenames relative to WP_CONTENT_DIR
*
* @since 30.11.2013
*
* @return array
*/
public static function getFiles()
{
// TODO - FUTURE - debug.log always 0
$content_dir = realpath( WP_CONTENT_DIR );
$path = $content_dir . DIRECTORY_SEPARATOR . '*.log';
$replace = $content_dir . DIRECTORY_SEPARATOR;
$files = array();
foreach( array_reverse( glob( $path ) ) as $file ) {
$files[] = str_replace( $replace, '', $file );
}
return $files;
}
/**
* Retruns the real path ( WP Content Dir ) of the file
*
* @param $file
*
* @return string
*/
public static function transformFilePath( $file )
{
$path = realpath( WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $file );
return $path;
}
}

View File

@@ -0,0 +1,396 @@
<?php
/**
* Log Viewer
*
* @package Log_Viewer_Admin
* @author Markus Fischbacher <fischbacher.markus@gmail.com>
* @license GPL-2.0+
* @link http://wordpress.org/extend/plugins/log-viewer/
* @copyright 2013 Markus Fischbacher
*/
/**
* Class Files_View_Page
*
* Provides controller functionality for the Files View page
*/
class Files_View_Page
{
/**
* @var string
*/
private static $_KEYS_FILEACTION_SUBMIT = 'fileactions';
/**
* @var string
*/
private static $_KEYS_FILEACTION_ACTION = 'action';
/**
* @var string
*/
private static $_KEYS_FILEACTION_SCROLLTO = 'scrollto';
/**
* @var string
*/
private static $_KEYS_FILEACTION_FILE = 'file';
/**
* @var string
*/
private static $_KEYS_FILEACTIONS_DUMP = 'dump';
/**
* @var string
*/
private static $_KEYS_FILEACTIONS_EMPTY = 'empty';
/**
* @var string
*/
private static $_KEYS_FILEACTIONS_BREAK = 'break';
/**
* @var string
*/
private static $_KEYS_VIEWFIELDS_SUBMIT = 'viewfields';
/**
* @var string
*/
public static $ACTIONS_VIEWOPTIONS_CHANGED = 'ViewOptions_Changed';
/**
* @var bool
*/
private $_currentFile = false;
/**
* The hook name for this page
*
* @var string
*/
public $_hook_name = null;
/**
* @var WP_Screen
*/
protected $_wpScreen;
/**
* The slug name for the parent menu
*
* @see http://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters
*
* @var string
*/
private static $_parent_slug = 'tools.php';
/**
* The text to be displayed in the title tags of the page when the menu is selected
*
* @var string
*/
private $_page_title = 'Files View';
/**
* The text to be used for the menu
*
* @var string
*/
private $_menu_title = 'Log Viewer';
/**
* The capability required for this menu to be displayed to the user.
*
* @see http://codex.wordpress.org/Roles_and_Capabilities
*
* @var string
*/
private $_capability = 'edit_plugins';
/**
* The slug name to refer to this menu by
*
* @var string
*/
private static $_menu_slug = 'log_viewer_files_view';
/**
* Filename for the view template. Prefixed with view_path of class constructor.
*
* @var string
*/
private $_view_file = 'files-view.php';
/**
* Fetches a WP_Screen object for this page.
*
* @see http://codex.wordpress.org/Class_Reference/WP_Screen
*
* @return WP_Screen
*/
public function getWPScreen()
{
if( !$this->_wpScreen ) {
$this->_wpScreen = WP_Screen::get( $this->_hook_name );
}
return $this->_wpScreen;
}
/**
* Returns the admin_url for this page.
*
* @see http://codex.wordpress.org/Function_Reference/admin_url
*
* @return string|void
*/
public static function getPageUrl()
{
$url = admin_url( self::$_parent_slug, 'admin' );
$url .= "?page=" . self::$_menu_slug;
return $url;
}
/**
* Constructor for this class.
*
* @param string $view_path View templates directory
*/
public function __construct( $view_path = '' )
{
$this->_hook_name = add_submenu_page( self::$_parent_slug, $this->_page_title, $this->_menu_title, $this->_capability, self::$_menu_slug, array( $this, 'view_page' ) );
$this->_view_file = realpath( $view_path . DIRECTORY_SEPARATOR . $this->_view_file );
// saves user options on changed settings
add_action( self::$ACTIONS_VIEWOPTIONS_CHANGED, array( 'User_Options', 'updateUserOptions' ) );
}
/**
* Returns current/active filename or false if none active or
* reads file request parameter to set the current file
*
* @return bool|string
*/
public function getCurrentFile()
{
if( false == $this->_currentFile ) {
$files = Log_Viewer_Admin::getFiles();
if( empty( $files ) ) {
return false;
}
if( isset( $_REQUEST['file'] ) ) {
$file = stripslashes( $_REQUEST['file'] );
} else {
$file = $files[0];
}
validate_file_to_edit( $file, $files );
$this->_currentFile = $file;
}
return $this->_currentFile;
}
/**
* Returns content of current file
*
* @return string
*/
public function getCurrentFileContent()
{
if( !$this->getCurrentFile() ) {
return '';
}
if( User_Options::LINEOUTPUTORDER_FILO == User_Options::getLineOutputOrder() ) {
$content = implode( array_reverse( file( Log_Viewer_Admin::transformFilePath( $this->getCurrentFile() ) ) ) );
} else {
$content = file_get_contents( Log_Viewer_Admin::transformFilePath( $this->getCurrentFile() ), false );
}
return $content;
}
/**
* Dumps the given file
* Respects is writeable
*
* @param $file
*
* @return bool|int
*/
private function _dumpFile( $file )
{
if( !is_writable( $file ) ) {
return -1;
}
$result = unlink( $file );
if( true == $result ) {
$this->_currentFile = false;
}
return $result;
}
/**
* Empties the given file
* Respects is writeable
*
* @param $file
*
* @return bool|int
*/
private function _emptyFile( $file )
{
if( !is_writable( $file ) ) {
return -1;
}
$handle = fopen( $file, 'w' );
if( !$handle ) {
return -2;
}
return fclose( $handle );
}
/**
* Appends break string to given file
* respects is writeable
*
* TODO - FUTURE :
* - user defined break string
*
* @param $file
*
* @return bool|int
*/
private function _appendBreak( $file )
{
if( !is_writable( $file ) ) {
return -1;
}
$handle = fopen( $file, 'a' );
if( !$handle ) {
return -2;
}
fwrite( $handle, '------------------------' );
return fclose( $handle );
}
/**
* Handles file actions of page post
*
* TODO - FUTURE :
* - adding update_recently_edited of wp core?
* - reimplementing message handling
*
* @param $fileaction action to handle
* @param $file file to target
*
* @return $this|bool|int
*/
private function _handle_fileaction( $fileaction, $file )
{
$files = Log_Viewer_Admin::getFiles();
validate_file_to_edit( $file, $files );
$realfile = Log_Viewer_Admin::transformFilePath( $file );
switch( $fileaction ) {
case self::$_KEYS_FILEACTIONS_DUMP:
$dumped = $this->_dumpFile( $realfile );
// BUG: better redirect but not working cause already present output
// wp_redirect( $this->getPageUrl() );
//exit();
// Workaround:
unset( $_POST[self::$_KEYS_FILEACTION_ACTION], $_POST[self::$_KEYS_FILEACTION_FILE], $_POST[self::$_KEYS_FILEACTION_SUBMIT], $_POST[self::$_KEYS_FILEACTION_SCROLLTO], $_REQUEST['file'] );
$this->_currentFile = false;
break;
case self::$_KEYS_FILEACTIONS_EMPTY:
$handle = $this->_emptyFile( $realfile );
return $handle;
break;
case self::$_KEYS_FILEACTIONS_BREAK:
$handle = $this->_appendBreak( $realfile );
return $handle;
break;
default:
break;
}
return $this;
}
/**
* Handles page view with post actions and output
* Respects user options
*
* TODO - FUTURE :
* - splitting functionality / event based
*
*/
public function view_page()
{
if( array_key_exists( self::$_KEYS_FILEACTION_SUBMIT, $_POST ) && check_admin_referer( 'actions_nonce', 'actions_nonce' ) ) {
$file = $_POST[self::$_KEYS_FILEACTION_FILE];
$fileaction = $_POST[self::$_KEYS_FILEACTION_ACTION];
$result = $this->_handle_fileaction( $fileaction, $file );
// Bug: Workaround for wp_redirect not working
unset( $file, $fileaction );
}
if( array_key_exists( self::$_KEYS_VIEWFIELDS_SUBMIT, $_POST ) && check_admin_referer( 'viewoptions_nonce', 'viewoptions_nonce' ) ) {
$viewoptions = array(
User_Options::KEYS_AUTOREFRESH => array_key_exists( User_Options::KEYS_AUTOREFRESH, $_POST ) ? 1 : 0,
);
if( array_key_exists( User_Options::KEYS_LINEOUTPUTORDER, $_POST ) ) {
$viewoptions[User_Options::KEYS_LINEOUTPUTORDER] = (int)$_POST[User_Options::KEYS_LINEOUTPUTORDER];
}
do_action( self::$ACTIONS_VIEWOPTIONS_CHANGED, $viewoptions );
}
$files = Log_Viewer_Admin::getFiles();
$showEditSection = true;
if( empty( $files ) ) {
$showEditSection = false;
}
$realfile = Log_Viewer_Admin::transformFilePath( $this->getCurrentFile() );
$writeable = is_writeable( $realfile );
if( isset( $file ) ) {
var_dump( array( $realfile, $writeable ) );
die();
}
if( !$writeable ) {
$action = false;
}
include_once $this->_view_file;
}
}

View File

@@ -0,0 +1,223 @@
<?php
/**
* Log Viewer
*
* @package Log_Viewer_Admin
* @author Markus Fischbacher <fischbacher.markus@gmail.com>
* @license GPL-2.0+
* @link http://wordpress.org/extend/plugins/log-viewer/
* @copyright 2013 Markus Fischbacher
*/
/**
* Class User_Options
*
* Controls storage and access of user options
* After setting new values, update function has to be called to save to database
*
* TODO - FUTURE :
* - user wordpress *_user_setting ? currently problems with cookie/headers_sent
* - cleanup on uninstall ( multisite installations different options tables )
*
* Bugs :
* - User_Options on MU installations stored in each wp_*_options table
*
*/
class User_Options
{
/**
* Unique string to identify option keys ( appends to user id )
*/
const KEYS_IDENTIFIER = '_log-viewer_settings';
/**
* Line output order of files : First-In-First-Out
*/
const LINEOUTPUTORDER_FIFO = 0;
/**
* Line output order of files : First-In-Last-Out
*/
const LINEOUTPUTORDER_FILO = 1;
/**
* Options keys : autorefresh
*/
const KEYS_AUTOREFRESH = 'autorefresh';
/**
* Options keys : interval of autorefresh
*/
const KEYS_AUTOREFRESHINTERVALL = 'arintervall';
/**
* Options keys : order of line output
*/
const KEYS_LINEOUTPUTORDER = 'lineoutputorder';
/**
* Options keys : options version
*/
const KEYS_OPTIONSVERSION = 'version';
/**
* Buffered/current options
*
* @var array|bool
*/
private static $_options = false;
/**
* Default values of options
*
* @var array
*/
private static $_defaultOptions = array(
self::KEYS_AUTOREFRESH => 1, self::KEYS_AUTOREFRESHINTERVALL => 15, self::KEYS_LINEOUTPUTORDER => self::LINEOUTPUTORDER_FIFO, self::KEYS_OPTIONSVERSION => '14.05.04-1559',
);
/**
* Returns value of Autorefresh; 1 if enabled, 0 if disabled
*
* @return int
*/
public static function getAutoRefresh()
{
if( !self::$_options ) {
self::_loadUserOptions();
}
return self::$_options[self::KEYS_AUTOREFRESH];
}
/**
* Sets value of autorefresh; true for enabled, false for disabled
*
* @param bool $enabled
*/
public static function setAutoRefresh( $enabled = true )
{
if( !self::$_options ) {
self::_loadUserOptions();
}
self::$_options[self::KEYS_AUTOREFRESH] = $enabled ? 1 : 0;
}
/**
* Returns interval of autorefresh
*
* @return int
*/
public static function getAutoRefreshIntervall()
{
if( !self::$_options ) {
self::_loadUserOptions();
}
return self::$_options[self::KEYS_AUTOREFRESHINTERVALL];
}
/**
* Returns order of line output
*
* @see Lineoutput constants
*
* @return int
*/
public static function getLineOutputOrder()
{
if( !self::$_options ) {
self::_loadUserOptions();
}
return self::$_options[self::KEYS_LINEOUTPUTORDER];
}
/**
* Handles loading of options out of database
*
* TODO - FUTURE :
* - TODO better management of updated options, currently only overwriting old settings
*/
private static function _loadUserOptions()
{
/*
* usage of user setting functions
* currently problems with headers sent
*
* $us = get_user_setting( 'log-viewer', false );
if( ! $us ) {
set_user_setting( 'log-viewer', self::$_defaultOptions );
$us = get_user_setting( 'log-viewer', false );
}
if( !$us ) {
error_log( 'cant load/set user settings' );
} else {
var_dump( $us );
}
*/
if( !is_user_logged_in() ) {
self::$_options = self::$_defaultOptions;
return;
}
$user = wp_get_current_user();
$key = sprintf( "%s_log-viewer_settings", $user->ID );
$settings = get_option( $key, false );
if( false === $settings ) {
add_option( $key, self::$_defaultOptions );
$settings = self::$_defaultOptions;
} elseif( !is_array( $settings ) || !array_key_exists( self::KEYS_OPTIONSVERSION, $settings ) ) {
update_option( $key, self::$_defaultOptions );
$settings = self::$_defaultOptions;
}
self::$_options = $settings;
}
/**
* Returns array of current values
*
* @return array|bool
*/
public static function toArray()
{
if( !self::$_options ) {
self::_loadUserOptions();
}
return self::$_options;
}
/**
* Saves newOptions to database and sets/caches current options for direct usage
* respects multiuser
*
* @param array $newOptions
*/
public static function updateUserOptions( $newOptions = array() )
{
if( !is_user_logged_in() ) {
return;
}
if( empty( $newOptions ) ) {
$newOptions = self::toArray();
} else {
$newOptions = wp_parse_args( $newOptions, self::toArray() );
}
$user = wp_get_current_user();
$key = sprintf( "%s%s", $user->ID, self::KEYS_IDENTIFIER );
$oldOptions = get_option( $key, false );
if( $newOptions != $oldOptions ) {
update_option( $key, $newOptions );
self::$_options = $newOptions;
}
}
}

View File

@@ -0,0 +1,178 @@
<?php
/**
* Represents the view for the administration dashboard.
*
* This includes the header, options, and other information that should provide
* The User Interface to the end user.
*
* @package log-viewer
* @author Markus Fischbacher <fischbacher.markus@gmail.com>
* @license GPL-2.0+
* @link http://wordpress.org/extend/plugins/log-viewer/
* @copyright 2013 Markus Fischbacher
*/
?>
<div class="wrap">
<h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
<?php // dumped file messages
if( isset( $dumped ) ) {
if( $dumped ) : ?>
<div id="message" class="updated">
<p><?php _e( 'File dumped successfully.' ); ?></p>
</div>
<?php return;
else :
?>
<div id="message" class="error">
<p><?php _e( 'Could not dump file.' ); ?></p>
</div>
<?php endif; // if $dumped
} // isset $dumped
// end - dumped file messages
?>
<?php // emptied/break file messages
if( isset( $handle ) ) {
if( !$handle ) : ?>
<div id="message" class="error">
<p><?php _e( 'Could not update file.' ); ?></p>
</div>
<?php else : ?>
<div id="message" class="updated">
<p><?php _e( 'File updated successfully.' ); ?></p>
</div>
<?php endif;
} // isset $handle
// end - emptied/break file messages
?>
<?php if( !$files ) : ?>
<div id="message" class="updated">
<p><?php _e( 'No files found.' ); ?></p>
</div>
<?php endif; ?>
<?php if( !$writeable ) : ?>
<div id="message" class="updated">
<p><?php _e( sprintf( 'You can not edit file [%s] ( not writeable ).', $this->getCurrentFile() ) ); ?></p>
</div>
<?php endif;
?>
<?php if( $showEditSection ) : ?>
<div class="fileedit-sub">
<?php printf( '%1$s <strong>%2$s</strong>', __( 'Showing' ), str_replace( realpath( ABSPATH ), "", $realfile ) ) ?>
<div class="tablenav top">
<?php if( $writeable ) : ?>
<div class="alignleft">
<form method="post" action="<?php echo $this->getPageUrl(); ?>">
<?php wp_nonce_field( 'actions_nonce', 'actions_nonce' ); ?>
<input type="hidden" value="<?php echo $this->getCurrentFile(); ?>"
name="<?php echo self::$_KEYS_FILEACTION_FILE; ?>" />
<input id="scrollto" type="hidden" value="0"
name="<?php echo self::$_KEYS_FILEACTION_SCROLLTO; ?>">
<select name="<?php echo self::$_KEYS_FILEACTION_ACTION; ?>">
<option selected="selected" value="-1"><?php _e( 'File Actions' ); ?></option>
<option
value="<?php echo self::$_KEYS_FILEACTIONS_DUMP; ?>"><?php _e( 'Dump' ); ?></option>
<option
value="<?php echo self::$_KEYS_FILEACTIONS_EMPTY; ?>"><?php _e( 'Empty' ); ?></option>
<option
value="<?php echo self::$_KEYS_FILEACTIONS_BREAK; ?>"><?php _e( 'Break' ); ?></option>
</select>
<?php submit_button( __( 'Do' ), 'button', self::$_KEYS_FILEACTION_SUBMIT, false ); ?>
</form>
</div>
<?php endif; ?>
<div class="alignright">
<form method="post" action="<?php echo $this->getPageUrl(); ?>">
<?php wp_nonce_field( 'viewoptions_nonce', 'viewoptions_nonce' ); ?>
<input type="hidden" value="<?php echo $this->getCurrentFile(); ?>" name="file2" />
<input
title="Autorefresh page every <?php echo( User_Options::getAutoRefreshIntervall() ); ?> seconds"
type="checkbox" value="1" <?php checked( 1 == User_Options::getAutoRefresh() ); ?>
id="<?php echo User_Options::KEYS_AUTOREFRESH; ?>"
name="<?php echo User_Options::KEYS_AUTOREFRESH; ?>" />
<label
title="Autorefresh page every <?php echo( User_Options::getAutoRefreshIntervall() ); ?> seconds"
for="<?php echo User_Options::KEYS_AUTOREFRESH; ?>">Autorefresh</label>
<select name="<?php echo User_Options::KEYS_LINEOUTPUTORDER; ?>">
<option <?php selected( User_Options::LINEOUTPUTORDER_FIFO == User_Options::getLineOutputOrder() ); ?>
value="<?php echo User_Options::LINEOUTPUTORDER_FIFO; ?>">FIFO
</option>
<option <?php selected( User_Options::LINEOUTPUTORDER_FILO == User_Options::getLineOutputOrder() ); ?>
value="<?php echo User_Options::LINEOUTPUTORDER_FILO; ?>">FILO
</option>
</select>
<?php submit_button( __( 'Apply' ), 'button', self::$_KEYS_VIEWFIELDS_SUBMIT, false ); ?>
</form>
</div>
</div>
<div id="templateside">
<h3>Log Files</h3>
<ul>
<?php foreach( $files as $file ):
if( $file === $this->getCurrentFile() ) {
?>
<li class="highlight">
<?php
} else {
?>
<li>
<?php
}
?>
<a href="<?php printf( "%s&file=%s", $this->getPageUrl(), $file ); ?>">
<?php echo $file; ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
<div id="template">
<div>
<?php if( !is_file( $realfile ) ) : ?>
<div id="message" class="error">
<p><?php _e( 'Could not load file.' ); ?></p>
</div>
<?php else : ?>
<textarea id="newcontent" name="newcontent" rows="25" cols="70"
readonly="readonly"><?php echo $this->getCurrentFileContent(); ?></textarea>
<?php endif; ?>
<div>
<h3><?php _e( 'Fileinfo' ); ?></h3>
<dl>
<dt><?php _e( 'Fullpath:' ); ?></dt>
<dd><?php echo $realfile; ?></dd>
<dt><?php _e( 'Last updated: ' ); ?></dt>
<dd><?php echo date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), filemtime( $realfile ) ); ?></dd>
</dl>
</div>
</div>
</div>
</div><!-- fileedit-sub -->
<?php endif; // showEditSection? ?>
<?php if( User_Options::getAutoRefresh() === 1 ) : ?>
<script type="text/javascript">
setTimeout( "window.location.replace(document.URL);", <?php echo ( User_Options::getAutoRefreshIntervall() * 1000 ); ?> );
</script>
<?php endif; ?>
</div>