Merge branch 'develop' into pr/session-class

This commit is contained in:
Kijin Sung 2016-07-17 23:07:06 +09:00
commit 1d1171344a
13 changed files with 83 additions and 19 deletions

View file

@ -46,11 +46,11 @@ class Mobile
// Try to detect from URL arguments and cookies, and finally fall back to user-agent detection.
$m = Context::get('m');
$cookie = (isset($_COOKIE['mobile']) && $_SESSION['user_agent'] === md5($_SERVER['HTTP_USER_AGENT'])) ? $_COOKIE['mobile'] : null;
if ($m === '1' || $cookie === 'true')
if ($m === '1' || ($m === null && $cookie === 'true'))
{
self::$_ismobile = TRUE;
}
elseif ($m === '0' || $cookie === 'false')
elseif ($m === '0' || ($m === null && $cookie === 'false'))
{
self::$_ismobile = FALSE;
}
@ -60,7 +60,7 @@ class Mobile
}
// Set cookie to prevent recalculation.
if (!$cookie)
if ($cookie !== (self::$_ismobile ? 'true' : 'false'))
{
$_SESSION['user_agent'] = md5($_SERVER['HTTP_USER_AGENT']);
$_COOKIE['mobile'] = self::$_ismobile ? 'true' : 'false';

View file

@ -58,7 +58,7 @@ class LangParser
}
// Load the XML lang file.
$xml = @simplexml_load_file($filename);
$xml = simplexml_load_string(Storage::read($filename));
if ($xml === false)
{
Storage::write($output_filename, '');

View file

@ -240,11 +240,16 @@ class Storage
}
}
if (self::$safe_overwrite && strncasecmp($mode, 'a', 1))
if (self::$safe_overwrite && strncasecmp($mode, 'a', 1) && @is_writable($destination_dir))
{
$use_atomic_rename = true;
$original_filename = $filename;
$filename = $filename . '.tmp.' . microtime(true);
}
else
{
$use_atomic_rename = false;
}
if ($fp = @fopen($filename, $mode))
{
@ -275,7 +280,7 @@ class Storage
@chmod($filename, ($perms === null ? (0666 & ~self::getUmask()) : $perms));
if (self::$safe_overwrite && strncasecmp($mode, 'a', 1))
if ($use_atomic_rename)
{
$rename_success = @rename($filename, $original_filename);
if (!$rename_success)
@ -350,14 +355,20 @@ class Storage
}
elseif (self::isDirectory($destination))
{
$destination_dir = $destination;
$destination = $destination . '/' . basename($source);
}
if (self::$safe_overwrite)
if (self::$safe_overwrite && @is_writable($destination_dir))
{
$use_atomic_rename = true;
$original_destination = $destination;
$destination = $destination . '.tmp.' . microtime(true);
}
else
{
$use_atomic_rename = false;
}
$copy_success = @copy($source, $destination);
if (!$copy_success)
@ -382,7 +393,7 @@ class Storage
@chmod($destination, $destination_perms);
}
if (self::$safe_overwrite)
if ($use_atomic_rename)
{
$rename_success = @rename($destination, $original_destination);
if (!$rename_success)

View file

@ -821,7 +821,7 @@ class boardView extends board
}
// if the document is not existed, then back to the board content page
if(!$oDocument->isExists())
if(!$oDocument || !$oDocument->isExists())
{
return $this->dispBoardContent();
}

View file

@ -48,6 +48,7 @@ $lang->enable_find_account_question = 'Account recovery using question/answer';
$lang->enable_ssl = 'Enable SSL';
$lang->msg_email_confirmation_required = 'A confirmation e-mail will be sent. Please check your email address carefully.';
$lang->security_sign_in = 'Sign in using enhanced security';
$lang->member_limited = 'Limited';
$lang->limit_day = 'Temporary Limit Date';
$lang->limit_day_description = 'Description for Temporary Limit Date';
$lang->limit_date = 'Limit Date';

View file

