Changeset 5160
- Timestamp:
- 01/28/08 03:24:26 (10 months ago)
- Location:
- trunk
- Files:
-
- 8 modified
- 2 copied
-
components/Textcube.Control.Openid.php (modified) (1 diff)
-
interface/comment/add/index.php (modified) (2 diffs)
-
interface/comment/addopenid (copied) (copied from trunk/interface/comment/add)
-
interface/comment/addopenid/index.php (copied) (copied from trunk/interface/comment/add/index.php) (2 diffs)
-
interface/comment/delete/index.php (modified) (1 diff)
-
interface/login/openid/index.php (modified) (2 diffs)
-
lib/blog.skin.php (modified) (5 diffs)
-
lib/model/blog.comment.php (modified) (1 diff)
-
lib/view/view.php (modified) (5 diffs)
-
script/common2.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/components/Textcube.Control.Openid.php
r5063 r5160 298 298 function printErrorReturn( $msg, $location ) 299 299 { 300 header("HTTP/1.0 200 OK"); 301 header("Content-type: text/html"); 302 print "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /></head><body><script type='text/javascript'>//<![CDATA[" . CRLF . "alert('$msg');document.location.href='$location';//]]>" . CRLF . "</script></body></html>"; 300 $query = split( '\?', $location ); 301 $query = array_pop($query); 302 parse_str($query,$args); 303 if( !empty($args['tid']) ) { 304 $tid = $args['tid']; 305 $tr = Transaction::taste($tid); 306 $tr['openid_errormsg'] = $msg; 307 Transaction::repickle($tid,$tr); 308 header( "Location: $location" ); 309 } else { 310 header("HTTP/1.0 200 OK"); 311 header("Content-type: text/html"); 312 print "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /></head><body><script type='text/javascript'>//<![CDATA[" . CRLF . "alert('$msg');"; 313 if( $location ) { 314 print "document.location.href='$location';"; 315 } 316 print "//]]>" . CRLF . "</script></body></html>"; 317 } 303 318 exit(0); 304 319 } -
trunk/interface/comment/add/index.php
r5152 r5160 65 65 $result = addComment($blogid, $comment); 66 66 67 if (in_array($result, array("ip", "name", "homepage", "comment", " etc"))) {67 if (in_array($result, array("ip", "name", "homepage", "comment", "openidonly", "etc"))) { 68 68 switch ($result) { 69 69 case "name": … … 78 78 case "comment": 79 79 $errorString = _text('금칙어를 사용하고 계시므로 댓글을 남기실 수 없습니다.'); 80 break; 81 case "openidonly": 82 $errorString = _text('관리자 설정에 의해 오픈아이디로만 댓글을 남길 수 있습니다.'); 80 83 break; 81 84 case "etc": -
trunk/interface/comment/addopenid/index.php
r5152 r5160 5 5 require ROOT . '/lib/includeForBlog.php'; 6 6 requireComponent('Textcube.Control.Openid'); 7 requireComponent('Textcube.Function.Respond');8 7 9 8 if (false) { … … 13 12 $IV = array( 14 13 'GET' => array( 14 "tid" => array('string', 'default' => ''), 15 15 '__T__' => array('any', 13, 13) 16 16 ), 17 17 'POST' => array( 18 18 'key' => array('string', 32, 32), 19 "name_$entryId" => array('string', 'default' => ''), 20 "password_$entryId" => array('string', 'default' => ''), 19 "comment_type_$entryId" => array('string', 'default' => ''), 21 20 "secret_$entryId" => array(array('1', 'on'), 'mandatory' => false), 22 21 "homepage_$entryId" => array('string', 'default' => 'http://'), 23 "comment_$entryId" => array('string', 'default' => '') 22 "openid_identifier_$entryId" => array('string', 'default' => ''), 23 "openid_errormsg" => array('string', 'default' => ''), 24 "comment_$entryId" => array('string', 'default' => ''), 25 "requestURI" => array('string', 'default' => '' ) 24 26 ) 25 27 ); 26 if(!Validator::validate($IV)) 27 respond::PrintResult(array('error' => 1, 'description' => 'Illigal parameters')); 28 29 $tr = array(); 30 if( !empty( $_GET["tid"] ) ) { 31 $tr = Transaction::unpickle( $_GET["tid"] ); 32 $_POST = $tr['_POST']; 33 $_SERVER['HTTP_REFERER'] = $tr['HTTP_REFERER']; 34 } else { 35 $_SESSION['last_comment'] = array(); 36 $_SESSION['last_comment']['homepage'] = $_POST["homepage_$entryId"]; 37 $_SESSION['last_comment']['comment'] = $_POST["comment_$entryId"]; 38 } 39 28 40 requireStrictRoute(); 29 header('Content-Type: text/xml; charset=utf-8'); 41 header('Content-Type: text/html; charset=utf-8'); 42 43 if(!Validator::validate($IV)) { 44 OpenIDConsumer::printErrorReturn( 'Illegal parameters', $_POST["requestURI"] ); 45 } 46 47 if( $_POST["comment_type_$entryId"] != 'openid' ) { 48 OpenIDConsumer::printErrorReturn( 'Invalid comment type', $_POST["requestURI"] ); 49 } 50 30 51 if (!isset($_GET['__T__']) || !isset($_POST['key']) || $_POST['key'] != md5(filemtime(ROOT . '/config.php'))) { 31 print ("<?xml version=\"1.0\" encoding=\"utf-8\"?><response><error>0</error><commentBlock></commentBlock><recentCommentBlock></recentCommentBlock></response>"); 32 exit; 52 OpenIDConsumer::printErrorReturn( 'Illegal parameters', $_POST["requestURI"] ); 33 53 } 54 55 if ($_POST["comment_$entryId"] == '') { 56 OpenIDConsumer::printErrorReturn( _text('본문을 입력해 주십시오.'), $_POST["requestURI"] ); 57 } 58 59 $openid_identity = Acl::getIdentity('openid'); 60 if( $openid_identity ) { 61 /* OpenID success return path.. */ 62 $_POST["name_$entryId"] = $_SESSION['openid']['nickname']; 63 if( empty($_POST["name_$entryId"]) ) { 64 $_POST["name_$entryId"] = $openid_identity; 65 } 66 if( empty($_POST["homepage_$entryId"]) || $_POST["homepage_$entryId"] == "http://" ) { 67 $_POST["homepage_$entryId"] = 68 empty($_SESSION['openid']['homepage']) ? $openid_identity : $_SESSION['openid']['homepage']; 69 } 70 } else { 71 if( empty($tr['openid_errormsg']) ) { 72 /* OpenID request path.. */ 73 global $blogURL; 74 $tid = Transaction::pickle( array('_POST' => $_POST, 'HTTP_REFERER' => $_SERVER['HTTP_REFERER'] ) ); 75 $requestURI = urlencode("$blogURL/comment/addopenid/$entryId?tid=$tid&__T__=".$_GET['__T__']); 76 77 /* eas_mode will redirect your browser to the IdP authentication page in EAS4.js addComment-onError handler */ 78 header( "Location: $blogURL/login/openid?action=try_auth&openid_remember=y&requestURI=$requestURI". 79 "&openid_identifier=".urlencode($_POST["openid_identifier_$entryId"]) ); 80 exit; 81 } else { 82 /* OpenID failure return path.. */ 83 OpenIDConsumer::printErrorReturn($tr['openid_errormsg'], $_POST["requestURI"] ); 84 } 85 } 86 34 87 $userName = isset($_POST["name_$entryId"]) ? $_POST["name_$entryId"] : ''; 35 $userPassword = isset($_POST["password_$entryId"]) ? $_POST["password_$entryId"] : '';36 88 $userSecret = isset($_POST["secret_$entryId"]) ? 1 : 0; 37 89 $userHomepage = isset($_POST["homepage_$entryId"]) ? $_POST["homepage_$entryId"] : ''; 38 90 $userComment = isset($_POST["comment_$entryId"]) ? $_POST["comment_$entryId"] : ''; 39 if (!doesHaveMembership() && !doesHaveOwnership() && $userName == '') { 40 echo '<?xml version="1.0" encoding="utf-8"?><response><error>2</error><description><![CDATA[', _text('이름을 입력해 주십시오.'), ']]></description></response>'; 41 } else if ($userComment == '') { 42 echo '<?xml version="1.0" encoding="utf-8"?><response><error>2</error><description><![CDATA[', _text('본문을 입력해 주십시오.'), ']]></description></response>'; 43 } else { 44 if (!empty($userName)) { 45 setcookie('guestName', $userName, time() + 2592000, "$blogURL/"); 91 92 $comment = array(); 93 $comment['entry'] = $entryId; 94 $comment['parent'] = null; 95 $comment['name'] = $userName; 96 $comment['password'] = OPENID_PASSWORD; 97 $comment['homepage'] = ($userHomepage == '' || $userHomepage == 'http://') ? '' : $userHomepage; 98 $comment['secret'] = $userSecret; 99 $comment['comment'] = $userComment; 100 $comment['ip'] = $_SERVER['REMOTE_ADDR']; 101 102 $result = addComment($blogid, $comment); 103 104 $errorString = ''; 105 if (in_array($result, array("ip", "name", "homepage", "comment", "etc"))) { 106 switch ($result) { 107 case "name": 108 $errorString = _text('차단된 이름을 사용하고 계시므로 댓글을 남기실 수 없습니다.'); 109 break; 110 case "ip": 111 $errorString = _text('차단된 IP를 사용하고 계시므로 댓글을 남기실 수 없습니다.'); 112 break; 113 case "homepage": 114 $errorString = _text('차단된 홈페이지 주소를 사용하고 계시므로 댓글을 남기실 수 없습니다.'); 115 break; 116 case "comment": 117 $errorString = _text('금칙어를 사용하고 계시므로 댓글을 남기실 수 없습니다.'); 118 break; 119 case "etc": 120 $errorString = _text('귀하는 차단되었으므로 사용하실 수 없습니다.'); 121 break; 46 122 } 47 if (!empty($userHomepage) && ($userHomepage != 'http://')) { 48 if (strpos($userHomepage, 'http://') !== 0) 49 $userHomepage = "http://$userHomepage"; 50 setcookie('guestHomepage', $userHomepage, time() + 2592000, "$blogURL/"); 51 } 52 if( Acl::getIdentity( 'openid' ) ) { 53 OpenIDConsumer::updateUserInfo( $userName, $userHomepage ); 54 } 55 $comment = array(); 56 $comment['entry'] = $entryId; 57 $comment['parent'] = null; 58 $comment['name'] = $userName; 59 $comment['password'] = $userPassword; 60 $comment['homepage'] = ($userHomepage == '' || $userHomepage == 'http://') ? '' : $userHomepage; 61 $comment['secret'] = $userSecret; 62 $comment['comment'] = $userComment; 63 $comment['ip'] = $_SERVER['REMOTE_ADDR']; 64 65 $result = addComment($blogid, $comment); 66 67 if (in_array($result, array("ip", "name", "homepage", "comment", "etc"))) { 68 switch ($result) { 69 case "name": 70 $errorString = _text('차단된 이름을 사용하고 계시므로 댓글을 남기실 수 없습니다.'); 71 break; 72 case "ip": 73 $errorString = _text('차단된 IP를 사용하고 계시므로 댓글을 남기실 수 없습니다.'); 74 break; 75 case "homepage": 76 $errorString = _text('차단된 홈페이지 주소를 사용하고 계시므로 댓글을 남기실 수 없습니다.'); 77 break; 78 case "comment": 79 $errorString = _text('금칙어를 사용하고 계시므로 댓글을 남기실 수 없습니다.'); 80 break; 81 case "etc": 82 $errorString = _text('귀하는 차단되었으므로 사용하실 수 없습니다.'); 83 break; 84 } 85 echo '<?xml version="1.0" encoding="utf-8"?><response><error>1</error><description><![CDATA[', $errorString, ']]></description></response>'; 86 } else if ($result === false) { 87 echo '<?xml version="1.0" encoding="utf-8"?><response><error>2</error><description><![CDATA[', _text('댓글을 달 수 없습니다.'), ']]></description></response>'; 88 } else { 89 $entry = array(); 90 $entry['id'] = $entryId; 91 $entry['slogan'] = getSloganById($blogid, $entryId); 92 if(!$comment['secret']) { 93 if($row = POD::queryRow("SELECT * FROM {$database['prefix']}Entries WHERE blogid = $blogid AND id = $entryId AND draft = 0 AND visibility = 3 AND acceptComment = 1")) 94 sendCommentPing($entryId, "$defaultURL/".($blog['useSlogan'] ? "entry/{$row['slogan']}": $entryId), is_null($user) ? $comment['name'] : $user['name'], is_null($user) ? $comment['homepage'] : $user['homepage']); 95 } 96 $skin = new Skin($skinSetting['skin']); 97 if ($entryId > 0) { 98 $commentBlock = getCommentView($entry, $skin); 99 dress('article_rep_id', $entryId, $commentBlock); 100 $commentBlock = escapeCData(revertTempTags(removeAllTags($commentBlock))); 101 $recentCommentBlock = escapeCData(revertTempTags(getRecentCommentsView(getRecentComments($blogid), $skin->recentComments))); 102 $commentCount = getCommentCount($blogid, $entryId); 103 $commentCount = ($commentCount > 0) ? $commentCount : 0; 104 list($tempTag, $commentView) = getCommentCountPart($commentCount, $skin); 105 } else { 106 $commentView = ''; 107 $commentBlock = getCommentView($entry, $skin); 108 dress('article_rep_id', $entryId, $commentBlock); 109 $commentBlock = escapeCData(revertTempTags(removeAllTags($commentBlock))); 110 $commentCount = 0; 111 $recentCommentBlock = escapeCData(revertTempTags(getRecentCommentsView(getRecentComments($blogid), $skin->recentComments))); 112 } 113 echo '<?xml version="1.0" encoding="utf-8"?><response><error>0</error><commentView>'.$commentView.'</commentView><commentCount>'.$commentCount.'</commentCount><commentBlock><![CDATA[', $commentBlock, ']]></commentBlock><recentCommentBlock><![CDATA[', $recentCommentBlock, ']]></recentCommentBlock></response>'; 114 } 123 } else if ($result === false) { 124 $errorString = _text('댓글을 달 수 없습니다.'); 115 125 } 126 127 if( $errorString ) { 128 OpenIDConsumer::printErrorReturn( $errorString, $_POST["requestURI"] ); 129 } 130 131 OpenIDConsumer::updateUserInfo( $userName, $userHomepage ); 132 133 header( "Location: {$_POST['requestURI']}" ); 116 134 ?> -
trunk/interface/comment/delete/index.php
r5152 r5160 143 143 $entry['id'] = $comment['entry']; 144 144 $entry['slogan'] = getSloganById($blogid, $entry['id']); 145 if( Acl::getIdentity( 'openid' ) ) { 146 OpenIDConsumer::updateUserInfo( $comment['name'], $comment['homepage'] ); 147 } 145 148 printHtmlHeader(); 146 149 $tempComments = revertTempTags(removeAllTags(getCommentView($entry, $skin))); -
trunk/interface/login/openid/index.php
r4980 r5160 59 59 } 60 60 61 $openid = $_GET['openid_identifier'];62 61 $errmsg = ""; 62 $openid = ""; 63 if( !empty($_GET['openid_identifier']) ) { 64 $openid = $_GET['openid_identifier']; 65 } 63 66 if (empty($openid)) { 64 67 $errmsg = _text("오픈아이디를 입력하세요"); … … 129 132 } 130 133 134 if( empty($_GET['action']) ) { 135 $_GET['action'] = 'try_auth'; 136 } 131 137 switch( $_GET['action'] ) { 132 138 case 'try_auth': -
trunk/lib/blog.skin.php
r5076 r5160 24 24 var $guest; 25 25 var $guestForm; 26 var $guestFormOpenIDOnly;27 26 var $guestGuest; 28 27 var $guestMember; … … 46 45 var $commentCount; 47 46 var $commentForm; 48 var $commentFormOpenIDOnly;49 47 var $commentGuest; 50 48 var $commentMember; … … 88 86 //$this->noneTrackbackMessage = getBlogSetting('noneTrackbackMessage'); 89 87 //$this->singleTrackbackMessage = getBlogSetting('singleTrackbackMessage'); 90 if($previewMode == true || ! $this->loadCache()) {88 if($previewMode == true || !empty($service['debug_skin_cache']) || !$this->loadCache()) { 91 89 $this->noneCommentMessage = $blog['noneCommentMessage']; 92 90 $this->singleCommentMessage = $blog['singleCommentMessage']; … … 220 218 221 219 list($sval, $this->guestGuest) = $this->cutSkinTag($sval, 'guest_form'); 222 $this->guestGuest = "[##_openid_links_##]\r\n" . $this->guestGuest;223 220 list($sval, $this->guestMember) = $this->cutSkinTag($sval, 'guest_member'); 224 221 list($sval, $this->guestForm) = $this->cutSkinTag($sval, 'guest_input_form'); 225 list($sval, $this->guestFormOpenIDOnly) = $this->cutSkinTag($sval, 'guest_input_form_openid_only');226 $this->guestFormOpenIDOnly = "[##_openid_links_##]\r\n" . $this->guestFormOpenIDOnly;227 222 list($sval, $this->guest) = $this->cutSkinTag($sval, 'guest'); 228 223 list($sval, $this->entryProtected) = $this->cutSkinTag($sval, 'article_protected'); … … 271 266 272 267 list($sval, $this->commentGuest) = $this->cutSkinTag($sval, 'rp_guest'); 273 $this->commentGuest = "[##_openid_links_##]\r\n" . $this->commentGuest;274 268 list($sval, $this->commentMember) = $this->cutSkinTag($sval, 'rp_member'); 275 269 list($sval, $this->commentForm) = $this->cutSkinTag($sval, 'rp_input_form'); 276 list($sval, $this->commentFormOpenIDOnly) = $this->cutSkinTag($sval, 'rp_input_form_openid_only');277 $this->commentFormOpenIDOnly = "[##_openid_links_##]\r\n" . $this->commentFormOpenIDOnly;278 270 list($sval, $this->comment) = $this->cutSkinTag($sval, 'rp'); 279 271 -
trunk/lib/model/blog.comment.php
r5073 r5160 360 360 } elseif ( !Acl::check( "group.writers" ) && !Acl::getIdentity('openid') && 361 361 getBlogSetting('AddCommentMode', '') == 'openid' ) { 362 $blockType = " etc";362 $blockType = "openidonly"; 363 363 $filtered = 1; 364 364 } else if (!fireEvent('AddingComment', true, $comment)) { -
trunk/lib/view/view.php
r5124 r5160 186 186 187 187 return $trackbacksView; 188 }189 190 function removePasswordIfLoggedIn( $content )191 {192 return preg_replace( "@(.*)(<p>|<div>).*?_rp_input_password_.*?(</p>|</div>)@ms", '$1', $content );193 188 } 194 189 … … 324 319 if (!($skin->commentForm == '')) { 325 320 $commentRrevView = $commentView; 326 if( getBlogSetting( 'AddCommentMode', '' ) == 'openid' && !$openid_identity ) { 327 $commentView = $skin->commentFormOpenIDOnly; 328 } else { 329 $commentView = $skin->commentForm; 330 } 321 $commentView = $skin->commentForm; 322 $skin->commentGuest = addOpenIDPannel( $skin->commentGuest, 'rp' ); 331 323 $useForm = true; 332 324 } … … 334 326 if (!($skin->guestForm == '')) { 335 327 $commentRrevView = $commentView; 336 if( getBlogSetting( 'AddCommentMode', '' ) == 'openid' && !$openid_identity ) { 337 $commentView = $skin->guestFormOpenIDOnly; 338 } else { 339 $commentView = $skin->guestForm; 340 } 328 $commentView = $skin->guestForm; 329 $skin->guestGuest = addOpenIDPannel( $skin->guestGuest, 'guest' ); 341 330 $useForm = true; 342 331 } 343 }344 345 if( isActivePlugin( 'CL_OpenID' ) ) {346 $whatisopenid = '<a target="_blank" href="http://www.google.co.kr/search?q=OpenID&lr=lang_ko">'._text('오픈아이디란?').'</a>';347 if( $openid_identity ) {348 $openid_links = '<div><a href="'.$blogURL.'/login/openid?action=logout&requestURI='.urlencode( $_SERVER["REQUEST_URI"] ).'"><img style="margin: 0pt; padding: 0pt;" src="'.$service['path'].'/image/icon_openid.gif" align="absmiddle" hspace="2"> <span style="">'._text('오픈아이디').' '._text('로그아웃').'</span></a> | <a href="'.$openid_identity.'">'.$openid_identity.'</a> </div>';349 } else {350 $openid_links = '<div><a href="'.$blogURL.'/login/openid/guest?requestURI='.urlencode( $_SERVER["REQUEST_URI"] ).'"><img style="margin: 0pt; padding: 0pt;" src="'.$service['path'].'/image/icon_openid.gif" align="absmiddle" hspace="2"> <span>'._text('오픈아이디').' '._text('로그인').'</span></a> | '.$whatisopenid.'</div>';351 }352 } else {353 $openid_links = '';354 332 } 355 333 … … 361 339 if (!doesHaveMembership()) { 362 340 $commentGuestView = ($isComment ? $skin->commentGuest : $skin->guestGuest); 363 dress( 'openid_links', $openid_links, $commentGuestView );364 if( $openid_identity ) {365 $commentGuestView = removePasswordIfLoggedIn( $commentGuestView );366 }367 341 dress($prefix1 . '_input_name', 'name', $commentGuestView); 368 342 dress($prefix1 . '_input_password', 'password', $commentGuestView); … … 1372 1346 } 1373 1347 1374 ?> 1348 function addOpenIDPannel( $comment, $prefix ) 1349 { 1350 global $service,$blogURL; 1351 $openid_identity = Acl::getIdentity('openid'); 1352 $whatisopenid = '<a target="_blank" href="'._text('http://www.google.co.kr/search?q=OpenID&lr=lang_ko').'"><span style="color:#ff6200">'._text('오픈아이디란?').'</span></a>'; 1353 //$lastcomment = ' | <a href="#" onClick="recallLastComment([##_article_rep_id_##]); return false"><span style="color:#ff6200">'._text('마지막 댓글로 채우기').'</span></a>'; 1354 $lastcomment = ''; 1355 1356 $openidOnlySettingNotice = ''; 1357 if( getBlogSetting( 'AddCommentMode', '' ) == 'openid' ) { 1358 $openidOnlySettingNotice = "<b>"._text('오픈아이디로만 댓글을 남길 수 있습니다')."</b>"; 1359 } 1360 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 } 1440 return $comment; 1441 } 1442 ?> -
trunk/script/common2.js
r5153 r5160 988 988 if (!oForm) 989 989 return false; 990 if( oForm.comment_type[0].checked && oForm.comment_type[0].value == 'openid' ) { 991 return addCommentWithOpenIDAuth(oForm, entryId); 992 } 990 993 var request = new HTTPRequest("POST", oForm.action); 991 994 request.onSuccess = function () { … … 1078 1081 } 1079 1082 1083 function addCommentWithOpenIDAuth(oForm, entryId) { 1084 if (!oForm) 1085 return false; 1086 form = document.createElement('form'); 1087 1088 var action = oForm.action.split("/"); 1089 action.pop(); 1090 action.pop(); 1091 form.action = action.join("/"); 1092 form.action += "/addopenid/"+entryId+"?__T__="+(new Date()).getTime(); 1093 form.method = "post"; 1094 1095 var input; 1096 input = document.createElement('input'); 1097 input.type = 'hidden'; 1098 input.name = 'key'; 1099 input.value = commentKey; 1100 form.appendChild( input ); 1101 1102 input = document.createElement('input'); 1103 input.type = 'hidden'; 1104 input.name = 'requestURI'; 1105 input.value = document.location.href; 1106 form.appendChild( input ); 1107 1108 tempComment = 'comment_' + entryId; 1109 tempHomepage = 'homepage_' + entryId; 1110 tempSecret = 'secret_' + entryId; 1111 1112 for (i=0; i<oForm.elements.length; i++) { 1113 // disabled 상태이면 패스. 1114 if (oForm.elements[i].disabled == true) 1115 continue; 1116 1117 var name = ''; 1118 var value = ''; 1119 1120 if (oForm.elements[i].tagName.toLowerCase() == "input") { 1121 switch (oForm.elements[i].type) { 1122 case "checkbox": 1123 case "radio": 1124 if (oForm.elements[i].checked == true) { 1125 if (oForm.elements[i].name == tempSecret) { 1126 name = oForm.elements[i].name; 1127 } else if (oForm.elements[i].id == tempSecret) { 1128 name = oForm.elements[i].id; 1129 } else if (oForm.elements[i].name != '') { 1130 name = oForm.elements[i].name + '_' + entryId; 1131 } else if (oForm.elements[i].id != '') { 1132 name = oForm.elements[i].id; 1133 } 1134 } 1135 break; 1136 case "text": 1137 case "password": 1138 case "hidden": 1139 case "button": 1140 case "submit":
