diff --git a/admin/index.php b/admin/index.php index 4e28865..77ecead 100644 --- a/admin/index.php +++ b/admin/index.php @@ -9,31 +9,41 @@ if(!defined('entry'))define('entry', true); gelato CMS is a free software licensed under the GPL 2.0 Copyright (C) 2007 by Pedro Santana - =========================== */ + =========================== */ ?> isAuthenticated()) { +$theme->set('isEdition',$isEdition); +$theme->set('postId',$postId); +$theme->set('pagination',''); +if (get_magic_quotes_gpc()) { + foreach($_GET as $k=>$get){ + $_GET[$k]=stripslashes($get); + } +} + +if ($user->isAuthenticated()) { if (isset($_GET["delete"])) { $tumble->deletePost($_GET['delete']); header("Location: index.php?deleted=true"); die(); } - if(isset($_POST["btnAdd"])) { + if(isset($_POST["btnAdd"])){ unset($_POST["btnAdd"]); - - - if ($_POST["type"]=="2") { // is Photo type - if (isset($_POST["url"]) && $_POST["url"]!="") { + $_POST['type'] = type2Number($_POST['type']); + + 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"); @@ -41,15 +51,15 @@ if ($user->isAuthenticated()) { } $_POST["url"] = "../uploads/".sanitizeName($photoName); } - + if ( move_uploaded_file( $_FILES['photo']['tmp_name'], "../uploads/".sanitizeName($_FILES['photo']['name']) ) ) { $_POST["url"] = "../uploads/".sanitizeName($_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"]); @@ -60,297 +70,219 @@ if ($user->isAuthenticated()) { if (isMP3($remoteFileName)) { $_POST["url"] = $conf->urlGelato."/uploads/".$mp3Name; } - } - - if (!get_magic_quotes_gpc()) { + } + + if (!get_magic_quotes_gpc()) { $_POST["title"] = addslashes($_POST["title"]); $_POST["description"] = addslashes($_POST["description"]); - } - + } + /* $textile = new Textile(); - + $_POST["title"] = $textile->TextileThis(removeBadTags($_POST["title"],true)); $_POST["description"] = $textile->TextileThis(removeBadTags($_POST["description"])); */ - + $_POST["title"] = removeBadTags($_POST["title"],true); $_POST["description"] = removeBadTags($_POST["description"]); - - if (isset($_POST["id_post"])) { + + if (isset($_POST["id_post"]) and is_numeric($_POST["id_post"]) and $_POST["id_post"]>0) { $tumble->modifyPost($_POST, $_POST["id_post"]); - } else { + } 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); + header("Location: ".$conf->urlGelato."/admin/index.php?error=2&des=".$tumble->merror); die(); } - } + } } else { if ($isEdition) { $post = $tumble->getPost($postId); } - -?> - - - - - - gelato :: <?php echo __("control panel")?> - - - - - - -richText) { -?> - - - - - - - - - - - - - - -
- -
-
- -

 

-check_version){ - $present = version(); - $lastest = _file_get_contents("http://www.gelatocms.com/vgel.txt"); - if ($present < $lastest) { - echo "
".__("A new gelato version has been released and is ready for download.")."

"; - } - } - if (isset($_GET["deleted"])) { - if ($_GET["deleted"]=="true") { - echo "
".__("The post has been eliminated successfully.")."
"; - } - } - - if (isset($_GET["modified"])) { - if ($_GET["modified"]=="true") { - echo "
".__("The post has been modified successfully.")."
"; - } - } - - if (isset($_GET["added"])) { - if ($_GET["added"]=="true") { - echo "
".__("The post has been added successfully.")."
"; - } - } - - if (isset($_GET["error"])) { - if ($_GET["error"]==2) { - echo "
".__("Error on the database server:")." ".$_GET["des"]."
"; - } - } - - if (isset($_GET["mp3"])) { - if ($_GET["mp3"]=="false") { - echo "
".__("Not an MP3 file or an upload problem.")."
"; - } - } - - if (isset($_GET["photo"])) { - if ($_GET["photo"]=="false") { - echo "
".__("Not a photo file or an upload problem.")."
"; - } - } -?> -
name="frmAdd" id="autosave" class="newpost"> -
- - -cargarPlantilla($input, $output, "template_add_post"); - $template->mostrarPlantilla(); - break; - case "photo": - $url = str_replace("../", $conf->urlGelato."/", $url); - $input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}"); - $output = array("2", $date, $_SESSION['user_id'], $url, $body); - - $template->cargarPlantilla($input, $output, "template_add_photo"); - $template->mostrarPlantilla(); - break; - case "quote": - $input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editBody}"); - $output = array("3", $date, $_SESSION['user_id'], $title, $body); - - $template->cargarPlantilla($input, $output, "template_add_quote"); - $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 "conversation": - $input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editBody}"); - $output = array("5", $date, $_SESSION['user_id'], $title, $body); - - $template->cargarPlantilla($input, $output, "template_add_conversation"); - $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; - default: - $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; - } -?> -

- - :
-      - - <strong> <em> <del> <ul> <ol> <li> <a> -
-     <blockquote> - <code> <pre> <img> -
-

- Bookmarklet - " href="javascript:var w; setTimeout('w.focus()',100);w=window.open('urlGelato; ?>/admin/bm.php?url='+encodeURIComponent(location.href)+'&sel='+encodeURIComponent(window.getSelection()),'bookmarklet','toolbar=0,resizable=0,status=1,width=650,height=540,dependent=yes' ); w.focus();"> -

-
-

-

- post" /> -

-
-
- -
- -
- -set('version',version()); + $theme->set('conf', array( + 'urlGelato'=>$conf->urlGelato, + 'richText'=>$conf->richText + )); + $theme->set('new',isset($_GET['new'])?$_GET['new']:''); + $theme->set('information',false); + $theme->set('error',false); + + if($conf->check_version){ + $present = version(); + $lastest = _file_get_contents("http://www.gelatocms.com/vgel.txt"); + if ($present < $lastest) + $theme->set('information',__("A new gelato version has been released and is ready for download.")); + } + + $actions = array( + 'deleted'=>false, + 'modified'=>false, + 'added'=>false + ); + + if(isset($_GET['deleted']) and $_GET['deleted']=='true'){ + $theme->set('exito',__("The post has been eliminated successfully.")); + $actions['deleted'] = true; + } + + if(isset($_GET["modified"]) and $_GET["modified"]==true){ + $theme->set('exito',__("The post has been modified successfully.")); + $actions['modified']=true; + } + + if(isset($_GET["added"]) and $_GET["added"]==true) { + $theme->set('exito',__("The post has been added successfully.")); + $actions['added']=true; + } + + $theme->set('action',$actions); + + if (isset($_GET["error"]) and $_GET["error"]==2) + $theme->set('error',__("Error on the database server:")." ".$_GET["des"]); + + if (isset($_GET["mp3"]) and $_GET["mp3"]=='false') + $theme->set('error',__("Not an MP3 file or an upload problem.")); + + if (isset($_GET["photo"]) and $_GET["photo"]=='false') + $theme->set('error',__("Not a photo file or an upload problem.")); + + if ($isEdition) { + switch ($post["type"]) { + case "1": $_GET["new"] = "post"; break; + case "2": $_GET["new"] = "photo"; break; + case "3": $_GET["new"] = "quote"; break; + case "4": $_GET["new"] = "url"; break; + case "5": $_GET["new"] = "conversation"; break; + case "6": $_GET["new"] = "video"; break; + case "7": $_GET["new"] = "mp3"; break; + } + } + + $date = ($isEdition) ? strtotime($post["date"]) : gmmktime(); + $title = ($isEdition) ? htmlspecialchars(stripslashes($post["title"])) : ""; + $body = ($isEdition) ? stripslashes($post["description"]) : ""; + $url = ($isEdition) ? $post["url"] : ""; + + if (!isset($_GET['new'])) $_GET['new'] = 'post'; + + $theme->set('date',$date); + $theme->set('id_user',$_SESSION['user_id']); + $theme->set('type',$_GET["new"]); + $theme->set('editBody',$body); + + switch ($_GET["new"]) { + case "post": + $theme->set('editTitle',$title); + break; + case "photo": + $url = str_replace("../", $conf->urlGelato."/", $url); + $theme->set('editUrl',$url); + break; + case "quote": + $theme->set('editTitle',$title); + break; + case "url": + $theme->set('editTitle',$title); + $theme->set('editUrl',$url); + break; + case "conversation": + $theme->set('editTitle',$title); + break; + case "video": + $theme->set('editUrl',$url); + break; + case "mp3": + $theme->set('editUrl',$url); + break; + } + + if (!$isEdition){ + if (isset($_GET["page"])) + $page_num = $_GET["page"]; + else + $page_num = NULL; + + $limit=$conf->postLimit; + + if(isset($page_num) && is_numeric($page_num) && $page_num>0)// Is defined the page and is numeric? + $from = (($page_num-1) * $limit); + else + $from = 0; + + $rs = $tumble->getPosts($limit, $from); + $theme->set('Posts_Number',$tumble->contarRegistros()); + + $rows = array(); + if ($tumble->contarRegistros()>0) { + while($register = mysql_fetch_array($rs)) { + $row['postType'] = type2Text($tumble->getType($register["id_post"])); + + $formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime)); + $permalink = $conf->urlGelato."/index.php/post/".$register["id_post"]."/"; + + $register["title"] = stripslashes($register["title"]); + $register["description"] = stripslashes($register["description"]); + + $row['Id_Post'] = $register["id_post"]; + $row['Date_Added'] = $formatedDate; + $row['Permalink'] = $permalink; + + switch ($tumble->getType($register["id_post"])) { + case "1": + $row['Title'] = $register["title"]; + $row['Body'] = $register["description"]; + break; + case "2": + $fileName = "../uploads/".getFileName($register["url"]); + + $x = @getimagesize($fileName); + if ($x[0] > 100) + $photoPath = $conf->urlGelato."/classes/imgsize.php?w=100&img=".$register["url"]; + else + $photoPath = $register["url"]; + + $effect = " href=\"".str_replace("../", $conf->urlGelato."/", $register["url"])."\" rel=\"lightbox\""; + + $row['PhotoURL'] = $photoPath; + $row['PhotoAlt'] = strip_tags($register["description"]); + $row['Caption'] = $register["description"]; + $row['Effect'] = $effect; + break; + case "3": + $row['Quote'] = $register["description"]; + $row['Source'] = $register["title"]; + break; + case "4": + if($conf->shorten_links) + $register["url"] = _file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]); + $register["title"] = ($register["title"]=="")? $register["url"] : $register["title"]; + + $row['URL'] = $register["url"]; + $row['Name'] = $register["title"]; + $row['Description'] = $register["description"]; + break; + case "5": + $row['Title'] = $register["title"]; + $row['Conversation'] = $tumble->formatConversation($register["description"]); + break; + case "6": + $row['Video'] = $tumble->getVideoPlayer($register["url"]); + $row['Caption'] = $register["description"]; + break; + case "7": + $row['Mp3'] = $tumble->getMp3Player($register["url"]); + $row['Caption'] = $register["description"]; + break; } +<<<<<<< .mine + $rows[] = $row; + } +======= $limit=$conf->postLimit; @@ -387,84 +319,22 @@ if ($user->isAuthenticated()) { } else { $photoPath = $register["url"]; } +>>>>>>> .r241 - $effect = " href=\"".str_replace("../", $conf->urlGelato."/", $register["url"])."\" rel=\"lightbox\""; - - $input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{PhotoURL}", "{PhotoAlt}", "{Caption}", "{Effect}", "{URL_Tumble}"); - $output = array($register["id_post"], $formatedDate, $permalink, $photoPath, strip_tags($register["description"]), $register["description"], $effect, $conf->urlGelato); - - $template->cargarPlantilla($input, $output, "template_photo"); - $template->mostrarPlantilla(); - break; - case "3": - $input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{Quote}", "{Source}", "{URL_Tumble}"); - $output = array($register["id_post"], $formatedDate, $permalink, $register["description"], $register["title"], $conf->urlGelato); - - $template->cargarPlantilla($input, $output, "template_quote"); - $template->mostrarPlantilla(); - break; - case "4": - if($conf->shorten_links){ - $register["url"] = _file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]); - } - $register["title"] = ($register["title"]=="")? $register["url"] : $register["title"]; - $input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{URL}", "{Name}", "{Description}", "{URL_Tumble}"); - $output = array($register["id_post"], $formatedDate, $permalink, $register["url"], $register["title"], $register["description"], $conf->urlGelato); - - $template->cargarPlantilla($input, $output, "template_url"); - $template->mostrarPlantilla(); - break; - case "5": - $input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{Title}", "{Conversation}", "{URL_Tumble}"); - $output = array($register["id_post"], $formatedDate, $permalink, $register["title"], $tumble->formatConversation($register["description"]), $conf->urlGelato); - - $template->cargarPlantilla($input, $output, "template_conversation"); - $template->mostrarPlantilla(); - break; - case "6": - $input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{Video}", "{Caption}", "{URL_Tumble}"); - $output = array($register["id_post"], $formatedDate, $permalink, $tumble->getVideoPlayer($register["url"]), $register["description"], $conf->urlGelato); - - $template->cargarPlantilla($input, $output, "template_video"); - $template->mostrarPlantilla(); - break; - case "7": - $input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{Mp3}", "{Caption}", "{URL_Tumble}"); - $output = array($register["id_post"], $formatedDate, $permalink, $tumble->getMp3Player($register["url"]), $register["description"], $conf->urlGelato); - - $template->cargarPlantilla($input, $output, "template_mp3"); - $template->mostrarPlantilla(); - break; - } - } + $p = new pagination; + $p->items($tumble->getPostsNumber()); + $p->limit($limit); + $p->currentPage(isset($page_num) ? $page_num : 1); - $p = new pagination; - $p->items($tumble->getPostsNumber()); - $p->limit($limit); - $p->currentPage(isset($page_num) ? $page_num : 1); - $p->show(); - - - } else { - $template->renderizaEtiqueta(__("No posts in this tumblelog."), "div","error"); - } - -?> - -
-
-set('pagination',$p->getPagination()); + $theme->set('rows',$rows); + }else{ + $theme->set('error',__("No posts in this tumblelog.")); } -?> - -
- - -display(Absolute_Path.'admin/themes/admin/index.htm'); } } else { header("Location: ".$conf->urlGelato."/login.php"); } -?> \ No newline at end of file +?> diff --git a/admin/themes/admin/template_add_conversation.htm b/admin/themes/admin/template_add_conversation.htm deleted file mode 100644 index 765406b..0000000 --- a/admin/themes/admin/template_add_conversation.htm +++ /dev/null @@ -1,35 +0,0 @@ -
-
- -
- -
- -
- Example
- - Geek: Wow an open source tumblelog CMS!!.
- Normal: Tumble... what??
- Geek: Read the wikipedia!! -
-
- -
- - - - - - - \ No newline at end of file diff --git a/admin/themes/admin/template_add_link.htm b/admin/themes/admin/template_add_link.htm deleted file mode 100644 index 5a2ec65..0000000 --- a/admin/themes/admin/template_add_link.htm +++ /dev/null @@ -1,38 +0,0 @@ - -
- -
-
-
- -
-
-
- - -
- - - - - - \ No newline at end of file diff --git a/admin/themes/admin/template_add_mp3.htm b/admin/themes/admin/template_add_mp3.htm deleted file mode 100644 index 49c03b3..0000000 --- a/admin/themes/admin/template_add_mp3.htm +++ /dev/null @@ -1,35 +0,0 @@ - -
- -
-
- This is the MP3 file URL or a GoEar URL or an Odeo URL.
- (ie. http://www.goear.com/listen.php?v=c0a2c85) -
-
-
-
- -
- - - - - - - - \ No newline at end of file diff --git a/admin/themes/admin/template_add_photo.htm b/admin/themes/admin/template_add_photo.htm deleted file mode 100644 index 7ef810d..0000000 --- a/admin/themes/admin/template_add_photo.htm +++ /dev/null @@ -1,76 +0,0 @@ - - -
- -
-
- Supports JPEG, GIF and PNG.  Max size is 10 MB. -
-
- Use a URL instead -
-
- -
- -
-
- Use a upload form instead -
-
- -
- - -
- - - - - - - - - - - \ No newline at end of file diff --git a/admin/themes/admin/template_add_photo_bm.htm b/admin/themes/admin/template_add_photo_bm.htm deleted file mode 100644 index 43b4961..0000000 --- a/admin/themes/admin/template_add_photo_bm.htm +++ /dev/null @@ -1,66 +0,0 @@ - - -
- -
- -
- -
-
- -
- -
-
- - - - - - - - - - - \ No newline at end of file diff --git a/admin/themes/admin/template_add_post.htm b/admin/themes/admin/template_add_post.htm deleted file mode 100644 index a2b79be..0000000 --- a/admin/themes/admin/template_add_post.htm +++ /dev/null @@ -1,27 +0,0 @@ - -
- -
-
-
- - -
- - - - - - - \ No newline at end of file diff --git a/admin/themes/admin/template_add_quote.htm b/admin/themes/admin/template_add_quote.htm deleted file mode 100644 index 6523651..0000000 --- a/admin/themes/admin/template_add_quote.htm +++ /dev/null @@ -1,29 +0,0 @@ - - -
- -
-
-
- -
-
- - - - - - - - \ No newline at end of file diff --git a/admin/themes/admin/template_add_video.htm b/admin/themes/admin/template_add_video.htm deleted file mode 100644 index 712275c..0000000 --- a/admin/themes/admin/template_add_video.htm +++ /dev/null @@ -1,36 +0,0 @@ - -
- -
-
- This is the URL from the video sites YouTube, Vimeo, Yahoo, Daily Motion
- or even an Slide Share Presentation.
- (ie. http://youtube.com/watch?v=HcBFLN9cli0) -
-
-
-
- -
- - - - - - - - \ No newline at end of file diff --git a/admin/themes/admin/template_comment.htm b/admin/themes/admin/template_comment.htm deleted file mode 100644 index 125ef3a..0000000 --- a/admin/themes/admin/template_comment.htm +++ /dev/null @@ -1,8 +0,0 @@ -
-
Link   -

{Comment_Author}

-
-
-

{Comment}

-
-
\ No newline at end of file diff --git a/admin/themes/admin/template_comment_post.htm b/admin/themes/admin/template_comment_post.htm deleted file mode 100644 index 0cf9389..0000000 --- a/admin/themes/admin/template_comment_post.htm +++ /dev/null @@ -1,28 +0,0 @@ -
-
-

- - -

-

- - -

-

- - -

-

-
- -

-

- -

-

- - - -

-
-
\ No newline at end of file diff --git a/admin/themes/admin/template_conversation.htm b/admin/themes/admin/template_conversation.htm deleted file mode 100644 index 9c26345..0000000 --- a/admin/themes/admin/template_conversation.htm +++ /dev/null @@ -1,9 +0,0 @@ -
-
Link   -

{Date_Added}

-
-
- {Title} -
{Conversation}
-
-
\ No newline at end of file diff --git a/admin/themes/admin/template_mp3.htm b/admin/themes/admin/template_mp3.htm deleted file mode 100644 index 0863a7f..0000000 --- a/admin/themes/admin/template_mp3.htm +++ /dev/null @@ -1,9 +0,0 @@ -
-
Link   -

{Date_Added}

-
-
- {Caption} -

Play song Play

-
-
\ No newline at end of file diff --git a/admin/themes/admin/template_photo.htm b/admin/themes/admin/template_photo.htm deleted file mode 100644 index 81f6386..0000000 --- a/admin/themes/admin/template_photo.htm +++ /dev/null @@ -1,9 +0,0 @@ -
-
Link   -

{Date_Added}

-
-
- {Caption} -

{PhotoAlt}

-
-
\ No newline at end of file diff --git a/admin/themes/admin/template_quote.htm b/admin/themes/admin/template_quote.htm deleted file mode 100644 index a88f6a1..0000000 --- a/admin/themes/admin/template_quote.htm +++ /dev/null @@ -1,9 +0,0 @@ -
-
Link   -

{Date_Added}

-
-
- — {Source} -

“ {Quote}

-
-
\ No newline at end of file diff --git a/admin/themes/admin/template_regular_post.htm b/admin/themes/admin/template_regular_post.htm deleted file mode 100644 index 83156b8..0000000 --- a/admin/themes/admin/template_regular_post.htm +++ /dev/null @@ -1,9 +0,0 @@ -
-
Link   -

{Date_Added}

-
-
- {Title} -

{Body}

-
-
\ No newline at end of file diff --git a/admin/themes/admin/template_url.htm b/admin/themes/admin/template_url.htm deleted file mode 100644 index 0cac945..0000000 --- a/admin/themes/admin/template_url.htm +++ /dev/null @@ -1,9 +0,0 @@ -
-
Link   -

{Date_Added}

-
-
- » {Name} -

{Description}

-
-
\ No newline at end of file diff --git a/admin/themes/admin/template_video.htm b/admin/themes/admin/template_video.htm deleted file mode 100644 index affb252..0000000 --- a/admin/themes/admin/template_video.htm +++ /dev/null @@ -1,9 +0,0 @@ -
-
Link   -

{Date_Added}

-
-
- {Caption} -

Watch video Watch

-
-
\ No newline at end of file diff --git a/classes/gelato.class.php b/classes/gelato.class.php index 1eebf22..fcec137 100644 --- a/classes/gelato.class.php +++ b/classes/gelato.class.php @@ -1,5 +1,5 @@ conf = new configuration(); } - + function saveSettings($fieldsArray) { if ($this->modificarDeFormulario($this->conf->tablePrefix."config", $fieldsArray)) { header("Location: ".$this->conf->urlGelato."/admin/settings.php?modified=true"); @@ -32,24 +32,24 @@ class gelato extends Conexion_Mysql { die(); } } - + function saveOption($value, $name) { - $sqlStr = "UPDATE ".$this->conf->tablePrefix."options SET val='".$value."' WHERE name='".$name."' LIMIT 1"; + $sqlStr = "UPDATE ".$this->conf->tablePrefix."options SET val='".$value."' WHERE name='".$name."' LIMIT 1"; if ($this->ejecutarConsulta($sqlStr)) { return true; } else { return true; } } - - function addPost($fieldsArray) { + + function addPost($fieldsArray) { if ($this->insertarDeFormulario($this->conf->tablePrefix."data", $fieldsArray)) { return true; } else { return false; - } + } } - + function modifyPost($fieldsArray, $id_post) { if ($this->modificarDeFormulario($this->conf->tablePrefix."data", $fieldsArray, "id_post=$id_post")) { header("Location: ".$this->conf->urlGelato."/admin/index.php?modified=true"); @@ -59,31 +59,31 @@ class gelato extends Conexion_Mysql { die(); } } - + function deletePost($idPost) { $this->ejecutarConsulta("DELETE FROM ".$this->conf->tablePrefix."data WHERE id_post=".$idPost); - } - + } + function getPosts($limit="10", $from="0") { $sqlStr = "select * from ".$this->conf->tablePrefix."data ORDER BY date DESC LIMIT $from,$limit"; $this->ejecutarConsulta($sqlStr); return $this->mid_consulta; } - + function getPost($id="") { $this->ejecutarConsulta("select * from ".$this->conf->tablePrefix."data WHERE id_post=".$id); return mysql_fetch_array($this->mid_consulta); } - + function getPostsNumber() { $this->ejecutarConsulta("select count(*) as total from ".$this->conf->tablePrefix."data"); $row = mysql_fetch_assoc($this->mid_consulta); return $row['total']; } - + function getType($id) { - if ($this->ejecutarConsulta("select type from ".$this->conf->tablePrefix."data WHERE id_post=".$id)) { - if ($this->contarRegistros()>0) { + if ($this->ejecutarConsulta("select type from ".$this->conf->tablePrefix."data WHERE id_post=".$id)) { + if ($this->contarRegistros()>0) { while($registro = mysql_fetch_array($this->mid_consulta)) { return $registro[0]; } @@ -92,55 +92,55 @@ class gelato extends Conexion_Mysql { return "0"; } } - + function formatConversation($text) { $formatedText = ""; $odd=true; - + $lines = explode("\n", $text); - + $formatedText .= "\n"; return $formatedText; } - + function formatApiConversation($text) { $formatedText = ""; - + $lines = explode("\n", $text); - + foreach ($lines as $line) { $pos = strpos($line, ":") + 1; - + $name = substr($line, 0, $pos-1); $label = substr($line, 0, $pos); $desc = substr($line, $pos, strlen($line)); - + $formatedText .= "".$desc."\n"; } - + return $formatedText; } - + function saveMP3($remoteFileName) { if (getMP3File($remoteFileName)) { return true; @@ -148,15 +148,15 @@ class gelato extends Conexion_Mysql { return false; } } - - function savePhoto($remoteFileName) { + + function savePhoto($remoteFileName) { if (getPhotoFile($remoteFileName)) { return true; } else { return false; } } - + function getVideoPlayer($url) { if (isYoutubeVideo($url)) { $id_video = getYoutubeVideoUrl($url); @@ -178,7 +178,7 @@ class gelato extends Conexion_Mysql { return "\t\t\t\n"; } else { return "This URL is not a supported video (YouTube, Google Video, Vimeo, DailyMotion, Yahoo Video or SlideShare)"; - } + } } function getMp3Player($url) { if (isMP3($url)) { @@ -190,7 +190,7 @@ class gelato extends Conexion_Mysql { return "\t\t\t\n"; } else { return "This URL is not an MP3 file."; - } + } } function getPermalink($post_id){ @@ -200,5 +200,13 @@ class gelato extends Conexion_Mysql { $out .= $post_id.$strEnd; return $out; } -} -?> \ No newline at end of file + + function getPermalink($post_id){ + $strEnd = ($this->conf->urlFriendly) ? "/" : ""; + $out = $this->conf->urlGelato; + $out .= ($this->conf->urlFriendly) ? "/post/" : "/index.php?post="; + $out .= $post_id.$strEnd; + return $out; + } +} +?> diff --git a/classes/mysql_connection.class.php b/classes/mysql_connection.class.php index f94efa6..721c2dd 100644 --- a/classes/mysql_connection.class.php +++ b/classes/mysql_connection.class.php @@ -122,12 +122,12 @@ class Conexion_Mysql { $sqlValues .= "'$valor',"; } } - $cols = rtrim($cols, ',').')'; - $sqlValues = rtrim($sqlValues, ',').')'; + $cols = rtrim($cols, ',').')'; + $sqlValues = rtrim($sqlValues, ',').')'; - // inserta los valores en la DB - $sql = "INSERT INTO $tabla $cols VALUES $sqlValues"; - return $this->ejecutarConsulta($sql); + // inserta los valores en la DB + $sql = "INSERT INTO $tabla $cols VALUES $sqlValues"; + return $this->ejecutarConsulta($sql); } /** @@ -291,4 +291,4 @@ class Conexion_Mysql { return $value; } } //fin de la Clase conexion_mysql -?> \ No newline at end of file +?> diff --git a/classes/themes.class.php b/classes/themes.class.php index 47b8f64..e688b64 100644 --- a/classes/themes.class.php +++ b/classes/themes.class.php @@ -110,4 +110,4 @@ class themes{ } } } -?> \ No newline at end of file +?> diff --git a/entry.php b/entry.php index 8268478..fd22776 100644 --- a/entry.php +++ b/entry.php @@ -81,6 +81,6 @@ if($installed){ $feeds = new feeds(); $feeds->updateFeeds(); unset($feeds); -} +} ?> diff --git a/index.php b/index.php index e3ba4a4..4a0c1b3 100644 --- a/index.php +++ b/index.php @@ -107,7 +107,7 @@ $theme = new themes; while($register = mysql_fetch_assoc($rs)) { $formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime)); if ( $dateTmp != null && $formatedDate == $dateTmp ) { $formatedDate = ""; } else { $dateTmp = $formatedDate; } - + $permalink = $tumble->getPermalink($register["id_post"]); $conversation = $register["description"];