@ -48,6 +48,7 @@ $lang->enable_find_account_question = '질문/답변 인증 사용';
$lang->enable_ssl = 'SSL 기능 사용';
$lang->msg_email_confirmation_required = '인증 메일이 발송되니 정확하게 입력해 주시기 바랍니다.';
$lang->security_sign_in = '보안로그인 사용';
$lang->member_limited = '임시 제한';
$lang->limit_day = '임시 제한 일자';
$lang->limit_day_description = '임시 제한 일자 설명';
$lang->limit_date = '제한일';

View file

@ -1756,13 +1756,16 @@ class memberController extends member
$redirectUrl = getUrl('', 'act', 'dispMemberResendAuthMail');
return $this->setRedirectUrl($redirectUrl, new Object(-1,'msg_user_not_confirmed'));
}
return new Object(-1, ($this->memberInfo->refused_reason)? lang('msg_user_denied') . "\n" . $this->memberInfo->refused_reason : 'msg_user_denied');
$refused_reason = $this->memberInfo->refused_reason ? ('<br>' . lang('refused_reason') . ': ' . $this->memberInfo->refused_reason) : '';
return new Object(-1, lang('msg_user_denied') . $refused_reason);
}
// Notify if user is limited
if($this->memberInfo->limit_date && substr($this->memberInfo->limit_date,0,8) >= date("Ymd"))
{
return new Object(-9,sprintf(lang('msg_user_limited'),zdate($this->memberInfo->limit_date,"Y-m-d")));
$limited_reason = $this->memberInfo->limited_reason ? ('<br>' . lang('refused_reason') . ': ' . $this->memberInfo->limited_reason) : '';
return new Object(-9, sprintf(lang('msg_user_limited'), zdate($this->memberInfo->limit_date,"Y-m-d")) . $limited_reason);
}
// Do not allow login as admin if not in allowed IP list

View file

@ -92,6 +92,13 @@
<span class="x_help-inline">{$lang->about_limit_date}</span>
</div>
</div>
<div class="x_control-group div_limited_reason">
<label class="x_control-label">{$lang->refused_reason}</label>
<div class="x_controls">
<textarea name="limited_reason" id="limited_reason" rows="2" cols="42" style="vertical-align:top">{$member_info->limited_reason}</textarea>
<span class="x_help-inline">{$lang->about_refused_reason}</span>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->is_admin}</label>
<div class="x_controls">
@ -136,6 +143,11 @@
onSelect:function(){
$(this).prev('input[type="hidden"]').val(this.value.replace(/-/g,""))
if($('#until').val()){
limited_reason_division.slideDown(200);
} else {
limited_reason_division.slideUp(200);
}
}
};
$.extend($.datepicker.regional['{$lang_type}'],option);
@ -147,7 +159,9 @@
}
$(".dateRemover").click(function() {
$(this).prevAll('input').val('');
return false;});
limited_reason_division.slideUp(200);
return false;
});
});
var refused_reason_division = $('.div_refused_reason');
@ -165,5 +179,11 @@
refused_reason_division.slideUp(200);
}
});
var limited_reason_division = $('.div_limited_reason');
if(!$('#until').val())
{
limited_reason_division.hide();
}
})(jQuery);
</script>

View file

@ -48,7 +48,15 @@
</td>
{@ $member_info['group_list'] = implode(', ', $member_info['group_list'])}
<td class="nowr" loop="$usedIdentifiers=>$name,$title">{$member_info[$name]}</td>
<td class="nowr"><!--@if($member_info['denied']=='Y')--><span style="color:red;">{$lang->denied}</span><!--@else-->{$lang->approval}<!--@end--></td>
<td class="nowr">
<!--@if($member_info['denied']=='Y')-->
<span style="color:red;">{$lang->denied}</span>
<!--@elseif($member_info['limit_date'] && substr($member_info['limit_date'], 0, 8) >= date('Ymd'))-->
<span style="color:red;">{$lang->member_limited}</span>
<!--@else-->
{$lang->approval}
<!--@end-->
</td>
<td class="nowr" title="{zdate($member_info['regdate'], 'Y-m-d H:i:s')}">{zdate($member_info['regdate'], 'Y-m-d')}</td>
<td class="nowr" title="{zdate($member_info['last_login'], 'Y-m-d H:i:s')}">{zdate($member_info['last_login'], 'Y-m-d')}</td>
<td>{$member_info['group_list']}&nbsp;</td>

