* Change on themes {$postType} from numbers to type string.

* fixed a bug when commenting is disabled and a other changes on index
master
Victor De la Rocha 2008-10-26 23:17:48 +00:00
parent 53a6dba3ed
commit 3290ea1a8d
2 changed files with 95 additions and 92 deletions

View File

@ -18,7 +18,7 @@ require_once('entry.php');
global $user, $tumble, $conf; global $user, $tumble, $conf;
$theme = new themes; $theme = new themes;
// Our first approach to MVC... ¿our second? visit http://www.flavorphp.com // Our first approach to MVC... <EFBFBD>our second? visit http://www.flavorphp.com
if(isset($_SERVER['PATH_INFO'])) $param_url = explode("/",$_SERVER['PATH_INFO']); if(isset($_SERVER['PATH_INFO'])) $param_url = explode("/",$_SERVER['PATH_INFO']);
@ -82,6 +82,7 @@ $theme = new themes;
$theme->set('Description',$conf->description); $theme->set('Description',$conf->description);
$theme->set('URL_Tumble',$conf->urlGelato); $theme->set('URL_Tumble',$conf->urlGelato);
$theme->set('Template_name',$conf->template); $theme->set('Template_name',$conf->template);
$theme->set('allowComments',$conf->allowComments);
$theme->set('isAuthenticated',$user->isAuthenticated()); $theme->set('isAuthenticated',$user->isAuthenticated());
if($user->isAuthenticated()){ if($user->isAuthenticated()){
@ -116,12 +117,11 @@ $theme = new themes;
$register["title"] = stripslashes($register["title"]); $register["title"] = stripslashes($register["title"]);
$register["description"] = stripslashes($register["description"]); $register["description"] = stripslashes($register["description"]);
$postType = $tumble->getType($register["id_post"]);
$row['Date_Added'] = $formatedDate; $row['Date_Added'] = $formatedDate;
$row['Permalink'] = $permalink; $row['Permalink'] = $permalink;
$row['postType'] = $postType; $row['postType'] = type2Text($register["type"]);
switch ($postType){
switch ($register['type']){
case "1": case "1":
$row['Title'] = $register["title"]; $row['Title'] = $register["title"];
$row['Body'] = $register["description"]; $row['Body'] = $register["description"];
@ -216,9 +216,9 @@ $theme = new themes;
$row['Date_Added'] = $formatedDate; $row['Date_Added'] = $formatedDate;
$row['Permalink'] = $permalink; $row['Permalink'] = $permalink;
$postType = $tumble->getType($register["id_post"]); $row['postType'] = type2Text($register["type"]);
$row['postType'] = $postType;
switch ($postType) { switch ($register['type']) {
case "1": case "1":
$row['Title'] = $register["title"]; $row['Title'] = $register["title"];
$row['Body'] = $register["description"]; $row['Body'] = $register["description"];
@ -266,11 +266,6 @@ $theme = new themes;
break; break;
} }
if ($conf->allowComments) {
$comment = new comments();
$rsComments = $comment->getComments($register["id_post"]);
$user = new user(); $user = new user();
$username = $user->getUserByID($register["id_user"]); $username = $user->getUserByID($register["id_user"]);
@ -287,11 +282,12 @@ $theme = new themes;
} }
$row["Post_Title"] = $postTitle; $row["Post_Title"] = $postTitle;
$comment = new comments();
$row["Comments_Number"] = $comment->countComments($register["id_post"]); $row["Comments_Number"] = $comment->countComments($register["id_post"]);
$rows[] = $row; if ($conf->allowComments) {
$theme->set('rows',$rows); $rsComments = $comment->getComments($register["id_post"]);
$comments = array(); $comments = array();
while($rowComment = mysql_fetch_assoc($rsComments)) { while($rowComment = mysql_fetch_assoc($rsComments)) {
$commentAuthor = ($rowComment["web"]=="") ? $rowComment["username"] : "<a href=\"".$rowComment["web"]."\" rel=\"external\">".$rowComment["username"]."</a>"; $commentAuthor = ($rowComment["web"]=="") ? $rowComment["username"] : "<a href=\"".$rowComment["web"]."\" rel=\"external\">".$rowComment["username"]."</a>";
@ -314,6 +310,9 @@ $theme = new themes;
$theme->set('Form_Action',$conf->urlGelato."/admin/comments.php"); $theme->set('Form_Action',$conf->urlGelato."/admin/comments.php");
$theme->set('whois',$whois); $theme->set('whois',$whois);
} }
$rows[] = $row;
$theme->set('rows',$rows);
} }
$theme->set('URL_Tumble',$conf->urlGelato); $theme->set('URL_Tumble',$conf->urlGelato);

View File

@ -36,8 +36,8 @@
{block {$rows} as {$row}} {block {$rows} as {$row}}
<div class="date"> <div class="date">
{$row.Date_Added} {$row.Date_Added}
</div> </div> {$row.postType}
{if {$row.postType}==1} {if {$row.postType}=='regular'}
<div class="post"> <div class="post">
<a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a> <a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
@ -46,7 +46,7 @@
{$row.Body} {$row.Body}
</div> </div>
</div> </div>
{elseif {$row.postType}==2} {elseif {$row.postType}=='photo'}
<div class="post"> <div class="post">
<a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a> <a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="photo"> <div class="photo">
@ -54,7 +54,7 @@
<div class="caption">{$row.Caption}</div> <div class="caption">{$row.Caption}</div>
</div> </div>
</div> </div>
{elseif {$row.postType}==3} {elseif {$row.postType}=='quote'}
<div class="post"> <div class="post">
<a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a> <a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="quote"> <div class="quote">
@ -62,7 +62,7 @@
<div class="source">&mdash; {$row.Source}</div> <div class="source">&mdash; {$row.Source}</div>
</div> </div>
</div> </div>
{elseif {$row.postType}==4} {elseif {$row.postType}=='link'}
<div class="post"> <div class="post">
<a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a> <a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="link"> <div class="link">
@ -70,7 +70,7 @@
<div class="description">{$row.Description}</div> <div class="description">{$row.Description}</div>
</div> </div>
</div> </div>
{elseif {$row.postType}==5} {elseif {$row.postType}=='conversation'}
<div class="post"> <div class="post">
<a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a> <a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="conversation"> <div class="conversation">
@ -78,7 +78,7 @@
{$row.Conversation} {$row.Conversation}
</div> </div>
</div> </div>
{elseif {$row.postType}==6} {elseif {$row.postType}=='video'}
<div class="post"> <div class="post">
<a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a> <a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="video"> <div class="video">
@ -86,7 +86,7 @@
<div class="caption">{$row.Caption}</div> <div class="caption">{$row.Caption}</div>
</div> </div>
</div> </div>
{elseif {$row.postType}==7} {elseif {$row.postType}=='mp3'}
<div class="post"> <div class="post">
<a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a> <a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="video"> <div class="video">
@ -98,12 +98,13 @@
{if !{$id_post}} {if !{$id_post}}
<div class="totalComments"> <div class="totalComments">
<h3>Posted by {$row.User} - <a href="{$row.Permalink}#comments">( {$row.Comments_Number} ) comments</a></h3> <h3>Posted by {$row.User} {if {$allowComments}}- <a href="{$row.Permalink}#comments">( {$row.Comments_Number} ) comments{/if}</a></h3>
</div> </div>
{/if} {/if}
{/block} {/block}
{if {$id_post}} {if {$id_post}}
{if {$row.Comments_Number}>0}
<div class="containerComments"> <div class="containerComments">
<h3 id="comments">{$row.Comments_Number} answers to &#8220;{$row.Post_Title}&#8221;</h3> <h3 id="comments">{$row.Comments_Number} answers to &#8220;{$row.Post_Title}&#8221;</h3>
<ol class="commentlist"> <ol class="commentlist">
@ -121,7 +122,9 @@
{/block} {/block}
</ol> </ol>
</div> </div>
{/if}
{if {$allowComments}}
<div class="containerFormComments"> <div class="containerFormComments">
<h3 id="respond">Add your comment</h3> <h3 id="respond">Add your comment</h3>
@ -165,6 +168,7 @@
</p> </p>
</form> </form>
</div> </div>
{/if}
{else} {else}
{pagination} {pagination}
{/if} {/if}