Browse Source

更新内容: (#352)

* 更新内容:
1.支持分享者和管理员在分享页查看文件位置
2.修改$_G['siteurl']生成方式,解决内网穿透问题
3.修复用户中心语言设置缺失问题

* 更新
pull/353/head
小胡 2 days ago
committed by GitHub
parent
commit
fe5d49c75b
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      core/class/dzz/Tpsqli.php
  2. 23
      core/class/dzz/dzz_app.php
  3. 3
      core/class/helper/helper_page.php
  4. 4
      core/language/zh-cn/lang.php
  5. 2
      dzz/appmanagement/language/zh-cn/lang.php
  6. 9
      dzz/shares/ajax.php
  7. 43
      user/profile/template/profile.htm

2
core/class/dzz/Tpsqli.php

@ -32,7 +32,7 @@ class Tpsqli extends Tpdb {
$this->linkID[$linkNum] = DB::linknum();
if (!isset($this->linkID[$linkNum])) {
if (empty($config)) $config = $this->config;
$this->linkID[$linkNum] = new mysqli($config['hostname'], $config['username'], $config['password'], $config['database'], $config['hostport'] ? intval($config['hostport']) : 3306);
$this->linkID[$linkNum] = new \mysqli($config['hostname'], $config['username'], $config['password'], $config['database'], $config['hostport'] ? intval($config['hostport']) : 3306);
if (mysqli_connect_errno()) {
echo "数据库连接错误";
exit;//E(mysqli_connect_error());

23
core/class/dzz/dzz_app.php

@ -176,17 +176,21 @@ class dzz_app extends dzz_base {
$sitepath = preg_replace("/\/archiver/i", '', $sitepath);
}
$_G['isHTTPS'] = $this->is_HTTPS();//($_SERVER['HTTPS'] && strtolower($_SERVER['HTTPS']) != 'off') ? true : false;
if(strpos($_SERVER['HTTP_HOST'],':')!==false){
list($host,$siteport) = explode(':',$_SERVER['HTTP_HOST']);
$_G['siteport']=':'.intval($siteport);
$host=$_SERVER['HTTP_HOST'];
}else{
$_G['siteport'] = (empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' || $_SERVER['SERVER_PORT'] == '443' || $_SERVER['HTTP_X_FORWARDED_PORT'] == '443')? '' : ':'.$_SERVER['SERVER_PORT'];
$host=preg_replace("/:\d+$/",'',$_SERVER['HTTP_HOST']).$_G['siteport'];
}
$_G['siteurl'] = dhtmlspecialchars('http'.($_G['isHTTPS'] ? 's' : '').'://'.$host.$sitepath.'/');
$port = (!empty($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] !='80') ? ':'.$_SERVER['SERVER_PORT']:'';
if ($_G['isHTTPS'] && $port == ':443') {$port = '';} // 忽略https 443端口;
$host = $_SERVER['SERVER_NAME'].$port;
if (isset($_SERVER['HTTP_HOST'])){$host = $_SERVER['HTTP_HOST'];}
if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {//proxy
$hosts = explode(',', $_SERVER['HTTP_X_FORWARDED_HOST']);
$host = trim($hosts[0]);
} else if (isset($_SERVER['HTTP_X_FORWARDED_SERVER'])) {
$host = $_SERVER['HTTP_X_FORWARDED_SERVER'];
}
$_G['siteurl'] = dhtmlspecialchars('http'.($_G['isHTTPS'] ? 's' : '').'://'.trim($host,'/').$sitepath.'/');
$url = parse_url($_G['siteurl']);
$_G['siteroot'] = isset($url['path']) ? $url['path'] : '';
$_G['siteport'] = $port;
if (defined('SUB_DIR')) {
$_G['siteurl'] = str_replace(SUB_DIR, '/', $_G['siteurl']);
@ -609,7 +613,6 @@ class dzz_app extends dzz_base {
}
private function _init_setting() {
global $_G;
if ($this->init_setting) {
if (empty($this->var['setting'])) {
$this->cachelist[] = 'setting';

3
core/class/helper/helper_page.php

@ -9,6 +9,9 @@ class helper_page {
public static function multi($num, $perpage, $curpage, $mpurl, $classname = '', $maxpages = 0, $page = 5, $autogoto = FALSE, $simple = FALSE, $jsfunc = FALSE) {
global $_G;
$num = max(0, intval($num));
$perpage = max(1, intval($perpage));
$curpage = max(1, intval($curpage));
$ajaxtarget = !empty($_GET['ajaxtarget']) ? " ajaxtarget=\"" . dhtmlspecialchars($_GET['ajaxtarget']) . "\" " : '';
$a_name = '';

4
core/language/zh-cn/lang.php

@ -1610,6 +1610,10 @@ $_G[siteurl]',
'cloud_no_available' => '云盘已关闭',
'cloud_no_info' => '云盘信息不存在',
'panel_notice_title' => '通知中心',
'supportted' => '支持',
'unsupportted' => '不支持',
'am' => '上午',
'pm' => '下午',
);
?>

2
dzz/appmanagement/language/zh-cn/lang.php

@ -1,8 +1,6 @@
<?php
$lang = array(
'appname' => '管理',
'supportted' => '支持',
'unsupportted' => '不支持',
'php_version_too_low' => 'php版本太低啦,请先升级php到5.3以上,建议使用php5.4及以上',
'step_env_check_desc' => '环境以及文件目录权限检查',
'advice_mysql_connect' => '请检查 mysql 模块是否正确加载',

9
dzz/shares/ajax.php

@ -341,9 +341,12 @@ if ($do == 'uploads') {//上传新文件(指新建)
}
$rids[] = $v;
}
$path = C::t('resources_path')->fetch_pathby_pfid($share['pfid'], true);
if ($path['path']) {
$first_path = $path['path'];
$first_path = '';
if (!$_G['adminid'] && $share['uid'] !== $_G['uid']) {
$path = C::t('resources_path')->fetch_pathby_pfid($share['pfid'], true);
if ($path['path']) {
$first_path = $path['path'];
}
}
$propertys = C::t('resources')->get_property_by_rid($rids, true, $first_path);
}

43
user/profile/template/profile.htm

@ -138,22 +138,33 @@
<!--{/if}-->
<!--{/loop}-->
<!--{if in_array('timeoffset', $allowitems)}-->
<div class="row mb-3">
<label class="col-sm-2" for="timeoffset">{lang time_zone}</label>
<div class="col-md-4">
<!--{eval $timeoffset = array({lang timezone});}-->
<select name="timeoffset" class="form-select" id="timeoffset">
<!--{loop $timeoffset $key $desc}-->
<option value="$key" {if $key==$space[timeoffset]} selected="selected" {/if}>$desc</option>
<!--{/loop}-->
</select>
<p class="mt10">{lang current_time} :
<!--{date($_G['timestamp'])}-->
</p>
<p class="gray form-text">{lang time_zone_state}</p>
</div>
</div>
<!--{/if}-->
<div class="row mb-3">
<label class="col-sm-2" for="timeoffset">{lang time_zone}</label>
<div class="col-md-4">
<!--{eval $timeoffset = array({lang timezone});}-->
<select name="timeoffset" class="form-select" id="timeoffset">
<!--{loop $timeoffset $key $desc}-->
<option value="$key" {if $key==$space[timeoffset]} selected="selected" {/if}>$desc</option>
<!--{/loop}-->
</select>
<p class="mt10">{lang current_time} :
<!--{date($_G['timestamp'])}-->
</p>
<span class="gray form-text">{lang time_zone_state}</span>
</div>
</div>
<!--{/if}-->
<div class="row mb-3">
<label class="col-sm-2" for="language">{lang language}</label>
<div class="col-md-4">
<select name="language" class="form-select" id="language">
<option value="" <!--{if $space[language] == ''}-->selected="selected"<!--{/if}-->>{lang language_auto}</option>
<!--{loop $langList $key $value}-->
<option value="$key" <!--{if $space[language] == $key}-->selected="selected"<!--{/if}--> /> $value</option>
<!--{/loop}-->
</select>
</div>
</div>
<!--{if !$vid || $showbtn}-->
<dl class="mb-3 d-grid">
<input type="submit" class="btn btn-primary btn-round bodyloading" <!--{if $vid}-->value="{lang submit_audit}"<!--{else}-->value="{lang save}"<!--{/if}-->>

Loading…
Cancel
Save