Skip to content

Commit

Permalink
refs #1738 : added - cookie prefix routines.
Browse files Browse the repository at this point in the history
 -
  • Loading branch information
inureyes committed Dec 31, 2014
1 parent a792507 commit 55c0bc3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
3 changes: 2 additions & 1 deletion interface/common/blog/entries.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

$entriesView = '';
requireModel('blog.comment');
$context = Model_Context::getInstance();
if (isset($cache->contents)) {
$entriesView = $cache->contents;
if(strpos($cache->name,'keyword')!==false) $isKeylog = true;
Expand Down Expand Up @@ -70,7 +71,7 @@
dress('notice_rep_author_link', $blogURL."/author/".rawurlencode(User::getName($entry['userid'])), $entryView);
$entriesView .= $entryView;

} else if (doesHaveOwnership() || ($entry['visibility'] >= 2) || (isset($_COOKIE['GUEST_PASSWORD']) && (trim($_COOKIE['GUEST_PASSWORD']) == trim($entry['password'])))) { // This is post
} else if (doesHaveOwnership() || ($entry['visibility'] >= 2) || (isset($_COOKIE[$context->getProperty('service.cookie_prefix').'GUEST_PASSWORD']) && (trim($_COOKIE[$context->getProperty('service.cookie_prefix').'GUEST_PASSWORD']) == trim($entry['password'])))) { // This is post
$entryView = $skin->entry;
$entryView = '<a id="entry_'.$entry['id'].'"></a>'.CRLF.$entryView;

Expand Down
7 changes: 4 additions & 3 deletions library/view/mobileView.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)

function printMobileEntryContentView($blogid, $entry, $keywords = array()) {
if (doesHaveOwnership() || ($entry['visibility'] >= 2) || (isset($_COOKIE['GUEST_PASSWORD']) && (trim($_COOKIE['GUEST_PASSWORD']) == trim($entry['password']))))
$context = Model_Context::getInstance();
if (doesHaveOwnership() || ($entry['visibility'] >= 2) || (isset($_COOKIE[$context->getProperty('service.cookie_prefix').'GUEST_PASSWORD']) && (trim($_COOKIE[$context->getProperty('service.cookie_prefix').'GUEST_PASSWORD']) == trim($entry['password']))))
print (getEntryContentView($blogid, $entry['id'], $entry['content'], $entry['contentformatter'], $keywords));
else
{
Expand Down Expand Up @@ -169,13 +170,13 @@ function printMobileCommentFormView($entryId) {
<input type="checkbox" id="secret_<?php echo $entryId;?>" name="secret_<?php echo $entryId;?>" />
<br />
<label for="name_<?php echo $entryId;?>"><?php echo _text('이름');?></label>
<input type="text" id="name_<?php echo $entryId;?>" name="name_<?php echo $entryId;?>" value="<?php echo isset($_COOKIE['guestName']) ? htmlspecialchars($_COOKIE['guestName']) : '';?>" />
<input type="text" id="name_<?php echo $entryId;?>" name="name_<?php echo $entryId;?>" value="<?php echo isset($_COOKIE[$context->getProperty('service.cookie_prefix').'guestName']) ? htmlspecialchars($_COOKIE[$context->getProperty('service.cookie_prefix').'guestName']) : '';?>" />
<br />
<label for="password_<?php echo $entryId;?>"><?php echo _text('비밀번호');?></label>
<input type="password" id="password_<?php echo $entryId;?>" name="password_<?php echo $entryId;?>" />
<br />
<label for="homepage_<?php echo $entryId;?>"><?php echo _text('홈페이지');?></label>
<input type="text" id="homepage_<?php echo $entryId;?>" name="homepage_<?php echo $entryId;?>" value="<?php echo (isset($_COOKIE['guestHomepage']) && $_COOKIE['guestHomepage'] != 'http://') ? htmlspecialchars($_COOKIE['guestHomepage']) : 'http://';?>" />
<input type="text" id="homepage_<?php echo $entryId;?>" name="homepage_<?php echo $entryId;?>" value="<?php echo (isset($_COOKIE[$context->getProperty('service.cookie_prefix').'guestHomepage']) && $_COOKIE[$context->getProperty('service.cookie_prefix').'guestHomepage'] != 'http://') ? htmlspecialchars($_COOKIE[$context->getProperty('service.cookie_prefix').'guestHomepage']) : 'http://';?>" />
<br />
<?php
}
Expand Down
9 changes: 5 additions & 4 deletions library/view/replyEditorView.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)

$context = Model_Context::getInstance();
$confirmString = '';
if (empty($comment['name']) ) {
if( isset($_SESSION['openid']['nickname'])) {
$comment['name'] = $_SESSION['openid']['nickname'];
} else if( isset($_COOKIE['guestName'])) {
$comment['name'] = $_COOKIE['guestName'];
} else if( isset($_COOKIE[$context->getProperty('service.cookie_prefix').'guestName'])) {
$comment['name'] = $_COOKIE[$context->getProperty('service.cookie_prefix').'guestName'];
}
}
if ((empty($comment['homepage']) || $comment['homepage'] == 'http://') ) {
if( isset($_SESSION['openid']['homepage'])) {
$comment['homepage'] = $_SESSION['openid']['homepage'];
} else if( isset($_COOKIE['guestHomepage']) && $_COOKIE['guestHomepage'] != 'http://') {
$comment['homepage'] = $_COOKIE['guestHomepage'];
} else if( isset($_COOKIE[$context->getProperty('service.cookie_prefix').'guestHomepage']) && $_COOKIE[$context->getProperty('service.cookie_prefix').'guestHomepage'] != 'http://') {
$comment['homepage'] = $_COOKIE[$context->getProperty('service.cookie_prefix').'guestHomepage'];
}
}

Expand Down
8 changes: 4 additions & 4 deletions library/view/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,8 @@ function getCommentView($entry, $skin, $inputBlock = true, $page = 1, $count = n
$guestName = htmlspecialchars($_POST["name_{$entry['id']}"]);
else if (!empty($_SESSION['openid']['nickname']))
$guestName = htmlspecialchars($_SESSION['openid']['nickname']);
else if (!empty($_COOKIE['guestName']))
$guestName = htmlspecialchars($_COOKIE['guestName']);
else if (!empty($_COOKIE[$context->getProperty('service.cookie_prefix').'guestName']))
$guestName = htmlspecialchars($_COOKIE[$context->getProperty('service.cookie_prefix').'guestName']);
else
$guestName = '';
dress('guest_name', $guestName, $commentGuestView);
Expand All @@ -461,8 +461,8 @@ function getCommentView($entry, $skin, $inputBlock = true, $page = 1, $count = n
$guestHomepage = 'http://' . htmlspecialchars($_POST["homepage_{$entry['id']}"]);
} else if (!empty($_SESSION['openid']['homepage'])) {
$guestHomepage = htmlspecialchars($_SESSION['openid']['homepage']);
} else if (!empty($_COOKIE['guestHomepage'])) {
$guestHomepage = htmlspecialchars($_COOKIE['guestHomepage']);
} else if (!empty($_COOKIE[$context->getProperty('service.cookie_prefix').'guestHomepage'])) {
$guestHomepage = htmlspecialchars($_COOKIE[$context->getProperty('service.cookie_prefix').'guestHomepage']);
}
else
$guestHomepage = 'http://';
Expand Down

0 comments on commit 55c0bc3

Please # to comment.