FIX: url not showing in comments template

This commit is contained in:
Will Rossiter 2012-07-22 09:54:24 +12:00
parent 8ab18fe1d0
commit e18cf3e2bb
2 changed files with 19 additions and 35 deletions

View File

@ -137,25 +137,6 @@ class Comment extends DataObject {
return ($parent->Title) ? $parent->Title : $parent->ClassName . " #" . $parent->ID; return ($parent->Title) ? $parent->Title : $parent->ClassName . " #" . $parent->ID;
} }
/**
* This method is called just before this object is
* written to the database.
*
* Specifically, make sure "http://" exists at the start
* of the URL, if it doesn't have https:// or http://
*/
public function onBeforeWrite() {
parent::onBeforeWrite();
$url = $this->CommenterURL;
if($url) {
if(strtolower(substr($url, 0, 8)) != 'https://' && strtolower(substr($url, 0, 7)) != 'http://') {
$this->CommenterURL = 'http://' . $url;
}
}
}
/** /**
* @todo needs to compare to the new {@link Commenting} configuration API * @todo needs to compare to the new {@link Commenting} configuration API
* *

View File

@ -5,25 +5,28 @@
$Comment.XML $Comment.XML
<% end_if %> <% end_if %>
</p> </p>
<p class="info"> <p class="info">
<% if CommenterURL %> <% if $URL %>
<% _t('PBY','Posted by') %> <a href="$CommenterURL.ATT" rel="nofollow">$Name.XML</a>, $Created.Nice ($Created.Ago) <% _t('PBY','Posted by') %> <a href="$URL.URL" rel="nofollow">$Name.XML</a>, $Created.Nice ($Created.Ago)
<% else %> <% else %>
<% _t('PBY','Posted by') %> $Name.XML, $Created.Nice ($Created.Ago) <% _t('PBY','Posted by') %> $Name.XML, $Created.Nice ($Created.Ago)
<% end_if %> <% end_if %>
</p> </p>
<ul class="action-links"> <% if ApproveLink || SpamLink || HamLink || DeleteLink %>
<% if ApproveLink %> <ul class="action-links">
<li><a href="$ApproveLink" class="approve"><% _t('APPROVE', 'approve this comment') %></a></li> <% if ApproveLink %>
<% end_if %> <li><a href="$ApproveLink" class="approve"><% _t('APPROVE', 'approve this comment') %></a></li>
<% if SpamLink %> <% end_if %>
<li><a href="$SpamLink" class="spam"><% _t('ISSPAM','this comment is spam') %></a></li> <% if SpamLink %>
<% end_if %> <li><a href="$SpamLink" class="spam"><% _t('ISSPAM','this comment is spam') %></a></li>
<% if HamLink %> <% end_if %>
<li><a href="$HamLink" class="ham"><% _t('ISNTSPAM','this comment is not spam') %></a></li> <% if HamLink %>
<% end_if %> <li><a href="$HamLink" class="ham"><% _t('ISNTSPAM','this comment is not spam') %></a></li>
<% if DeleteLink %> <% end_if %>
<li class="last"><a href="$DeleteLink" class="delete"><% _t('REMCOM','remove this comment') %></a></li> <% if DeleteLink %>
<% end_if %> <li class="last"><a href="$DeleteLink" class="delete"><% _t('REMCOM','remove this comment') %></a></li>
</ul> <% end_if %>
</ul>
<% end_if %>