|
@@ -0,0 +1,221 @@
|
|
1
|
+<?php
|
|
2
|
+if(!defined('entry'))define('entry', true);
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+ gelato CMS - A PHP based tumblelog CMS
|
|
6
|
+ development version
|
|
7
|
+ http:
|
|
8
|
+
|
|
9
|
+ gelato CMS is a free software licensed under the GPL 2.0
|
|
10
|
+ Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
|
|
11
|
+
|
|
12
|
+ =========================== */
|
|
13
|
+?>
|
|
14
|
+<?php
|
|
15
|
+
|
|
16
|
+require('../entry.php');
|
|
17
|
+global $user, $conf, $tumble;
|
|
18
|
+$template = new plantillas("admin");
|
|
19
|
+
|
|
20
|
+if ($user->isAdmin()) {
|
|
21
|
+
|
|
22
|
+ if(isset($_POST["btnAdd"])) {
|
|
23
|
+ unset($_POST["btnAdd"]);
|
|
24
|
+
|
|
25
|
+ if ($_POST["type"]=="2") {
|
|
26
|
+ if (isset($_POST["url"]) && $_POST["url"]!="") {
|
|
27
|
+ $photoName = getFileName($_POST["url"]);
|
|
28
|
+ if (!$tumble->savePhoto($_POST["url"])) {
|
|
29
|
+ header("Location: ".$conf->urlGelato."/admin/index.php?photo=false");
|
|
30
|
+ die();
|
|
31
|
+ }
|
|
32
|
+ $_POST["url"] = "../uploads/".sanitizeName($photoName);
|
|
33
|
+ }
|
|
34
|
+
|
|
35
|
+ if ( move_uploaded_file( $_FILES['photo']['tmp_name'], "../uploads/".sanitizeName($_FILES['photo']['name']) ) ) {
|
|
36
|
+ $_POST["url"] = "../uploads/".sanitizeName($_FILES['photo']['name']);
|
|
37
|
+ }
|
|
38
|
+
|
|
39
|
+ unset($_POST["photo"]);
|
|
40
|
+ unset($_POST["MAX_FILE_SIZE"]);
|
|
41
|
+ }
|
|
42
|
+
|
|
43
|
+ if ($_POST["type"]=="7") {
|
|
44
|
+ set_time_limit(300);
|
|
45
|
+ $mp3Name = getFileName($_POST["url"]);
|
|
46
|
+ if (!$tumble->saveMP3($_POST["url"])) {
|
|
47
|
+ header("Location: ".$conf->urlGelato."/admin/index.php?mp3=false");
|
|
48
|
+ die();
|
|
49
|
+ }
|
|
50
|
+ if (isMP3($remoteFileName)) {
|
|
51
|
+ $_POST["url"] = $conf->urlGelato."/uploads/".$mp3Name;
|
|
52
|
+ }
|
|
53
|
+ }
|
|
54
|
+
|
|
55
|
+ if (!get_magic_quotes_gpc()) {
|
|
56
|
+ $_POST["title"] = addslashes($_POST["title"]);
|
|
57
|
+ $_POST["description"] = addslashes($_POST["description"]);
|
|
58
|
+ }
|
|
59
|
+
|
|
60
|
+ $_POST["title"] = strip_tags($_POST["title"]);
|
|
61
|
+ $_POST["description"] = strip_tags($_POST["description"]);
|
|
62
|
+
|
|
63
|
+ if ($tumble->addPost($_POST)) {
|
|
64
|
+ header("Location: ".$conf->urlGelato."/admin/index.php?added=true");
|
|
65
|
+ die();
|
|
66
|
+ } else {
|
|
67
|
+ header("Location: ".$conf->urlGelato."/admin/index.php?error=2&des=".$this->merror);
|
|
68
|
+ die();
|
|
69
|
+ }
|
|
70
|
+ } else {
|
|
71
|
+
|
|
72
|
+ if (isset($_GET["url"])) {
|
|
73
|
+ $url = $_GET["url"];
|
|
74
|
+ } else {
|
|
75
|
+ $url = null;
|
|
76
|
+ }
|
|
77
|
+ if (isset($url)) {
|
|
78
|
+
|
|
79
|
+ if (isMP3($url)) {
|
|
80
|
+ $postType = "mp3";
|
|
81
|
+ } elseif (isGoEar($url)) {
|
|
82
|
+ $postType = "mp3";
|
|
83
|
+ } elseif (isImageFile($url)) {
|
|
84
|
+ $postType = "photo";
|
|
85
|
+ } elseif (isVideo($url)) {
|
|
86
|
+ $postType = "video";
|
|
87
|
+ } else {
|
|
88
|
+ if (isset($_GET["sel"]) && !$_GET["sel"]=="" ) {
|
|
89
|
+ $postType = "post";
|
|
90
|
+ } else {
|
|
91
|
+ $postType = "url";
|
|
92
|
+ }
|
|
93
|
+ }
|
|
94
|
+
|
|
95
|
+ } else {
|
|
96
|
+ die(__("Must be a valid URL"));
|
|
97
|
+ }
|
|
98
|
+?>
|
|
99
|
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
100
|
+ <html xmlns="http://www.w3.org/1999/xhtml">
|
|
101
|
+ <head>
|
|
102
|
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
103
|
+ <meta name="generator" content="gelato cms <?php echo version();?>" />
|
|
104
|
+ <title>gelato :: <?php echo __("bookmarklet")?></title>
|
|
105
|
+ <link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
|
|
106
|
+ <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/tools.js"></script>
|
|
107
|
+ <style type="text/css" media="screen">
|
|
108
|
+ @import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
|
|
109
|
+ </style>
|
|
110
|
+ </head>
|
|
111
|
+
|
|
112
|
+ <body>
|
|
113
|
+ <div id="cont">
|
|
114
|
+ <div id="main">
|
|
115
|
+ <div class="box">
|
|
116
|
+ <h3><?php echo __("New Post")?></h3>
|
|
117
|
+ <ul class="menu">
|
|
118
|
+<?php
|
|
119
|
+ switch ($postType) {
|
|
120
|
+ case "post":
|
|
121
|
+?>
|
|
122
|
+ <li class="selected"><a href="#"><img src="css/images/page.png" alt="New post" /> <?php echo __("Regular")?></a></li>
|
|
123
|
+<?php
|
|
124
|
+ break;
|
|
125
|
+ case "photo":
|
|
126
|
+?>
|
|
127
|
+ <li class="selected"><a href="#"><img src="css/images/image.png" alt="New picture" /> <?php echo __("Picture")?></a></li>
|
|
128
|
+<?php
|
|
129
|
+ break;
|
|
130
|
+ case "url":
|
|
131
|
+?>
|
|
132
|
+ <li class="selected"><a href="#"><img src="css/images/world.png" alt="New link" /> <?php echo __("Link")?></a></li>
|
|
133
|
+<?php
|
|
134
|
+ break;
|
|
135
|
+ case "video":
|
|
136
|
+?>
|
|
137
|
+ <li class="selected"><a href="#"><img src="css/images/film.png" alt="New video" /> <?php echo __("Video")?></a></li>
|
|
138
|
+<?php
|
|
139
|
+ break;
|
|
140
|
+ case "mp3":
|
|
141
|
+?>
|
|
142
|
+ <li class="selected"><a href="#"><img src="css/images/music.png" alt="New audio" /> <?php echo __("Audio")?></a></li>
|
|
143
|
+<?php
|
|
144
|
+ break;
|
|
145
|
+ }
|
|
146
|
+?>
|
|
147
|
+ </ul>
|
|
148
|
+ <p> </p>
|
|
149
|
+ <form action="index.php" method="post" <?php echo (isset($_GET["new"]) && $_GET["new"]=="photo") ? "enctype=\"multipart/form-data\"" : ""?> name="frmAdd" class="newpost">
|
|
150
|
+ <fieldset>
|
|
151
|
+<?php
|
|
152
|
+ $date = gmmktime();
|
|
153
|
+ $title = "";
|
|
154
|
+ $body = (isset($_GET["sel"])) ? $_GET["sel"] : "";
|
|
155
|
+ $url = (isset($url)) ? $url : "";
|
|
156
|
+
|
|
157
|
+ switch ($postType) {
|
|
158
|
+ case "post":
|
|
159
|
+ $input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editBody}");
|
|
160
|
+ $output = array("1", $date, $_SESSION['user_id'], $title, $body);
|
|
161
|
+
|
|
162
|
+ $template->cargarPlantilla($input, $output, "template_add_post");
|
|
163
|
+ $template->mostrarPlantilla();
|
|
164
|
+ break;
|
|
165
|
+ case "photo":
|
|
166
|
+ $input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
|
|
167
|
+ $output = array("2", $date, $_SESSION['user_id'], $url, $body);
|
|
168
|
+
|
|
169
|
+ $template->cargarPlantilla($input, $output, "template_add_photo");
|
|
170
|
+ $template->mostrarPlantilla();
|
|
171
|
+ break;
|
|
172
|
+ case "url":
|
|
173
|
+
|
|
174
|
+ $input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editUrl}", "{editBody}");
|
|
175
|
+ $output = array("4", $date, $_SESSION['user_id'], $title, $url, $body);
|
|
176
|
+
|
|
177
|
+ $template->cargarPlantilla($input, $output, "template_add_link");
|
|
178
|
+ $template->mostrarPlantilla();
|
|
179
|
+ break;
|
|
180
|
+ case "video":
|
|
181
|
+ $input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
|
|
182
|
+ $output = array("6", $date, $_SESSION['user_id'], $url, $body);
|
|
183
|
+
|
|
184
|
+ $template->cargarPlantilla($input, $output, "template_add_video");
|
|
185
|
+ $template->mostrarPlantilla();
|
|
186
|
+ break;
|
|
187
|
+ case "mp3":
|
|
188
|
+ $input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
|
|
189
|
+ $output = array("7", $date, $_SESSION['user_id'], $url, $body);
|
|
190
|
+
|
|
191
|
+ $template->cargarPlantilla($input, $output, "template_add_mp3");
|
|
192
|
+ $template->mostrarPlantilla();
|
|
193
|
+ break;
|
|
194
|
+ }
|
|
195
|
+?>
|
|
196
|
+ <p>
|
|
197
|
+ <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>
|
|
198
|
+ </p>
|
|
199
|
+ <p>
|
|
200
|
+ <input class="btn" type="submit" name="btnAdd" value="<?php echo ($isEdition) ? "Modify" : "Create"; ?> post" />
|
|
201
|
+ </p>
|
|
202
|
+ </fieldset>
|
|
203
|
+ </form>
|
|
204
|
+ <div class="footer-box"> </div>
|
|
205
|
+ </div>
|
|
206
|
+
|
|
207
|
+ </div>
|
|
208
|
+<?php
|
|
209
|
+ }
|
|
210
|
+?>
|
|
211
|
+ <div id="foot">
|
|
212
|
+ <a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
|
|
213
|
+ </div>
|
|
214
|
+ </div>
|
|
215
|
+ </body>
|
|
216
|
+ </html>
|
|
217
|
+<?php
|
|
218
|
+} else {
|
|
219
|
+ header("Location: ".$conf->urlGelato."/login.php");
|
|
220
|
+}
|
|
221
|
+?>
|