实现成员可用(只显示该成员的分享)
2024-07-17 23:50 更新
为了获取更多最新内容及功能更新,请直接访问我们的首页以查看DzzOffice笔记的最新地址。
最重要的一步:
将admin\share文件夹移入\dzz\目录下
第二步:
打开\dzz\share\index.php文件,以下步骤均在此文件中操作!
- 将if (!defined('IN_DZZ') || !defined('IN_ADMIN')) {修改为if (!defined('IN_DZZ')) {
- uid = intval(_GET['uid']);后面添加$uid1=$_G['uid'];
if ($count = DB::result_first("SELECT COUNT(*) FROM %t WHERE $sql", $param)) {
$list = DB::fetch_all("SELECT * FROM %t WHERE $sql $orderby limit $start,$perpage", $param);
foreach ($list as $k=> $value) {
$value['sharelink'] = C::t('shorturl')->getShortUrl(getglobal('siteurl').'index.php?mod=shares&sid='.dzzencode($value['id']));
if ($value['dateline'])
$value['fdateline'] = dgmdate($value['dateline']);
if ($value['password'])
$value['password'] = dzzdecode($value['password']);
if ($value['endtime'])
$value['fendtime'] = dgmdate($value['endtime'], 'Y-m-d');
$value['fsize'] = formatsize($value['size']);
$value['ftype'] = getFileTypeName($value['type'], $value['ext']);
if ($value['type'] == 'folder')
$value['img'] = 'dzz/images/extimg/folder.png';
if ($value['img'])
$value['img'] = str_replace('dzz/images/extimg/', 'dzz/images/extimg_small/', $value['img']);
if ($value['type'] == 'image' && $value['status'] == -3)
$value['img'] = '';
$value['fstatus'] = $sharestatus[$value['status']];
if (is_file($_G['setting']['attachdir'] . './qrcode/' . $value['sid'][0] . '/' . $value['sid'] . '.png'))
$value['qrcode'] = $_G['setting']['attachurl'] . './qrcode/' . $value['sid'][0] . '/' . $value['sid'] . '.png';
$value['shareurl'] = $_G['siteurl'] . 's.php?sid=' . $value['sid'];
$list[$k] = $value;
}
$multi = multi($count, $perpage, $page, $theurl, 'pull-right');
}
将上面的代码替换为下面的代码
if ($_G['adminid']) {
if ($count = DB::result_first("SELECT COUNT(*) FROM %t WHERE $sql", $param)) {
$list = DB::fetch_all("SELECT * FROM %t WHERE $sql $orderby limit $start,$perpage", $param);
}
}else{
if ($count = DB::result_first("SELECT COUNT(*) FROM %t WHERE uid =$uid1 and $sql", $param)) {
$list = DB::fetch_all("SELECT * FROM %t WHERE uid =$uid1 and $sql $orderby limit $start,$perpage", $param);
}
}
foreach ($list as $k=> $value) {
$value['sharelink'] = C::t('shorturl')->getShortUrl(getglobal('siteurl').'index.php?mod=shares&sid='.dzzencode($value['id']));
if ($value['dateline'])
$value['fdateline'] = dgmdate($value['dateline']);
if ($value['password'])
$value['password'] = dzzdecode($value['password']);
if ($value['endtime'])
$value['fendtime'] = dgmdate($value['endtime'], 'Y-m-d');
$value['ftype'] = getFileTypeName($value['type'], $value['ext']);
if ($value['type'] == 'folder')
$value['img'] = 'dzz/images/extimg/folder.png';
if ($value['img'])
$value['img'] = str_replace('dzz/images/extimg/', 'dzz/images/extimg_small/', $value['img']);
if ($value['type'] == 'image' && $value['status'] == -3)
$value['img'] = '';
$value['fstatus'] = $sharestatus[$value['status']];
if (is_file($_G['setting']['attachdir'] . './qrcode/' . $value['sid'][0] . '/' . $value['sid'] . '.png'))
$value['qrcode'] = $_G['setting']['attachurl'] . './qrcode/' . $value['sid'][0] . '/' . $value['sid'] . '.png';
$value['shareurl'] = $_G['siteurl'] . 's.php?sid=' . $value['sid'];
$list[$k] = $value;
}
$multi = multi($count, $perpage, $page, $theurl, 'pull-right');
第三步:
打开\dzz\share\template\share.htm文件:
- 将文件中出现的所有{ADMINSCRIPT}修改为{DZZSCRIPT}
- 在{lang del_share}</span> </button>后面添加<!--{if $_G[adminid]==1}-->,
- 在{lang cancel_shielding}</span> </button>后面添加<!--{/if}-->
第四步:
后台应用市场中编辑文件管理,修改以下参数:
应用路径:dzz
应用地址:{dzzscript}?mod=share
组权限:成员可用
在权限管理管理中将文件管理的默认位置设置为开始菜单
第五步:
打开\admin\language\zh-cn\lang.php文件,将下面的代码都移至\dzz\share\language\zh-cn\lang.php文件中:
'sharing_file'=>'分享文件',
'share_time'=>'分享时间',
'share_user'=>'分享用户',
'private_share'=>'私密分享',
'share_title'=>'分享标题',
'stop_sharing'=>'取消分享',
'stop_sharing_success'=>'取消分享成功',
'affirm_stop_sharing'=>'确定取消分享',
'del_share'=>'删除分享',
'screen_share'=>'屏蔽分享',
'affirm_screen_share'=>'确定屏蔽分享',
'share_screen'=>'分享屏蔽',
'share_screen_success'=>'分享屏蔽成功',
'share_screen_failure'=>'分享屏蔽失败',
'shielding_failure'=>'屏蔽失败',
'cancel_shielding'=>'取消屏蔽',
'cancel_shielding_success'=>'取消屏蔽成功',
'cancel_shielding_failure'=>'取消屏蔽失败',
'affirm_cancel_shielding'=>'确定取消屏蔽',
'scon_code_send_mobile'=>'扫描二维码,发送到手机',
'expiration_time'=>'到期时间',
'limited_number'=>'限制次数',
'extract_password'=>'提取密码',
'been_blocked'=>'已屏蔽',
'file_been_deleted'=>'文件已删除',
'degree_exhaust'=>'次数用尽',
// admin/share/share.html
'share_file_content'=>'好东西要晒出来,快把你的文件分享给身边的朋友们吧。',
'share_stop_sharing1'=>'<p class="text-center">取消分享后,该条分享记录将被删除,将无法再访问此分享链接。</p><p class="text-center">你确认要取消分享吗?</p>',
'share_stop_sharing2'=>'<p class="text-center">该条分享记录将被屏蔽,将无法再访问此分享链接。</p><p class="text-center">你确认要屏蔽该条分享吗?</p>',
'share_stop_sharing3'=>'<p class="text-center">该条分享记录将被恢复访问。</p><p class="text-center">你确认要取消屏蔽该条分享吗?</p>',
'attachment' => '附件',
'other' => '其他',
第六步:
打开\dzz\share\ajax.php文件
elseif ($_GET['do'] == 'forbidden' ) {
$sids = $_GET['sids'];
if ($_GET['flag'] == 'forbidden') {
$status = -4;
} else {
$status = 0;
}
if ($sids && C::t('shares') -> update($sids, array('status' => $status))) {
exit(json_encode(array('msg' => 'success')));
} else {
exit(json_encode(array('error' => lang('share_screen_failure'))));
}
}
//将上面的代码替换为下面的代码
elseif ($_GET['do'] == 'forbidden' && $_G['adminid']) {
$sids = $_GET['sids'];
if ($_GET['flag'] == 'forbidden') {
$status = -4;
} else {
$status = 0;
}
if ($sids && C::t('shares') -> update($sids, array('status' => $status))) {
exit(json_encode(array('msg' => 'success')));
} else {
exit(json_encode(array('error' => lang('share_screen_failure'))));
}
}else{
exit(json_encode(array('error' => '非法操作')));
}
第七步:
后台系统工具中清理缓存即可
以上内容是否对您有帮助:
更多建议: