Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

a few bugfixes

NickENickE New
edited April 2010 in Vanilla 2.0 - 2.8
Hiya everyone,

Wow, this is looking really good Mark! I tried out Vanilla 2 and it's very cool. Here are some small patches for a few small bugs I noticed early on with Windows and Apache (no mod_rewrite).

fix time formatting to be compatible with windows (%l isn't recognized apparently):
diff --git a/applications/garden/locale/en-CA/definitions.php b/applications/garden/locale/en-CA/definitions.php
index 952cf41..0994d80 100755
--- a/applications/garden/locale/en-CA/definitions.php
+++ b/applications/garden/locale/en-CA/definitions.php
@ $Definition['Date.DefaultDayFormat'] = '%B %e';
$Definition['Date.DefaultYearFormat'] = '%B %Y';
-$Definition['Date.DefaultTimeFormat'] = '%l:%M%p';
+$Definition['Date.DefaultTimeFormat'] = '%I:%M%p';

diff --git a/library/core/class.format.php b/library/core/class.format.php
index ce75497..68179e4 100644
--- a/library/core/class.format.php
+++ b/library/core/class.format.php
@ class Format {
// Use the time format
- $Format = T('Date.DefaultTimeFormat', '%l:%M%p');
+ $Format = T('Date.DefaultTimeFormat', '%I:%M%p');
} else if (date('Y', $Timestamp) == date('Y', time())) {
@ class Format {
}
- return strftime($Format, $Timestamp);
+
+ // Emulate %l (not supported on windows)
+ return ltrim(strftime($Format, $Timestamp), '0');
}
correct a very minor styling bug in user status anchors:
diff --git a/applications/garden/design/style.css b/applications/garden/design/style.css
index c6adcc1..0be0a80 100755
--- a/applications/garden/design/style.css
+++ b/applications/garden/design/style.css
@ div.User h1 {
}
-#Status a {
+#Status a.Change {
text-transform: lowercase;
diff --git a/applications/garden/views/profile/user.php b/applications/garden/views/profile/user.php
index 6833ec0..9d22356 100644
--- a/applications/garden/views/profile/user.php
+++ b/applications/garden/views/profile/user.php
@ $Session = Gdn::Session();
if ($this->User->About != '' && ($Session->UserID == $this->User->UserID || $Session->CheckPermission('Garden.Users.Edit')))
- echo ' - ' . Anchor(T('Clear'), '/profile/clear/'.$this->User->UserID.'/'.$Session->TransientKey());
+ echo ' - ' . Anchor(T('Clear'), '/profile/clear/'.$this->User->UserID.'/'.$Session->TransientKey(), 'Change');
(will continue; lousy text limits...)

Comments

  • fix js/ajax links to be aware of (a lack of) mod_rewrite:
    diff --git a/applications/garden/js/messages.js b/applications/garden/js/messages.js
    index ca9282b..902af7b 100755
    --- a/applications/garden/js/messages.js
    +++ b/applications/garden/js/messages.js
    @ jQuery(document).ready(function($) {
    onUnload: function(settings) {
    - $('#Content').load(combinePaths(definition('WebRoot', ''), '/garden/message?DeliveryType=VIEW'));
    + $('#Content').load(combinePaths(definition('WebRoot', ''), 'index.php/garden/message?DeliveryType=VIEW'));
    }
    diff --git a/applications/garden/js/routes.js b/applications/garden/js/routes.js
    index e20e793..d0b02ed 100755
    --- a/applications/garden/js/routes.js
    +++ b/applications/garden/js/routes.js
    @ jQuery(document).ready(function($) {
    onUnload: function(settings) {
    - $('#Content').load(combinePaths(definition('WebRoot', ''), '/garden/routes?DeliveryType=VIEW'));
    + $('#Content').load(combinePaths(definition('WebRoot', ''), 'index.php/garden/routes?DeliveryType=VIEW'));
    }
    diff --git a/applications/garden/js/settings.js b/applications/garden/js/settings.js
    index 725ff97..8172658 100755
    --- a/applications/garden/js/settings.js
    +++ b/applications/garden/js/settings.js
    @ jQuery(document).ready(function($) {
    type: "POST",
    - url: combinePaths(webroot, 'garden/utility/updateproxy'),
    + url: combinePaths(webroot, 'index.php/garden/utility/updateproxy'),
    data: data,
    @ jQuery(document).ready(function($) {
    type: "POST",
    - url: combinePaths(webroot, 'garden/utility/updateresponse'),
    + url: combinePaths(webroot, 'index.php/garden/utility/updateresponse'),
    data: 'Messages='+json.messages+'&Response='+json.response+'&TransientKey='+definition('TransientKey'),
    @ jQuery(document).ready(function($) {
    $('#Content').load(
    - combinePaths(webroot, 'garden/settings/index'),
    + combinePaths(webroot, 'index.php/garden/settings/index'),
    'DeliveryType=ASSET&DeliveryMethod=XHTML'
    diff --git a/applications/vanilla/js/categories.js b/applications/vanilla/js/categories.js
    index d546c97..0ee8d50 100755
    --- a/applications/vanilla/js/categories.js
    +++ b/applications/vanilla/js/categories.js
    @ jQuery(document).ready(function($) {
    var data = $.tableDnD.serialize() + '&TableID=' + tableId + '&DeliveryType=VIEW&Form/TransientKey=' + transientKey;
    - $.post(combinePaths(webRoot, '/vanilla/settings/sortcategories/'), data, function(response) {
    + $.post(combinePaths(webRoot, 'index.php/vanilla/settings/sortcategories/'), data, function(response) {
    if (response == 'TRUE') {
    // Reload the page content...
    - $.get(webRoot + '/vanilla/settings/managecategories/?DeliveryType=VIEW', function(data){
    + $.get(combinePaths(webRoot, '/index.php/vanilla/settings/managecategories/?DeliveryType=VIEW'), function(data){
    $('#Content form').remove();
    diff --git a/applications/vanilla/js/discussion.js b/applications/vanilla/js/discussion.js
    index b7fa981..83d4838 100755
    --- a/applications/vanilla/js/discussion.js
    +++ b/applications/vanilla/js/discussion.js
    @ jQuery(document).ready(function($) {
    type: "POST",
    - url: combinePaths(definition('WebRoot', ''), '/discussion/getnew/' + discussionID + '/' + lastCommentID),
    + url: combinePaths(definition('WebRoot', ''), 'index.php/discussion/getnew/' + discussionID + '/' + lastCommentID),
    data: "DeliveryType=ASSET&DeliveryMethod=JSON",
    diff --git a/applications/vanilla/js/toolbar.js b/applications/vanilla/js/toolbar.js
    index 7113122..0b7ce22 100755
    --- a/applications/vanilla/js/toolbar.js
    +++ b/applications/vanilla/js/toolbar.js
    @ jQuery(document).ready(function($) {
    // var height = $('#CommentForm textarea').height();
    - // $.get(combinePaths(definition('WebRoot', ''), '/garden/utility/set/preference/CommentBoxHeight/'+ height + '/' + definition('TransientKey', '') + '/?DeliveryType=BOOL'));
    + // $.get(combinePaths(definition('WebRoot', ''), 'index.php/garden/utility/set/preference/CommentBoxHeight/'+ height + '/' + definition('TransientKey', '') + '/?DeliveryType=BOOL'));
    }
    diff --git a/js/global.js b/js/global.js
    index 68c7db7..e5c1505 100755
    --- a/js/global.js
    +++ b/js/global.js
    @ jQuery(document).ready(function($) {
    $.post(
    - combinePaths(definition('WebRoot', ''), '/utility/setclienthour/'+d.getHours()+'/'+definition('TransientKey')),
    + combinePaths(definition('WebRoot', ''), 'index.php/utility/setclienthour/'+d.getHours()+'/'+definition('TransientKey')),
    'DeliveryType=BOOL'
    @ jQuery(document).ready(function($) {
    $('li.UserNotifications a span').click(function() {
    - document.location = combinePaths(definition('WebRoot', ''), '/profile/notifications');
    + document.location = combinePaths(definition('UrlRoot', ''), '/profile/notifications');
    return false;
    @ jQuery(document).ready(function($) {
    var webRoot = definition('WebRoot', '');
    - $.post(combinePaths(webRoot, '/garden/utility/sort/'), data, function(response) {
    + $.post(combinePaths(webRoot, 'index.php/garden/utility/sort/'), data, function(response) {
    if (response == 'TRUE')
    diff --git a/library/core/class.controller.php b/library/core/class.controller.php
    index d5fa0fc..aaf112f 100755
    --- a/library/core/class.controller.php
    +++ b/library/core/class.controller.php
    @ class Gdn_Controller extends Gdn_Pluggable {

    + if (!array_key_exists('UrlRoot', $this->_Definitions))
    + $this->_Definitions['UrlRoot'] = substr(Url(' '), 0, -2);
    +
    if (!array_key_exists('ConfirmHeading', $this->_Definitions))
    Also I have some suggestions:
    - Could we make the post textareas bigger by default, and/or change size in jumps? Not a huge fan of the line-by-line growth.
    - It'd be great if you could allow choices for formatters (e.g. plaintext when trying to post markup), or at least allow the xmp tag.
    - At least for technical discussions, limiting the size of posts is a real nuisance.
  • hm, do you think the time display function should show the hour/minute format if the post was made in the past 24hrs, rather than if it was on the same day? It seems a bit inconsistent when everything jumps from '11:something' to 'April 5' right after midnight.
  • MarkMark Vanilla Staff
    Oh man- I have to honestly say that getting your changes implemented is going to be very tough unless you do it on GitHub and send a pull request. These look like greek to me :/
  • MarkMark Vanilla Staff
    Which reminds me - I know a lot of you have gone through the wringer to start using GitHub and send pull requests - is anyone interested in documenting the process for beginners?
  • @Mark, you can feed this most diff tools to apply it for you. At least the svn diff tool can eat this and process the on files.
  • @NickE, if you can't send a pull request through GitHub, perhaps just sending @Mark the diffs as patch files would be a lot easier? Less chance of HTML Purifier doing something funky to the code that way ;)
  • ok sent pull request.
  • MarkMark Vanilla Staff
    AWESOME
  • NickENickE New
    edited April 2010
    Hrm, I just realized that %e isn't supported on windows either. Fixed it properly now :-P
Sign In or Register to comment.