Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F727098
D212.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Jan 6, 6:46 AM
Size
6 KB
Mime Type
text/x-diff
Expires
Tue, Jan 7, 6:46 AM (3 d, 3 h ago)
Engine
blob
Format
Raw Data
Handle
536640
Attached To
D212: MINB-26 - Don't persist data for anonymous users
D212.diff
View Options
Index: branches/5.2.x/units/posts/post_eh.php
===================================================================
--- branches/5.2.x/units/posts/post_eh.php
+++ branches/5.2.x/units/posts/post_eh.php
@@ -221,9 +221,11 @@
$main_object = $this->Application->recallObject($parent_prefix);
/* @var $main_object kCatDBItem */
- // update user posts counter
- $user_posts = $this->Application->RecallPersistentVar('bb_posts');
- $this->Application->StorePersistentVar('bb_posts', $user_posts + 1);
+ if ( $this->Application->LoggedIn() ) {
+ // Update user posts counter.
+ $user_posts = $this->Application->RecallPersistentVar('bb_posts');
+ $this->Application->StorePersistentVar('bb_posts', $user_posts + 1);
+ }
$post_helper = $this->Application->recallObject('PostHelper');
/* @var $post_helper PostHelper */
@@ -394,6 +396,10 @@
{
parent::OnAfterConfigRead($event);
+ if ( !$this->Application->LoggedIn() ) {
+ return;
+ }
+
$virtual_fields = $this->Application->getUnitOption($event->Prefix, 'VirtualFields');
$virtual_fields['DisableBBCodes']['default'] = (int)!$this->Application->RecallPersistentVar('bbcode');
$virtual_fields['DisableSmileys']['default'] = (int)!$this->Application->RecallPersistentVar('smileys');
@@ -444,4 +450,4 @@
$object->SetDBField('PostingText', '[quote id=' . $reply_to . ']' . $source_post->GetDBField('PostingText') . '[/quote]');
}
}
- }
\ No newline at end of file
+ }
Index: branches/5.2.x/units/posts/post_tp.php
===================================================================
--- branches/5.2.x/units/posts/post_tp.php
+++ branches/5.2.x/units/posts/post_tp.php
@@ -144,28 +144,41 @@
}
/**
- * Checks if poster signature needs to be shown together with post
+ * Checks if poster signature needs to be shown together with post.
*
- * @param Array $params
- * @return bool
+ * @param array $params Tag params.
+ *
+ * @return boolean
*/
- function ShowPostSignature($params)
+ protected function ShowPostSignature(array $params)
{
+ static $show_signatures;
+
+ if ( !isset($show_signatures) ) {
+ if ( $this->Application->LoggedIn() ) {
+ $show_signatures = $this->Application->RecallPersistentVar('bb_signatures');
+ }
+ else {
+ $show_signatures = false;
+ }
+ }
+
+ if ( !$show_signatures ) {
+ return false;
+ }
+
+ /** @var kDBItem $object */
$object = $this->getObject($params);
- $post_options = $object->GetDBField('Options');
+ /** @var PostHelper $post_helper */
$post_helper = $this->Application->recallObject('PostHelper');
- /* @var $post_helper PostHelper */
- // show poster signature in this post
- if ($post_helper->GetPostOption('show_sig', $post_options)) {
- // logged-in user wishes to view signatures in posts
- $show_other_signatures = $this->Application->RecallPersistentVar('bb_signatures');
- if ($show_other_signatures) {
- // don't show signature when it is empty
- $signature = $this->getUserSignature($object->GetDBField('CreatedById'));
- return strlen(trim($signature)) ? true : false;
- }
+ // Show poster signature in this post.
+ if ( $post_helper->GetPostOption('show_sig', $object->GetDBField('Options')) ) {
+ // Don't show signature when it is empty.
+ $signature = $this->getUserSignature($object->GetDBField('CreatedById'));
+
+ return strlen(trim($signature)) ? true : false;
}
return false;
@@ -308,4 +321,4 @@
}
return parent::PageLink($params);
}
- }
\ No newline at end of file
+ }
Index: branches/5.2.x/units/posts/posts_config.php
===================================================================
--- branches/5.2.x/units/posts/posts_config.php
+++ branches/5.2.x/units/posts/posts_config.php
@@ -98,7 +98,7 @@
'VirtualFields' => Array (
'DisableBBCodes' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1, 'default' => 0),
'DisableSmileys' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1, 'default' => 0),
- 'ShowSignatures' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1, 'default' => 1),
+ 'ShowSignatures' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1, 'default' => 0),
'UserName' => Array ('type' => 'string', 'default' => ''),
// for avatar image
'AltName' => Array('type' => 'string', 'default' => ''),
@@ -114,4 +114,4 @@
'ConfigMapping' => Array (
'PerPage' => 'Perpage_Postings',
),
- );
\ No newline at end of file
+ );
Index: branches/5.2.x/units/private_messages/private_message_eh.php
===================================================================
--- branches/5.2.x/units/private_messages/private_message_eh.php
+++ branches/5.2.x/units/private_messages/private_message_eh.php
@@ -237,6 +237,10 @@
{
parent::OnAfterConfigRead($event);
+ if ( !$this->Application->LoggedIn() ) {
+ return;
+ }
+
$virtual_fields = $this->Application->getUnitOption($event->Prefix, 'VirtualFields');
$virtual_fields['DisableBBCodes']['default'] = (int)!$this->Application->RecallPersistentVar('bbcode');
$virtual_fields['DisableSmileys']['default'] = (int)!$this->Application->RecallPersistentVar('smileys');
Index: branches/5.2.x/units/topics/topics_config.php
===================================================================
--- branches/5.2.x/units/topics/topics_config.php
+++ branches/5.2.x/units/topics/topics_config.php
@@ -492,7 +492,7 @@
'type' => 'int',
'formatter' => 'kOptionsFormatter',
'options' => Array (0 => 'la_No', 1 => 'la_Yes',), 'use_phrases' => 1,
- 'default' => 1,
+ 'default' => 0,
),
// for primary image
@@ -562,4 +562,4 @@
'RatingDelayValue' => 'topic_RatingDelay_Value',
'RatingDelayInterval' => 'topic_RatingDelay_Interval',
),
- );
\ No newline at end of file
+ );
Index: branches/5.2.x/units/topics/topics_event_handler.php
===================================================================
--- branches/5.2.x/units/topics/topics_event_handler.php
+++ branches/5.2.x/units/topics/topics_event_handler.php
@@ -217,6 +217,10 @@
{
parent::OnAfterConfigRead($event);
+ if ( !$this->Application->LoggedIn() ) {
+ return;
+ }
+
$fields = $this->Application->getUnitOption($event->Prefix, 'Fields');
$fields['NotifyOwnerOnChanges']['default'] = (int)$this->Application->RecallPersistentVar('owner_notify');
$this->Application->setUnitOption($event->Prefix, 'Fields', $fields);
@@ -300,4 +304,4 @@
$manager->subscribe();
}
}
- }
\ No newline at end of file
+ }
Event Timeline
Log In to Comment