View file

@ -55,20 +55,19 @@ class ncenterliteAdminController extends ncenterlite
$config->mention_suffixes = array_map('trim', explode(',', $config->mention_suffixes));
}
}
if ($obj->disp_act == 'dispNcenterliteAdminSeletedmid')
{
if (!$config->hide_module_srls)
if (!$obj->hide_module_srls)
{
$config->hide_module_srls = array();
}
if (!$config->admin_notify_module_srls)
if (!$obj->admin_notify_module_srls)
{
$config->admin_notify_module_srls = array();
}
}
$output = $oModuleController->updateModuleConfig('ncenterlite', $config);
$output = $oModuleController->insertModuleConfig('ncenterlite', $config);
if(!$output->toBool())
{
return new Object(-1, 'ncenterlite_msg_setting_error');

View file

@ -36,9 +36,11 @@
<div class="pagination pagination-centered">
<ul>
<li><a href="{getUrl('page','')}" class="direction">&laquo; {$lang->first_page}</a></li>
<!--@if($page_navigation)-->
<!--@while($page_no = $page_navigation->getNextPage())-->
<li class="active"|cond="$page == $page_no"><a href="{getUrl('page',$page_no)}">{$page_no}</a></li>
<!--@end-->
<!--@end-->
<li><a href="{getUrl('page',$page_navigation->last_page)}" class="direction">{$lang->last_page} &raquo;</a></li>
</ul>
</div>

View file

@ -35,10 +35,12 @@
<div class="pagination pagination-centered">
<ul>
<li><a href="{getUrl('page','')}" class="direction">&laquo; {$lang->first_page}</a></li>
<li><a href="{getUrl('page','')}" class="direction">&laquo; {$lang->first_page}</a></li>
<!--@if($page_navigation)-->
<!--@while($page_no = $page_navigation->getNextPage())-->
<li class="active"|cond="$page == $page_no"><a href="{getUrl('page',$page_no)}">{$page_no}</a></li>
<!--@end-->
<!--@end-->
<li><a href="{getUrl('page',$page_navigation->last_page)}" class="direction">{$lang->last_page} &raquo;</a></li>
</ul>
</div>

View file

@ -9,11 +9,13 @@ class StorageTest extends \Codeception\TestCase\Test
public function _after()
{
@chmod(\RX_BASEDIR . 'tests/_output', 0755);
Rhymix\Framework\Storage::deleteDirectory(\RX_BASEDIR . 'tests/_output', false);
}
public function _failed()
{
@chmod(\RX_BASEDIR . 'tests/_output', 0755);
Rhymix\Framework\Storage::deleteDirectory(\RX_BASEDIR . 'tests/_output', false);
}
@ -191,13 +193,28 @@ class StorageTest extends \Codeception\TestCase\Test
{
$source = \RX_BASEDIR . 'tests/_output/copy.source.txt';
$target = \RX_BASEDIR . 'tests/_output/copy.target.txt';
$target_dir = \RX_BASEDIR . 'tests/_output';
file_put_contents($source, 'foobarbaz');
chmod($source, 0646);
// Copy with exact destination filename
$this->assertTrue(Rhymix\Framework\Storage::copy($source, $target));
$this->assertTrue(file_exists($target));
$this->assertTrue(file_get_contents($target) === 'foobarbaz');
// Copy into directory with source filename
$this->assertTrue(Rhymix\Framework\Storage::copy($source, $target_dir));
$this->assertTrue(file_exists($target_dir . '/copy.source.txt'));
$this->assertTrue(file_get_contents($target_dir . '/copy.source.txt') === 'foobarbaz');
// Copy into directory with no write permissions
chmod($target_dir, 0555);
file_put_contents($source, 'foobarbaz has changed');
$this->assertTrue(Rhymix\Framework\Storage::copy($source, $target));
$this->assertTrue(file_exists($target));
$this->assertTrue(file_get_contents($target) === 'foobarbaz has changed');
chmod($target_dir, 0755);
if (strncasecmp(\PHP_OS, 'Win', 3) !== 0)
{
$this->assertEquals(0646, fileperms($target) & 0777);