Discuz!官方免费开源建站系统

 找回密码
 立即注册
搜索
12
返回列表 发新帖

UCHOME2.0里如何设置一些网址不带框架

[复制链接]
larryli 发表于 2009-9-14 15:25:23 | 显示全部楼层
把domain从url提取出来就是了
回复

使用道具 举报

larryli 发表于 2009-9-15 14:29:44 | 显示全部楼层
本帖最后由 larryli 于 2009-9-16 17:17 编辑

补丁包,直接下载已修改的代码覆盖现有的代码就可以了。
会用diff/patch工具的话,参见代码:
  1. Index: admin/admincp_config.php
  2. ===================================================================
  3. --- admin/admincp_config.php
  4. +++ admin/admincp_config.php
  5. @@ -34,6 +34,10 @@
  6.         $_POST['config']['newspacerealname'] = intval($_POST['config']['newspacerealname']);
  7.         $_POST['config']['newspacevideophoto'] = intval($_POST['config']['newspacevideophoto']);
  8.        
  9. +        $_POST['config']['nolinkdomain'] = trim($_POST['config']['nolinkdomain'], "\r\n");
  10. +        if (!empty($_POST['config']['nolinkdomain']))
  11. +                $_POST['config']['nolinkdomain'] = addslashes("/(".str_replace(array("\r\n", ' '), array('|', ''), preg_quote($_POST['config']['nolinkdomain'], '/')).")$/");
  12. +       
  13.         foreach ($_POST['config'] as $var => $value) {
  14.                 $value = trim($value);
  15.                 if($var == 'timeoffset') {
  16. @@ -79,6 +83,9 @@
  17. $configs = array();
  18. $query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('config'));
  19. while ($value = $_SGLOBAL['db']->fetch_array($query)) {
  20. +        if ($value['var'] == 'nolinkdomain') {
  21. +                $configs[$value['var']] = str_replace(array('/(', ')$/', '|', '\.'), array('', '', "\r\n", '.'), $value['datavalue']);
  22. +        } else
  23.         $configs[$value['var']] = shtmlspecialchars($value['datavalue']);
  24. }

  25. Index: admin/tpl/config.htm
  26. ===================================================================
  27. --- admin/tpl/config.htm
  28. +++ admin/tpl/config.htm
  29. @@ -343,6 +343,14 @@
  30.                 </td>
  31.         </tr>
  32.         <tr>
  33. +                <th>不显示导航条的外部链接域名</th>
  34. +                <td>
  35. +                        <textarea name="config[nolinkdomain]" cols="80" rows="4">$configs[nolinkdomain]</textarea>
  36. +                        <br>不含 http:// 的域名,如 www.foo.com。每行一个
  37. +                        <br>支持子域名,如 .foo.com 匹配所有以 .foo.com 结尾的域名(abc.xyz.foo.com)
  38. +                </td>
  39. +        </tr>
  40. +        <tr>
  41.                 <th>星星经验阀值</th>
  42.                 <td><input type="text" name="config[starcredit]" value="$configs[starcredit]" size="5"> (默认为 100)<br>当用户经验数到此阀值时,增加一个星星。最小为2,否则此功能无效,不显示星星数。</td>
  43.         </tr>
  44. Index: source/function_common.php
  45. ===================================================================
  46. --- source/function_common.php
  47. +++ source/function_common.php
  48. @@ -1008,6 +1008,9 @@

  49. //外链
  50. function iframe_url($url) {
  51. +        global $_SCONFIG;
  52. +        if (!empty($_SCONFIG['nolinkdomain']) && preg_match($_SCONFIG['nolinkdomain'], strtok($url, '/')))
  53. +                return "<a href="http://$url"";
  54.         $url = rawurlencode($url);
  55.         return "<a href="link.php?url=http://$url"";
  56. }
复制代码

patch.zip

27.76 KB, 下载次数: 20

UCenter Home 2.0 GBK

回复

使用道具 举报

d007 发表于 2009-9-16 00:03:05 | 显示全部楼层
经过测试 上面的 patch无法正常使用,请楼主再查 谢谢
回复

使用道具 举报

d007 发表于 2009-9-16 12:02:23 | 显示全部楼层
顶起来。((em:01))
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2025-9-11 02:59 , Processed in 0.123599 second(s), 15 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表