mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 16:51:40 +09:00
Merge branch 'rhymix:master' into master
This commit is contained in:
commit
a5c3dc8ae5
24 changed files with 219 additions and 95 deletions
|
|
@ -338,7 +338,11 @@ class Context
|
|||
}
|
||||
|
||||
// start session
|
||||
if (\PHP_SAPI !== 'cli')
|
||||
if (\PHP_SAPI === 'cli')
|
||||
{
|
||||
$_SESSION = [];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (self::$_current_request->getRouteOption('enable_session'))
|
||||
{
|
||||
|
|
@ -1214,7 +1218,7 @@ class Context
|
|||
else
|
||||
{
|
||||
// Set HTTP_RAW_POST_DATA for third-party apps that look for it.
|
||||
if (!$_POST && !isset($GLOBALS['HTTP_RAW_POST_DATA']))
|
||||
if (empty($_POST) && empty($_FILES) && !isset($GLOBALS['HTTP_RAW_POST_DATA']))
|
||||
{
|
||||
$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents('php://input');
|
||||
}
|
||||
|
|
@ -1230,7 +1234,7 @@ class Context
|
|||
}
|
||||
|
||||
// Decide whether it's JSON or XMLRPC by looking at the first character of the POST data.
|
||||
if (!$_POST && !empty($GLOBALS['HTTP_RAW_POST_DATA']))
|
||||
if (empty($_POST) && !empty($GLOBALS['HTTP_RAW_POST_DATA']))
|
||||
{
|
||||
self::$_instance->request_method = substr($GLOBALS['HTTP_RAW_POST_DATA'], 0, 1) === '<' ? 'XMLRPC' : 'JSON';
|
||||
return;
|
||||
|
|
@ -1258,7 +1262,7 @@ class Context
|
|||
}
|
||||
|
||||
// Set JSON and XMLRPC arguments.
|
||||
if(isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST' && !$_POST && !empty($GLOBALS['HTTP_RAW_POST_DATA']))
|
||||
if(isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST' && empty($_POST) && !empty($GLOBALS['HTTP_RAW_POST_DATA']))
|
||||
{
|
||||
$params = array();
|
||||
$request_method = self::getRequestMethod();
|
||||
|
|
|
|||
|
|
@ -151,13 +151,20 @@ class HTMLDisplayHandler
|
|||
Context::loadFile(array($edited_layout_css, 'all', '', 100));
|
||||
}
|
||||
}
|
||||
if(!$layout_path)
|
||||
if (!$layout_path)
|
||||
{
|
||||
$layout_path = './common/tpl';
|
||||
}
|
||||
if(!$layout_file)
|
||||
if (!$layout_file)
|
||||
{
|
||||
$layout_file = 'default_layout';
|
||||
if ($layout_path === './common/tpl')
|
||||
{
|
||||
$layout_file = 'default_layout';
|
||||
}
|
||||
else
|
||||
{
|
||||
$layout_file = 'layout';
|
||||
}
|
||||
}
|
||||
|
||||
$oTemplate = new Rhymix\Framework\Template;
|
||||
|
|
|
|||
|
|
@ -151,7 +151,16 @@ class ModuleHandler extends Handler
|
|||
$site_module_info->domain = Rhymix\Framework\URL::getCurrentDomain();
|
||||
$site_module_info->is_default_domain = 'N';
|
||||
$site_module_info->is_default_replaced = true;
|
||||
|
||||
// Reset context variables if the domain was replaced.
|
||||
Context::set('site_module_info', $site_module_info);
|
||||
Context::set('_default_url', null);
|
||||
Context::set('request_uri', $current_url = Context::getRequestUri());
|
||||
if ($query_string = http_build_query(Context::getCurrentRequest()->args))
|
||||
{
|
||||
$current_url .= '?' . $query_string;
|
||||
}
|
||||
Context::set('current_url', $current_url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,24 +44,23 @@ class PageHandler extends Handler implements Iterator
|
|||
$this->page_count = $page_count;
|
||||
$this->point = 0;
|
||||
|
||||
$first_page = $cur_page - (int) ($page_count / 2);
|
||||
if($first_page < 1)
|
||||
if ($this->cur_page > $total_page)
|
||||
{
|
||||
$first_page = 1;
|
||||
$this->cur_page = $total_page;
|
||||
}
|
||||
if ($this->page_count > $total_page)
|
||||
{
|
||||
$this->page_count = $total_page;
|
||||
}
|
||||
|
||||
if($total_page > $page_count && $first_page + $page_count - 1 > $total_page)
|
||||
$first_page = max(1, $this->cur_page - floor($this->page_count / 2));
|
||||
if (($first_page + $this->page_count - 1) > $total_page)
|
||||
{
|
||||
$first_page -= $first_page + $page_count - 1 - $total_page;
|
||||
$first_page = max(1, $total_page - $this->page_count + 1);
|
||||
}
|
||||
|
||||
$this->first_page = $first_page;
|
||||
$this->last_page = $total_page;
|
||||
|
||||
if($total_page < $this->page_count)
|
||||
{
|
||||
$this->page_count = $total_page;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue