* 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;
$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']);
@ -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"];
@ -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,11 +266,6 @@ $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"]);
@ -286,12 +281,13 @@ $theme = new themes;
$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"] : "<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('whois',$whois);
}
$rows[] = $row;
$theme->set('rows',$rows);
}
$theme->set('URL_Tumble',$conf->urlGelato);

View File

@ -36,8 +36,8 @@
{block {$rows} as {$row}}
<div class="date">
{$row.Date_Added}
</div>
{if {$row.postType}==1}
</div> {$row.postType}
{if {$row.postType}=='regular'}
<div class="post">
<a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
@ -46,7 +46,7 @@
{$row.Body}
</div>
</div>
{elseif {$row.postType}==2}
{elseif {$row.postType}=='photo'}
<div class="post">
<a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="photo">
@ -54,7 +54,7 @@
<div class="caption">{$row.Caption}</div>
</div>
</div>
{elseif {$row.postType}==3}
{elseif {$row.postType}=='quote'}
<div class="post">
<a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="quote">
@ -62,7 +62,7 @@
<div class="source">&mdash; {$row.Source}</div>
</div>
</div>
{elseif {$row.postType}==4}
{elseif {$row.postType}=='link'}
<div class="post">
<a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="link">
@ -70,7 +70,7 @@
<div class="description">{$row.Description}</div>
</div>
</div>
{elseif {$row.postType}==5}
{elseif {$row.postType}=='conversation'}
<div class="post">
<a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="conversation">
@ -78,7 +78,7 @@
{$row.Conversation}
</div>
</div>
{elseif {$row.postType}==6}
{elseif {$row.postType}=='video'}
<div class="post">
<a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="video">
@ -86,7 +86,7 @@
<div class="caption">{$row.Caption}</div>
</div>
</div>
{elseif {$row.postType}==7}
{elseif {$row.postType}=='mp3'}
<div class="post">
<a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="video">
@ -98,73 +98,77 @@
{if !{$id_post}}
<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>
{/if}
{/block}
{if {$id_post}}
<div class="containerComments">
<h3 id="comments">{$row.Comments_Number} answers to &#8220;{$row.Post_Title}&#8221;</h3>
<ol class="commentlist">
{block {$comments} as {$comment}}
<li class="alt" id="comment-{$comment.Id_Comment}">
<cite>
<a href="#comment-{$comment.Id_Comment}" title="Comment permalink">#</a>&nbsp;&nbsp;
{$comment.Comment_Author} said:
</cite>
<br />
<span class="timestampComment"> at {$comment.Date}</span><br /><br />
{$comment.Comment}
<br /><br />
</li>
{/block}
</ol>
</div>
{if {$row.Comments_Number}>0}
<div class="containerComments">
<h3 id="comments">{$row.Comments_Number} answers to &#8220;{$row.Post_Title}&#8221;</h3>
<ol class="commentlist">
{block {$comments} as {$comment}}
<li class="alt" id="comment-{$comment.Id_Comment}">
<cite>
<a href="#comment-{$comment.Id_Comment}" title="Comment permalink">#</a>&nbsp;&nbsp;
{$comment.Comment_Author} said:
</cite>
<br />
<span class="timestampComment"> at {$comment.Date}</span><br /><br />
{$comment.Comment}
<br /><br />
</li>
{/block}
</ol>
</div>
{/if}
<div class="containerFormComments">
<h3 id="respond">Add your comment</h3>
{if {$allowComments}}
<div class="containerFormComments">
<h3 id="respond">Add your comment</h3>
<form action="{Form_Action}" method="post" name="commentForm" id="commentForm">
<p>
<label for="username">
<small>Name:</small>
</label>
<input name="username" id="username" value="{whois.User_Cookie}" size="22" tabindex="1" type="text" />
</p>
<p>
<label for="email">
<small>E-mail:</small>
</label>
<input name="email" id="email" value="{whois.Email_Cookie}" size="22" tabindex="2" type="text" />
</p>
<p>
<label for="web">
<small>Website:</small>
</label>
<input name="web" id="web" value="{whois.Web_Cookie}" size="22" tabindex="3" type="text" />
</p>
<p>
<textarea name="content" id="content" cols="100" rows="10" tabindex="4"></textarea>
</p>
<p>
<span style="color: rgb(136, 136, 136); margin-bottom: 10px; font-size: 10px;">
Some HTML allowed:<br />
&nbsp;&nbsp;&nbsp;&nbsp;
<code>
&lt;blockquote&gt; &lt;code&gt; &lt;em&gt; &lt;strong&gt; &lt;a&gt;
</code>
</span>
</p>
<p>
<input type="submit" value="Add comment" name="btnAdd" id="btnAdd" tabindex="5" />
</p>
<p>
<input name="id_post" id="id_post" value="{id_post}" type="hidden" />
<input name="comment_date" id="comment_date" value="{Date_Added}" type="hidden" />
</p>
</form>
</div>
<form action="{Form_Action}" method="post" name="commentForm" id="commentForm">
<p>
<label for="username">
<small>Name:</small>
</label>
<input name="username" id="username" value="{whois.User_Cookie}" size="22" tabindex="1" type="text" />
</p>
<p>
<label for="email">
<small>E-mail:</small>
</label>
<input name="email" id="email" value="{whois.Email_Cookie}" size="22" tabindex="2" type="text" />
</p>
<p>
<label for="web">
<small>Website:</small>
</label>
<input name="web" id="web" value="{whois.Web_Cookie}" size="22" tabindex="3" type="text" />
</p>
<p>
<textarea name="content" id="content" cols="100" rows="10" tabindex="4"></textarea>
</p>
<p>
<span style="color: rgb(136, 136, 136); margin-bottom: 10px; font-size: 10px;">
Some HTML allowed:<br />
&nbsp;&nbsp;&nbsp;&nbsp;
<code>
&lt;blockquote&gt; &lt;code&gt; &lt;em&gt; &lt;strong&gt; &lt;a&gt;
</code>
</span>
</p>
<p>
<input type="submit" value="Add comment" name="btnAdd" id="btnAdd" tabindex="5" />
</p>
<p>
<input name="id_post" id="id_post" value="{id_post}" type="hidden" />
<input name="comment_date" id="comment_date" value="{Date_Added}" type="hidden" />
</p>
</form>
</div>
{/if}
{else}
{pagination}
{/if}