View Single Post
  #1  
Old 4th May 2008, 09:14
Kotafi Kotafi is offline
Senior Member
 
Join Date: Jan 2008
Posts: 139
Cool [Help request] For stylesheets manager
Hello, i found this mod on tblatvia but cant understand a word of latvia or find even a freaking translator. :unknown:
It is based on that Category Manager from tbdev.net

Original post at tblatvia.bmx.lv
Board Message

screenshot
Click image for larger version

Name:	themescy2.png
Views:	25
Size:	3.4 KB
ID:	416

Mod should be work so that you can add, edit and delete stylesheets from your tracker but im having some problems with it.. The adding new theme works but it keeps adding that same theme every browser rehresh over and over again! lol

Also the Modify and Delete part dont work, it redirect's me on some strange url like this:
Code:
http://localhost/?editid=1&name=(default)&uri=default.css
Hehe, so basicly nothing works with this mod :D

themes.php
Code:
<?php
ob_start();
require_once("include/bittorrent.php");
dbconn(false);
loggedinorreturn();
if (get_user_class() < UC_SYSOP) {
die("Access denied.");
}
mysql_connect($mysql_host,$mysql_user,$mysql_pass);
mysql_select_db($mysql_db);
stdhead("Stylesheets");
print("<h1>Manage Stylesheets</h1>\n");
print("</br>");
print("<table width=70% border=1 cellspacing=0 cellpadding=2><tr><td align=center>\n");

///////////////////// D E L E T E T H E M E \\\\\\\\\\\\\\\\\\\\\\\\\\\\

$sure = htmlspecialchars($_GET['sure']);
if($sure == "yes") {
$delid = 0+$_GET['delid'];
$query = "DELETE FROM stylesheets WHERE id=" .sqlesc($delid) . " LIMIT 1";
$sql = mysql_query($query);
echo("theme succesfully deleted! [ Back ]");
end_frame();
stdfoot();
die();
}
$delid = 0+$_GET['delid'];
$name = $_GET['stylesheet'];
if($delid > 0) {
echo("Are you sure you would like to delete this theme? ($name) ( Yes! / No )");
end_frame();
stdfoot();
die();

}

///////////////////// E D I T A T H E M E \\\\\\\\\\\\\\\\\\\\\\\\\\\\
$edited = 0+$_GET['edited'];
if($edited == 1) {
$id = 0+$_GET['id'];
$name = htmlspecialchars($_GET['name']);
$uri = htmlspecialchars($_GET['uri']);
$query = "UPDATE stylesheets SET
name = ".sqlesc($name).",
uri = '$uri' WHERE id=".sqlesc($id);
$sql = mysql_query($query);
if($sql) {
echo("<table class=main cellspacing=0 cellpadding=5 width=50%>");
echo("<tr><td><div align='center'>Well done! Your theme has been edited succesfully! [ Back ]</div></tr>");
echo("</table>");
end_frame();
stdfoot();
die();
}
}

$editid = 0+$_GET['editid'];
$name = htmlspecialchars($_GET['name']);
$uri = htmlspecialchars($_GET['uri']);
if($editid > 0) {
echo("<form name='form1' method='get' action='" . $_SERVER['PHP_SELF'] . "'>");
echo("<table class=main cellspacing=0 cellpadding=5 width=50%>");
echo("<div align='center'><input type='hidden' name='edited' value='1'>Now editing theme "$name"</div>");
echo("
");
echo("<input type='hidden' name='id' value='$editid'<table class=main cellspacing=0 cellpadding=5 width=50%>");
echo("<tr><td>Name: </td><td align='right'><input type='text' size=50 name='name' value='$name'></td></tr>");
echo("<tr><td>uri: </td><td align='right'><input type='text' size=50 name='uri' value='$uri'></td></tr>");
echo("<tr><td></td><td><div align='right'><input type='Submit'></div></td></tr>");
echo("</table></form>");
end_frame();
stdfoot();
die();
}

///////////////////// A D D A N E W T H E M E \\\\\\\\\\\\\\\\\\\\\\\\\\\\
$add = htmlspecialchars($_GET['add']);
if($add == 'true') {
$name = htmlspecialchars($_GET['name']);
$uri = htmlspecialchars($_GET['uri']);
$query = "INSERT INTO stylesheets SET
name = ".sqlesc($name).",
uri = ".sqlesc($uri);
$sql = mysql_query($query);
if($sql) {
$success = TRUE;
} else {
$success = FALSE;
}
}
print("Add A New theme:");
print("
");
print("
");
echo("<form name='form1' method='get' action='" . $_SERVER['PHP_SELF'] . "'>");
echo("<table class=main cellspacing=0 cellpadding=5 width=50%>");
echo("<tr><td>Name: </td><td align='right'><input type='text' size=50 name='name'></td></tr>");
echo("<tr><td>uri: </td><td align='right'><input type='text' size=50 name='uri'><input type='hidden' name='add' value='true'></td></tr>");
echo("<tr><td></td><td><div align='right'><input type='Submit'></div></td></tr>");
echo("</table>");
if($success == TRUE) {
print("Success!");
}
echo("
");
echo("</form>");

///////////////////// E X I S T I N G C A T E G O R I E S \\\\\\\\\\\\\\\\\\\\\\\\\\\\

print("Existing stylesheets:");
print("
");
print("
");
echo("<table class=main cellspacing=0 cellpadding=5>");
echo("<td>ID:</td><td>Name:</td><td>URI:</td><td>Modify:</td><td>Delete:</td>");
$query = "SELECT * FROM stylesheets WHERE 1=1";
$sql = mysql_query($query);
while ($row = mysql_fetch_array($sql)) {
$id = $row['id'];
$name = $row['name'];
$uri = $row['uri'];
echo("<tr><td>$id </td> <td>$name</td> <td>$uri</td> <td><div align='center'>[img]$BASEURL/pic/multipage.gif[/img]</div></td> <td><div align='center'>[img]$BASEURL/pic/warned2.gif[/img]</div></td></tr>");
}

end_frame();
end_frame();
stdfoot();

?>
I really would like to get this working so i hope someone could point out where is the problem. :smile:

// Hatchet
Reply With Quote