File size: 3.88Kb
<?php
# Ma nguon ULoKI Forum v2.1 Editor by Quochuy - Vietnam
# E-mail kutebin@gmail.com
# Site http://quochuy.wen.ru
# All rights are reserved by the script! Ie me! The script is forbidden to distribute, and/or sell without the consent of the author!
# Phone +82.10.4964.4150
error_reporting(0);
require ("../include/settings.php");
require ("../lib/db.php");
require ("../lib/users.php");
require ("../lib/functions.php");
require ("../lib/sessions.php");
$config->ip=$_SERVER['REMOTE_ADDR'];
$config->browser=$_SERVER['HTTP_USER_AGENT'];
init_session();
if ($group[$user->groupid]['type'] < 3)
{
forward ("index.php");
}
?>
<?php
include "../header.php";
?>
<title>Admin CP - <?php echo $config->title;?></title>
<?php
include "../title.php";
?>
<?php
include "../navbar.php";
if(isset($_POST['newstyle']) && $_POST['newstyle'] != '') {
$data_file = str_replace(' ','_',$_POST['newstyle']);
$data_file = htmlspecialchars('../css/'.trim($data_file).'.css',ENT_COMPAT,'UTF-8');
if($f = fopen($data_file,"w")) {
fclose($f);
forward2("admincp/style.php","2");
err_msg("Style","Tạo thành công.");
} else {
forward2("admincp/style.php","2");
err_msg("Style","Không thể tạo tập tin.");
}
}
if(isset($_POST['delstyle'])) {
$data_file = '../css/'.trim($_POST['delstyle']).'.css';
if(unlink($data_file)) {
forward2("admincp/style.php","2");
err_msg("Style","Xóa thành công.");
} else {
forward2("admincp/style.php","2");
err_msg("Style","Không thể xóa tập tin.");
}
}
if(isset($_POST['css']))
$file = $_SESSION['css'] = $_POST['css'];
else
$file = $_SESSION['css'];
$file = '../css/'.$file.'.css';
echo '<div class="catSides">Style Manage</div><div class="row1">';
print '<form action="style.php" method="post">
Add style:<br>
<input name="newstyle" type="text" value="">
<input type="submit" value="Add"></form></div>';
echo '<div class="row1">';
print '<form action="style.php" method="post">Delete style:<br>
<select size="1" name="delstyle">';
foreach(glob('../css/'.'*.css',GLOB_NOESCAPE) as $var) {
$value = htmlspecialchars(pathinfo($var,PATHINFO_FILENAME),ENT_NOQUOTES);
echo '<option value="'.$value.'">'.$value.'</option>';
}
echo '</select>
<input type="submit" value="Del"></form></div>';
echo '<div class="row1">';
print '<form action="style.php" method="post">Edit style:<br>
<select size="1" name="css">';
foreach(glob('../css/'.'*.css',GLOB_NOESCAPE) as $var) {
$value = htmlspecialchars(pathinfo($var,PATHINFO_FILENAME),ENT_NOQUOTES);
echo '<option value="'.$value.'" '.sel($value,$_SESSION['css']).'>'.$value.'</option>';
}
echo '</select>
<input type="submit" value="Edit"></form></div>';
if($_POST['tex2']) {
$tex2 = $_POST['tex2'];
$tex2 = str_replace('\"','"',$tex2);
echo '<form action= "style.php" method="post"><div class="catSides">Edit by '.basename($file).'</div>
<textarea rows="30" name="tex2" maxlength="1256" value="">'.$tex2.'</textarea><br><br>
<input type="submit" value="Chỉnh sửa"></form>';
echo '</div></div>';
$fp = fopen($file,"w");
flock($fp,LOCK_EX);
fputs($fp,$tex2);
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);
}else{
$tex = file_get_contents($file);
$tex = htmlentities($tex,ENT_QUOTES,'UTF-8');
echo '<form action= "style.php" method="post"><div class="catSides">Edit by '.basename($file).'</div>
<textarea rows="30" name="tex2" maxlength="10024" value="">'.$tex.'</textarea><br><br>
<input type="submit" value="Edit"></form>';
}
echo '<div class="row1">» <a href="index.php">Admin panel</a></div>';
echo '<div class="row1">» <a href="../index.php">Trang chủ</a></div>';
?>
<?php include "../footer.php"; ?>