xiunobbs 修罗论坛 本站已运行了多少天”代码(php版),增加附件下载位置详细信息

下载地址已下载 0 次

服务协议

文章介绍
发表评论
更新日志
历史版本

xiunobbs 修罗论坛 本站已运行了多少天”代码(php版),增加附件下载位置详细信息

<?php
$sitestart = strtotime(“2010-4-15″);       //获取特定时间戳
$sitenow = time();                                          //获取服务器当前时间戳
$sitetime = $sitenow – $sitestart;           //时间戳相减
$sitedays = (int)($sitetime/86400);     //转换为天数
echo ‘本站已安全运行 ‘.$sitedays.’ 天’;     //输出显示
?>

要实现附件信息功能,要增加下面三个hook文件。

1. attach_output_before.php

2. model_attach_start.php

// downloads + 1
function attach_downloads($aid, $n = 1) {
    global $conf;
    $sqladd = strpos($conf['db']['type'], 'mysql') === FALSE ? '' : ' LOW_PRIORITY';
    $r = db_exec("UPDATE$sqladd `bbs_attach` SET downloads=downloads+$n WHERE aid='$aid'");
    return $r;
}

3. model_post_file_list_html_delete_before.php

$s .= '<br><div style="color:#999;"> 上传时间:'.date('Y-m-d', $attach['create_date'])."\r\n";
$s .= ' | 下载次数:'.intval($attach['downloads'])."\r\n";
$s .= '次 | 文件大小:'.humansize($attach['filesize'])."\r\n";
$s .= '</div>'."\r\n";

 

THE END
© 版权声明
点赞15 分享
暂无内容
暂无更新日志
暂无内容
暂无历史版本

xiunobbs 修罗论坛 本站已运行了多少天”代码(php版),增加附件下载位置详细信息

xiunobbs 修罗论坛 本站已运行了多少天”代码(php版),增加附件下载位置详细信息

<?php
$sitestart = strtotime(“2010-4-15″);       //获取特定时间戳
$sitenow = time();                                          //获取服务器当前时间戳
$sitetime = $sitenow – $sitestart;           //时间戳相减
$sitedays = (int)($sitetime/86400);     //转换为天数
echo ‘本站已安全运行 ‘.$sitedays.’ 天’;     //输出显示
?>

要实现附件信息功能,要增加下面三个hook文件。

1. attach_output_before.php

2. model_attach_start.php

// downloads + 1
function attach_downloads($aid, $n = 1) {
    global $conf;
    $sqladd = strpos($conf['db']['type'], 'mysql') === FALSE ? '' : ' LOW_PRIORITY';
    $r = db_exec("UPDATE$sqladd `bbs_attach` SET downloads=downloads+$n WHERE aid='$aid'");
    return $r;
}

3. model_post_file_list_html_delete_before.php

$s .= '<br><div style="color:#999;"> 上传时间:'.date('Y-m-d', $attach['create_date'])."\r\n";
$s .= ' | 下载次数:'.intval($attach['downloads'])."\r\n";
$s .= '次 | 文件大小:'.humansize($attach['filesize'])."\r\n";
$s .= '</div>'."\r\n";

 

© 版权声明
THE END
点赞15 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容