Source for file b2template.php
Documentation is available at b2template.php
* Custom skin template editing
* b2evolution - {@link http://b2evolution.net/}
* Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
* @copyright (c)2003-2005 by Francois PLANQUE - {@link http://fplanque.net/}
* @author This file built upon code from original b2 - http://cafelog.com/
require_once(dirname(__FILE__
).
'/_header.php');
$admin_tab =
'templates';
$admin_pagetitle =
T_('Custom skin template editing');
$current_User->check_perm( 'templates', '', true );
param( 'action', 'string' );
param( 'error', 'string' );
param( 'file', 'string' );
// Determine the edit folder:
$edit_folder =
get_path('skins').
'/custom';
param( 'newcontent', 'html' );
$f =
fopen( $edit_folder.
'/'.
$file, "w+" );
header("Location: b2template.php?file=$file&a=te");
require
(dirname(__FILE__
).
'/_menutop.php');
require
(dirname(__FILE__
).
'/_menutop_end.php');
// Determine the edit folder:
$edit_folder =
get_path('skins').
'/custom';
echo
'<div class="panelblock">';
echo
T_('Listing:'), ' <strong>', $edit_folder, '/', $file, '</strong>';
if( ereg( '([^-A-Za-z0-9._]|\.\.)', $file ) )
echo
'<p>', T_('Invalid filename!'), '</p>';
elseif( !is_file($edit_folder.
'/'.
$file) )
echo
'<p>', T_('Oops, no such file !'), '</p>';
$f =
fopen( $edit_folder.
'/'.
$file, 'r');
// $content = template_simplify($content);
// $content = str_replace("</textarea","</textarea",$content);
if ($a ==
'te') echo
'<em> [ ', T_('File edited!'), ' ]</em>';
<p>
<?php echo
T_('Be careful what you do, editing this file could break your template! Do not edit what\'s between <code><?php</code> and <code>?></code> if you don\'t know what you\'re doing!') ?></p>
<form name="template" action="b2template.php" method="post">
<fieldset class="input"><img src="img/blank.gif" alt="" width="1" height="1" /><textarea cols="80" rows="20" class="large" name="newcontent" tabindex="1">
<?php echo
$content ?></textarea></fieldset>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="file" value="
<?php echo
$file ?>" />
echo
'<input type="submit" name="submit" class="SaveButton" value="', T_(' Save ! '), '" tabindex="2" />';
echo
'<input type="button" name="oops" class="search" value="', T_('(you cannot update that file/template: must make it writable, e.g. CHMOD 766)'), '" tabindex="2" />';
<p>
<?php echo
T_('This screen allows you to edit the <strong>custom skin</strong> (located under /skins/custom). ') ?></p>
<p>
<?php echo
T_('You can edit any of the following files (provided it\'s writable by the server, e.g. CHMOD 766)') ?>:</p>
// Determine the edit folder:
if( empty($edit_folder) ) $edit_folder =
get_path('skins').
'/custom';
//lists all files in edit directory
echo
'<div class="panelinfo"><p>'.
sprintf( T_('Directory %s not found.'), $edit_folder ).
'</p></div>';
$this_dir =
dir( $edit_folder );
while ($this_file =
$this_dir->read())
if( is_file($edit_folder.
'/'.
$this_file) )
<li><a href="b2template.php?file=
<?php echo
$this_file; ?>">
<?php echo
$this_file; ?></a>
echo
'- ', T_('This is the template that displays the links to the archives for a blog');
echo
'- ', T_('This is the template that displays the (recursive) list of (sub)categories');
echo
'- ', T_('This is the template that displays the feedback for a post');
case '_lastcomments.php':
echo
'- ', T_('This is the template that displays the last comments for a blog');
echo
'- ', T_('This is the main template. It displays the blog.');
case 'comment_popup.php':
echo
'- ', T_('This is the page displayed in the comment popup');
case 'pingback_popup.php':
echo
'- ', T_('This is the page displayed in the pingback popup');
case 'trackback_popup.php':
echo
'- ', T_('This is the page displayed in the trackback popup');
<p>
<?php echo
T_('Note: of course, you can also edit the files/templates in your text editor and upload them. This online editor is only meant to be used when you don\'t have access to a text editor...') ?>
require
( dirname(__FILE__
).
'/_footer.php' );