Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/2.0.18'
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowhand committed Feb 14, 2012
2 parents 7743482 + ee1b2eb commit 972f710
Show file tree
Hide file tree
Showing 12 changed files with 97 additions and 62 deletions.
5 changes: 2 additions & 3 deletions applications/dashboard/controllers/class.entrycontroller.php
Expand Up @@ -280,7 +280,7 @@ public function Auth($AuthenticationSchemeAlias = 'default') {
public function Connect($Method) {
$this->AddJsFile('entry.js');
$this->View = 'connect';
$IsPostBack = $this->Form->IsPostBack() && $this->Form->GetFormValue('Connect') == 'Connect';
$IsPostBack = $this->Form->IsPostBack() && $this->Form->GetFormValue('Connect', NULL) !== NULL;

if (!$IsPostBack) {
// Here are the initial data array values. that can be set by a plugin.
Expand Down Expand Up @@ -506,8 +506,7 @@ public function Connect($Method) {
$User['Name'] = $User['ConnectName'];
$User['Password'] = RandomString(50); // some password is required
$User['HashMethod'] = 'Random';

$UserID = $UserModel->Register($User, array('CheckCaptcha' => FALSE), array('NoConfirmEmail' => TRUE));
$UserID = $UserModel->Register($User, array('CheckCaptcha' => FALSE, 'NoConfirmEmail' => TRUE));
$User['UserID'] = $UserID;
$this->Form->SetValidationResults($UserModel->ValidationResults());

Expand Down
20 changes: 19 additions & 1 deletion applications/dashboard/models/class.vbulletinimportmodel.php
Expand Up @@ -25,14 +25,16 @@ public function AfterImport() {
$Router->SetRoute('member\.php\?u=(\d+)', 'dashboard/profile/$1/x', 'Permanent');
// Make different sizes of avatars
$this->ProcessAvatars();
// Prep config for ProfileExtender plugin based on imported fields
$this->ProfileExtenderPrep();
}

/**
* Create different sizes of user photos.
*/
public function ProcessAvatars() {
$UploadImage = new Gdn_UploadImage();
$UserData = $this->SQL->Select('u.*')->From('User u')->Where('u.Photo is not null')->Get();
$UserData = $this->SQL->Select('u.Photo')->From('User u')->Where('u.Photo is not null')->Get();

// Make sure the avatars folder exists.
if (!file_exists(PATH_UPLOADS.'/userpics'))
Expand Down Expand Up @@ -68,4 +70,20 @@ public function ProcessAvatars() {
} catch (Exception $ex) { }
}
}

/**
* Get profile fields imported and add to ProfileFields list.
*/
public function ProfileExtenderPrep() {
$ProfileKeyData = $this->SQL->Select('m.Name')->Distinct()->From('UserMeta m')->Like('m.Name', 'Profile_%')->Get();
$ExistingKeys = array_filter((array)explode(',', C('Plugins.ProfileExtender.ProfileFields', '')));
foreach ($ProfileKeyData->Result() as $Key) {
$Name = str_replace('Profile.', '', $Key->Name);
if (!in_array($Name, $ExistingKeys)) {
$ExistingKeys[] = $Name;
}
}
if (count($ExistingKeys))
SaveToConfig('Plugins.ProfileExtender.ProfileFields', implode(',', $ExistingKeys));
}
}
4 changes: 3 additions & 1 deletion applications/dashboard/views/setup/index.php
Expand Up @@ -9,4 +9,6 @@
<ul>
<li><?php echo Anchor(T('Click here to carry on to your dashboard'), 'settings'); ?>.</li>
</ul>
</div>
</div>
<?php
echo $this->Form->Close();
2 changes: 1 addition & 1 deletion applications/dashboard/views/setup/prerequisites.php
Expand Up @@ -17,4 +17,4 @@
</div>
</div>
<?php
$this->Form->Close();
echo $this->Form->Close();
2 changes: 1 addition & 1 deletion index.php
@@ -1,6 +1,6 @@
<?php
define('APPLICATION', 'Vanilla');
define('APPLICATION_VERSION', '2.0.18.1');
define('APPLICATION_VERSION', '2.0.18.2');
/*
Copyright 2008, 2009 Vanilla Forums Inc.
This file is part of Garden.
Expand Down
94 changes: 51 additions & 43 deletions js/library/jquery.gardencheckcolumn.js
@@ -1,47 +1,55 @@
/**************************************************************
jQuery / Garden CheckColumn Plugin v1
**************************************************************/
/*
* Garden CheckColumn Plugin (1.1)
* by Mark O'Sullivan (mark@vanillaforums.com)
* by Tim Gunter (tim@vanillaforums.com)
*
* Copyright (c) 2008 Vanilla Forums, Inc
* Licensed under the GPL (GPL-LICENSE.txt) license.
*
* NOTE: This script requires jQuery to work.
* Download jQuery at www.jquery.com
*/

(function($) {
$.fn.checkColumn = function(opt) {
opt = $.extend({
noOptionsYet: 0
}, opt);

// Remove the cellpadding on anchor cells
$(this).find('thead td').css('padding', '0px');
jQuery(document).ready(function($){
$.fn.checkColumn = function(opt) {
opt = $.extend({
noOptionsYet: 0
}, opt);

// Remove the cellpadding on anchor cells
$(this).find('thead td').css('padding', '0px');

// Handle column heading clicks
$(this).find('thead td').each(function(i,el) {
el = $(el);
var columnIndex = el.prop('cellIndex');
var text = el.html();
el.html('');

var anchor = $('<a></a>');
anchor.click(function(event) {
var rows = $(el).parents('table').find('tbody tr');
var checkbox = false;
rows.each(function(j,row){
checkbox = $(row).find('td:eq(' + (columnIndex) + ')').find(":checkbox");
if (checkbox) {
if (checkbox.prop('checked')) {
checkbox.removeAttr('checked');
} else {
checkbox.prop('checked', 'checked');
}
}
})
return false;
});
anchor.html(text);
anchor.prop('href', '#');
el.append(anchor);
});

// Handle column heading clicks
$(this).find('thead td').each(function() {
var columnIndex = $(this).attr('cellIndex');
var text = $(this).html();
var anchor = document.createElement('a');
anchor.onclick = function(sender) {
var rows = $(this).parents('table').find('tbody tr');
var checkbox = false;
for (i = 0; i < rows.length; i++) {
checkbox = $(rows[i]).find('td:eq(' + (columnIndex) + ')').find(":checkbox");
if (checkbox) {
if ($(checkbox).attr('checked')) {
checkbox.removeAttr('checked');
} else {
checkbox.attr('checked', 'checked');
}
}
}
return false;
}
anchor.innerHTML = text;
anchor.href = '#';
$(this).html(anchor);
});

// Return the object for chaining
return $(this);
}

// Return the object for chaining
return $(this);
}
})(jQuery);

$(function() {
$('table.CheckColumn').checkColumn();
$('table.CheckColumn').checkColumn();
});
2 changes: 1 addition & 1 deletion library/core/class.applicationmanager.php
Expand Up @@ -190,7 +190,7 @@ public function TestApplication($ApplicationName, &$Validation) {
throw new Exception(T('The application folder was not properly defined.'));

// Hook directly into the autoloader and force it to load the newly tested application
Gdn_Autoloader::AttachApplication($ApplicationName);
Gdn_Autoloader::AttachApplication($ApplicationFolder);

// Redefine the locale manager's settings $Locale->Set($CurrentLocale, $EnabledApps, $EnabledPlugins, TRUE);
$Locale = Gdn::Locale();
Expand Down
10 changes: 9 additions & 1 deletion library/core/class.configuration.php
Expand Up @@ -533,7 +533,15 @@ public function Save($File = '', $Group = '', $RequireSourceFile = TRUE) {
$Result = FALSE;
if (file_put_contents($TmpFile, $FileContents) !== FALSE) {
chmod($TmpFile, 0775);
$Result = rename($TmpFile, $File);
if (!rename($TmpFile, $File)) {
// The rename may not work on Windows servers so try a copy.
if (copy($TmpFile, $File)) {
unlink($TmpFile);
$Result = TRUE;
}
} else {
$Result = TRUE;
}
}
}

Expand Down
10 changes: 6 additions & 4 deletions library/core/class.format.php
Expand Up @@ -1189,14 +1189,16 @@ public static function Timespan($timespan) {
* @return mixed
*/
public static function Url($Mixed) {
if (!is_string($Mixed)) {
if (!is_string($Mixed))
return self::To($Mixed, 'Url');
} elseif (preg_replace('`([^\PP])`u', '', 'Test') == '') {


if (preg_replace('`([^\PP])`u', '', 'Test') == '') {
// No Unicode PCRE support.
$Mixed = trim($Mixed);
$Mixed = strip_tags(html_entity_decode($Mixed, ENT_COMPAT, 'UTF-8'));
$Mixed = strtr($Mixed, self::$_UrlTranslations);
$Mixed = preg_replace('/([^\w\d_:.])/', ' ', $Mixed); // get rid of punctuation and symbols
$Mixed = preg_replace('/([^\w\d_:])/', ' ', $Mixed); // get rid of punctuation and symbols
$Mixed = str_replace(' ', '-', trim($Mixed)); // get rid of spaces
$Mixed = preg_replace('/-+/', '-', $Mixed); // limit to 1 hyphen at a time
$Mixed = urlencode(strtolower($Mixed));
Expand All @@ -1208,7 +1210,7 @@ public static function Url($Mixed) {
$Mixed = strtr($Mixed, self::$_UrlTranslations);
$Mixed = preg_replace('`([^\PP.\-_])`u', '', $Mixed); // get rid of punctuation
$Mixed = preg_replace('`([^\PS+])`u', '', $Mixed); // get rid of symbols
$Mixed = preg_replace('`[\s\-/+]+`u', '-', $Mixed); // replace certain characters with dashes
$Mixed = preg_replace('`[\s\-/+.]+`u', '-', $Mixed); // replace certain characters with dashes
$Mixed = rawurlencode(strtolower($Mixed));
return $Mixed;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/Gravatar/default.php
Expand Up @@ -33,7 +33,7 @@ function UserPhotoDefaultUrl($User) {
.'&amp;size='.C('Garden.Thumbnail.Width', 50);

if (C('Plugins.Gravatar.UseVanillicon', FALSE))
$Url .= '&amp;default='.urlencode(Asset('http://vanillicon.com/'.md5($User->Name).'.png'));
$Url .= '&amp;default='.urlencode(Asset('http://vanillicon.com/'.md5($User->Email).'.png'));
else
$Url .= '&amp;default='.urlencode(Asset(C('Plugins.Gravatar.DefaultAvatar', 'plugins/Gravatar/default.gif'), TRUE));

Expand Down
4 changes: 2 additions & 2 deletions plugins/Tagging/class.tagging.plugin.php
Expand Up @@ -12,7 +12,7 @@
$PluginInfo['Tagging'] = array(
'Name' => 'Tagging',
'Description' => 'Allow tagging of discussions.',
'Version' => '1.1',
'Version' => '1.1p1',
'SettingsUrl' => '/dashboard/settings/tagging',
'SettingsPermission' => 'Garden.Settings.Manage',
'Author' => "Mark O'Sullivan",
Expand Down Expand Up @@ -376,7 +376,7 @@ public function PostController_BeforeFormButtons_Handler($Sender) {
->From('TagDiscussion td')
->Join('Tag t', 'td.TagID = t.TagID')
->Where('td.DiscussionID', GetValue('DiscussionID', $Discussion))
->Where('t.Type', '')
->Where("coalesce(t.Type, '')", '')
->Get()->ResultArray();

$Tags = ConsolidateArrayValuesByKey($Tags, 'Name');
Expand Down
4 changes: 1 addition & 3 deletions plugins/embedvanilla/local.js
Expand Up @@ -16,9 +16,6 @@ $(function() {
forceRemoteUrl = gdn.definition('ForceRemoteUrl', '') != '',
webroot = gdn.definition('WebRoot'),
pathroot = gdn.definition('UrlFormat').replace('/{Path}', '').replace('{Path}', '');

if (!inIframe)
return;

if (inIframe) {
if ("postMessage" in parent) {
Expand Down Expand Up @@ -135,6 +132,7 @@ $(function() {

$(window).unload(function() { remotePostMessage('unload', '*'); });
}
else return; // Ignore the rest if we're not embedded.

var path = gdn.definition('Path', '~');
if (path != '~') {
Expand Down

0 comments on commit 972f710

Please sign in to comment.