免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5990 | 回复: 4

[Web] [原创]发布一个webalizer中文UTF-8汉化及图片修正完全补丁 [复制链接]

论坛徽章:
0
发表于 2006-12-21 12:41 |显示全部楼层
使用
patch -p1 -i webalizer-2.01-10.zh_CN_utf8.patch




  1. diff -Nur webalizer-2.01-10/graphs.c webalizer-2.01-10.zh_CN_utf8/graphs.c
  2. --- webalizer-2.01-10/graphs.c        2001-06-15 16:34:24.000000000 +0800
  3. +++ webalizer-2.01-10.zh_CN_utf8/graphs.c        2006-11-22 16:00:31.000000000 +0800
  4. @@ -750,3 +750,14 @@

  5.     return;
  6. }
  7. +
  8. +/*
  9. + * @follow functions is added by redor at Wed Nov 22 14:07:46 CST 2006
  10. + */
  11. +   void gdImageString(gdImagePtr im, gdFontPtr font, int x, int y, unsigned char *s, int color){
  12. +        gdImageStringFT(im, 0 , color, font_path, 9 , 0.0, x, y+9, s); //font size is 9
  13. +   }
  14. +
  15. +   void gdImageStringUp(gdImagePtr im, gdFontPtr font, int x, int y, unsigned char *s, int color){
  16. +        gdImageStringFT(im, 0 , color, font_path, 9 , -PI/2, x, y-9 , s);
  17. +   }
  18. +
  19. diff -Nur webalizer-2.01-10/sample.conf webalizer-2.01-10.zh_CN_utf8/sample.conf
  20. --- webalizer-2.01-10/sample.conf        2000-09-29 11:51:42.000000000 +0800
  21. +++ webalizer-2.01-10.zh_CN_utf8/sample.conf        2006-11-22 16:00:31.000000000 +0800
  22. @@ -153,6 +153,7 @@
  23. # is 80 characters, so use multiple lines if needed.

  24. #HTMLHead <META NAME="author" CONTENT="The Webalizer">
  25. +HTMLHead <meta http-equiv="content-type" content="text/html; charset=UTF-8">

  26. # HTMLBody defined the HTML code to be inserted, starting with the
  27. # <BODY> tag.  If not specified, the default is shown below.  If
  28. @@ -569,3 +570,5 @@
  29. #DumpSearchStr  no

  30. # End of configuration file...  Have a nice day!
  31. +
  32. +FontPath /usr/share/fonts/chinese/TrueType/ukai.ttf
  33. diff -Nur webalizer-2.01-10/webalizer.c webalizer-2.01-10.zh_CN_utf8/webalizer.c
  34. --- webalizer-2.01-10/webalizer.c        2002-04-17 06:11:31.000000000 +0800
  35. +++ webalizer-2.01-10.zh_CN_utf8/webalizer.c        2006-11-22 16:00:31.000000000 +0800
  36. @@ -166,6 +166,8 @@
  37. int     dump_search  = 0;                     /* Search strings           */
  38. int     dump_header  = 0;                     /* Dump header as first rec */
  39. char    *dump_path   = NULL;                  /* Path for dump files      */
  40. +char        *font_path   = "/usr/share/fonts/chinese/TrueType/ukai.ttf";
  41. +                                                /*default font path */

  42. int     cur_year=0, cur_month=0,              /* year/month/day/hour      */
  43.          cur_day=0, cur_hour=0,                /* tracking variables       */
  44. @@ -1449,7 +1451,8 @@
  45.                       "DNSCache",          /* DNS Cache file name        84  */
  46.                       "DNSChildren",       /* DNS Children (0=no DNS)    85  */
  47.                       "DailyGraph",        /* Daily Graph (0=no)         86  */
  48. -                     "DailyStats"         /* Daily Stats (0=no)         87  */
  49. +                     "DailyStats",         /* Daily Stats (0=no)        87  */
  50. +                     "FontPath"            /* Font Path                        88  */
  51.                     };

  52.     FILE *fp;
  53. @@ -1593,6 +1596,7 @@
  54. #endif  /* USE_DNS */
  55.          case 86: daily_graph=(value[0]=='n')?0:1; break;  /* HourlyGraph    */
  56.          case 87: daily_stats=(value[0]=='n')?0:1; break;  /* HourlyStats    */
  57. +        case 88: font_path=save_opt(value); break;  /* Font Path    */
  58.        }
  59.     }
  60.     fclose(fp);
  61. diff -Nur webalizer-2.01-10/webalizer.h webalizer-2.01-10.zh_CN_utf8/webalizer.h
  62. --- webalizer-2.01-10/webalizer.h        2001-02-10 08:58:18.000000000 +0800
  63. +++ webalizer-2.01-10.zh_CN_utf8/webalizer.h        2006-11-22 16:00:31.000000000 +0800
  64. @@ -219,6 +219,8 @@
  65. extern int     dump_header  ;                 /* Dump header as first rec */
  66. extern char    *dump_path   ;                 /* Path for dump files      */

  67. +extern char    *font_path   ;                      /* Chinese font  for gragh  */
  68. +
  69. extern u_long  cur_tstamp;                    /* Current timestamp        */
  70. extern u_long  epoch;                         /* used for timestamp adj.  */
  71. extern int     check_dup;                     /* check for dups flag      */
复制代码

webalizer-2.01-10.zh_CN_utf8.patch.zip

9.11 KB, 下载次数: 188

webalizer-2.01-10.zh_CN_utf8.patch

论坛徽章:
0
发表于 2007-06-25 14:56 |显示全部楼层
我怎么发现图形上没有文字呢,也没有年份?是我服务器的问题吗?大家装的都正常吗?另外不知怎么样安装才有“[引用][搜索][代理]”这几个,我的只有[每日统计] [每小时统计] [URLs] [进入] [退出] [IP] [用户] [区域] ,应该怎么样配置呢?英文版本和UTF8版本的都没有“[引用][搜索][代理]”。但英文的图片上什么都有,看上去挺正常的。中文装上不能显示,可能是站点用的是UTF8吧?

我的安装:

# patch -p1 -i webalizer-2.01-10.zh_CN_utf8.patch
# ./configure --prefix=/usr/local/webalizer --with-gdlib=/usr/local/gd/lib --with-gd=/usr/local/gd/include --with-language=simplified_chinese_utf8      //这里用simplified_chinese_utf8 还是simplified_chinese呢,一会我再试试用simplified_chinese看看
# make
# make install

环境:AS4+Apache/2.0.59+mysql/5.1.11-beta+php/5.2.3+GD/2.3.4
woyaoqian 该用户已被删除
发表于 2007-10-28 18:42 |显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽

论坛徽章:
0
发表于 2008-01-18 15:18 |显示全部楼层
原帖由 wlacf 于 2007-6-25 14:56 发表
我怎么发现图形上没有文字呢,也没有年份?是我服务器的问题吗?大家装的都正常吗?另外不知怎么样安装才有“[引用][搜索][代理]”这几个,我的只有[每日统计] [每小时统计]  [进入] [退出]  [用户] [区域] ,应 ...



你得字体路径对么?
/usr/share/fonts/chinese/TrueType/ukai.ttf  这个文件存在么?

论坛徽章:
0
发表于 2008-07-07 22:29 |显示全部楼层
好东西,收下,支持一下楼主
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP