?? changetemplate.php
字號:
<?
if ($_POST["template"]!="") {
$theme=$_POST["template"];
$filename = realpath('template.inc.php');
$somecontent="<? \n";
$somecontent.="\$theme=\"".$_POST["template"]."\"; \n";
$somecontent.="?>";
// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {
// In our example we're opening $filename in append mode.
// The file pointer is at the bottom of the file hence
// that's where $somecontent will go when we fwrite() it.
if (!$handle = fopen($filename, 'w')) {
$feedback="<span style=\"color:red;font-weight:bold;\">Cannot open file ($filename)</span>";
exit;
}
// Write $somecontent to our opened file.
if (fwrite($handle, $somecontent) === FALSE) {
$feedback="<span style=\"color:red;font-weight:bold;\">Cannot write to file ($filename)</span>";
exit;
}
$feedback="<span style=\"color:green;font-weight:bold;\">Successfully written configuration.</span>";
fclose($handle);
} else {
$feedback="<span style=\"color:red;font-weight:bold;\">The file $filename is not writable</span>";
}
} //end if POST
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?=$titleOfPage?></title>
<link rel="stylesheet" type="text/css" href="templates/<?=$theme?>/style.css" />
<script type="text/javascript" src="modules/firewall/checkRule.js"></script>
</head>
<body>
<? backToIndex(); ?>
<h2>Template Chooser</h2>
<? if (!empty($feedback)) echo $feedback; ?>
<table class="tableBorder" width="300">
<tr><td><br/>
<form action="index.php?modules=changeTemplate" method="post">
<?
function listTemplate() {
global $theme;
$dir="templates/";
echo "<select name=\"template\">\n";
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if (is_dir($dir.$file) && ($file!=".") && ($file!="..")) {
echo "<option value=\"$file\"";
if ($file==$theme) echo " SELECTED";
echo "> $file </option>\n";
}
}
closedir($dh);
}
}
echo "</select>\n";
}
listTemplate();
?><input type="submit" name="save" value="Apply" /></form><br/>
</td></tr></table>
<br/><br/>
<div class="info">
<img src="images/info.png" alt="info" align="absmiddle" border="0" /> For writing your own templates, simply create a "nametemplate" folder under "templates" folder, with a style.css style into :-)<br/>
For example:<br/>
<pre>
templates/
|_____ blueTemplate/
|_______ style.css
</pre>
</div>
<? author(); ?>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -