From 0a2903e20d7aa0e2280bbb054870efa2f840138e Mon Sep 17 00:00:00 2001 From: xiaosong Date: Tue, 2 Apr 2013 01:03:29 +0800 Subject: [PATCH] 4.2.3 --- README.md | 10 +- reader_wall.php | 216 +++++++++++++++++++-------------------- reader_wall_callback.php | 54 +++++----- reader_wall_config.php | 22 ++-- reader_wall_setting.php | 158 ++++++++++++++-------------- 5 files changed, 230 insertions(+), 230 deletions(-) diff --git a/README.md b/README.md index 6c810cd..fa5ef0f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -emlog 读者墙插件 -==================== - -貌似没什么好介绍的了,最初模仿的是wordpress的读者墙(其实就是模仿wordpress的),根据emlog的特殊性移植过来。有周读者墙,月读者墙,总读者墙,取决于你怎么调用。 - +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 index bfb1153..bf6e483 100644 --- a/reader_wall.php +++ b/reader_wall.php @@ -1,109 +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'); +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 index d6e3c49..4321a37 100644 --- a/reader_wall_callback.php +++ b/reader_wall_callback.php @@ -1,28 +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'); - } - } -} +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 index a11fcb9..f2bd744 100644 --- a/reader_wall_config.php +++ b/reader_wall_config.php @@ -1,12 +1,12 @@ - \ No newline at end of file diff --git a/reader_wall_setting.php b/reader_wall_setting.php index 3d6d1d3..58f8bfe 100644 --- a/reader_wall_setting.php +++ b/reader_wall_setting.php @@ -1,80 +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); -} + + +
读者墙设置 +插件设置完成 +
+
+
+
+

①、一周评论排行显示头像数: + +   头像大小(单位为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