| -11,10 +11,117 | 
|  | 
| 일단 이름에 cookie 또는 userdata가 들어가는 해시 변수의 키를 다 바꿔주는데, 문제는 디스크에 저장된 유저 데이타 파일들 <code>data/user/*.db</code> 내에 키가 'id'로 되어 있다. | 
|  | 
| 이걸 해결하려면 이걸 전부 지우고 새로 아이디를 만들어야 하는데 그건 사람들이 싫어할테니... | 
| 이걸 해결하려면 이걸 전부 지우고 새로 아이디를 만들어야 하는데 그건 사람들이 싫어할테니... 유저 데이타 파일을 읽어들인 후 userid 키가 없으면 그 시점에 생성한 후 덮어쓰도록 꼼수 해결을 함. (이거 참 맘에 안 들지만) | 
|  | 
| 유저 데이타 파일을 읽어들인 후 userid 키가 없으면 그 시점에 생성한 후 덮어쓰도록 꼼수 해결을 함. (이거 참 맘에 안 들지만) | 
| 수정 내역이 여기저기 흩어져 있어서 그냥 diff 로 보임: | 
|  | 
| {{{#!vim diff | 
| diff --git a/wiki.pl b/wiki.pl | 
| index 3a18e84..5f89d63 100755 | 
| --- a/wiki.pl | 
| +++ b/wiki.pl | 
| @@ -359,10 +359,10 @@ sub InitCookie { | 
| $TimeZoneOffset = 0; | 
| undef $q->{'.cookies'};  # Clear cache if it exists (for SpeedyCGI) | 
| %UserCookie = $q->cookie($CookieName); | 
| -    $UserCookie{id} = DecodeUrl($UserCookie{id}); | 
| -    $UserID = $UserCookie{'id'}; | 
| +    $UserCookie{'userid'} = DecodeUrl($UserCookie{'userid'}); | 
| +    $UserID = $UserCookie{'userid'}; | 
| &LoadUserData($UserID); | 
| -    if (($UserData{'id'} ne $UserCookie{'id'})      || | 
| +    if (($UserData{'userid'} ne $UserCookie{'userid'})      || | 
| ($UserData{'randkey'} ne $UserCookie{'randkey'})) { | 
| $UserID = 113; | 
| %UserData = ();   # Invalid.  Later consider warning message. | 
| @@ -1511,7 +1511,7 @@ sub GetHttpHeader { | 
| my $t; | 
|  | 
| $t = gmtime; | 
| -    if (defined($SetCookie{'id'})) { | 
| +    if (defined($SetCookie{'userid'})) { | 
| ### 로긴할 때 자동 로그인 여부 선택 | 
| #       $cookie = "$CookieName=" | 
| #                       . "rev&" . $SetCookie{'rev'} | 
| @@ -1522,7 +1522,7 @@ sub GetHttpHeader { | 
| $cookie = "$CookieName=" | 
| . "expire&" . $SetCookie{'expire'} | 
| . "&rev&"   . $SetCookie{'rev'} | 
| -            . "&id&"    . EncodeUrl($SetCookie{'id'}) | 
| +            . "&userid&"    . EncodeUrl($SetCookie{'userid'}) | 
| . "&randkey&" . $SetCookie{'randkey'} | 
| . ";"; | 
| ### slashlinks 지원 - 로긴,로그아웃시에 쿠키의 path를 동일하게 해줌 | 
| @@ -4224,6 +4224,13 @@ sub LoadUserData { | 
| %UserData = split(/$FS1/, $data, -1);  # -1 keeps trailing null fields | 
| ### 관심 페이지 | 
| %UserInterest = split(/$FS2/, $UserData{'interest'}, -1); | 
| + | 
| +# rename cookie 'id' to 'userid' | 
| +    if ( not exists $UserData{'userid'} and exists $UserData{'id'} ) { | 
| +        $UserData{'userid'} = $UserData{'id'}; | 
| +        delete $UserData{'id'}; | 
| +        SaveUserData(); | 
| +    } | 
| } | 
|  | 
| sub UserDataFilename { | 
| @@ -5407,7 +5414,7 @@ sub DoUpdatePrefs { | 
| ### 다른 사용자의 환경설정 변경을 금지 | 
| my ($status, $data) = &ReadFile(&UserDataFilename($UserID)); | 
| if ($status) { | 
| -        if ((!(&UserIsAdmin)) && ($UserData{'id'} ne $UserID)) { | 
| +        if ((!(&UserIsAdmin)) && ($UserData{'userid'} ne $UserID)) { | 
| print T('Error: Can not update prefs. That ID already exists and does not match your ID.'). '<br>'; | 
| print &GetCommonFooter(); | 
| return; | 
| @@ -5523,7 +5530,7 @@ sub DoUpdatePrefs { | 
| $TimeZoneOffset = &GetParam("tzoffset", 0) * (60 * 60); | 
| print T('Local time:'), ' ', &TimeToText($Now), '<br>'; | 
|  | 
| -    $UserData{'id'} = $UserID; | 
| +    $UserData{'userid'} = $UserID; | 
| &SaveUserData(); | 
| print '<b>', T('Preferences saved.'), '</b>'; | 
| print &GetCommonFooter(); | 
| @@ -5619,7 +5626,7 @@ sub DoNewLogin { | 
| $SetCookie{'randkey'} = int(rand(1000000000)); | 
| $SetCookie{'rev'} = 1; | 
| %UserCookie = %SetCookie; | 
| -    $UserID = $SetCookie{'id'}; | 
| +    $UserID = $SetCookie{'userid'}; | 
| # The cookie will be transmitted in the next header | 
| %UserData = %UserCookie; | 
| $UserData{'createtime'} = $Now; | 
| @@ -5685,13 +5692,13 @@ sub DoLogin { | 
| $SetCookie{'expire'} = $expire_mode; | 
| } | 
|  | 
| -            $SetCookie{'id'} = $uid; | 
| +            $SetCookie{'userid'} = $uid; | 
| $SetCookie{'randkey'} = $UserData{'randkey'}; | 
| $SetCookie{'rev'} = 1; | 
| $success = 1; | 
| } | 
| else { | 
| -            $SetCookie{'id'} = ""; | 
| +            $SetCookie{'userid'} = ""; | 
| ### 잘못된 아이디를 넣었을 때의 처리 추가 | 
| ### from Bab2's patch | 
| $UserID = ""; | 
| @@ -5725,7 +5732,7 @@ sub DoLogin { | 
| } | 
|  | 
| sub DoLogout { | 
| -    $SetCookie{'id'} = ""; | 
| +    $SetCookie{'userid'} = ""; | 
| $SetCookie{'randkey'} = $UserData{'randkey'}; | 
| $SetCookie{'rev'} = 1; | 
| }}} | 
|  | 
|  | 
|  | 
| github에서 보려면: [https://github.com/gypark/UseModKr/commit/5b11baf33aed5afac673fa7e191fe315e98616d9 Commit 5b11baf33aed5afac673fa7e191fe315e98616d9 to gypark/UseModKr - GitHub] | 
|  | 
|  | 
| === # 추가 업데이트 내역 === |