starting adding the new control panel

master
pecesama 2007-05-11 03:17:01 +00:00
parent bc13d08ac8
commit 5c7d0d84d7
18 changed files with 363 additions and 90 deletions

BIN
admin/css/images/bg-box.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 B

BIN
admin/css/images/film.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
admin/css/images/image.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 516 B

BIN
admin/css/images/music.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

BIN
admin/css/images/world.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

128
admin/css/style.css Normal file
View File

@ -0,0 +1,128 @@
/* CSS Document created by Jorge Condomi */
/************ BASICS *************/
div, p, ul, ol, li, h1, h2, h3, h4, h5, h6, h7,form, span, pre, a{margin:0; padding:0;}
h1, h2, h3, h4, h5, h6, h7{ font-weight:normal;}
a, a:link, a:visited, a:active{ color:#000; text-decoration:none; outline:none;}
a:hover{ text-decoration:underline; color:#000000; outline:none;}
acronym{ border-bottom: 1px dotted #666; cursor:help;}
fieldset{ border:none; margin:0; padding:0;}
.gelato{color:#006699; font-weight:bold; font-family:'Trebuchet Ms', Verdad, Tahoma;}
.option{ color:#666666; font-style:italic; font-size:0.9em}
/*********** LAYOUT *************/
body{ background: #fff; text-align:center; font-family:"Trebuchet Ms", Verdana, Tahoma; font-size:1em;}
#cont{ width:569px; margin:30px auto 10px auto; text-align:left;}
#head{ background: transparent url(images/head_bg.png) bottom center no-repeat; position: relative; padding-bottom:20px; height:73px;}
h1 a{ display:block; height:77px; width:161px; background:#fff url(images/gelato-logo.png) top left no-repeat; text-indent:-9999px; overflow:hidden;}
#nav{ position:absolute; right:1px; font-size:0.75em; line-height:normal; margin:0; padding:0 10px 0 0; list-style:none;bottom:34px;}
#nav li{ margin:0; padding:0; text-align:right;}
#nav li a:link, #nav li a:visited, #nav li a:active, #nav li a:focus{ color:#777; text-decoration: none;}
#nav li a:hover{ text-decoration:underline;}
#main{ background: #fff url(images/main_bg.png) top left repeat-y; text-align:left; padding:0 0 40px 0;}
h2{ font-size:1.56em; margin:4px; text-indent:20px;}
h3{font-size:1.12em; margin:4px; color:#333333; text-indent:20px;}
.box{ background:#efefef url(images/bg-box.png) left top repeat-y;}
.footer-box{background:#fff url(images/bg-foot-box.png) top center no-repeat;}
.box h3{float:left; color:#FFFFFF; font-weight:bold; padding:5px 10px 0 0;}
.menu{ background:#c1c7cd url(images/bg-top-box.png) top center no-repeat; height:40px; width:559px; list-style-type:none; padding-right:10px;}
.menu li{ display:inline;}
.menu li.selected a{background: transparent url(images/bg-top-box-hover.png) left top repeat-x; text-decoration:none;}
.menu li a{ font-family:Verdana, Arial, Helvetica, sans-serif; font-size:0.7em; display:block; float:right; height:28px; padding:12px 3px 0 3px;}
.menu li a:hover{ background: transparent url(images/bg-top-box-hover.png) left top repeat-x; text-decoration:none;}
.menu li a img{border:none; vertical-align:bottom;}
.manage li a{ padding:14px 6px 0 6px;}
form.newpost{ width:500px; margin:0 auto; padding:0;}
form.newpost ul{ list-style-type:none; margin:20px 0 10px 0; padding:0;}
form.newpost li{ margin:4px 0; padding:0;}
form.newpost label{}
form.newpost input{ margin-bottom:10px;}
form.newpost input.txt{ background: #fff url(images/grad-small.png) top left repeat-x; height:15px; border:1px solid #999; width:490px; padding:5px;}
form.newpost input.btn{ }
form.newpost textarea{background: #fff url(images/grad-big.png) top left repeat-x; height:190px; border:1px solid #999; width:490px; padding:5px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:0.8em;}
.entry{ background-color:#efefef; border:1px solid #ccc; margin:20px 15px;}
.info{ border-bottom:1px solid #aaa; position:relative; display:block; padding:4px 10px; height:20px; }
.info p{font-size:0.8em; color:#297aab; display:inline;}
form.compact{ float:right; margin:-2px 0 0 0; padding:0;}
.post{ padding:10px;}
.post h4{ font-style:italic; font-weight:bold; }
.post p{ font-size:0.9em; text-indent:20px;}
.post img{}
.post blockqoute{}
.post .video{}
.post .audio{}
#foot{ background: transparent url(images/foot_bg.png) top center no-repeat; clear: both;}
#foot { text-align:center;
font-size: 10px;
color: #000;
}
#footer a {
color: #000;
}
#div-process {
top:0px;
padding-left: 22px;
font: normal 14.5px/17px georgia, "times new roman", serif;
background: url('../../images/proceso.gif') no-repeat 0% 10%;
float: right;
height: 20px;
width: 150px;
border: 1px solid #000066;
background-color:#FFFFCC;
color:#011940;
}
/* Mensajes para el usuario */
.error {
width:80%;
background: #FFF7F2 url('../../images/error.png') 15px center no-repeat;
border-top: 2px solid #CC0000;
border-bottom: 2px solid #CC0000;
margin: 0 auto;
padding: 5px 20px 5px 45px;
}
.exito {
width:80%;
background: #F4FBF5 url('../../images/information.png') 15px center no-repeat;
border-top: 2px solid #006600;
border-bottom: 2px solid #006600;
margin: 0 auto;
padding: 5px 20px 5px 45px;
}
.information {
width:80%;
background: #FFF6BF url('../../images/icon_info.gif') 15px center no-repeat;
border-top: 2px solid #FFD324;
border-bottom: 2px solid #FFD324;
margin: 0 auto;
padding: 5px 20px 5px 45px;
}

View File

@ -11,17 +11,82 @@
<?
require_once('../config.php');
include("../classes/user.class.php");
include("../classes/gelato.class.php");
include("../classes/templates.class.php");
require_once("../classes/configuration.class.php");
$user = new user();
$tumble = new gelato();
$conf = new configuration();
$template = new plantillas("admin");
if ($user->isAdmin()) {
if(isset($_POST["btnAdd"])) {
unset($_POST["btnAdd"]);
if ($_POST["type"]=="2") { // is Photo type
if (isset($_POST["url"]) && $_POST["url"]!="") {
$photoName = getFileName($_POST["url"]);
if (!$tumble->savePhoto($_POST["url"])) {
header("Location: ".$conf->urlGelato."/admin/index.php?photo=false");
die();
}
$_POST["url"] = $conf->urlGelato."/uploads/".$photoName;
}
if ( move_uploaded_file( $_FILES['photo']['tmp_name'], "../uploads/".$_FILES['photo']['name'] ) ) {
$_POST["url"] = $conf->urlGelato."/uploads/".$_FILES['photo']['name'];
}
unset($_POST["photo"]);
unset($_POST["MAX_FILE_SIZE"]);
}
if ($_POST["type"]=="7") { // is MP3 type
set_time_limit(300);
$mp3Name = getFileName($_POST["url"]);
if (!$tumble->saveMP3($_POST["url"])) {
header("Location: ".$conf->urlGelato."/admin/index.php?mp3=false");
die();
}
$_POST["url"] = $conf->urlGelato."/uploads/".$mp3Name;
}
if (get_magic_quotes_gpc()) {
$_POST["title"] = htmlspecialchars(stripslashes($_POST["title"]));
$_POST["description"] = htmlspecialchars(stripslashes($_POST["description"]));
} else {
$_POST["title"] = htmlspecialchars($_POST["title"]);
$_POST["description"] = htmlspecialchars($_POST["description"]);
}
$_POST["title"] = strip_tags($_POST["title"]);
$_POST["description"] = strip_tags($_POST["description"]);
if (isset($_POST["id_post"])) {
//$tumble->modifyPost($_POST, $_POST["id_post"]);
} else {
if ($tumble->addPost($_POST)) {
header("Location: ".$conf->urlGelato."/admin/index.php?added=true");
die();
} else {
header("Location: ".$conf->urlGelato."/admin/index.php?error=2&des=".$this->merror);
die();
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!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>
<title>gelato :: Control panel</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>gelato :: Control panel</title>
<link rel="shortcut icon" href="<?=$conf->urlGelato;?>/images/favicon.ico" />
<script language="javascript" type="text/javascript" src="<?=$conf->urlGelato;?>/admin/scripts/tools.js"></script>
<script language="javascript" type="text/javascript" src="<?=$conf->urlGelato;?>/admin/scripts/mootools.js"></script>
<script type="text/javascript">
<!--
@ -42,6 +107,7 @@ if ($user->isAdmin()) {
contenedor = new Fx.Style('divMessages', 'opacity', {duration: 5000, onComplete:
function() {
document.getElementById('divMessages').style.display="none";
document.getElementById('pMessages').style.display="none";
}
});
contenedor.custom(1,0);
@ -49,98 +115,177 @@ if ($user->isAdmin()) {
-->
</script>
<style type="text/css" media="screen">
@import "<?=$conf->urlGelato;?>/admin/css/style-codice.css";
@import "<?=$conf->urlGelato;?>/admin/css/style.css";
</style>
</head>
<body>
<div id="div-process" style="display:none;"></div>
<div id="titulo">
<img src="<?=$conf->urlGelato;?>/images/logo.jpg" alt="gelato CMS" title="gelato CMS" />
</div>
<div id="menuContenedor">
<ul>
<li id="active"><a href="#" id="current">Posts</a></li>
<ul>
<li id="subactive"><a href="#" id="subcurrent">Manage</a></li>
<div id="div-process" style="display:none;">Processing request...</div>
<div id="cont">
<div id="head">
<h1><a href="<?=$conf->urlGelato;?>/admin/index.php" title="gelato :: home">gelato cms</a></h1>
<ul id="nav">
<li><a href="<?=$conf->urlGelato;?>/" title="Take me to the tumblelog">View Tumblelog</a></li>
<li><a href="close.php" onclick="return exit('div-process','<?=$conf->urlGelato;?>/admin/ajax.php?action=close');">Log out</a></li>
</ul>
</div>
<div id="main">
<div class="box">
<ul class="menu">
<h3>New Post</h3>
<li><a href="<?=$conf->urlGelato;?>/admin/index.php?new=conversation"><img src="css/images/comments.png" alt="New chat" /> Chat</a></li>
<li><a href="<?=$conf->urlGelato;?>/admin/index.php?new=quote"><img src="css/images/comments.png" alt="New qoute" /> Quote</a></li>
<li><a href="<?=$conf->urlGelato;?>/admin/index.php?new=url"><img src="css/images/world.png" alt="New link" /> Link</a></li>
<li><a href="<?=$conf->urlGelato;?>/admin/index.php?new=mp3"><img src="css/images/music.png" alt="New audio" /> Audio</a></li>
<li><a href="<?=$conf->urlGelato;?>/admin/index.php?new=video"><img src="css/images/film.png" alt="New video" /> Video</a></li>
<li><a href="<?=$conf->urlGelato;?>/admin/index.php?new=photo"><img src="css/images/image.png" alt="New picture" /> Picture</a></li>
<li class="selected"><a href="<?=$conf->urlGelato;?>/admin/index.php?new=post"><img src="css/images/page_white_text.png" alt="New post" /> Regular</a></li>
</ul>
</li>
<li><a href="<?=$conf->urlGelato;?>/admin/admin.php">Manage users</a></li>
<li><a href="<?=$conf->urlGelato;?>/">Take me to the tumblelog</a></li>
<li><a href="close.php" onclick="return exit('div-process','<?=$conf->urlGelato;?>/admin/ajax.php?action=close');">Logoff</a></li>
</ul>
</div>
<div id="contenido">
<div class="center">
<div class="ventana">
<p class="titulo"><span class="handle">Manage the posts</span></p>
<div id="formulario">
<?
if (isset($_GET["deleted"])) {
if ($_GET["deleted"]=="true") {
echo "<div class=\"exito\" id=\"divMessages\">The article has been eliminated successfully.</div>";
}
if (isset($_GET["deleted"])) {
if ($_GET["deleted"]=="true") {
echo "<p id=\"pMessages\">&nbsp;</p><div class=\"exito\" id=\"divMessages\">The article has been eliminated successfully.</div>";
}
}
if (isset($_GET["modified"])) {
if ($_GET["modified"]=="true") {
echo "<div class=\"exito\" id=\"divMessages\">The article has been modified successfully.</div>";
}
if (isset($_GET["modified"])) {
if ($_GET["modified"]=="true") {
echo "<p id=\"pMessages\">&nbsp;</p><div class=\"exito\" id=\"divMessages\">The article has been modified successfully.</div>";
}
}
if (isset($_GET["added"])) {
if ($_GET["added"]=="true") {
echo "<div class=\"exito\" id=\"divMessages\">The article has been added successfully.</div>";
}
if (isset($_GET["added"])) {
if ($_GET["added"]=="true") {
echo "<p id=\"pMessages\">&nbsp;</p><div class=\"exito\" id=\"divMessages\">The article has been added successfully.</div>";
}
}
if (isset($_GET["error"])) {
if ($_GET["error"]==2) {
echo "<div class=\"error\"><strong>Error on the database server: </strong>".$_GET["des"]."</div>";
}
if (isset($_GET["error"])) {
if ($_GET["error"]==2) {
echo "<p id=\"pMessages\">&nbsp;</p><div class=\"error\"><strong>Error on the database server: </strong>".$_GET["des"]."</div>";
}
}
if (isset($_GET["mp3"])) {
if ($_GET["mp3"]=="false") {
echo "<div class=\"error\" id=\"divMessages\">Not an MP3 file or an upload problem.</div>";
}
if (isset($_GET["mp3"])) {
if ($_GET["mp3"]=="false") {
echo "<p id=\"pMessages\">&nbsp;</p><div class=\"error\" id=\"divMessages\">Not an MP3 file or an upload problem.</div>";
}
}
if (isset($_GET["photo"])) {
if ($_GET["photo"]=="false") {
echo "<div class=\"error\" id=\"divMessages\">Not a photo file or an upload problem.</div>";
}
if (isset($_GET["photo"])) {
if ($_GET["photo"]=="false") {
echo "<p id=\"pMessages\">&nbsp;</p><div class=\"error\" id=\"divMessages\">Not a photo file or an upload problem.</div>";
}
}
?>
<form action="index.php" method="post" <?=($_GET["new"]=="photo") ? "enctype=\"multipart/form-data\"" : ""?> name="frmAdd" class="newpost">
<fieldset>
<?
switch ($_GET["new"]) {
case "post":
$input = array("{type}", "{date}", "{id_user}");
$output = array("1", time(), $_SESSION['user_id']);
<h2>Add a new...</h2>
<table class="imgmenu" width="550px" border="0" align="center" cellpadding="5" cellspacing="5">
<tr>
<td><div align="center"><a href="<?=$conf->urlGelato;?>/admin/add.php?new=post"><img alt="New regular post" src="../images/post.gif" /></a></div></td>
<td><div align="center"><a href="<?=$conf->urlGelato;?>/admin/add.php?new=photo"><img alt="New photo" src="../images/foto.gif" /></a></div></td>
<td><div align="center"><a href="<?=$conf->urlGelato;?>/admin/add.php?new=quote"><img alt="New quote" src="../images/cita.gif" /></a></div></td>
</tr>
<tr>
<td><div align="center"><a href="<?=$conf->urlGelato;?>/admin/add.php?new=url"><img alt="New link" src="../images/enlace.gif" /></a></div></td>
<td><div align="center"><a href="<?=$conf->urlGelato;?>/admin/add.php?new=conversation"><img alt="New conversation" src="../images/conversacion.gif" /></a></div></td>
<td><div align="center"><a href="<?=$conf->urlGelato;?>/admin/add.php?new=video"><img alt="New video" src="../images/video.gif" /></a></div></td>
</tr>
<tr>
<td colspan="3"><div align="center"><a href="<?=$conf->urlGelato;?>/admin/add.php?new=mp3"><img alt="New MP3" src="../images/mp3.gif" /></a></div></td>
</tr>
</table>
<p>&nbsp;</p>
<h2>Title 1</h2>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas facilisis scelerisque ligula. Aliquam accumsan. In hac habitasse platea dictumst. Nulla ut urna eget felis tempor pellentesque. Fusce sollicitudin ultricies lacus. Duis felis. Mauris posuere enim ac tortor scelerisque tempus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Fusce porta. Integer odio purus, semper malesuada, eleifend in, volutpat non, quam. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Aliquam pellentesque aliquet turpis. Quisque non enim sed enim ullamcorper aliquet. Integer sit amet arcu.</p>
<p>&nbsp;</p>
$template->cargarPlantilla($input, $output, "template_add_post");
$template->mostrarPlantilla();
break;
case "photo":
$input = array("{type}", "{date}", "{id_user}");
$output = array("2", time(), $_SESSION['user_id']);
$template->cargarPlantilla($input, $output, "template_add_photo");
$template->mostrarPlantilla();
break;
case "quote":
$input = array("{type}", "{date}", "{id_user}");
$output = array("3", time(), $_SESSION['user_id']);
$template->cargarPlantilla($input, $output, "template_add_quote");
$template->mostrarPlantilla();
break;
case "url":
$input = array("{type}", "{date}", "{id_user}");
$output = array("4", time(), $_SESSION['user_id']);
$template->cargarPlantilla($input, $output, "template_add_link");
$template->mostrarPlantilla();
break;
case "conversation":
$input = array("{type}", "{date}", "{id_user}");
$output = array("5", time(), $_SESSION['user_id']);
$template->cargarPlantilla($input, $output, "template_add_conversation");
$template->mostrarPlantilla();
break;
case "video":
$input = array("{type}", "{date}", "{id_user}");
$output = array("6", time(), $_SESSION['user_id']);
$template->cargarPlantilla($input, $output, "template_add_video");
$template->mostrarPlantilla();
break;
case "mp3":
$input = array("{type}", "{date}", "{id_user}");
$output = array("7", time(), $_SESSION['user_id']);
$template->cargarPlantilla($input, $output, "template_add_mp3");
$template->mostrarPlantilla();
break;
default:
$input = array("{type}", "{date}", "{id_user}");
$output = array("1", time(), $_SESSION['user_id']);
$template->cargarPlantilla($input, $output, "template_add_post");
$template->mostrarPlantilla();
break;
}
?>
<p>
<input class="btn" type="submit" name="btnAdd" value="Create post" />&nbsp;&nbsp;
<a href="#" onclick="if (confirm('Cancel editing this post? All changes will be lost.'))
{location.href='index.php';}; return false;">Cancel</a>
</p>
</fieldset>
</form>
<div class="footer-box">&nbsp;</div>
</div>
<div class="box">
<ul class="menu manage">
<h3>Manage</h3>
<li><a href="#">Settings</a></li>
<li><a href="<?=$conf->urlGelato;?>/admin/admin.php">Users</a></li>
<li class="selected"><a href="#">Posts</a></li>
</ul>
<div class="entry">
<div class="info"><form class="compact"><input type="submit" value="Edit" /> <input type="submit" value="Delete" /></form>
<p>25/05 Regular Post (0 Comments) </p>
</div>
<div class="post">
<span class="option">(no title)</span>
<p>I just discovered Gelato</p>
</div>
</div>
<div class="entry">
<div class="info"><form class="compact"><input type="submit" value="Edit" /> <input type="submit" value="Delete" /></form>
<p>25/05 Regular Post (0 Comments) </p>
</div>
<div class="post">
<h4>One with a title</h4>
<p>Another entry, this one has some varations in the content, even dares
to be in two lines.</p>
</div>
</div>
<div class="footer-box">&nbsp;</div>
</div>
</div>
<div id="pie">
<p>
<a href="http://www.gelatocms.com/" title="gelato CMS" target="_blank">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
</p>
<div id="foot">
<a href="http://www.gelatocms.com/" title="gelato CMS" target="_blank">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
</div>
</div>
</body>

View File

@ -1,11 +1,11 @@
<legend>Add a Regular Post</legend>
<p>
<label for="title"><strong>Title</strong>&nbsp;<em>(optional)</em></label>
<input class="input-text" type="text" name="title" id="title" size="80" />
<label for="title">Title <span class="option">(optional)</span></label>
<input class="txt" type="text" name="title" id="title" size="80" />
</p>
<input class="input-text" type="hidden" name="url" id="url" value="" />
<input class="txt" type="hidden" name="url" id="url" value="" />
<p>
<label for="description"><strong>Body</strong></label><br />
<label for="description">Body</label><br />
<textarea rows="12" cols="84" name="description" id="description"></textarea>
</p>
<input type="hidden" name="type" id="type" value="{type}" />

View File

@ -9,7 +9,7 @@
=========================== */
?>
<?
//header("Content-type: text/xml; charset=utf-8");
header("Content-type: text/xml; charset=utf-8");
require(dirname(__FILE__)."/config.php");
include("classes/configuration.class.php");