Some changes and bug fixes.

master
Victor De la Rocha 2008-10-24 06:51:48 +00:00
parent 77cb58b951
commit 11022c204d
3 changed files with 50 additions and 50 deletions

View File

@ -21,9 +21,9 @@ if ($user->isAdmin()) {
if(isset($_POST["btnAdd"])) { if(isset($_POST["btnAdd"])) {
unset($_POST["btnAdd"]); unset($_POST["btnAdd"]);
if ($_POST["type"]=="2") { // is Photo type if ($_POST["type"]=="2") { // is Photo type
if (isset($_POST["url"]) && $_POST["url"]!="") { if (isset($_POST["url"]) && $_POST["url"]!="") {
$photoName = getFileName($_POST["url"]); $photoName = getFileName($_POST["url"]);
if (!$tumble->savePhoto($_POST["url"])) { if (!$tumble->savePhoto($_POST["url"])) {
header("Location: ".$conf->urlGelato."/admin/index.php?photo=false"); header("Location: ".$conf->urlGelato."/admin/index.php?photo=false");
@ -31,15 +31,15 @@ if ($user->isAdmin()) {
} }
$_POST["url"] = "../uploads/".sanitizeName($photoName); $_POST["url"] = "../uploads/".sanitizeName($photoName);
} }
if ( move_uploaded_file( $_FILES['photo']['tmp_name'], "../uploads/".sanitizeName($_FILES['photo']['name']) ) ) { if ( move_uploaded_file( $_FILES['photo']['tmp_name'], "../uploads/".sanitizeName($_FILES['photo']['name']) ) ) {
$_POST["url"] = "../uploads/".sanitizeName($_FILES['photo']['name']); $_POST["url"] = "../uploads/".sanitizeName($_FILES['photo']['name']);
} }
unset($_POST["photo"]); unset($_POST["photo"]);
unset($_POST["MAX_FILE_SIZE"]); unset($_POST["MAX_FILE_SIZE"]);
} }
if ($_POST["type"]=="7") { // is MP3 type if ($_POST["type"]=="7") { // is MP3 type
set_time_limit(300); set_time_limit(300);
$mp3Name = getFileName($_POST["url"]); $mp3Name = getFileName($_POST["url"]);
@ -50,22 +50,22 @@ if ($user->isAdmin()) {
if (isMP3($remoteFileName)) { if (isMP3($remoteFileName)) {
$_POST["url"] = $conf->urlGelato."/uploads/".$mp3Name; $_POST["url"] = $conf->urlGelato."/uploads/".$mp3Name;
} }
} }
if (!get_magic_quotes_gpc()) { if (!get_magic_quotes_gpc()) {
$_POST["title"] = addslashes($_POST["title"]); $_POST["title"] = addslashes($_POST["title"]);
$_POST["description"] = addslashes($_POST["description"]); $_POST["description"] = addslashes($_POST["description"]);
} }
$textile = new Textile(); $textile = new Textile();
$_POST["title"] = $textile->TextileThis(removeBadTags($_POST["title"])); $_POST["title"] = $textile->TextileThis(removeBadTags($_POST["title"]));
$_POST["description"] = $textile->TextileThis(removeBadTags($_POST["description"])); $_POST["description"] = $textile->TextileThis(removeBadTags($_POST["description"]));
if ($tumble->addPost($_POST)) { if ($tumble->addPost($_POST)) {
$input = array("{type}"); $input = array("{type}");
$output = array("1"); $output = array("1");
$template->cargarPlantilla($input, $output, "template_bm"); $template->cargarPlantilla($input, $output, "template_bm");
$template->mostrarPlantilla(); $template->mostrarPlantilla();
die(); die();
@ -74,14 +74,14 @@ if ($user->isAdmin()) {
die(); die();
} }
} else { } else {
if (isset($_GET["url"])) { if (isset($_GET["url"])) {
$url = $_GET["url"]; $url = $_GET["url"];
} else { } else {
$url = null; $url = null;
} }
if (isset($url)) { if (isset($url)) {
if (isMP3($url)) { if (isMP3($url)) {
$postType = "mp3"; $postType = "mp3";
} elseif (isGoEar($url)) { } elseif (isGoEar($url)) {
@ -97,11 +97,11 @@ if ($user->isAdmin()) {
$postType = "url"; $postType = "url";
} }
} }
} else { } else {
die(__("Must be a valid URL")); die(__("Must be a valid URL"));
} }
?> ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!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"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -110,11 +110,11 @@ if ($user->isAdmin()) {
<title>gelato :: <?php echo __("bookmarklet")?></title> <title>gelato :: <?php echo __("bookmarklet")?></title>
<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" /> <link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/tools.js"></script> <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/tools.js"></script>
<style type="text/css" media="screen"> <style type="text/css" media="screen">
@import "<?php echo $conf->urlGelato;?>/admin/css/style.css"; @import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
</style> </style>
</head> </head>
<body> <body>
<div id="cont"> <div id="cont">
<div id="main"> <div id="main">
@ -131,69 +131,69 @@ if ($user->isAdmin()) {
case "photo": case "photo":
?> ?>
<li class="selected"><a href="#"><img src="css/images/image.png" alt="New picture" /> <?php echo __("Picture")?></a></li> <li class="selected"><a href="#"><img src="css/images/image.png" alt="New picture" /> <?php echo __("Picture")?></a></li>
<?php <?php
break; break;
case "url": case "url":
?> ?>
<li class="selected"><a href="#"><img src="css/images/world.png" alt="New link" /> <?php echo __("Link")?></a></li> <li class="selected"><a href="#"><img src="css/images/world.png" alt="New link" /> <?php echo __("Link")?></a></li>
<?php <?php
break; break;
case "video": case "video":
?> ?>
<li class="selected"><a href="#"><img src="css/images/film.png" alt="New video" /> <?php echo __("Video")?></a></li> <li class="selected"><a href="#"><img src="css/images/film.png" alt="New video" /> <?php echo __("Video")?></a></li>
<?php <?php
break; break;
case "mp3": case "mp3":
?> ?>
<li class="selected"><a href="#"><img src="css/images/music.png" alt="New audio" /> <?php echo __("Audio")?></a></li> <li class="selected"><a href="#"><img src="css/images/music.png" alt="New audio" /> <?php echo __("Audio")?></a></li>
<?php <?php
break; break;
} }
?> ?>
</ul> </ul>
<p>&nbsp;</p> <p>&nbsp;</p>
<form action="bm.php" method="post" <?php echo (isset($_GET["new"]) && $_GET["new"]=="photo") ? "enctype=\"multipart/form-data\"" : ""?> name="frmAdd" class="newpost"> <form action="bm.php" method="post" <?php echo (isset($_GET["new"]) && $_GET["new"]=="photo") ? "enctype=\"multipart/form-data\"" : ""?> name="frmAdd" class="newpost">
<fieldset> <fieldset>
<?php <?php
$date = gmmktime(); $date = gmmktime();
$title = ""; $title = "";
$body = (isset($_GET["sel"])) ? $_GET["sel"] : ""; $body = (isset($_GET["sel"])) ? $_GET["sel"] : "";
$url = (isset($url)) ? $url : ""; $url = (isset($url)) ? $url : "";
switch ($postType) { switch ($postType) {
case "post": case "post":
$input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editBody}"); $input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editBody}");
$output = array("1", $date, $_SESSION['user_id'], $title, $body); $output = array("1", $date, $_SESSION['user_id'], $title, $body);
$template->cargarPlantilla($input, $output, "template_add_post"); $template->cargarPlantilla($input, $output, "template_add_post");
$template->mostrarPlantilla(); $template->mostrarPlantilla();
break; break;
case "photo": case "photo":
$input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}"); $input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
$output = array("2", $date, $_SESSION['user_id'], $url, $body); $output = array("2", $date, $_SESSION['user_id'], $url, $body);
$template->cargarPlantilla($input, $output, "template_add_photo_bm"); $template->cargarPlantilla($input, $output, "template_add_photo_bm");
$template->mostrarPlantilla(); $template->mostrarPlantilla();
break; break;
case "url": case "url":
$input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editUrl}", "{editBody}"); $input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editUrl}", "{editBody}");
$output = array("4", $date, $_SESSION['user_id'], $title, $url, $body); $output = array("4", $date, $_SESSION['user_id'], $title, $url, $body);
$template->cargarPlantilla($input, $output, "template_add_link"); $template->cargarPlantilla($input, $output, "template_add_link");
$template->mostrarPlantilla(); $template->mostrarPlantilla();
break; break;
case "video": case "video":
$input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}"); $input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
$output = array("6", $date, $_SESSION['user_id'], $url, $body); $output = array("6", $date, $_SESSION['user_id'], $url, $body);
$template->cargarPlantilla($input, $output, "template_add_video"); $template->cargarPlantilla($input, $output, "template_add_video");
$template->mostrarPlantilla(); $template->mostrarPlantilla();
break; break;
case "mp3": case "mp3":
$input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}"); $input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
$output = array("7", $date, $_SESSION['user_id'], $url, $body); $output = array("7", $date, $_SESSION['user_id'], $url, $body);
$template->cargarPlantilla($input, $output, "template_add_mp3"); $template->cargarPlantilla($input, $output, "template_add_mp3");
$template->mostrarPlantilla(); $template->mostrarPlantilla();
break; break;
@ -203,10 +203,10 @@ if ($user->isAdmin()) {
<span style="color: rgb(136, 136, 136); margin-bottom: 10px; font-size: 10px;"><a href="http://hobix.com/textile/">Textile</a> <?php echo __("syntax is supported.")?></span> <span style="color: rgb(136, 136, 136); margin-bottom: 10px; font-size: 10px;"><a href="http://hobix.com/textile/">Textile</a> <?php echo __("syntax is supported.")?></span>
</p> </p>
<p> <p>
<input class="btn" type="submit" name="btnAdd" value="<?php echo ($isEdition) ? "Modify" : "Create"; ?> post" /> <input class="btn" type="submit" name="btnAdd" value="Create post" />
</p> </p>
</fieldset> </fieldset>
</form> </form>
<div class="footer-box">&nbsp;</div> <div class="footer-box">&nbsp;</div>
</div> </div>
@ -220,7 +220,7 @@ if ($user->isAdmin()) {
</div> </div>
</body> </body>
</html> </html>
<?php <?php
} else { } else {
header("Location: ".$conf->urlGelato."/login.php"); header("Location: ".$conf->urlGelato."/login.php");
} }

