This commit is contained in:
tanghucheng
2023-06-08 01:10:38 +00:00
14 changed files with 74 additions and 29 deletions
+1
View File
@@ -21,6 +21,7 @@ $filter->default->paramValue = 'reg::paramValue';
$filter->default->get['onlybody'] = 'equal::yes';
$filter->default->get['_single'] = 'equal::1';
$filter->default->get['_nocache'] = 'equal::1';
$filter->default->get['tid'] = 'reg::word';
$filter->default->get['HTTP_X_REQUESTED_WITH'] = 'equal::XMLHttpRequest';
+1
View File
@@ -955,6 +955,7 @@ class baseControl
for($i = 0; $i < $obLevel; $i++) ob_end_clean();
$response = helper::removeUTF8Bom(urldecode(json_encode($data)));
$this->app->outputXhprof();
die($response);
}
+2 -2
View File
@@ -718,7 +718,7 @@ class baseRouter
*
* @return bool
*/
protected function outputXhprof()
public function outputXhprof()
{
if(empty($this->config->debug) || $this->config->debug < 4 || !extension_loaded('xhprof')) return false;
@@ -2266,7 +2266,7 @@ class baseRouter
{
$cacheEnable = $this->config->cache->enableFullPage;
/* If caching is not turned on, pages that do not need to be cached, or when searching, they are not cached. */
if(!$cacheEnable || !in_array("{$this->moduleName}|{$this->methodName}", $this->config->cache->fullPages) || stripos($this->server->request_uri, 'search') !== false)
if(!$cacheEnable || !in_array("{$this->moduleName}|{$this->methodName}", $this->config->cache->fullPages) || stripos($this->server->request_uri, 'search') !== false || isset($_GET['_nocache']) || $this->server->http_x_zt_refresh)
{
$this->loadModule();
return helper::removeUTF8Bom(ob_get_clean());
+16
View File
@@ -350,12 +350,28 @@ class helper extends baseHelper
}
/**
* 是否是内网。
* Check is intranet.
*
* @return bool
*/
public static function isIntranet()
{
return !defined('USE_INTRANET') ? false : USE_INTRANET;
}
/**
* 检查是否启用缓存。
* Check is enable cache.
*
* @return bool
*/
public static function isCacheEnabled()
{
if(isset($_GET['_nocace']) || isset($_SERVER['HTTP_X_ZT_REFRESH'])) return false;
global $config;
return $config->cache->enable;
}
}
/**
+1 -1
View File
@@ -1259,7 +1259,7 @@ EOT;
* Set js value.
*
* @param string $key
* @param mix $value
* @param mixed $value
* @static
* @access public
* @return string
+2 -1
View File
@@ -255,7 +255,8 @@ class dbh
public function formatDmSQL($sql)
{
$sql = trim($sql);
$sql = str_replace(array('\r', '\n'), ' ', $sql);
/* '\\\\n' try to compatible screen json like \u0232\\nBug. */
$sql = str_replace(array('\\\\n', '\r', '\n'), ' ', $sql);
$sql = $this->formatFunction($sql);
$actionPos = strpos($sql, ' ');
+1 -1
View File
@@ -81,7 +81,7 @@ class admin extends control
*/
public function ajaxSetZentaoData()
{
if(helper::isIntranet()) return $this->send(array('result' => 'fail'));
if(helper::isIntranet()) return $this->send(array('result' => 'ignore'));
$hasInternet = $this->admin->checkInternet();
+4 -4
View File
@@ -381,7 +381,7 @@ class block extends control
$this->view->tutorialed = $this->loadModel('tutorial')->getTutorialed();
$cacheKey = 'welcomeBlockData';
if($this->config->cache->enable and $this->cache->has($cacheKey))
if(helper::isCacheEnabled() && $this->cache->has($cacheKey))
{
$data = $this->cache->get($cacheKey);
}
@@ -418,7 +418,7 @@ class block extends control
*/
public function contribute()
{
if($this->config->cache->enable && $this->cache->has('contributeBlockData'))
if(helper::isCacheEnabled() && $this->cache->has('contributeBlockData'))
{
$data = $this->cache->get('contributeBlockData');
}
@@ -984,7 +984,7 @@ class block extends control
}
$cacheKey = __FUNCTION__ . $status . $count . $excludedModel;
if($this->config->cache->enable and $this->cache->has($cacheKey))
if(helper::isCacheEnabled() && $this->cache->has($cacheKey))
{
$projects = $this->cache->get($cacheKey);
}
@@ -2037,7 +2037,7 @@ class block extends control
$this->app->loadClass('pager', $static = true);
$pager = new pager(0, 3, 1);
$cacheKey = __FUNCTION__;
if($this->config->cache->enable and $this->cache->has($cacheKey))
if(helper::isCacheEnabled() && $this->cache->has($cacheKey))
{
$this->app->loadLang('project');
$projects = $this->cache->get($cacheKey);
+6 -3
View File
@@ -58,14 +58,17 @@ function resizeBlock(blockID, width, callback)
*
* @param object $panel
* @param function afterRefresh
* @param number forceRefresh
* @access public
* @return void
*/
function refreshBlock($panel, afterRefresh)
function refreshBlock($panel, afterRefresh, forceRefresh = 0)
{
var url = $panel.data('url');
var headers = {};
if(forceRefresh) headers['X-Zt-Refresh'] = forceRefresh;
$panel.addClass('load-indicator loading');
$.ajax({url: url, dataType: 'html'}).done(function(data)
$.ajax({url: url, dataType: 'html', headers: headers}).done(function(data)
{
var $data = $(data);
if($data.hasClass('panel')) $panel.empty().append($data.children());
@@ -284,7 +287,7 @@ $(function()
always: function(){sortMessager.isShow && sortMessager.hide();}
}).on('click', '.refresh-panel', function()
{
refreshBlock($(this).closest('.panel'));
refreshBlock($(this).closest('.panel'), null, 1);
});
});
+1 -1
View File
@@ -166,7 +166,7 @@ class bug extends control
/* Get executions. */
$cacheKey = "bugBrowse{$this->projectID}";
if($this->config->cache->enable && $this->cache->has($cacheKey))
if(helper::isCacheEnabled() && $this->cache->has($cacheKey))
{
$executions = $this->cache->get($cacheKey);
}
+33 -10
View File
@@ -3819,13 +3819,34 @@ class execution extends control
* @param int $executionID
* @param string $module
* @param string $method
* @param mix $extra
* @param mixed $extra
* @access public
* @return void
*/
public function ajaxGetDropMenu($executionID, $module, $method, $extra)
{
$orderedExecutions = array();
$this->view->link = $this->execution->getLink($module, $method, $extra);
$this->view->module = $module;
$this->view->method = $method;
$this->view->executionID = $executionID;
$this->view->extra = $extra;
$cacheProjectsKey = 'execution|dropmenu|project';
$cacheExecutionsKey = 'execution|dropmenu|executions';
if(helper::isCacheEnabled())
{
$projects = $this->cache->get($cacheProjectsKey);
$projectExecutions = $this->cache->get($cacheExecutionsKey);
if(!empty($projects) && !empty($projectExecutions))
{
$this->view->projects = $projects;
$this->view->projectExecutions = $projectExecutions;
$this->display();
return;
}
}
$projects = $this->loadModel('program')->getProjectList(0, 'all', 0, 'order_asc', null, 0, 0, true);
$executionGroups = $this->dao->select('*')->from(TABLE_EXECUTION)
@@ -3842,7 +3863,8 @@ class execution extends control
->andWhere('type')->eq('execution')
->fetchGroup('root', 'account');
$projectPairs = array();
$projectPairs = array();
$orderedExecutions = array();
foreach($projects as $project)
{
$executions = zget($executionGroups, $project->id, array());
@@ -3878,13 +3900,14 @@ class execution extends control
$projectExecutions[$execution->project][] = $execution;
}
$this->view->link = $this->execution->getLink($module, $method, $extra);
$this->view->module = $module;
$this->view->method = $method;
$this->view->executionID = $executionID;
$this->view->extra = $extra;
$this->view->projects = $projectPairs;
$this->view->projectExecutions = $projectExecutions;
if($this->config->cache->enable)
{
$this->cache->set($cacheProjectsKey, $projectPairs);
$this->cache->set($cacheExecutionsKey, $projectExecutions);
}
$this->view->projects = $projectPairs;
$this->view->projectExecutions = $projectExecutions;
$this->display();
}
+1 -1
View File
@@ -2297,7 +2297,7 @@ class executionModel extends model
}
/**
* Get full name of executons.
* Get full name of executions.
* @param array $executions
* @access public
* @return array
+1 -1
View File
@@ -37,7 +37,7 @@ class index extends control
if($this->get->open) $open = $this->get->open;
$latestVersionList = array();
if(isset($this->config->global->latestVersionList)) $latestVersionList = json_decode($this->config->global->latestVersionList);
if(isset($this->config->global->latestVersionList)) $latestVersionList = json_decode($this->config->global->latestVersionList, true);
$this->view->title = $this->lang->index->common;
$this->view->open = helper::safe64Decode($open);
+4 -4
View File
@@ -133,15 +133,15 @@ js::set('isIntranet', helper::isIntranet());
<div class="version-list">
<div>
<i class='version-upgrade icon-version'></i>
<h4><?php echo $version->name;?></h4>
<h4><?php echo $version['name'];?></h4>
</div>
<div class="version-detail"><?php echo $version->explain;?></div>
<div class="version-detail"><?php echo $version['explain'];?></div>
<div class="version-footer">
<a href="<?php echo inLink('changeLog', 'version=' . $versionNumber);?>" class="btn btn-link iframe" data-width="800"><?php echo $lang->index->log;?></strong></a>
<a href='<?php echo $version->link?>' class='btn btn-primary upgrade-now' style='color: white;' target='_blank'><?php echo $lang->index->upgradeNow;?></a>
<a href='<?php echo $version['link']?>' class='btn btn-primary upgrade-now' style='color: white;' target='_blank'><?php echo $lang->index->upgradeNow;?></a>
</div>
</div>
<?php if($version->name != $lastVersion->name):?>
<?php if($version['name'] != $lastVersion['name']):?>
<hr class='version-hr'>
<?php endif;?>
<?php endforeach;?>