Extra Form
PHP PHP 7.3
CMS Rhymix 2.x

1

알림 센터 라이트에서 알림은 정상적으로 오는데 알림을 클릭하면, 잘못된 요청이라도 나올때가 많습니다.

 

이때 주소를 보면 아래와 같습니다.

https://scorefactory.io/index.php?act=procNcenterliteRedirect&notify=02e433522386e1cacc2e407fdea87a14

 

amp; 가 수상하여 지워보니 제대로 이동합니다. 왜 생기는 것일까요? 어떻게 해결할 수 있을까요?

 

2

그리고 이 문제를 해결하고자 일단 최신 버젼(3.0.9)를 설치했는데 라이믹스 순정 알림센터를 사용하라고 합니다.

라이믹스 순정 알림센터는 어디서 받을 수 있을까요?

 

알림 1.PNG

  • profile

    1.번은 저 링크를 어디서 제공하는지 알수 없지만 그 스킨의 문제일 가능성이 있어 보이구요.
    2.번은 당연히 따로 설치하시면 안됩니다. 내장되어 있는 것을 덮어 씌우는 것이니 현재 라이믹스 코어 버전에 포함된 라이믹스로 다시 덮어 씌우시길 바랍니다.

  • profile profile
    확인해보니 멀쩡하게 설치된 라이믹스 알림센터를 구버전이라고 생각하고 xe 알림센터를 설치했네요. 감사합니다.
    스킨 문제군요.. 어떻게 해결해야 할지 실마리를 주셔서 감사합니다.
  • profile profile
    스킨문제가 아닐 수 있는게 다시 읽어보니 모든 알림이 그렇지 않고 일부가 그렇다면 스킨의 문제가 아닐수도 있어 보입니다. 일단 스킨에서 해당 url을 어떻게 인코딩하는지 살펴볼 필요는 있겠지요.
  • profile profile
    웹지기님 말씀을 보고 다시 찬찬히 보니 최신~5번째까지는 정상, 6번째부터는 모두 &amp가 끼어들어가서 에러가 생깁니다.. 어느 스킨인지 찾아봐야겠네요..
  • profile profile
    레이아웃에서 제공하는거 아닌가요??
  • profile profile
    맞아요.. 의뢰해서 개조하긴 했는데 그래도 여전히 레이아웃 스킨이겠죠.. 어느 부분을 들여다봐야할지는 잘모르지만 찾아봐야죠!
  • profile

    & 이 붙는 항목은 제가 그때 보니까 getUrl 으로 setRedirectUrl 함수를 사용하는 부분을 getNotEncoededUrl 함수이던가 그걸로 고치셔야 할거예요. 

  • profile profile
    혹시 그 부분이 스킨내에 있을까요? 어느 화일을 봐야할지..
  • profile profile

    지금 겉으로 보이기에는 comely 레이아웃을 개조하신 것 같습니다.
    해당 레이아웃 폴더에
    /notify.html 파일을 열어보세요.

    저희 사이트의 경우는
    <li loop="$ncenterList => $o">
    href="{$o->url}
    </li>
    이런식으로 따로 인코딩이나 그런것 없이 바로 사용하게 되어있네요.

  • profile profile
    해보겠습니다! 감사합니다!
  • profile profile

    그리고 지금 6번째 부터 이상해 진다고 하는 부분이 php 부분이 아니고 오히려  js 측에서 링크를 표시해 주는 부분에서 문제를 일으킬 수도 있다고 보여질 수도 있습니다.

    해당 링크를 생성하는 곳을 찾아  js 까지 살펴보셔야 할 수도 있습니다.

  • profile profile
    걍 라이믹스로 업데이트하세용.. 그리고 그전에 생성된 항목들은 안되고 새롭게 추가되는 사항에 대해서만 적용될겁니다
  • profile profile
    라이믹스용에서 잘못된 XE용 설치는 이문제를 해결해 보기 위해 시도해 본 것으로 보입니다. 라이믹스용 알림센터 이용시 부터 발생했던 문제로 보입니다.
  • profile profile
    웹지기님 말씀대로 입니다.. 현재는 라이믹스로 다시 설치했고, 멀쩡하던 알림도 6번째가 되는 순간 중간에 amp; 가 붙어버립니다.
  • profile profile
    skins파일도 전부 순정라이믹스엿나요? 아니면 다른 스킨을 사용한적이 있나요?
  • profile profile

    님 알림센터에서 알림 가져오는게 아닌데요?

    getNotifications 함수를 사용하는 부분이 알림센터에 없습니다 -_-;

     

    타 모듈에서 알림센터의 데이터를 처리해서 가져오는것 같은데 위 타 모듈의 내용을 고쳐야 합니다.

     

    위에도 설명드렷다 시피 내부 코드상에서 getUrl으로 막 코딩한 링크들이 문제입니다.

     

  • profile profile

    스킨을 사용하지 않고 레이아웃에서 처리 방법을 이용했을 겁니다.

    화면 캡처 2021-08-29 165837.png


    지금 사용하는 개조된 레이아웃의 원본 레이아웃에 알림센터의 알림을 가져오는 코드가 있습니다.

    레이아웃에서 이 데이터를 직접 출력하는데 개조를 하셨다고 하는데 어떤 부분에서 잘못된 개조를 했거나 혹은 원래 부터 오류가 있었을 지도요..

    순정상태에서는 php 단에서

    $oNcenterliteModel = getModel('ncenterlite');
    $ncenterCount = $oNcenterliteModel->getMyNotifyList()->total_count;
    $ncenterList = $oNcenterliteModel->getMyNotifyList()->data;



    $ncenterList 로 데이터를 가져온 후

    이것을 html에서 출력해 주고 있는데 지금 오류가 나는 것입니다.

    레이아웃 출력 부분에서 얼마자 수정을 했는지는 저희가 모르기에 지금 원인을 알려드릴 수 없는 상황이구요.
    <li loop="$ncenterList => $o">
    href="{$o->url}
    </li>

    이 상태이긴 한데...

    순정상태에서는 더보기로 더 불러오고 하는 등에서 js가 관여를 합니다.
    그런데 지금 접속해서 테스트 계정으로 접속해 보면 더보기 관련 부분도 없어지고 그냥 5개가 넘는 부분도 한꺼번에 출력하는거 같기도 하고 그런 상황이네요.

     

    질문하신 분께서 현재 레이아웃에서 개조된 부분의 코드를 보여주셔야 할 필요가 있어 보입니다.

  • profile profile

    관련있어보이는 내용을 찾아보았습니다. 아래 두 화일모두 레이아웃 폴더에 있습니다.

    notify.html 일부

    <div class="inner notify_list ncenter scrollbar-macosx">
    {@
    $ncenterList = getModel('ncenterlite')->getMyNotifyList(null, 1, false)->data;
    // var_dump($ncenterList);
    }
    <!--@if($ncenterList)-->
    <ul>
    <li loop="$ncenterList => $o">
    <img src="/download_content/red_dot_xs.png" alt="new" title="new" style="right: unset; top: 11px; left: 50px; margin-left: 3px; border: 0px solid #F6F6F6; border-radius: 10px;" class="menu_new" cond="$o->readed == 'N'">
    <a class="list_link" href="{$o->url}"></a>
    <span class="pf small lined"><img src="{$o->profileImage}" class="pf_img" cond="$o->profileImage" alt="profile_image" /></span>
    <div class="msg">{$o->text}</div><div class="ago">{@ echo wstToAgo($o->regdate); }</div>
    </li>
    </ul>
    <!--@else-->
    <div class="no_notify" cond="$_is_mobile">
    새로운 알림이 없습니다.<br />No New Notifications
    </div>
    <!--@end-->
    </div>


    ncenter.lib.php 일부

    if(!function_exists('wstGetNoticeList'))
    {
    function wstGetNoticeList()
    {
    $addon_info = getAdminModel('addon')->getAddonInfoXml('sejin7940_all_notice', 0, 'site');

    $notice_document_srl = '';
    foreach($addon_info->extra_vars as $ev)
    {
    if($ev->name == 'notice_document_srl')
    {
    $notice_document_srl = $ev->value;
    break;
    }
    }

    $d = $notice_document_srl;
    $d = explode(',', str_replace(' ', '', $d));

    $notice_list = [];
    $oDocumentModel = getModel('document');
    foreach($d as $srl)
    {
    $notice_list[] = $oDocumentModel->getDocument($srl);
    }

    return $notice_list;
    }
    }

     

    레이아웃내 querise 폴더내 getNoticeList.xml

     

    <query id="getNoticeList" action="select">

        <tables>

            <table name="documents" />

        </tables>

        <columns>

            <column name="document_srl" />

        </columns>

        <conditions>

            <condition operation="in" column="module_srl" var="module_srls" />

            <condition operation="more" column="document_srl" var="min_srl" pipe="and" />

        </conditions>

    </query>

  • profile profile
    notify.html 에 있는 스크립트가 영향을 줄 수 있습니다.
  • profile profile
    <script type="text/javascript">
    notify.html 내부에 있는 스크립트는 아래와 같습니다.

    //<![CDATA[
    (function($){
    $(document).ready(function(){
    var $n = $("#notify");
    var $nc = $n.find(".notify_list.ncenter");
    var $lw = $nc.find('ul');

    var page = 2;

    function btMore(){
    var $item = $('<li><a class="list_link"></a><span class="pf small lined"></span><div class="msg"></div><div class="ago"></div></li>');
    var $profile = $('<img class="pf_img" alt="profile image" />');

    $.get(default_url.setQuery('ajax', '1').setQuery('type', 'getNotifications').setQuery('page', page), function(ret){
    if(!ret.list.data){
    return;
    }

    for(var i in ret.list.data){
    if(ret.list.data.hasOwnProperty(i)){
    var item = ret.list.data[i];

    var $html = $item.clone();

    var $img = $profile.clone();
    if(!item.profileImage){
    item.profileImage = request_uri + 'layouts/comely_layout/images/profile.png';
    }
    $img.attr('src', item.profileImage);
    $html.find('.pf').prepend($img);

    $html.find('.msg').html(item.text);
    $html.find('.ago').html(item.ago);
    $html.find('a').attr('href', item.url);

    if(i == 0){
    $html.attr('id', 'ncenterlite_page_' + ret.list.page.cur_page).addClass('notify_page');
    }

    $lw.append($html);
    }
    }

    $n.parent().scrollTop($n.parent()[0].scrollHeight);
    });

    page++;
    return false;
    }

    if($('.inner-notify').height() < $('#notify').height()){
    btMore();
    }

    $('#notify').on('scroll touchstart', function(){
    if($('#notify').scrollTop() >= $('.inner-notify').height() - $('#notify').height() - 10){
    btMore();
    }
    });

    window.openAllNotifications = function(){
    $.get(default_url.setQuery('ajax', '1').setQuery('type', 'openNotifications'));
    };
    });
    })(jQuery);
    //]]>
    </script>
  • profile
    $html.attr('id', 'ncenterlite_page_' + ret.list.page.cur_page).addClass('notify_page');

    이부분에서 문제가 생기는 것 같아요.
  • profile profile
    이 부분말고 $type 변수가 getNotifications 로 전달될때 로딩되는 파일이 위의 파일들중에 한가지인가요?
  • profile profile

    getNotifications 이 포함된 부분은

    1. 레이아웃폴더 내 ncenter.lib.php
    case 'getNotifications':
    $ncenterList = getModel('ncenterlite')->getMyNotifyList(null, Context::get('page'), false);
    $struct['list'] = $ncenterList;
    break;

    2. 레이아웃폴더 내 notify.html

    $type = Context::get('type');

        switch($type)

        {

            case 'getNotifications':

                $ncenterList = getModel('ncenterlite')->getMyNotifyList(null, Context::get('page'), false);

                $struct['list'] = $ncenterList;

            break;

            

            case 'openNotifications':

                getController('ncenterlite')->procNcenterliteNotifyReadAll();

                

                $d = Context::get('sejin7940_all_notice_config')->notice_document_srl;

                $d = explode(',', str_replace(' ', '', $d));

                $v = max($d);

                

                wstSetNcenterNoticeCache($v);

            break;

        }



    입니다.. $type 변수가 전달될때 로딩되는 파일은 어떻게 확인하는지 모르겠어요..

  • profile profile

    getMyNotifyList 를 getMyNotifyListTpl 함수로 호출하도록 바꿔보세요.

    함수스팩에 맞춰 코드 변경하셔야 하고요.

    어디까지나 정석은 외부에서 호출하는게 아니라 직접 함수를 exec_json으로 호출해야합니다.-_-;

  • profile profile
    함수 스팩에 맞춰 코드를 어떻게 변경해야할지 힌트라도 없을까요 ㅠ.ㅠ
  • profile profile
    그러네요. 원본을 수정하지 않은 파일에서 열어보면

    $.exec_json('ncenterlite.getMyNotifyListTpl', { 'page':page }, function(ret) {
    }

    위와 같이 사용했는데
    코드 상당부분을 다른 것으로 바꿔서 지금 같은 url 문제가 발생하고 있네요.

    수정작업 해주신 분이 해결 할 수 있을 것 같습니다.
  • profile profile

    지금 고치신게 너무 많아 완전히 달라져서 어려울 것 같은데요. 수정해주신 분께 연락을 해보시던지...

    편법이라도 이거 한번 시도를..

    notify.html 의 스크립트 중

    $html.find('a').attr('href', item.url);


    $html.find('a').attr('href', item.url.replace(/&amp;/g, "&"));

    될지도 모르겠고 완전 땜빵이고 부작용이 있을지도 모르겠습니다.

    추가로 알림을 더 가지고 오는 경우 스크립트에서  불러오는데 불러올때 잘못된 방법이 사용된 듯 하네요. 람보님 답변에 의하면요..

  • profile profile
    오.. 맙소사.. 해결되었습니다. 정말 감사합니다. 안그래도 너무 민폐를 끼치는 것 같아 개발자님에게 요청하거나 따로 의뢰하거나 해야겠다 하고 있었습니다. 오늘 이 포스팅을 올리기 전에는 이게 알림센터의 문제인지, 레이아웃 문제인지, 개조할때 생긴 문제인지조차 제대로 파악하지 못하고 있었습니다.
  • profile profile

    먼저도 말씀 드렸지만 임시방편으로 땜빵해주는거라 구조적인 저 문제를 발생시키는 원인은 해결되지 않았으니 모니터링을 좀더 해 보시고 다른 형태의 부작용이 생기는지 확인해 보세요.
    저희 사용자들이 수정등의 의뢰를 맡겨도 잘못된 방법이 사용된 건지 알 수 없어 이런 점은 리스크라고 해야겠네요.

  • profile profile
    네 정말 감사합니다. 정말 의뢰를 해서 만들던, 유료 자료를 구매를 하던.. 저같은 코딩을 모르는 사람은 정석적인 방법으로 잘 만들어주셨는지 어떻게든 되게만 만들어주셨는지 알 방법이 없지요..