This commit is contained in:
2012-10-16 17:14:52 +08:00
commit 5b5e2c4d66
8 changed files with 425 additions and 0 deletions

22
.gitattributes vendored Normal file
View File

@@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain

163
.gitignore vendored Normal file
View File

@@ -0,0 +1,163 @@
#################
## Eclipse
#################
*.pydevproject
.project
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# PDT-specific
.buildpath
#################
## Visual Studio
#################
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.vspscc
.builds
*.dotCover
## TODO: If you have NuGet Package Restore enabled, uncomment this
#packages/
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
# Visual Studio profiler
*.psess
*.vsp
# ReSharper is a .NET coding add-in
_ReSharper*
# Installshield output folder
[Ee]xpress
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish
# Others
[Bb]in
[Oo]bj
sql
TestResults
*.Cache
ClientBin
stylecop.*
~$*
*.dbmdl
Generated_Code #added for RIA/Silverlight projects
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
############
## Windows
############
# Windows image file caches
Thumbs.db
# Folder config file
Desktop.ini
#############
## Python
#############
*.py[co]
# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
#Translations
*.mo
#Mr Developer
.mr.developer.cfg
# Mac crap
.DS_Store

6
README.md Normal file
View File

@@ -0,0 +1,6 @@
emlog 读者墙插件
====================
貌似没什么好介绍的了最初模仿的是wordpress的读者墙其实就是模仿wordpress的根据emlog的特殊性移植过来。有周读者墙月读者墙总读者墙取决于你怎么调用。
[插件主页](http://xiaosong.org/share/emlog-readers-wall-plug-reloaded)

109
reader_wall.php Normal file
View File

@@ -0,0 +1,109 @@
<?php
/*
Plugin Name: 读者墙
Version: 4.2.3
Plugin URL: http://xiaosong.org/share/emlog-readers-wall-plug-reloaded
Description: 页面或文章正文,侧边栏显示读者墙
ForEmlog: 4.1.0以上
Author: 小松
Author Email: sahala_2007@126.com
Author URL: http://xiaosong.org
*/
!defined('EMLOG_ROOT') && exit('access deined!');
require_once('reader_wall_config.php');
function reader_wall(){
global $imgnum_week,$imgnum_month,$imgnum_all,$imgsize_week,$imgsize_month,$imgsize_all,$tip;
$CACHE = Cache::getInstance();
$user_cache = $CACHE->readCache('user');
$content = ob_get_clean();
if (Option::get('isgzipenable') == 'y' && function_exists('ob_gzhandler')){
ob_start('ob_gzhandler');
} else {
ob_start();
}
$content = explode("<body",$content);
$log_content = $content[1];
if(strpos($log_content, '[READERWALL-WEEK]') > -1) {
$cur_time_span = strtotime('last Monday',strtotime('Sunday'));
$option = 0;
$imgnums = $imgnum_week;
$imgsize = $imgsize_week;
}
elseif(strpos($log_content, '[READERWALL-MONTH]') > -1){
$cur_time_span = strtotime('this month',strtotime(date('m/01/y')));
$option = 1;
$imgnums = $imgnum_month;
$imgsize = $imgsize_month;
}
else{$cur_time_span = 0;$option = 2;$imgnums = $imgnum_all;$imgsize = $imgsize_all;}
if(empty($imgsize)){$imgsize = 32;}
$DB = MySql::getInstance();
$userName = $user_cache[1]['name'];
$userMail = $user_cache[1]['mail'];
$sql = "SELECT count(1) AS comment_nums,poster,mail,url FROM ".DB_PREFIX."comment where date > $cur_time_span and mail != '' and mail != '$userMail' and poster != '$userName' and hide = 'n' group by mail order by comment_nums DESC limit 0,$imgnums";
$result = $DB->query($sql);
while($row = $DB->fetch_array($result)){
$img = "<img width='".$imgsize."' height='".$imgsize."' title='".$row['poster']." (".$row['comment_nums'].")' alt='' src='".getGravatar($row['mail'],$imgsize)."' />";
if($row['url']){
$tmp = "<a href='".$row['url']."' target='_blank'>".$img."</a>";
}else{$tmp = $img;}
$output .= $tmp;
}
if(empty($output)){
$output = "<p style='text-align:center'>".$tip."</p>";
}else{
$output = "<div id='readerswall'>".$output."</div>";}
if($option == 0)
$log_content = preg_replace("'\[READERWALL-WEEK\]'i", $output, $log_content, 1);
elseif($option == 1)
$log_content = preg_replace("'\[READERWALL-MONTH\]'i", $output, $log_content, 1);
else
$log_content = preg_replace("'\[READERWALL\]'i", $output, $log_content, 1);
echo $content[0].'<body'.$log_content;
unset($content);
unset($log_content);
}
addAction('index_footer', 'reader_wall');
function reader_wall_side(){
global $imgsize_side,$imgnum_side,$type_wall,$tip,$open;
$CACHE = Cache::getInstance();
$user_cache = $CACHE->readCache('user');
if($type_wall == 'week'){
$time_side = strtotime('last Monday',strtotime('Sunday'));
}elseif($type_wall == 'month'){
$time_side = strtotime('this month',strtotime(date('m/01/y')));
}else{
$time_side = 0;
}
if(empty($imgsize_side)){
$imgsize_side = 32;
}
$DB = MySql::getInstance();
$userName = $user_cache[1]['name'];
$sql_side = "SELECT count(1) AS comment_nums,poster,mail,url FROM ".DB_PREFIX."comment where date > $time_side and mail != '' and poster != '$userName' and hide ='n' group by mail order by comment_nums DESC limit 0,$imgnum_side";
$result_side = $DB->query($sql_side);
while($row_side = $DB->fetch_array($result_side)){
$img_side = "<img width='".$imgsize_side."' height='".$imgsize_side."' title='".$row_side['poster']." (".$row_side['comment_nums'].")' alt='' src='".getGravatar($row_side['mail'],$imgsize_side)."' />";
if($row_side['url']){
$tmp_side = "<a href='".$row_side['url']."' target='_blank'>".$img_side."</a>";
}else{
$tmp_side = $img_side;
}
$output_side .= $tmp_side;
}
if(empty($output_side)){
$output_side = "<p style='text-align:center'>".$tip."</p>";
}else{
$output_side = "<div id='readerswall_side'>".$output_side."</div>";
}
return $output_side;
}
if(isset($_GET['reader_wall_widgets'])){
echo 'document.write("'.reader_wall_side().'")';
exit;
}
function reader_wall_menu(){
echo '<div class="sidebarsubmenu" id="reader_wall"><a href="./plugin.php?plugin=reader_wall">读者墙设置</a></div>';
}
addAction('adm_sidebar_ext', 'reader_wall_menu');
?>

28
reader_wall_callback.php Normal file
View File

@@ -0,0 +1,28 @@
<?php
if(!defined('EMLOG_ROOT')) {exit('error!');}
function callback_init(){
$CACHE = Cache::getInstance();
$DB = MySql::getInstance();
$options_cache = $CACHE->readCache('options');
//写入widgest
$custom_widget = $options_cache['custom_widget'] ? @unserialize($options_cache['custom_widget']) : array();
$reader_wall_widgets_content = '<script type="text/javascript" src="'.BLOG_URL.'index.php?reader_wall_widgets"></script>';
if(is_array($custom_widget))
{
if(!in_array('custom_wg_reader_wall',array_keys($custom_widget)))
{
//添加
$custom_wg_index = 'custom_wg_reader_wall';
$custom_widget[$custom_wg_index] = array('title'=>"读者墙",'content'=>$reader_wall_widgets_content);
$custom_widget_str = addslashes(serialize($custom_widget));
$DB->query("update ".DB_PREFIX."options set option_value='$custom_widget_str' where option_name='custom_widget'");
//启用
$widgets = !empty($options_cache['widgets1']) ? unserialize($options_cache['widgets1']) : array();
$widgets[] = "custom_wg_reader_wall";
$widgets = serialize($widgets);
$DB->query("update ".DB_PREFIX."options set option_value='$widgets' where option_name='widgets1'");
$CACHE->updateCache('options');
}
}
}
?>

12
reader_wall_config.php Normal file
View File

@@ -0,0 +1,12 @@
<?php
$imgnum_week = 20;
$imgsize_week = 32;
$imgnum_month = 30;
$imgsize_month = 32;
$imgnum_all = 40;
$imgsize_all = 32;
$imgnum_side = 8;
$imgsize_side = 32;
$type_wall = 'all';
$tip = '墙上还没人,快抢沙发啦~';
?>

80
reader_wall_setting.php Normal file
View File

@@ -0,0 +1,80 @@
<?php
/*
* 读者墙插件
* design by 小松
*/
function plugin_setting_view(){
require_once('reader_wall_config.php');
}
?>
<script type="text/javascript">
$("#reader_wall").addClass('sidebarsubmenu1');
</script>
<div class="containertitle"><b>读者墙设置</b>
<?php if(isset($_GET['setting'])):?><span class="actived">插件设置完成</span><?php endif;?>
</div>
<div class="line"></div>
<form action="plugin.php?plugin=reader_wall&action=setting" method="post">
<div>
<p>①、一周评论排行显示头像数:
<input size="3" name="imgnum_week" type="text" value="<?php echo $imgnum_week; ?>" />
&nbsp;&nbsp;头像大小单位为px
<input size="3" name="imgsize_week" type="text" value="<?php echo $imgsize_week; ?>" />
</p>
<p>②、一月评论排行显示头像数:
<input size="3" name="imgnum_month" type="text" value="<?php echo $imgnum_month; ?>" />
&nbsp;&nbsp;头像大小单位为px
<input size="3" name="imgsize_month" type="text" value="<?php echo $imgsize_month; ?>" />
</p>
<p>③、开博至今评论排行显示头像数:
<input size="3" name="imgnum_all" type="text" value="<?php echo $imgnum_all; ?>" />
&nbsp;&nbsp;头像大小单位为px
<input size="3" name="imgsize_all" type="text" value="<?php echo $imgsize_all; ?>" />
</p>
<p>④、侧边栏评论排行显示头像数:
<input size="3" name="imgnum_side" type="text" value="<?php echo $imgnum_side; ?>" />
&nbsp;&nbsp;头像大小单位为px
<input size="3" name="imgsize_side" type="text" value="<?php echo $imgsize_side; ?>" />
&nbsp;&nbsp;统计区间:
<select name="type_wall">
<option value="week"<?php if($type_wall == 'week'):?> selected<?php endif;?>>week</option>
<option value="month"<?php if($type_wall == 'month'):?> selected<?php endif;?>>month</option>
<option value="all"<?php if($type_wall == 'all'):?> selected<?php endif;?>>all</option>
</select>
</p>
<p>⑤、如果统计区间内数据为空,则显示如下:
<input size="50" name="tip" type="text" value="<?php echo $tip; ?>" />
</p>
<p><input type="submit" value="保 存" class="submit" /></p>
</div>
</form>
<?php
function plugin_setting(){
$imgnum_week = isset($_POST['imgnum_week']) ? intval($_POST['imgnum_week']) : 20;
$imgsize_week = isset($_POST['imgsize_week']) ? intval($_POST['imgsize_week']) : 32;
$imgnum_month = isset($_POST['imgnum_month']) ? intval($_POST['imgnum_month']) : 30;
$imgsize_month = isset($_POST['imgsize_month']) ? intval($_POST['imgsize_month']) : 32;
$imgnum_all = isset($_POST['imgnum_all']) ? intval($_POST['imgnum_all']) : 40;
$imgsize_all = isset($_POST['imgsize_all']) ? intval($_POST['imgsize_all']) : 32;
$imgnum_side = isset($_POST['imgnum_side']) ? intval($_POST['imgnum_side']) : 8;
$imgsize_side = isset($_POST['imgsize_side']) ? intval($_POST['imgsize_side']) : 32;
$type_wall = isset($_POST['type_wall']) ? addslashes(trim($_POST['type_wall'])) : '';
$tip = isset($_POST['tip']) ? addslashes(trim($_POST['tip'])) : '';
$data = "<?php
\$imgnum_week = ".$imgnum_week.";
\$imgsize_week = ".$imgsize_week.";
\$imgnum_month = ".$imgnum_month.";
\$imgsize_month = ".$imgsize_month.";
\$imgnum_all = ".$imgnum_all.";
\$imgsize_all = ".$imgsize_all.";
\$imgnum_side = ".$imgnum_side.";
\$imgsize_side = ".$imgsize_side.";
\$type_wall = '".$type_wall."';
\$tip = '".$tip."';
?>";
$file = EMLOG_ROOT.'/content/plugins/reader_wall/reader_wall_config.php';
@ $fp = fopen($file, 'wb') OR emMsg('读取文件失败如果您使用的是Unix/Linux主机请修改文件/content/plugins/reader_wall/reader_wall_config.php的权限为777。如果您使用的是Windows主机请联系管理员将该文件设为everyone可写');
@ $fw = fwrite($fp,$data) OR emMsg('写入文件失败如果您使用的是Unix/Linux主机请修改文件/content/plugins/reader_wall/reader_wall_config.php的权限为777。如果您使用的是Windows主机请联系管理员将该文件设为everyone可写');
fclose($fp);
}
?>

5
readme.txt Normal file
View File

@@ -0,0 +1,5 @@
1.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4.1.0<EFBFBD><EFBFBD>֮ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><EFBFBD><EFBFBD>ٸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2.<2E><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>֮ǰ<D6AE><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>Ŀ¼<C4BF><C2BC>page.php<68><70>echo_log.php<68><70><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>doAction('xiaosong', $log_content)<29><><EFBFBD><EFBFBD><EFBFBD>滻Ϊ<E6BBBB><CEAA>echo $log_content<6E><74><EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD><E2A3AC><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>Ҫ<EFBFBD>޸ģ<DEB8><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>²<EFBFBD><C2B2><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>ʾ<EFBFBD><CABE>
3.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>http://xiaosong.org/guestbook<6F><6B><EFBFBD>ԡ<EFBFBD>