Permalink
Browse files

Merge branch 'master' of github.com:vanillaforums/Garden

  • Loading branch information...
2 parents 07cb2f4 + ded293b commit 924bb6f3a9765d73c8fe1d844cbadf4a76863b9f @tburry tburry committed Mar 6, 2012
@@ -294,8 +294,8 @@ public function Edit($UserReference = '', $Username = '') {
}
}
- $this->Title(T('Edit My Profile'));
- $this->_SetBreadcrumbs(T('Edit My Profile'), '/profile/edit');
+ $this->Title(T('Edit Account'));
+ $this->_SetBreadcrumbs(T('Edit Account'), '/profile/edit');
$this->Render();
}
@@ -563,7 +563,7 @@ public function Picture($UserReference = '', $Username = '') {
if ($this->Form->ErrorCount() > 0)
$this->DeliveryType(DELIVERY_TYPE_ALL);
- $this->Title(T('Change My Picture'));
+ $this->Title(T('Change Picture'));
$this->_SetBreadcrumbs(T('Change My Picture'), '/profile/picture');
$this->Render();
}
@@ -968,6 +968,7 @@ public function AddSideMenu($CurrentUrl = '') {
$SideMenu = new SideMenuModule($this);
$this->EventArguments['SideMenu'] = &$SideMenu; // Doing this out here for backwards compatibility.
if ($this->EditMode) {
+ $this->AddModule('MeModule');
$this->BuildEditMenu($SideMenu, $CurrentUrl);
$this->FireEvent('AfterAddSideMenu');
$this->AddModule($SideMenu, 'Panel');
@@ -1442,6 +1442,10 @@ body.Profile #Panel {
float: left;
width: 250px;
} */
+
+.Profile #Panel .MeBox.NotMe .MeMenu {
+ display: none;
+}
.ChangePicture span {
position: absolute;
background: #333;
@@ -1460,7 +1464,6 @@ body.Profile #Panel {
float: right;
}
/* Hiding form headings with CSS in case the forms get popped */
-body.Profile.EditMode h2,
body.Profile.picture .SmallPopup h1 {
display: none;
}
@@ -1,20 +1,28 @@
<?php if (!defined('APPLICATION')) exit();
$Session = Gdn::Session();
+$User = $Session->User;
-if ($Session->IsValid()):
- echo '<div class="MeBox">';
+if (property_exists($this->_Sender, 'User'))
+ $User = $this->_Sender->User;
+if ($Session->IsValid()):
+
+ $NotMe = '';
+ if ($User->UserID != Gdn::Session()->UserID)
+ $NotMe = 'NotMe';
+
+ echo "<div class=\"MeBox {$NotMe}\">";
- $Name = $Session->User->Name;
+ $Name = $User->Name;
- echo UserPhoto($Session->User);
+ echo UserPhoto($User);
echo '<div class="WhoIs">';
- echo UserAnchor($Session->User, 'Username');
+ echo UserAnchor($User, 'Username');
echo '<div class="MeMenu">';
// Notifications
- $CountNotifications = $Session->User->CountNotifications;
+ $CountNotifications = $User->CountNotifications;
$CNotifications = is_numeric($CountNotifications) && $CountNotifications > 0 ? '<span class="Alert">'.$CountNotifications.'</span>' : '';
- $ProfileSlug = urlencode($Session->User->Name) == $Session->User->Name ? $Session->User->Name : $Session->UserID.'/'.urlencode($Session->User->Name);
+ $ProfileSlug = urlencode($User->Name) == $User->Name ? $User->Name : $UserID.'/'.urlencode($User->Name);
echo Anchor(Sprite('SpNotifications', 'Sprite16').Wrap(T('Notifications'), 'em').$CNotifications, '/profile/'.$ProfileSlug, array('title' => T('Notifications')));
// Inbox
@@ -6,7 +6,7 @@
<?php
$Controller->FireEvent('BeforeProfileOptions');
if ($Controller->EditMode) {
- echo UserAnchor($Controller->User, 'Button', array('Text' => T('Back to Profile')));
+ echo UserAnchor($Controller->User, 'BackToProfile Button', array('Text' => T('Back to Profile')));
} else {
$Session = Gdn::Session();
@@ -29,7 +29,3 @@
$Controller->FireEvent('AfterProfileOptions');
?>
</div>
-<?php
-if ($Controller->EditMode)
- echo Wrap(sprintf(T('Edit Profile: %s'), htmlentities($Controller->User->Name)), 'h1');
-
@@ -1,5 +1,5 @@
<?php if (!defined('APPLICATION')) exit(); ?>
-<h2><?php echo T('Edit My Account'); ?></h2>
+<h2><?php echo $this->Data('Title'); ?></h2>
<?php
echo $this->Form->Open();
echo $this->Form->Errors();
@@ -27,7 +27,7 @@
$Thumbnail = Img($Thumbnail, array('alt' => T('Thumbnail')));
?>
<div class="SmallPopup">
-<h1><?php echo T('Change My Picture'); ?></h1>
+<h2><?php echo $this->Data('Title'); ?></h2>
<?php
echo $this->Form->Open(array('enctype' => 'multipart/form-data'));
echo $this->Form->Errors();
@@ -309,7 +309,7 @@ public function Comment($DiscussionID = '') {
if ($Discussion) {
$this->DiscussionID = $DiscussionID = $Discussion->DiscussionID;
- $this->Form->SetFormValue('DiscussionID', $DiscussionID);
+ $this->Form->SetValue('DiscussionID', $DiscussionID);
}
}
@@ -359,21 +359,24 @@ public function Comment($DiscussionID = '') {
}
$SystemUserID = Gdn::UserModel()->GetSystemUserID();
+ $EmbeddedDiscussionData = array(
+ 'InsertUserID' => $SystemUserID,
+ 'DateInserted' => Gdn_Format::ToDateTime(),
+ 'UpdateUserID' => $SystemUserID,
+ 'DateUpdated' => Gdn_Format::ToDateTime(),
+ 'CategoryID' => $vanilla_category_id,
+ 'ForeignID' => $vanilla_identifier,
+ 'Type' => $vanilla_type,
+ 'Name' => $Title,
+ 'Body' => $Body,
+ 'Format' => 'Html',
+ 'Attributes' => serialize(array('ForeignUrl' => $vanilla_url))
+ );
+ $this->EventArguments['Discussion'] = $EmbeddedDiscussionData;
+ $this->FireEvent('BeforeEmbedDiscussion');
$DiscussionID = $this->DiscussionModel->SQL->Insert(
'Discussion',
- array(
- 'InsertUserID' => $SystemUserID,
- 'DateInserted' => Gdn_Format::ToDateTime(),
- 'UpdateUserID' => $SystemUserID,
- 'DateUpdated' => Gdn_Format::ToDateTime(),
- 'CategoryID' => $vanilla_category_id,
- 'ForeignID' => $vanilla_identifier,
- 'Type' => $vanilla_type,
- 'Name' => $Title,
- 'Body' => $Body,
- 'Format' => 'Html',
- 'Attributes' => serialize(array('ForeignUrl' => $vanilla_url))
- )
+ $EmbeddedDiscussionData
);
$ValidationResults = $this->DiscussionModel->ValidationResults();
if (count($ValidationResults) == 0 && $DiscussionID > 0) {
@@ -79,6 +79,7 @@ function WriteComment($Comment, $Sender, $Session, $CurrentOffset) {
$Sender->CanEditComments = $Session->CheckPermission('Vanilla.Comments.Edit', TRUE, 'Category', 'any') && C('Vanilla.AdminCheckboxes.Use');
// Prep event args
+ $CssClass = CssClass($Comment, $CurrentOffset);
$Sender->EventArguments['Comment'] = &$Comment;
$Sender->EventArguments['Author'] = &$Author;
$Sender->EventArguments['CssClass'] = &$CssClass;
@@ -89,7 +90,7 @@ function WriteComment($Comment, $Sender, $Session, $CurrentOffset) {
// First comment template event
$Sender->FireEvent('BeforeCommentDisplay'); ?>
-<li class="<?php echo CssClass($Comment, $CurrentOffset); ?>" id="<?php echo 'Comment_'.$Comment->CommentID; ?>">
+<li class="<?php echo $CssClass; ?>" id="<?php echo 'Comment_'.$Comment->CommentID; ?>">
<div class="Comment">
<?php $Sender->FireEvent('BeforeCommentMeta'); ?>
<span class="Author">
@@ -22,7 +22,7 @@ class Gdn_Configuration extends Gdn_Pluggable {
*
* @var array
*/
- protected $Data = array();
+ public $Data = array();
/**
* Configuration Source List
@@ -408,15 +408,21 @@ public function Load($File, $Name = 'Configuration', $Dynamic = FALSE) {
$ConfigurationSource = Gdn_ConfigurationSource::FromFile($this, $File, $Name);
if (!$ConfigurationSource) return FALSE;
- $ConfigurationSource->Splitting($this->Splitting);
+ $UseSplitting = $this->Splitting;
+ $ConfigurationSource->Splitting($UseSplitting);
if (!$ConfigurationSource) return FALSE;
$SourceTag = "file:{$File}";
$this->Sources[$SourceTag] = $ConfigurationSource;
- self::MergeConfig($this->Data, $ConfigurationSource->Export());
if ($Dynamic)
$this->Dynamic = $ConfigurationSource;
+
+ if (!$UseSplitting) {
+ $this->MassImport($ConfigurationSource->Export());
+ } else {
+ self::MergeConfig($this->Data, $ConfigurationSource->Export());
+ }
}
/**
@@ -437,14 +443,20 @@ public function LoadString($String, $Tag, $Name = 'Configuration', $Dynamic = TR
$ConfigurationSource = Gdn_ConfigurationSource::FromString($this, $String, $Tag, $Name);
if (!$ConfigurationSource) return FALSE;
- $ConfigurationSource->Splitting($this->Splitting);
+ $UseSplitting = $this->Splitting;
+ $ConfigurationSource->Splitting($UseSplitting);
$SourceTag = "string:{$Tag}";
$this->Sources[$SourceTag] = $ConfigurationSource;
- self::MergeConfig($this->Data, $ConfigurationSource->Export());
if ($Dynamic)
$this->Dynamic = $ConfigurationSource;
+
+ if (!$UseSplitting) {
+ $this->MassImport($ConfigurationSource->Export());
+ } else {
+ self::MergeConfig($this->Data, $ConfigurationSource->Export());
+ }
}
/**
@@ -513,7 +525,9 @@ public static function LoadFile($Path, $Options = array()) {
public function MassImport($Data) {
if ($this->Splitting) return;
$this->Data = array_merge($this->Data, $Data);
- $this->Dynamic->MassImport($Data);
+
+ if ($this->Dynamic instanceof Gdn_ConfigurationSource)
+ $this->Dynamic->MassImport($Data);
}
/**
@@ -637,30 +637,30 @@ public static function FuzzyTime($Timestamp = NULL, $MorePrecise = FALSE) {
$time = $Timestamp;
- define('NOW', time());
- define('ONE_MINUTE', 60);
- define('ONE_HOUR', 3600);
- define('ONE_DAY', 86400);
- define('ONE_WEEK', ONE_DAY*7);
- define('ONE_MONTH', ONE_WEEK*4);
- define('ONE_YEAR', ONE_MONTH*12);
+ $NOW = time();
+ if (!defined('ONE_MINUTE')) define('ONE_MINUTE', 60);
+ if (!defined('ONE_HOUR')) define('ONE_HOUR', 3600);
+ if (!defined('ONE_DAY')) define('ONE_DAY', 86400);
+ if (!defined('ONE_WEEK')) define('ONE_WEEK', ONE_DAY*7);
+ if (!defined('ONE_MONTH')) define('ONE_MONTH', ONE_WEEK*4);
+ if (!defined('ONE_YEAR')) define('ONE_YEAR', ONE_MONTH*12);
- $SecondsAgo = NOW - $time;
+ $SecondsAgo = $NOW - $time;
// sod = start of day :)
$sod = mktime(0, 0, 0, date('m', $time), date('d', $time), date('Y', $time));
- $sod_now = mktime(0, 0, 0, date('m', NOW), date('d', NOW), date('Y', NOW ));
+ $sod_now = mktime(0, 0, 0, date('m', $NOW), date('d', $NOW), date('Y', $NOW ));
// used to convert numbers to strings
$convert = array(1 => T('a'), 2 => T('two'), 3 => T('three'), 4 => T('four'), 5 => T('five'), 6 => T('six'), 7 => T('seven'), 8 => T('eight'), 9 => T('nine'), 10 => T('ten'), 11 => T('eleven'));
// today
if ($sod_now == $sod) {
- if ( $time > NOW-(ONE_MINUTE*3)) {
+ if ( $time > $NOW-(ONE_MINUTE*3)) {
return T('just now');
- } else if ($time > NOW-(ONE_MINUTE*7)) {
+ } else if ($time > $NOW-(ONE_MINUTE*7)) {
return T('a few minutes ago');
- } else if ($time > NOW-(ONE_HOUR)) {
+ } else if ($time > $NOW-(ONE_HOUR)) {
if ($MorePrecise) {
$MinutesAgo = ceil($SecondsAgo / 60);
return sprintf(T('%s minutes ago'), $MinutesAgo);
@@ -41,7 +41,11 @@ public function __construct($Loud = FALSE, $RequestDefaults = NULL) {
$this->Loud = $Loud;
$CookieKey = md5(mt_rand(0, 72312189).microtime(true));
- $this->CookieJar = CombinePaths(array(PATH_CACHE,"cookiejar.{$CookieKey}"));
+ if (defined('PATH_CACHE')) {
+ $this->CookieJar = CombinePaths(array(PATH_CACHE,"cookiejar.{$CookieKey}"));
+ } else {
+ $this->CookieJar = CombinePaths(array("/tmp","cookiejar.{$CookieKey}"));
+ }
if (!is_array($RequestDefaults)) $RequestDefaults = array();
$Defaults = array(
@@ -396,9 +400,8 @@ public function Request($Options, $QueryParams = NULL, $Files = NULL, $ExtraHead
$SendFileSize = filesize($SendFile);
$this->Action(" PUTing file: {$SendFile}");
- $SendFileHandle = fopen($SendFile, 'r');
curl_setopt($Handler, CURLOPT_PUT, TRUE);
- curl_setopt($Handler, CURLOPT_INFILE, $SendFileHandle);
+ curl_setopt($Handler, CURLOPT_INFILE, $SendFile);
curl_setopt($Handler, CURLOPT_INFILESIZE, $SendFileSize);
$SendExtraHeaders[] = "Content-Length: {$SendFileSize}";
@@ -497,6 +497,12 @@ private function _GetStashSession() {
$Path = C('Garden.Cookie.Path', '/');
$Domain = C('Garden.Cookie.Domain', '');
$Expire = 0;
+
+ // If the domain being set is completely incompatible with the current domain then make the domain work.
+ $CurrentHost = Gdn::Request()->Host();
+ if (!StringEndsWith($CurrentHost, trim($Domain, '.')))
+ $Domain = '';
+
setcookie($Name, $SessionID, $Expire, $Path, $Domain);
}
return $Session;
@@ -54,7 +54,7 @@
<span><?php echo T('FlaggedBy', "Reported by:"); ?> </span>
<span><?php echo "<strong>".Anchor($Flag['InsertName'],"profile/{$Flag['InsertUserID']}/{$Flag['InsertName']}")."</strong>{$OtherString} ".T('on').' '.$Flag['DateInserted']; ?></span>
</div>
- <div class="FlaggedItemComment">"<?php echo $Flag['Comment']; ?>"</div>
+ <div class="FlaggedItemComment">"<?php echo Gdn_Format::Text($Flag['Comment']); ?>"</div>
<div class="FlaggedActions">
<?php
echo $this->Form->Button('Dismiss',array(

0 comments on commit 924bb6f

Please sign in to comment.