Question Fix lỗi ChangShoutBox trên Xen 1.2.0

Thảo luận trong 'Add-on Quesions' bắt đầu bởi Lightness, 7/9/13.

1votes
5/5, 1 vote

  1. Lightness

    Lightness Imma Superman

    Bài viết:
    1,021
    Likes :
    772
    Mình upgrade xen lên 1.2.0 thì chatbox ko xài được nữa X_X Bị lỗi line 22 ở template chatbox. Theo mình biết thì do sai biến, mà ngặt nổi là ko biết fix như thế nào :< Bác nào giúp mình với :-< Đây là đoạn template chatbox của mình, line 22 mình có làm dấu :D

    Mã:
    <xen:set var="$chatbox.title">Chatbox</xen:set>
    <xen:set var="$chatbox.link">http://domain.com/</xen:set>
    <xen:set var="$chatbox.height">300px</xen:set>
    <xen:set var="$chatbox.key">xxxxxxxxx</xen:set>
    
    <style type="text/css">
    .fcb_chatbox{padding:0px 0px;}
    .fcb_chatbox div{margin:0px 0px 5px 0px;}
    .fcb_chatbox iframe{
        width:100%;
    background:white;
        border:0px;
        padding:0px;
        height:{xen:raw "$chatbox.height"};}
    .fcb_chatbox .txtarea{min-width:90%;}
    .fcb_chatbox form input{margin-left:3px;}
    </style>
    
    <script language="JavaScript" type="text/javascript">
    var chatboxlink = "{xen:raw "$chatbox.link"}";
    var textstyle=document.getElementById("hmess");
    <!-- line 22 -->
    var chatboxkey="{xen:calc "md5({xen:raw "$chatbox.key"}.{$_SERVER.REMOTE_ADDR}.md5({$visitor.user_id}.{$visitor.user_group_id}.{$visitor.username}))"}";
    <!-- end line 22 -->
    var huid="{$visitor.user_id}";
    var hgroupid="{$visitor.user_group_id}";
    var huser="{$visitor.username}";
    if(fcb_getCookie("fcb_b_userid{$visitor.user_id}").length>0)
    {document.fcb_form.hbold.value=fcb_getCookie("fcb_b_userid{$visitor.user_id}");}
    if(fcb_getCookie("fcb_i_userid{$visitor.user_id}").length>0)
    {document.fcb_form.hitalic.value=fcb_getCookie("fcb_i_userid{$visitor.user_id}");}
    if(fcb_getCookie("fcb_u_userid{$visitor.user_id}").length>0)
    {document.fcb_form.hunderline.value=fcb_getCookie("fcb_u_userid{$visitor.user_id}");}
    if(fcb_getCookie("fcb_font_userid{$visitor.user_id}").length>0)
    {document.fcb_form.hfont.value=fcb_getCookie("fcb_font_userid{$visitor.user_id}");}
    if(fcb_getCookie("fcb_color_userid{$visitor.user_id}").length>0)
    {document.fcb_form.hcolor.value=fcb_getCookie("fcb_color_userid{$visitor.user_id}");}
    fcb_upstyle_cookie();function fcb_upstyle_cookie()
    {if(document.fcb_form.hbold.value=="B*")
    {textstyle.style.fontWeight="bold";}
    else
    {textstyle.style.fontWeight="normal";}
    if(document.fcb_form.hitalic.value=="I*")
    {textstyle.style.fontStyle="italic";}
    else
    {textstyle.style.fontStyle="normal";}
    if(document.fcb_form.hunderline.value=="U*")
    {textstyle.style.textDecoration="underline";}
    else
    {textstyle.style.textDecoration="none";}
    textstyle.style.fontFamily=document.fcb_form.hfont.value;textstyle.style.color=document.fcb_form.hcolor.value;}
    function fcb_upstyle(element)
    {if(element=="b")
    {if(document.fcb_form.hbold.value=="B")
    {document.fcb_form.hbold.value="B*";textstyle.style.fontWeight="bold";}
    else
    {document.fcb_form.hbold.value="B";textstyle.style.fontWeight="normal";}}
    else if(element=="i")
    {if(document.fcb_form.hitalic.value=="I")
    {document.fcb_form.hitalic.value="I*";textstyle.style.fontStyle="italic";}
    else
    {document.fcb_form.hitalic.value="I";textstyle.style.fontStyle="normal";}}
    else if(element=="u")
    {if(document.fcb_form.hunderline.value=="U")
    {document.fcb_form.hunderline.value="U*";textstyle.style.textDecoration="underline";}
    else
    {document.fcb_form.hunderline.value="U";textstyle.style.textDecoration="none";}}
    else if(element=="font")
    {textstyle.style.fontFamily=document.fcb_form.hfont.value;}
    else if(element=="color")
    {textstyle.style.color=document.fcb_form.hcolor.value;}
    fcb_setCookie("fcb_b_userid{$visitor.user_id}",document.fcb_form.hbold.value);fcb_setCookie("fcb_i_userid{$visitor.user_id}",document.fcb_form.hitalic.value);fcb_setCookie("fcb_u_userid{$visitor.user_id}",document.fcb_form.hunderline.value);fcb_setCookie("fcb_font_userid{$visitor.user_id}",document.fcb_form.hfont.value);fcb_setCookie("fcb_color_userid{$visitor.user_id}",document.fcb_form.hcolor.value);}
    function fcb_setCookie(c_name,value)
    {exdate=new Date();exdate.setDate(exdate.getDate()+365);document.cookie=c_name+"="+escape(value)+";expires="+exdate.toGMTString()+"path=/";}
    function fcb_getCookie(c_name)
    {if(document.cookie.length>0)
    {c_start=document.cookie.indexOf(c_name+"=");if(c_start!=-1)
    {c_start=c_start+c_name.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1)c_end=document.cookie.length;return unescape(document.cookie.substring(c_start,c_end));}
    else{return"";}}}
    function fcb_postshout()
    {hmess1=document.fcb_form.hmess.value;var hmess2=hmess1.replace("[img]","[img]");var hmess=hmess2.replace("http","http");hcolor=document.fcb_form.hcolor.value;hfont=document.fcb_form.hfont.value;hbold=document.fcb_form.hbold.value;hitalic=document.fcb_form.hitalic.value;hunderline=document.fcb_form.hunderline.value;document.fcb_form.hmess.value="";if(hmess=="")
    {alert("Xin hãy nhập nội dung!");}
    else
    {fcb_frame.location=chatboxlink+"/?do=postshout&key="+chatboxkey+"&userid="+huid+"&groupid="+hgroupid+"&username="+huser+"&message="+encodeURIComponent(hmess)+"&color="+hcolor+"&font="+hfont+"&bold="+hbold+"&italic="+hitalic+"&underline="+hunderline;}}
    function archivepage()
    {window.open("ajax.php?do=fcb_shoutboxarchive","fcbarchive","location=no,scrollbars=no,width=610,height=500");}
    function fcb_refresh()
    {fcb_frame.location=chatboxlink;}
    function updatesmilies()
    {window.open("ajax.php?do=fcb_shoutboxtools","fcbshoutboxtools","location=no,scrollbars=no,width=590,height=500");}
    function smiliepopup()
    {window.open("ajax.php?do=fcb_allsmilies","fcballsmilies","location=no,scrollbars=yes,width=500,height=500");}
    function addsmilie(code)
    {document.fcb_form.hmess.value = document.fcb_form.hmess.value + code;}
    function fcb_showsmilies()
    {document.getElementById("fcb_smiliebox").innerHTML = "Đang tải Smilies....";
    $("#fcb_smiliebox").load("ajax.php?do=fcb_randomsmilies");}
    function fcb_showsmiliebox()
    {if(document.getElementById("fcb_smilieboxmain").style.display=="none")
    {document.getElementById("fcb_smilieboxmain").style.display="inline";fcb_showsmilies();}
    else
    {document.getElementById("fcb_smilieboxmain").style.display="none";}}
    function fcb_hideshowsmiliebox()
    {document.getElementById("fcb_smilieboxmain").style.display="none";}
    </script>
    
    <fieldset>
    <ol class="nodeList sectionMain" id="forums">
    <div class="nodeInfo categoryNodeInfo categoryStrip">
    <div class="categoryText"><h3 class="nodeTitle">
    {$xenOptions.boardTitle}</h3>     
    </div></div>
    <div class="fcb_chatbox" >
    
    <div id="fcb_smilieboxmain" style="display: none;">
        <div align="center">
            <input type="button" class="button" value="Other Smilies" onclick="fcb_showsmilies();">
            <input type="button" class="button" value="All Smilies" onclick="smiliepopup();">
    <xen:if is="{$visitor.is_admin}"><input type="button" class="button" value="Shoutbox Tools" onclick="updatesmilies();"></xen:if>
            <input type="button" class="button" value="Close" onclick="fcb_hideshowsmiliebox();">
        </div>
        <div id="fcb_smiliebox" align="center" style="margin-top: 0px; margin-bottom: 0px;"></div>
    </div>
    <form name="fcb_form" method="post" action="javascript:fcb_postshout();">
    <div style="display:block"><input  id="hmess" type="text"class="txtarea" name="hmess">
    <input type="submit" class="button" value="Send"></div>
    <div style="display:block">
        <input style="font-weight: bold;" type="button" name="hbold" value="B" class="button" onclick="fcb_upstyle('b');">
        <input style="font-style: italic;" type="button" name="hitalic" value="I" class="button" onclick="fcb_upstyle('i');">
        <input style="text-decoration: underline;" type="button" name="hunderline" value="U" class="button" onclick="fcb_upstyle('u');">
        <select onchange="fcb_upstyle('font');" name="hfont">
        <option value="">{xen:phrase font_family}</option>
        <option style="font: Arial;" value="Arial">Arial</option><option style="font: Arial Black;" value="Arial Black">Arial Black</option><option style="font: Arial Narrow;" value="Arial Narrow">Arial Narrow</option><option style="font: Book Antiqua;" value="Book Antiqua">Book Antiqua</option><option style="font: Century Gothic;" value="Century Gothic">Century Gothic</option><option style="font: Comic Sans MS;" value="Comic Sans MS">Comic Sans MS</option><option style="font: Courier New;" value="Courier New">Courier New</option><option style="font: Fixedsys;" value="Fixedsys">Fixedsys</option><option style="font: Franklin Gothic Medium;" value="Franklin Gothic Medium">Franklin Gothic Medium</option><option style="font: Garamond;" value="Garamond">Garamond</option><option style="font: Georgia;" value="Georgia">Georgia</option><option style="font: Impact;" value="Impact">Impact</option><option style="font: Lucida Console;" value="Lucida Console">Lucida Console</option><option style="font: Lucida Sans Unicode;" value="Lucida Sans Unicode">Lucida Sans Unicode</option><option style="font: Microsoft Sans Serif;" value="Microsoft Sans Serif">Microsoft Sans Serif</option><option style="font: Palatino Linotype;" value="Palatino Linotype">Palatino Linotype</option><option style="font: System;" value="System">System</option><option style="font: Tahoma;" value="Tahoma">Tahoma</option><option style="font: Times New Roman;" value="Times New Roman">Times New Roman</option><option style="font: Trebuchet MS;" value="Trebuchet MS">Trebuchet MS</option><option style="font: Verdana;" value="Verdana">Verdana</option>
        </select>
        <select onchange="fcb_upstyle('color');" name="hcolor">
        <option value="">{xen:phrase color_picker}</option>
        <option style="background: Gold;" value="Gold">Gold</option><option style="background: Khaki;" value="Khaki">Khaki</option><option style="background: Orange;" value="Orange">Orange</option><option style="background: LightPink;" value="LightPink">LightPink</option><option style="background: Salmon;" value="Salmon">Salmon</option><option style="background: Tomato;" value="Tomato">Tomato</option><option style="background: Red;" value="Red">Red</option><option style="background: Brown;" value="Brown">Brown</option><option style="background: Maroon;" value="Maroon">Maroon</option><option style="background: DarkGreen;" value="DarkGreen">DarkGreen</option><option style="background: DarkCyan;" value="DarkCyan">DarkCyan</option><option style="background: LightSeaGreen;" value="LightSeaGreen">LightSeaGreen</option><option style="background: LawnGreen;" value="LawnGreen">LawnGreen</option><option style="background: MediumSeaGreen;" value="MediumSeaGreen">MediumSeaGreen</option><option style="background: BlueViolet;" value="BlueViolet">BlueViolet</option><option style="background: Cyan;" value="Cyan">Cyan</option><option style="background: Blue;" value="Blue">Blue</option><option style="background: DodgerBlue;" value="DodgerBlue">DodgerBlue</option><option style="background: LightSkyBlue;" value="LightSkyBlue">LightSkyBlue</option><option style="background: White;" value="White">White</option><option style="background: DimGray;" value="DimGray">DimGray</option><option style="background: DarkGray;" value="DarkGray">DarkGray</option><option style="background: Black;" value="Black">Black</option>
        </select>
    <input type="button" value="{xen:phrase smilies}" class="button" onclick="fcb_showsmiliebox();">
    <input type="button" value="Refresh" class="button" onclick="fcb_refresh();">
    <input type="button" value="Archive" class="button" onclick="archivepage();">
    </div>
    <iframe name="fcb_frame" src="{xen:raw '$chatbox.link'}" frameborder="0" class="framesb"></iframe>
    
    </form>
    </ol>
    </fieldset>
     
    Đang tải...
  2. Lightness

    Lightness Imma Superman

    Bài viết:
    1,021
    Likes :
    772
    Lên cho ai thấy giúp với :<
     
  3. Lightness

    Lightness Imma Superman

    Bài viết:
    1,021
    Likes :
    772
    NÓ chỉ báo line 22 thôi bạn ơi
    var chatboxkey="{xen:calc "md5({xen:raw "$chatbox.key"}.{$_SERVER.REMOTE_ADDR}.md5({$visitor.user_id}.{$visitor.user_group_id}.{$visitor.username}))"}";
     
  4. Lightness

    Lightness Imma Superman

    Bài viết:
    1,021
    Likes :
    772
    Tèo luôn cái chatbox X_X
     
comments powered by Disqus

Chia sẻ trang này

Đang tải...