From 3290ea1a8dd3ccb6fb4b0d8f897857643e121283 Mon Sep 17 00:00:00 2001 From: Victor De la Rocha Date: Sun, 26 Oct 2008 23:17:48 +0000 Subject: [PATCH] * Change on themes {$postType} from numbers to type string. * fixed a bug when commenting is disabled and a other changes on index --- index.php | 43 ++++++------ themes/tumblr/index.htm | 144 +++++++++++++++++++++------------------- 2 files changed, 95 insertions(+), 92 deletions(-) diff --git a/index.php b/index.php index f1782d1..0d2f14d 100644 --- a/index.php +++ b/index.php @@ -18,7 +18,7 @@ require_once('entry.php'); global $user, $tumble, $conf; $theme = new themes; - // Our first approach to MVC... ¿our second? visit http://www.flavorphp.com + // Our first approach to MVC... �our second? visit http://www.flavorphp.com if(isset($_SERVER['PATH_INFO'])) $param_url = explode("/",$_SERVER['PATH_INFO']); @@ -36,7 +36,7 @@ $theme = new themes; } $theme->set('id_post',$id_post); - $theme->set('error',''); + $theme->set('error',''); if (isset($_GET["page"])) { $page_num = $_GET["page"]; @@ -61,7 +61,7 @@ $theme = new themes; $page_title_divisor = " » "; // it should be set in configuration $page_title_len = 50; // it should be set in configuration if ($id_post) { - $register = $tumble->getPost($id_post); + $register = $tumble->getPost($id_post); if (empty($register["title"])) { if (!empty($register["description"])) { $page_title_data = trimString($register["description"], $page_title_len); @@ -70,7 +70,7 @@ $theme = new themes; } } else { $page_title_data = $register["title"]; - } + } if (!empty($page_title_data)) { $page_title .= $page_title_divisor.stripslashes($page_title_data); } @@ -82,6 +82,7 @@ $theme = new themes; $theme->set('Description',$conf->description); $theme->set('URL_Tumble',$conf->urlGelato); $theme->set('Template_name',$conf->template); + $theme->set('allowComments',$conf->allowComments); $theme->set('isAuthenticated',$user->isAuthenticated()); if($user->isAuthenticated()){ @@ -116,12 +117,11 @@ $theme = new themes; $register["title"] = stripslashes($register["title"]); $register["description"] = stripslashes($register["description"]); - $postType = $tumble->getType($register["id_post"]); - $row['Date_Added'] = $formatedDate; $row['Permalink'] = $permalink; - $row['postType'] = $postType; - switch ($postType){ + $row['postType'] = type2Text($register["type"]); + + switch ($register['type']){ case "1": $row['Title'] = $register["title"]; $row['Body'] = $register["description"]; @@ -216,9 +216,9 @@ $theme = new themes; $row['Date_Added'] = $formatedDate; $row['Permalink'] = $permalink; - $postType = $tumble->getType($register["id_post"]); - $row['postType'] = $postType; - switch ($postType) { + $row['postType'] = type2Text($register["type"]); + + switch ($register['type']) { case "1": $row['Title'] = $register["title"]; $row['Body'] = $register["description"]; @@ -266,16 +266,11 @@ $theme = new themes; break; } - if ($conf->allowComments) { - - $comment = new comments(); - $rsComments = $comment->getComments($register["id_post"]); - $user = new user(); $username = $user->getUserByID($register["id_user"]); $row["User"] = $username["name"]; - + if (empty($register["title"])) { if (!empty($register["description"])) { $postTitle = trimString($register["description"]); @@ -284,14 +279,15 @@ $theme = new themes; } } else { $postTitle = $register["title"]; - } + } - $row["Post_Title"] = $postTitle; - $row["Comments_Number"] = $comment->countComments($register["id_post"]); + $row["Post_Title"] = $postTitle; - $rows[] = $row; - $theme->set('rows',$rows); + $comment = new comments(); + $row["Comments_Number"] = $comment->countComments($register["id_post"]); + if ($conf->allowComments) { + $rsComments = $comment->getComments($register["id_post"]); $comments = array(); while($rowComment = mysql_fetch_assoc($rsComments)) { $commentAuthor = ($rowComment["web"]=="") ? $rowComment["username"] : "".$rowComment["username"].""; @@ -314,6 +310,9 @@ $theme = new themes; $theme->set('Form_Action',$conf->urlGelato."/admin/comments.php"); $theme->set('whois',$whois); } + + $rows[] = $row; + $theme->set('rows',$rows); } $theme->set('URL_Tumble',$conf->urlGelato); diff --git a/themes/tumblr/index.htm b/themes/tumblr/index.htm index 5ef0161..8e8db98 100644 --- a/themes/tumblr/index.htm +++ b/themes/tumblr/index.htm @@ -36,8 +36,8 @@ {block {$rows} as {$row}}
{$row.Date_Added} -
- {if {$row.postType}==1} + {$row.postType} + {if {$row.postType}=='regular'}
Permalink @@ -46,7 +46,7 @@ {$row.Body}
- {elseif {$row.postType}==2} + {elseif {$row.postType}=='photo'}
Permalink
@@ -54,7 +54,7 @@
{$row.Caption}
- {elseif {$row.postType}==3} + {elseif {$row.postType}=='quote'}
Permalink
@@ -62,7 +62,7 @@
— {$row.Source}
- {elseif {$row.postType}==4} + {elseif {$row.postType}=='link'}
Permalink
- {elseif {$row.postType}==5} + {elseif {$row.postType}=='conversation'}
Permalink
@@ -78,7 +78,7 @@ {$row.Conversation}
- {elseif {$row.postType}==6} + {elseif {$row.postType}=='video'}
Permalink
@@ -86,7 +86,7 @@
{$row.Caption}
- {elseif {$row.postType}==7} + {elseif {$row.postType}=='mp3'}
Permalink
@@ -98,73 +98,77 @@ {if !{$id_post}}
-

Posted by {$row.User} - ( {$row.Comments_Number} ) comments

+

Posted by {$row.User} {if {$allowComments}}- ( {$row.Comments_Number} ) comments{/if}

{/if} {/block} - {if {$id_post}} -
-

{$row.Comments_Number} answers to “{$row.Post_Title}”

-
    - {block {$comments} as {$comment}} -
  1. - - #   - {$comment.Comment_Author} said: - -
    - at {$comment.Date}

    - {$comment.Comment} -

    -
  2. - {/block} -
-
+ {if {$id_post}} + {if {$row.Comments_Number}>0} +
+

{$row.Comments_Number} answers to “{$row.Post_Title}”

+
    + {block {$comments} as {$comment}} +
  1. + + #   + {$comment.Comment_Author} said: + +
    + at {$comment.Date}

    + {$comment.Comment} +

    +
  2. + {/block} +
+
+ {/if} + + {if {$allowComments}} +
+

Add your comment

-
-

Add your comment

- -
-

- - -

-

- - -

-

- - -

-

- -

-

- - Some HTML allowed:
-      - - <blockquote> <code> <em> <strong> <a> - -
-

-

- -

-

- - -

-
-
+
+

+ + +

+

+ + +

+

+ + +

+

+ +

+

+ + Some HTML allowed:
+      + + <blockquote> <code> <em> <strong> <a> + +
+

+

+ +

+

+ + +

+
+
+ {/if} {else} {pagination} {/if}