View File

@ -16,7 +16,7 @@ require_once('entry.php');
$configFile = Absolute_Path."config.php"; $configFile = Absolute_Path."config.php";
if(file_exists($configFile)){ if(file_exists($configFile)){
require($configFile); require_once($configFile);
}else{ }else{
exit("You need to rename config-sample.php to config.php and fill out the required details."); exit("You need to rename config-sample.php to config.php and fill out the required details.");
} }

View File

@ -1,5 +1,5 @@
<?php <?php
if(!defined('entry')) define('entry',true); if(!defined('entry')) define('entry',true);
/* =========================== /* ===========================
gelato CMS - A PHP based tumblelog CMS gelato CMS - A PHP based tumblelog CMS
@ -15,27 +15,27 @@ if(!defined('entry')) define('entry',true);
require('entry.php'); require('entry.php');
global $configFile, $db; global $configFile, $db;
if (!file_exists($configFile)) { if (!file_exists($configFile)) {
$mensaje = " $mensaje = "
<h3 class=\"important\">Error reading configuration file</h3> <h3 class=\"important\">Error reading configuration file</h3>
<p>There doesn't seem to be a <code>config.php</code> file. I need this before we can get started.</p> <p>There doesn't seem to be a <code>config.php</code> file. I need this before we can get started.</p>
<p>This either means that you did not rename the <code>config-sample.php</code> file to <code>config.php</code>.</p>"; <p>This either means that you did not rename the <code>config-sample.php</code> file to <code>config.php</code>.</p>";
die($mensaje); die($mensaje);
} else { } else {
require($configFile); require_once($configFile);
} }
$sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('shorten_links', '0');"; $sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('shorten_links', '0');";
$db->ejecutarConsulta($sqlStr); $db->ejecutarConsulta($sqlStr);
$sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('rss_import_frec', '5 minutes');"; $sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('rss_import_frec', '5 minutes');";
$db->ejecutarConsulta($sqlStr); $db->ejecutarConsulta($sqlStr);
$sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('check_version', '1');"; $sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('check_version', '1');";
$db->ejecutarConsulta($sqlStr); $db->ejecutarConsulta($sqlStr);
$sqlStr = "CREATE TABLE `".Table_prefix."feeds` ( $sqlStr = "CREATE TABLE `".Table_prefix."feeds` (