Changeset 5220

Show
Ignore:
Timestamp:
02/11/08 03:12:26 (9 months ago)
Author:
gofeel
Message:

#703

  • 사용자 삭제 추가
Location:
trunk
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/components/Textcube.Core.php

    r5194 r5220  
    194194        } 
    195195    } 
     196 
     197    function deleteUser($userid) { 
     198        global $database; 
     199        if ($userid == 1) 
     200            return false; 
     201        if (!isset($userid))  
     202            return false; 
     203        $blogs = User::getOwnedBlogs($userid); 
     204        $sql = "UPDATE `{$database['prefix']}Comments` SET replier = NULL WHERE replier = ".$userid; 
     205        POD::execute($sql); 
     206        foreach ($blogs as $ownedBlog) { 
     207            changeBlogOwner($ownedBlog,1); // 관리자 uid로 변경 
     208        } 
     209        $blogs = User::getBlogs($userid); 
     210        foreach ($blogs as $joinedBlog) { 
     211            deleteTeamblogUser($userid,$joinedBlog); 
     212        } 
     213        deleteUser($userid); 
     214        return true; 
     215    } 
    196216} 
    197217 
  • trunk/interface/owner/control/action/blog/changeOwner/index.php

    r5107 r5220  
    33/// All rights reserved. Licensed under the GPL. 
    44/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT) 
    5 require ROOT . '/lib/includeForBlogOwner.php'; 
    65 
    76$IV = array( 
     
    1110    )  
    1211); 
     12 
     13require ROOT . '/lib/includeForBlogOwner.php'; 
    1314requireStrictRoute(); 
    1415 
    15 $blogid=$_GET['blogid']; 
    16 $userid=$_GET['owner']; 
    17  
    18 $sql = "UPDATE `{$database['prefix']}Teamblog` SET acl = 3 WHERE blogid = ".$blogid." and acl = " . BITWISE_OWNER; 
    19 POD::execute($sql); 
    20  
    21 $acl = POD::queryCell("SELECT acl FROM {$database['prefix']}Teamblog WHERE blogid='$blogid' and userid='$userid'"); 
    22  
    23 if( $acl === null ) { // If there is no ACL, add user into the blog. 
    24     POD::query("INSERT INTO `{$database['prefix']}Teamblog`   
    25         VALUES('$blogid', '$userid', '".BITWISE_OWNER."', UNIX_TIMESTAMP(), '0')"); 
     16if (changeBlogOwner($_GET['blogid'],$_GET['owner'])) { 
     17    return respond::ResultPage(true); 
    2618} 
    27 else { 
    28     $sql = "UPDATE `{$database['prefix']}Teamblog` SET acl = ".BITWISE_OWNER."  
    29         WHERE blogid = ".$blogid." and userid = " . $userid; 
    30     POD::execute($sql); 
    31 } 
    32  
    33 respond::PrintResult(array('error' => 0)); 
     19respond::ResultPage(false); 
    3420?> 
  • trunk/interface/owner/control/blog/detail/index.php

    r5129 r5220  
    121121                                        <thead> 
    122122                                            <tr> 
    123                                                 <th class="name"><?php echo _t('사용자');?></th> 
     123                                                <th class="name"><?php echo _t('Action');?></th> 
    124124                                            </tr> 
    125125                                        </thead> 
  • trunk/interface/owner/control/user/detail/index.php

    r5118 r5220  
    33/// All rights reserved. Licensed under the GPL. 
    44/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT) 
     5 
     6$service['admin_script']='control.js'; 
    57 
    68require ROOT . '/lib/includeForBlogOwner.php'; 
     
    4547                                        </thead> 
    4648                                        <tbody> 
     49                                            <tr> 
     50    <?php echo "<td class=\"name\"><a href=\"".$blogURL."/owner/control/action/user/delete/?userid=" . $userid . "\" onclick =  \"cleanUser(".$userid.");return false;\">사용자 삭제</a></td>";?> 
     51                                            </tr> 
    4752                                        </tbody> 
    4853                                    </table> 
  • trunk/lib/model/blog.teamblog.php

    r5212 r5220  
    8585    return true; 
    8686} 
     87 
     88function changeBlogOwner($blogid,$userid) { 
     89    global $database; 
     90    $sql = "UPDATE `{$database['prefix']}Teamblog` SET acl = 3 WHERE blogid = ".$blogid." and acl = " . BITWISE_OWNER; 
     91    POD::execute($sql); 
     92 
     93    $acl = POD::queryCell("SELECT acl FROM {$database['prefix']}Teamblog WHERE blogid='$blogid' and userid='$userid'"); 
     94 
     95    if( $acl === null ) { // If there is no ACL, add user into the blog. 
     96        POD::query("INSERT INTO `{$database['prefix']}Teamblog`   
     97            VALUES('$blogid', '$userid', '".BITWISE_OWNER."', UNIX_TIMESTAMP(), '0')"); 
     98    } 
     99    else { 
     100        $sql = "UPDATE `{$database['prefix']}Teamblog` SET acl = ".BITWISE_OWNER."  
     101            WHERE blogid = ".$blogid." and userid = " . $userid; 
     102        POD::execute($sql); 
     103    } 
     104 
     105    return true; 
     106} 
    87107?> 
  • trunk/script/control.js

    r5185 r5220  
    373373    request.send(); 
    374374} 
     375 
     376function cleanUser(uid) { 
     377    if (!confirm(_t('모든 글과 블로그가 관리자의 소유로 옮겨집니다.') + '\t\n\n' + _t('되돌릴 수 없습니다.') + '\t\n\n' + _t('계속 진행하시겠습니까?'))) return false; 
     378    var request = new HTTPRequest(blogURL + "/owner/control/action/user/delete/?userid="+uid); 
     379    request.onSuccess = function() { 
     380        PM.removeRequest(this); 
     381        window.location.href = '../'; 
     382    } 
     383    request.onError = function() { 
     384        PM.removeRequest(this); 
     385        msg = this.getText("/response/result"); 
     386        alert(_t('사용자 삭제에 실패하였습니다.') + "\r\nError : " + msg); 
     387    } 
     388    PM.addRequest(request, _t("사용자 삭제중")); 
     389    request.send(); 
     390} 
     391 
    375392function ctlRefresh() { 
    376393    window.location.reload();