⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 defaultrender.java

📁 cwbbs 云网论坛源码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                                tmp = tmp.replaceFirst("\\$s",                                        "" + isc.getUserSum(seeUserName));                                info += tmp;                                 canSee = true;                            } catch (ResKeyException e) {                                reason = e.getMessage(request);                                canSee = false;                            }                        } else {                            canSee = false;                        }                    }                }                if (!canSee) {                    String action = "[<a href='#' onClick=\"if (window.confirm('" +                                    LoadString(request, "info_confirm_fee") +                                    "')) window.location.href='showtopic_tree.jsp?" +                                    "rootid=" + md.getRootid() + "&showid=" +                                    md.getId() + "&usePoint=true'\">" +                                    LoadString(request, "info_click_view") +                                    "</a>]";                    action += "<BR><BR><font color=red>" + reason + "</font>";                    content = matcher.replaceFirst(subStrPoint + "<BR>" + action);                    showAttachment = false;                } else {                    content = matcher.replaceFirst(subStrPoint + "<BR>" + "$4" +                                                   info);                }            }            String subStrPayme = LoadString(request, "info_fee_to_user");             patternStr =                    "(\\[payme=([a-z|A-Z]*),\\s*([0-9]*)\\])(.*?)(\\[\\/payme\\])";            pattern = Pattern.compile(patternStr,                                      Pattern.DOTALL | Pattern.CASE_INSENSITIVE);            matcher = pattern.matcher(content);            if (matcher.find()) {                String moneyCode = matcher.group(2);                String strsum = matcher.group(3);                int sum = 0;                String payme = ParamUtil.get(request, "payme");                try {                    sum = StrUtil.toInt(strsum);                } catch (Exception e) {                    logger.info("doRenderContent:" + e.getMessage());                }                int orgSum = sum;                                ScoreExchangeConfig secfg = new ScoreExchangeConfig();                int maxEarningThread = secfg.getIntProperty("maxearningthread");                boolean isExceed = false;                if (maxEarningThread != 0) {                    if (sum > maxEarningThread) {                        sum = maxEarningThread;                        isExceed = true;                    }                }                ScoreMgr sm = new ScoreMgr();                ScoreUnit su = sm.getScoreUnit(moneyCode);                subStrPayme = subStrPayme.replaceFirst("\\$u",                        um.getUser(md.getName()).getNick());                subStrPayme = subStrPayme.replaceFirst("\\$f", su.getName());                subStrPayme = subStrPayme.replaceFirst("\\$e", "" + orgSum);                subStrPayme = subStrPayme.replaceFirst("\\$w", su.getDanWei());                if (isExceed) {                    subStrPayme +=                            StrUtil.format(LoadString(request,                            "info_fee_exceed_max_earning_thread"),                                           new Object[] {"" + maxEarningThread});                }                boolean canSee = canEdit;                String reason = "";                String info = "";                                if (payme.equals("true")) {                                        if (!privilege.isUserLogin(request)) {                        canSee = false;                        reason = SkinUtil.LoadString(request,                                                     SkinUtil.ERR_NOT_LOGIN);                     } else {                        IPluginScore isc = su.getScore();                        if (isc != null) {                            try {                                isc.pay(seeUserName, md.getName(), sum);                                String tmp = LoadString(request,                                        "info_fee_user_detail");                                tmp = tmp.replaceFirst("\\$u",                                        um.getUser(md.getName()).getNick());                                tmp = tmp.replaceFirst("\\$c", su.getName());                                tmp = tmp.replaceFirst("\\$s", "" + sum);                                tmp = tmp.replaceFirst("\\$w", su.getDanWei());                                tmp = tmp.replaceFirst("\\$y",                                        "" + isc.getUserSum(seeUserName));                                info += tmp;                                                                                                                                canSee = true;                            } catch (ResKeyException e) {                                reason = e.getMessage(request);                                canSee = false;                            }                        } else {                            canSee = false;                        }                    }                }                if (!canSee) {                    String tmp = LoadString(request, "info_confirm_user_fee");                    tmp = tmp.replaceFirst("\\$u", um.getUser(md.getName()).getNick());                    String action = "[<a href='#' onClick=\"if (window.confirm('" +                                    tmp +                                    "')) window.location.href='showtopic_tree.jsp?" +                                    "rootid=" + md.getRootid() + "&showid=" +                                    md.getId() +                                    "&payme=true'\">" +                                    LoadString(request, "info_click_view") +                                    "</a>]";                    action += "<BR><BR><font color=red>" + reason + "</font>";                    content = matcher.replaceFirst(subStrPayme + "<BR>" + action);                    showAttachment = false;                } else {                    content = matcher.replaceFirst(subStrPayme + "<BR>" + "$4" +                                                   info);                }            }        }        return content;    }    public String RenderAttachment(HttpServletRequest request, MsgDb md) {        if (!showAttachment) {            return "";        }                    if (md != null) {                java.util.Vector attachments = md.                                               getAttachments();                java.util.Iterator ir = attachments.                                        iterator();                String str = "";                while (ir.hasNext()) {                    Attachment am = (Attachment)                                    ir.next();                    if (md.getIsWebedit()!=md.WEBEDIT_REDMOON) {                                                String extName = StrUtil.getFileExt(am.getDiskName());                        if (extName.equalsIgnoreCase("gif") ||                            extName.equalsIgnoreCase("jpg") ||                            extName.equalsIgnoreCase("png") || extName.equalsIgnoreCase("bmp"))                            continue;                    }                    str +=                            "<table width='90%' border='0' cellspacing='0' cellpadding='0'>";                    str += "  <tr>";                    str +=                            "<td height=40 align='left'><img src='" + Global.getRootPath() + "/netdisk/images/" + am.getIcon() + "'>";                                        Privilege privilege = new Privilege();                    String groupCode = "";                    if (privilege.isUserLogin(request)) {                        UserDb ud = new UserDb();                        ud = ud.getUser(privilege.getUser(request));                        groupCode = ud.getGroupCode();                    }                                        if (groupCode.equals(""))                        groupCode = UserGroupDb.EVERYONE;                                        UserGroupPrivDb ugpd = new UserGroupPrivDb();                    ugpd = ugpd.getUserGroupPrivDb(groupCode, md.getboardcode());                    String moneyCode = StrUtil.getNullStr(ugpd.getString("money_code"));                    if (!moneyCode.equals("")) {                        ScoreMgr sm = new ScoreMgr();                        ScoreUnit su = sm.getScoreUnit(moneyCode);                        String sFee = StrUtil.format(LoadString(request, "info_confirm_download_attach_fee"), new Object[] {su.getName(), "" + ugpd.getInt("money_sum")});                        str +=                            "    &nbsp; <a href=\"#\" onclick=\"if (window.confirm('" + sFee +"')) window.open('" + request.getContextPath() + "/forum/getfile.jsp?msgId=" + am.getMsgId() + "&attachId=" + am.getId() +                            "')\">";                    }                    else                        str +=                            "    &nbsp; <a target=_blank href='" + request.getContextPath() + "/forum/getfile.jsp?msgId=" + am.getMsgId() + "&attachId=" + am.getId() +                            "'>";                    str  += am.getName() +                          "</a> (" + DateUtil.format(am.getUploadDate(), "yyyy-MM-dd HH:mm") + ", &nbsp;" + NumberUtil.round((double)am.getSize()/1024000, 3) + "&nbsp;M)";                    String str1 = SkinUtil.LoadString(request, "info_attach_download_count").replaceFirst("\\$count", ""+am.getDownloadCount());                    str += str1;                    str += "</td>";                    str += "  </tr>";                    str += "</table>";                }                return str;            }                return "";    }    public void setShowAttachment(boolean showAttachment) {        this.showAttachment = showAttachment;    }    public boolean isShowAttachment() {        return showAttachment;    }        public static String replyCanSee(String content, boolean canSee, String subStr) {        String patternStr = "";        Pattern pattern;        Matcher matcher;        patternStr = "(\\[REPLY\\])(.[^\\[]*)(\\[\\/REPLY\\])";        pattern = Pattern.compile(patternStr, Pattern.DOTALL|Pattern.CASE_INSENSITIVE);        matcher = pattern.matcher(content);        if (canSee)            content = matcher.replaceAll(subStr + "<BR>" + "$2");        else            content = matcher.replaceAll(subStr);        return content;    }    public static String canSee(String content, boolean canSee, String subStr) {        String patternStr = "";        Pattern pattern;        Matcher matcher;                patternStr =                "(\\[HIDE=([a-z|A-Z]*),\\s*([0-9]*)\\])(.[^\\[]*)(\\[\\/HIDE\\])";        pattern = Pattern.compile(patternStr, Pattern.DOTALL|Pattern.CASE_INSENSITIVE);        matcher = pattern.matcher(content);        if (canSee)            content = matcher.replaceFirst(subStr + "<BR>" + "$4");        else            content = matcher.replaceFirst(subStr);        return content;    }    private boolean showAttachment = true;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -