123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- <?php
- if (!defined('entry')) {
- define('entry', true);
- }
- /* ===========================
-
- Sorbet CMS - A PHP based tumblelog CMS forked from Gelato CMS
-
- Sorbet CMS is a free software licensed under the GPL 3.0
-
- =========================== */
- ?>
- <?php
-
- require '../entry.php';
- global $user, $conf, $tumble;
- $template = new plantillas("admin");
- $util_class = new util();
- if ($user->isAdmin()) {
- if (isset($_POST["btnAdd"])) {
- unset($_POST["btnAdd"]);
-
- if ($_POST["type"]=="2") { // is Photo type
- if (isset($_POST["url"]) && $_POST["url"]!="") {
- $photoName = $util_class->getFileName($_POST["url"]);
- if (!$tumble->savePhoto($_POST["url"])) {
- header("Location: ".$conf->urlSorbet."/admin/index.php?photo=false");
- die();
- }
- $_POST["url"] = "../uploads/".$util_class->sanitizeName($photoName);
- }
-
- unset($_POST["photo"]);
- unset($_POST["MAX_FILE_SIZE"]);
- }
-
- if ($_POST["type"]=="7") { // is MP3 type
- set_time_limit(300);
- $mp3Name = $util_class->getFileName($_POST["url"]);
- if (!$tumble->saveMP3($_POST["url"])) {
- header("Location: ".$conf->urlSorbet."/admin/index.php?mp3=false");
- die();
- }
- if (isMP3($remoteFileName)) {
- $_POST["url"] = $conf->urlSorbet."/uploads/".$mp3Name;
- }
- }
-
- if (!get_magic_quotes_gpc()) {
- $_POST["title"] = addslashes($_POST["title"]);
- $_POST["description"] = addslashes($_POST["description"]);
- }
-
- $_POST["title"] = $util_class->removeBadTags($_POST["title"], true);
- $_POST["description"] = $util_class->removeBadTags($_POST["description"]);
-
- if ($tumble->addPost($_POST)) {
- $input = array("{type}");
- $output = array("1");
-
- $template->cargarPlantilla($input, $output, "template_bm");
- $template->mostrarPlantilla();
- die();
- } else {
- header("Location: ".$conf->urlSorbet."/admin/index.php?error=2&des=".$this->merror);
- die();
- }
- } else {
- if (isset($_GET["url"])) {
- $url = $_GET["url"];
- } else {
- $url = null;
- }
- if (isset($url)) {
- if ($util_class->isMP3($url)) {
- $postType = "mp3";
- } elseif ($util_class->isGoEar($url)) {
- $postType = "mp3";
- } elseif ($util_class->isImageFile($url)) {
- $postType = "photo";
- } elseif ($util_class->isVideo($url)) {
- $postType = "video";
- } else {
- if (isset($_GET["sel"]) && !$_GET["sel"]=="") {
- $postType = "post";
- } else {
- $postType = "url";
- }
- }
- } else {
- 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">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta name="generator" content="sorbet cms <?php echo $util_class->version(); ?>" />
- <title>sorbet :: <?php echo __("bookmarklet")?></title>
- <link rel="shortcut icon" href="<?php echo $conf->urlSorbet; ?>/images/favicon.ico" />
- <script language="javascript" type="text/javascript" src="<?php echo $conf->urlSorbet; ?>/admin/scripts/jquery.js"></script>
- <script language="javascript" type="text/javascript" src="<?php echo $conf->urlSorbet; ?>/admin/scripts/tools.js"></script>
- <script type="text/javascript" src="<?php echo $conf->urlSorbet; ?>/admin/scripts/markitup/jquery.markitup.pack.js"></script>
- <script type="text/javascript" src="<?php echo $conf->urlSorbet; ?>/admin/scripts/markitup/sets/html/set.js"></script>
- <link rel="stylesheet" type="text/css" href="<?php echo $conf->urlSorbet; ?>/admin/scripts/markitup/skins/simple/style.css" />
- <link rel="stylesheet" type="text/css" href="<?php echo $conf->urlSorbet; ?>/admin/scripts/markitup/sets/html/style.css" />
- <script type="text/javascript" >
- $(document).ready(function() {
- $("#description").markItUp(my_html);
- });
- </script>
- <style type="text/css" media="screen">
- @import "<?php echo $conf->urlSorbet; ?>/admin/css/style.css";
- </style>
- </head>
-
- <body>
- <div id="cont">
- <div id="main">
- <div class="box">
- <h3><?php echo __("New Post")?></h3>
- <ul class="menu">
- <?php
- switch ($postType) {
- case "post":
- ?>
- <li class="selected"><a href="#"><img src="css/images/page.png" alt="New post" /> <?php echo __("Regular")?></a></li>
- <?php
- break;
- case "photo":
- ?>
- <li class="selected"><a href="#"><img src="css/images/image.png" alt="New picture" /> <?php echo __("Picture")?></a></li>
- <?php
- break;
- case "url":
- ?>
- <li class="selected"><a href="#"><img src="css/images/world.png" alt="New link" /> <?php echo __("Link")?></a></li>
- <?php
- break;
- case "video":
- ?>
- <li class="selected"><a href="#"><img src="css/images/film.png" alt="New video" /> <?php echo __("Video")?></a></li>
- <?php
- break;
- case "mp3":
- ?>
- <li class="selected"><a href="#"><img src="css/images/music.png" alt="New audio" /> <?php echo __("Audio")?></a></li>
- <?php
- break;
- } ?>
- </ul>
- <p> </p>
- <form action="bm.php" method="post" <?php echo (isset($_GET["new"]) && $_GET["new"]=="photo") ? "enctype=\"multipart/form-data\"" : ""?> name="frmAdd" class="newpost">
- <fieldset>
- <?php
- $date = time();
- $title = "";
- $body = (isset($_GET["sel"])) ? $_GET["sel"] : "";
- $url = (isset($url)) ? $url : "";
-
- switch ($postType) {
- case "post":
- $input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editBody}");
- $output = array("1", $date, $_SESSION['user_id'], $title, $body);
-
- $template->cargarPlantilla($input, $output, "template_add_post");
- $template->mostrarPlantilla();
- break;
- case "photo":
- $input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
- $output = array("2", $date, $_SESSION['user_id'], $url, $body);
-
- $template->cargarPlantilla($input, $output, "template_add_photo_bm");
- $template->mostrarPlantilla();
- break;
- case "url":
-
- $input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editUrl}", "{editBody}");
- $output = array("4", $date, $_SESSION['user_id'], $title, $url, $body);
-
- $template->cargarPlantilla($input, $output, "template_add_link");
- $template->mostrarPlantilla();
- break;
- case "video":
- $input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
- $output = array("6", $date, $_SESSION['user_id'], $url, $body);
-
- $template->cargarPlantilla($input, $output, "template_add_video");
- $template->mostrarPlantilla();
- break;
- case "mp3":
- $input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
- $output = array("7", $date, $_SESSION['user_id'], $url, $body);
-
- $template->cargarPlantilla($input, $output, "template_add_mp3");
- $template->mostrarPlantilla();
- break;
- } ?>
- <p>
- <span style="color: rgb(136, 136, 136); margin-bottom: 10px; font-size: 10px;">
- <?php echo __("Some HTML allowed")?>:<br />
-
- <code>
- <strong> <em> <del> <ul> <ol> <li> <a>
- <br />
- <blockquote>
- <code> <pre> <img>
- </code>
- <br /><br />
- </span>
- </p>
- <p>
- <input class="btn" type="submit" name="btnAdd" value="Create post" />
- </p>
- </fieldset>
- </form>
- <div class="footer-box"> </div>
- </div>
-
- </div>
- <?php
-
- } ?>
- <div id="foot">
- Sorbet CMS :: PHP Tumblelog Content Management System.
- </div>
- </div>
- </body>
- </html>
- <?php
-
- } else {
- $target = (isset($_GET["url"]))? "/login.php?redirect_url=".$_GET["url"]."&sel=".$_GET["sel"] : "/login.php";
- header("Location: ".$conf->urlSorbet.$target);
- }
- ?>
|