Changeset 5162

Show
Ignore:
Timestamp:
01/28/08 11:24:59 (10 months ago)
Author:
coolengineer
Message:
  • #816
  • 플러그인이 활성화 되지 않았을 경우의 flow를 수정
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/view/view.php

    r5160 r5162  
    320320            $commentRrevView = $commentView; 
    321321            $commentView = $skin->commentForm; 
    322             $skin->commentGuest = addOpenIDPannel( $skin->commentGuest, 'rp' ); 
    323322            $useForm = true; 
    324323        } 
     324        $skin->commentGuest = addOpenIDPannel( $skin->commentGuest, 'rp' ); 
    325325    } else { 
    326326        if (!($skin->guestForm == '')) { 
    327327            $commentRrevView = $commentView; 
    328328            $commentView = $skin->guestForm; 
    329             $skin->guestGuest = addOpenIDPannel( $skin->guestGuest, 'guest' ); 
    330329            $useForm = true; 
    331330        } 
     331        $skin->guestGuest = addOpenIDPannel( $skin->guestGuest, 'guest' ); 
    332332    } 
    333333 
     
    13481348function addOpenIDPannel( $comment, $prefix ) 
    13491349{ 
     1350    if( !isActivePlugin( 'CL_OpenID' ) ) { 
     1351        return $comment; 
     1352    } 
     1353 
    13501354    global $service,$blogURL; 
    13511355    $openid_identity = Acl::getIdentity('openid'); 
     
    13591363    } 
    13601364 
    1361     if( isActivePlugin( 'CL_OpenID' ) ) { 
    1362  
    1363         $tag_login = '<a href="'.$blogURL.'/login/openid/guest?requestURI='. 
    1364                 urlencode( $_SERVER["REQUEST_URI"] ). 
    1365                 '"><span style="color:#ff6200">'._text('오픈아이디').' '._text('로그인').'</span></a>'; 
    1366  
    1367         $tag_logoff = '<a href="'.$blogURL.'/login/openid?action=logout&requestURI='. 
    1368                 urlencode( $_SERVER["REQUEST_URI"] ). 
    1369                 '"><span style="">'._text('로그아웃').'</span></a>'; 
    1370  
    1371         $pannel = '<div class="commentOuterPannel">'.CRLF; 
    1372         $openid_input = 'OPENID_TAG_NEEDED'; 
    1373  
    1374         $cookie_openid = ''; 
    1375         if( !empty( $_COOKIE['openid'] ) ) { 
    1376             $cookie_openid = $_COOKIE['openid']; 
    1377         } 
    1378         if( $openidOnlySettingNotice || $openid_identity ) { 
    1379             $checked1 = 'checked="checked"'; $checked2 = ''; 
    1380             $disabled1 = ''; $disabled2 = 'disabled="disabled"';  
    1381         } else { 
    1382             $checked1 = ''; $checked2 = 'checked="checked"'; 
    1383             $disabled1 = 'disabled="disabled"'; $disabled2 = '';  
    1384         } 
    1385         if( $openid_identity ) { 
    1386             $openid_input = '<span><a href="'.$openid_identity.'">'.$openid_identity.'</a></span>'.CRLF; 
    1387             $openid_input .= '<input type="hidden" name="openid_identifier" id="openid_identifier_[##_article_rep_id_##]" value="'.htmlentities($openid_identity).'" />'; 
    1388             $openid_input = _text('현재 로그인한 오픈아이디').' '.$openid_input; 
    1389             $_COOKIE['guestHomepage'] = $_SESSION['openid']['homepage']; 
    1390             $_COOKIE['guestName'] = $_SESSION['openid']['nickname']; 
    1391         } else { 
    1392             if( preg_match( '/.*?(<input[^>]+_(?:guest|rp)_input_homepage_[^>]+>).*/sm', $comment, $match ) ) { 
    1393                 $openid_input = $match[1]; 
    1394                 $openid_input = str_replace( 'homepage_[##', 'openid_identifier_[##', $openid_input ); 
    1395                 $openid_input = str_replace( '[##_'.$prefix.'_input_homepage_##]_[##', 'openid_identifier_[##', $openid_input ); 
    1396                 $openid_input = preg_replace( '/value=(?:"|\')?(?:[^"\']+)(?:"|\')?/', 'value="'.$cookie_openid.'"', $openid_input ); 
    1397                 $openid_input = preg_replace( '/name=(?:"|\')?(?:[^"\']+)(?:"|\')?/', $disabled1.' name="openid_identifier"', $openid_input ); 
    1398                 $openid_input = preg_replace( '/style=("|\')?([^"\']+)("|\')?/', '', $openid_input ); 
    1399                 $openid_input = preg_replace( '/(value=(?:"|\'))/', 'style="padding-left:21px; width:165px; background:no-repeat url('.$service['path'].'/image/icon_openid.gif'.') " $1', $openid_input ); 
    1400                 //$openid_input = _text('오픈아이디').' '.$openid_input; 
    1401             } 
    1402         } 
    1403  
    1404         if( $disabled1 ) { 
    1405             $openid_input = preg_replace( '/(name=(?:"|\'))/', $disabled1.' $1', $openid_input ); 
    1406         } 
    1407         if( $disabled2 ) { 
    1408             $comment = preg_replace( "/(.*)(<input)((?:[^>]+)name_\[##_article_rep_id_##\](?:[^>]+)>(?:.*))/sm", "$1$2 $disabled2 $3", $comment ); 
    1409             $comment = preg_replace( "/(.*)(<input)((?:[^>]+)password_\[##_article_rep_id_##\](?:[^>]+)>(?:.*))/sm", "$1$2 $disabled2 $3", $comment ); 
    1410             $comment = preg_replace( "/(.*)(<input)((?:[^>]+)\[##_{$prefix}_input_name_##\](?:[^>]+)>(?:.*))/sm", "$1$2 $disabled2 $3", $comment ); 
    1411             $comment = preg_replace( "/(.*)(<input)((?:[^>]+)\[##_{$prefix}_input_password_##\](?:[^>]+)>(?:.*))/sm", "$1$2 $disabled2 $3", $comment ); 
    1412         } 
    1413  
    1414         $pannel .= '<div class="comment_type_openid">'. 
    1415             '<input '.$checked1.' type="radio" '.CRLF. 
    1416                 'style="width:15px;height:15px;border:0px;padding:0px" '.CRLF. 
    1417                 'id="comment_type_[##_article_rep_id_##]_openid" '.CRLF. 
    1418                 'name="comment_type" '.CRLF. 
    1419                 'value="openid" '.CRLF. 
    1420                 'onclick="this.form.[##_'.$prefix.'_input_name_##].disabled=this.form.[##_'.$prefix.'_input_password_##].disabled=true;this.form.openid_identifier.disabled=false"'.CRLF. 
    1421                 '/> '.CRLF. 
    1422             '<label for="comment_type_[##_article_rep_id_##]_openid" style="display:inline">'. 
    1423             _text('오픈아이디로 글쓰기'). 
    1424             '</label> | '.($openid_identity ? $tag_logoff:$tag_login).' | '.$whatisopenid.$lastcomment.'</div>'.CRLF; 
    1425  
    1426         $pannel .= '<div style="padding:5px 0 5px 0px"><!--img style="margin: 0pt 5px; padding: 0pt;border:1px solid; border-color:#dddddd" src="'.$service['path'].'/image/icon_openid.gif" align="absmiddle" hspace="2" -->'.$openid_input.'</div>'.CRLF; 
    1427  
    1428         $pannel .= '<div class="comment_type_namepassword">'.CRLF. 
    1429             '<input '.$checked2.' type="radio" '.CRLF. 
    1430                 'style="width:15px;height:15px;border:0px;padding:0px" '.CRLF. 
    1431                 'id="comment_type_[##_article_rep_id_##]_idpwd" '.CRLF. 
    1432                 'name="comment_type" '.CRLF. 
    1433                 'value="idpwd" '.CRLF. 
    1434                 'onclick="this.form.[##_'.$prefix.'_input_name_##].disabled=this.form.[##_'.$prefix.'_input_password_##].disabled=false;this.form.openid_identifier.disabled=true"'.CRLF. 
    1435                 '/> '.CRLF. 
    1436             '<label for="comment_type_[##_article_rep_id_##]_idpwd" style="display:inline">'. 
    1437             '이름/비밀번호로 글쓰기</label> '.$openidOnlySettingNotice.'</div>'.CRLF; 
    1438         $comment = $pannel.$comment."</div>"; 
    1439     } 
     1365    $tag_login = '<a href="'.$blogURL.'/login/openid/guest?requestURI='. 
     1366            urlencode( $_SERVER["REQUEST_URI"] ). 
     1367            '"><span style="color:#ff6200">'._text('오픈아이디').' '._text('로그인').'</span></a>'; 
     1368 
     1369    $tag_logoff = '<a href="'.$blogURL.'/login/openid?action=logout&requestURI='. 
     1370            urlencode( $_SERVER["REQUEST_URI"] ). 
     1371            '"><span style="">'._text('로그아웃').'</span></a>'; 
     1372 
     1373    $pannel = '<div class="commentOuterPannel">'.CRLF; 
     1374    $openid_input = 'OPENID_TAG_NEEDED'; 
     1375 
     1376    $cookie_openid = ''; 
     1377    if( !empty( $_COOKIE['openid'] ) ) { 
     1378        $cookie_openid = $_COOKIE['openid']; 
     1379    } 
     1380    if( $openidOnlySettingNotice || $openid_identity ) { 
     1381        $checked1 = 'checked="checked"'; $checked2 = ''; 
     1382        $disabled1 = ''; $disabled2 = 'disabled="disabled"';  
     1383    } else { 
     1384        $checked1 = ''; $checked2 = 'checked="checked"'; 
     1385        $disabled1 = 'disabled="disabled"'; $disabled2 = '';  
     1386    } 
     1387    if( $openid_identity ) { 
     1388        $openid_input = '<span><a href="'.$openid_identity.'">'.$openid_identity.'</a></span>'.CRLF; 
     1389        $openid_input .= '<input type="hidden" name="openid_identifier" id="openid_identifier_[##_article_rep_id_##]" value="'.htmlentities($openid_identity).'" />'; 
     1390        $openid_input = _text('현재 로그인한 오픈아이디').' '.$openid_input; 
     1391        $_COOKIE['guestHomepage'] = $_SESSION['openid']['homepage']; 
     1392        $_COOKIE['guestName'] = $_SESSION['openid']['nickname']; 
     1393    } else { 
     1394        if( preg_match( '/.*?(<input[^>]+_(?:guest|rp)_input_homepage_[^>]+>).*/sm', $comment, $match ) ) { 
     1395            $openid_input = $match[1]; 
     1396            $openid_input = str_replace( 'homepage_[##', 'openid_identifier_[##', $openid_input ); 
     1397            $openid_input = str_replace( '[##_'.$prefix.'_input_homepage_##]_[##', 'openid_identifier_[##', $openid_input ); 
     1398            $openid_input = preg_replace( '/value=(?:"|\')?(?:[^"\']+)(?:"|\')?/', 'value="'.$cookie_openid.'"', $openid_input ); 
     1399            $openid_input = preg_replace( '/name=(?:"|\')?(?:[^"\']+)(?:"|\')?/', $disabled1.' name="openid_identifier"', $openid_input ); 
     1400            $openid_input = preg_replace( '/style=("|\')?([^"\']+)("|\')?/', '', $openid_input ); 
     1401            $openid_input = preg_replace( '/(value=(?:"|\'))/', 'style="padding-left:21px; width:165px; background:no-repeat url('.$service['path'].'/image/icon_openid.gif'.') " $1', $openid_input ); 
     1402            //$openid_input = _text('오픈아이디').' '.$openid_input; 
     1403        } 
     1404    } 
     1405 
     1406    if( $disabled1 ) { 
     1407        $openid_input = preg_replace( '/(name=(?:"|\'))/', $disabled1.' $1', $openid_input ); 
     1408    } 
     1409    if( $disabled2 ) { 
     1410        $comment = preg_replace( "/(.*)(<input)((?:[^>]+)name_\[##_article_rep_id_##\](?:[^>]+)>(?:.*))/sm", "$1$2 $disabled2 $3", $comment ); 
     1411        $comment = preg_replace( "/(.*)(<input)((?:[^>]+)password_\[##_article_rep_id_##\](?:[^>]+)>(?:.*))/sm", "$1$2 $disabled2 $3", $comment ); 
     1412        $comment = preg_replace( "/(.*)(<input)((?:[^>]+)\[##_{$prefix}_input_name_##\](?:[^>]+)>(?:.*))/sm", "$1$2 $disabled2 $3", $comment ); 
     1413        $comment = preg_replace( "/(.*)(<input)((?:[^>]+)\[##_{$prefix}_input_password_##\](?:[^>]+)>(?:.*))/sm", "$1$2 $disabled2 $3", $comment ); 
     1414    } 
     1415 
     1416    $pannel .= '<div class="comment_type_openid">'. 
     1417        '<input '.$checked1.' type="radio" '.CRLF. 
     1418            'style="width:15px;height:15px;border:0px;padding:0px" '.CRLF. 
     1419            'id="comment_type_[##_article_rep_id_##]_openid" '.CRLF. 
     1420            'name="comment_type" '.CRLF. 
     1421            'value="openid" '.CRLF. 
     1422            'onclick="this.form.[##_'.$prefix.'_input_name_##].disabled=this.form.[##_'.$prefix.'_input_password_##].disabled=true;this.form.openid_identifier.disabled=false"'.CRLF. 
     1423            '/> '.CRLF. 
     1424        '<label for="comment_type_[##_article_rep_id_##]_openid" style="display:inline">'. 
     1425        _text('오픈아이디로 글쓰기'). 
     1426        '</label> | '.($openid_identity ? $tag_logoff:$tag_login).' | '.$whatisopenid.$lastcomment.'</div>'.CRLF; 
     1427 
     1428    $pannel .= '<div style="padding:5px 0 5px 0px"><!--img style="margin: 0pt 5px; padding: 0pt;border:1px solid; border-color:#dddddd" src="'.$service['path'].'/image/icon_openid.gif" align="absmiddle" hspace="2" -->'.$openid_input.'</div>'.CRLF; 
     1429 
     1430    $pannel .= '<div class="comment_type_namepassword">'.CRLF. 
     1431        '<input '.$checked2.' type="radio" '.CRLF. 
     1432            'style="width:15px;height:15px;border:0px;padding:0px" '.CRLF. 
     1433            'id="comment_type_[##_article_rep_id_##]_idpwd" '.CRLF. 
     1434            'name="comment_type" '.CRLF. 
     1435            'value="idpwd" '.CRLF. 
     1436            'onclick="this.form.[##_'.$prefix.'_input_name_##].disabled=this.form.[##_'.$prefix.'_input_password_##].disabled=false;this.form.openid_identifier.disabled=true"'.CRLF. 
     1437            '/> '.CRLF. 
     1438        '<label for="comment_type_[##_article_rep_id_##]_idpwd" style="display:inline">'. 
     1439        '이름/비밀번호로 글쓰기</label> '.$openidOnlySettingNotice.'</div>'.CRLF; 
     1440    $comment = $pannel.$comment."</div>"; 
    14401441    return $comment; 
    14411442}