From 5b5e2c4d66590c9e1e304e0c7e68604545a942fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=9D=BE?= Date: Tue, 16 Oct 2012 17:14:52 +0800 Subject: [PATCH] =?UTF-8?q?4.2.3=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitattributes | 22 ++++++ .gitignore | 163 +++++++++++++++++++++++++++++++++++++++ README.md | 6 ++ reader_wall.php | 109 ++++++++++++++++++++++++++ reader_wall_callback.php | 28 +++++++ reader_wall_config.php | 12 +++ reader_wall_setting.php | 80 +++++++++++++++++++ readme.txt | 5 ++ 8 files changed, 425 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 README.md create mode 100644 reader_wall.php create mode 100644 reader_wall_callback.php create mode 100644 reader_wall_config.php create mode 100644 reader_wall_setting.php create mode 100644 readme.txt diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..412eeda --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5ebd21a --- /dev/null +++ b/.gitignore @@ -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 diff --git a/README.md b/README.md new file mode 100644 index 0000000..6c810cd --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +emlog 读者墙插件 +==================== + +貌似没什么好介绍的了,最初模仿的是wordpress的读者墙(其实就是模仿wordpress的),根据emlog的特殊性移植过来。有周读者墙,月读者墙,总读者墙,取决于你怎么调用。 + +[插件主页](http://xiaosong.org/share/emlog-readers-wall-plug-reloaded) \ No newline at end of file diff --git a/reader_wall.php b/reader_wall.php new file mode 100644 index 0000000..bfb1153 --- /dev/null +++ b/reader_wall.php @@ -0,0 +1,109 @@ +readCache('user'); + $content = ob_get_clean(); + if (Option::get('isgzipenable') == 'y' && function_exists('ob_gzhandler')){ + ob_start('ob_gzhandler'); + } else { + ob_start(); + } + $content = explode(" -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 = ""; + if($row['url']){ + $tmp = "".$img.""; + }else{$tmp = $img;} + $output .= $tmp; + } + if(empty($output)){ + $output = "

".$tip."

"; + }else{ + $output = "
".$output."
";} + 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].'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 = ""; + if($row_side['url']){ + $tmp_side = "".$img_side.""; + }else{ + $tmp_side = $img_side; + } + $output_side .= $tmp_side; + } + if(empty($output_side)){ + $output_side = "

".$tip."

"; + }else{ + $output_side = "
".$output_side."
"; + } + return $output_side; +} +if(isset($_GET['reader_wall_widgets'])){ + echo 'document.write("'.reader_wall_side().'")'; + exit; +} +function reader_wall_menu(){ + echo ''; +} +addAction('adm_sidebar_ext', 'reader_wall_menu'); +?> \ No newline at end of file diff --git a/reader_wall_callback.php b/reader_wall_callback.php new file mode 100644 index 0000000..d6e3c49 --- /dev/null +++ b/reader_wall_callback.php @@ -0,0 +1,28 @@ +readCache('options'); + //写入widgest + $custom_widget = $options_cache['custom_widget'] ? @unserialize($options_cache['custom_widget']) : array(); + $reader_wall_widgets_content = ''; + 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'); + } + } +} +?> \ No newline at end of file diff --git a/reader_wall_config.php b/reader_wall_config.php new file mode 100644 index 0000000..a11fcb9 --- /dev/null +++ b/reader_wall_config.php @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/reader_wall_setting.php b/reader_wall_setting.php new file mode 100644 index 0000000..3d6d1d3 --- /dev/null +++ b/reader_wall_setting.php @@ -0,0 +1,80 @@ + + +
读者墙设置 +插件设置完成 +
+
+
+
+

①、一周评论排行显示头像数: + +   头像大小(单位为px): + +

+

②、一月评论排行显示头像数: + +   头像大小(单位为px): + +

+

③、开博至今评论排行显示头像数: + +   头像大小(单位为px): + +

+

④、侧边栏评论排行显示头像数: + +   头像大小(单位为px): + +   统计区间: + +

+

⑤、如果统计区间内数据为空,则显示如下: + +

+

+
+
+"; + $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); +} +?> \ No newline at end of file diff --git a/readme.txt b/readme.txt new file mode 100644 index 0000000..69be0fc --- /dev/null +++ b/readme.txt @@ -0,0 +1,5 @@ +1.4.1.0֮ǰڸǰòȻٸļò + +2.Ѿδ֮ǰļôģĿ¼page.phpecho_log.phpҵdoAction('xiaosong', $log_content)滻Ϊecho $log_contentע⣬ļҪ޸ģ²ȷʾ + +3.http://xiaosong.org/guestbookԡ \ No newline at end of file