Changeset 3303

Show
Ignore:
Timestamp:
05/21/07 03:39:21 (20 months ago)
Author:
inureyes
Message:

#408

  • 사용자 이미지가 없을 경우 발생하는 warning message 처리
  • 앞에서 빼먹고 넘어간 DB 쿼리 루틴들을 컴포넌트 기반으로 warning 안나게 수정
Location:
sandbox/blog/owner/setting/teamblog
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • sandbox/blog/owner/setting/teamblog/index.php

    r3302 r3303  
    319319 
    320320<?php 
    321    $sql = "SELECT * FROM {$database['prefix']}Teamblog WHERE userid='$owner' and teams='$owner'"; 
    322    $teamblog_owner = mysql_fetch_array(DBQuery::query("$sql")); 
    323  
    324    $sql = "SELECT a.*, b.name FROM {$database['prefix']}Teamblog a, {$database['prefix']}Users b  WHERE a.userid='$_SESSION[admin]' and a.teams='$_SESSION[userid]' AND b.userid=a.userid"; 
    325    $teamblog_user = mysql_fetch_array(DBQuery::query("$sql")); 
     321    $teamblog_owner = DBQuery::queryRow("SELECT * FROM {$database['prefix']}Teamblog  
     322            WHERE userid='".$owner."' AND teams='".$owner."'"); 
     323    $teamblog_user = DBQuery::queryRow("SELECT a.*, b.name  
     324            FROM {$database['prefix']}Teamblog a, {$database['prefix']}Users b   
     325            WHERE a.userid = '".$_SESSION['admin']."' AND a.teams = '".$_SESSION['userid']."' AND b.userid = a.userid"); 
     326    
     327    // 비트 연산을 통한 변수 추출 
     328 
     329    // 1번째 비트가 0인지 1인지, 0이면 이름 스타일 사용 1이면 사용하지 않고 블로그 스타일을 따라감 
     330    $is_style = $teamblog_owner['font_style'] & 1; 
     331    
     332    // 2번째 비트가 0인지 1인지, 0이면 사용자마음대로 이름 표시 1이면 관리자만 이름스타일 변경 가능 
     333    $font_style = $teamblog_owner['font_style'] & 2; 
     334    
     335    $font_bold = $teamblog_user['font_bold'] & 1; 
     336    $font_i = $teamblog_user['font_bold'] & 2; 
     337    $Fstyle = 'style="'; 
     338    if(!empty($font_bold)) $Fstyle .= 'font-Weight:Bold;'; 
     339    if(!empty($font_i)) $Fstyle .= 'font-Style:italic;'; 
     340    $Fstyle .= 'font-Size:'.$teamblog_user['font_size'].'pt;color:'.$teamblog_user['font_color'].';"'; 
     341    
     342    $NAmestyle1 = 1; 
     343    $NAmestyle2 = 0; 
     344    $NAmestyle3 = 0; 
     345    $NAmestyle4 = 0; 
     346    
     347    // 3번째 비트가 0인지 1인지, 0이면 이름스타일 표시, 1이면 팀원의 이름을 표시하지 않음 
     348    $isname = $teamblog_owner['font_style'] & 4; 
     349    if(empty($isname)) { 
     350        $NAmestyle1 = 0; 
     351        $name_pos = $teamblog_owner['font_style'] & 16; 
     352        if(empty($name_pos)){ 
     353        // 4번째 비트가 0인지 1인지, 0 이면 시간옆에 이름 표시 1이면 제목옆에 이름표시 
     354        $name_pos = $teamblog_owner['font_style'] & 8; 
     355            if(!empty($name_pos)) $NAmestyle2 = 1; 
     356            else $NAmestyle3 = 1; 
     357        } else { 
     358            $NAmestyle4 = 1; 
     359        } 
     360    } 
    326361    
    327362    
    328 // 비트 연산을 통한 변수 추출 
    329  
    330    // 1번째 비트가 0인지 1인지, 0이면 이름 스타일 사용 1이면 사용하지 않고 블로그 스타일을 따라감 
    331    $is_style = $teamblog_owner['font_style'] & 1; 
    332     
    333    // 2번째 비트가 0인지 1인지, 0이면 사용자마음대로 이름 표시 1이면 관리자만 이름스타일 변경 가능 
    334    $font_style = $teamblog_owner['font_style'] & 2; 
    335     
    336    $font_bold = $teamblog_user['font_bold'] & 1; 
    337    $font_i = $teamblog_user['font_bold'] & 2; 
    338    $Fstyle = 'style="'; 
    339    if(!empty($font_bold)) $Fstyle .= 'font-Weight:Bold;'; 
    340    if(!empty($font_i)) $Fstyle .= 'font-Style:italic;'; 
    341    $Fstyle .= 'font-Size:'.$teamblog_user['font_size'].'pt;color:'.$teamblog_user['font_color'].';"'; 
    342     
    343    $NAmestyle1 = 1; 
    344    $NAmestyle2 = 0; 
    345    $NAmestyle3 = 0; 
    346    $NAmestyle4 = 0; 
    347     
    348    // 3번째 비트가 0인지 1인지, 0이면 이름스타일 표시, 1이면 팀원의 이름을 표시하지 않음 
    349    $isname = $teamblog_owner['font_style'] & 4; 
    350    if(empty($isname)){ 
    351        $NAmestyle1 = 0; 
    352       $name_pos = $teamblog_owner['font_style'] & 16; 
    353       if(empty($name_pos)){ 
    354         // 4번째 비트가 0인지 1인지, 0 이면 시간옆에 이름 표시 1이면 제목옆에 이름표시 
    355             $name_pos = $teamblog_owner['font_style'] & 8; 
    356             if(!empty($name_pos)) $NAmestyle2 = 1; 
    357             else $NAmestyle3 = 1; 
    358         } 
    359         else $NAmestyle4 = 1; 
    360    } 
    361     
    362     
    363 // Profile 설정 
    364  
    365   $logo = $teamblog_user['logo']; 
    366   $img = getimagesize('../../../../attach/1/teamProfileImages/' . $logo); 
    367   $profile_x = $img[0]; 
    368   $profile_y = $img[1]; 
     363    // Profile 설정 
     364 
     365    $logo = $teamblog_user['logo']; 
    369366   
    370   if(empty($logo)){ 
    371     $logo = $service['path'] . '/image/spacer.gif'; 
    372     $profile_x = 92; 
    373     $profile_y = 93; 
    374   } 
    375   else{ 
    376     $logo = $service['path'] . '/attach/1/teamProfileImages/' . $logo; 
    377     if($profile_y > 93){ 
    378         $profile_x = intval($profile_x * 93 / $profile_y); 
    379         $profile_y = 93; 
    380     } 
    381   } 
     367    if(empty($logo)){ 
     368        $logo = $service['path'] . '/image/spacer.gif'; 
     369        $profile_x = 92; 
     370        $profile_y = 93; 
     371    } else { 
     372        $logo = $service['path'] . '/attach/1/teamProfileImages/' . $logo; 
     373        $img = getimagesize('../../../../attach/1/teamProfileImages/' . $logo); 
     374        $profile_x = $img[0]; 
     375        $profile_y = $img[1]; 
     376        if($profile_y > 93){ 
     377            $profile_x = intval($profile_x * 93 / $profile_y); 
     378            $profile_y = 93; 
     379        } 
     380    } 
    382381   
    383   $enduser = $teamblog_owner['enduser']; 
     382    $enduser = $teamblog_owner['enduser']; 
    384383   
    385   $profile = $teamblog_user['profile']; 
    386   $profile = str_replace("<br>", "\n", $profile); 
     384    $profile = $teamblog_user['profile']; 
     385    $profile = str_replace("<br>", "\n", $profile); 
    387386?> 
    388387 
  • sandbox/blog/owner/setting/teamblog/profileImage/index.php

    r3299 r3303  
    3434    } 
    3535 
    36  
     36    // Create directory if not exists. 
    3737    $pcheck = ROOT. '/attach/1'; 
    3838    $path = ROOT. '/attach/1/teamProfileImages'; 
     
    4949        @chmod($path,0777); 
    5050    } 
    51     do{ 
     51    do { 
    5252        $attachment['name']=rand(1000000000,9999999999)."$extension"; 
    5353        $attachment['path']="$path/{$attachment['name']}"; 
    54     }while(file_exists($attachment['path'])); 
     54    } while(file_exists($attachment['path'])); 
    5555    if($imageAttributes=@getimagesize($file['tmp_name'])){ 
    5656        $attachment['mime']=$imageAttributes['mime']; 
     
    6363    @chmod($attachment['path'],0666); 
    6464 
    65     $res = mysql_fetch_array(DBQuery::query("SELECT profile_fic FROM {$database['prefix']}Teamblog WHERE teams='$owner' and userid='$_SESSION[admin]'"));    
     65    $logoFilePath = DBQuery::queryCell("SELECT logo FROM {$database['prefix']}Teamblog WHERE teams='".$owner."' and userid='."$_SESSION['admin']."'");   
    6666    $result = DBQuery::query("UPDATE {$database['prefix']}Teamblog SET `logo`='$attachment[name]' WHERE teams='$owner' AND userid='$_SESSION[admin]' "); 
    6767    if(!$result){ 
     
    7070    } 
    7171     
    72     if(!empty($res['profile_fic'])) 
    73         @unlink($path."/".$res['profile_fic']); 
     72    if(!empty($logoFilePath)) 
     73        @unlink($path."/".$logoFilePath); 
    7474    if($attachment['height'] > 93){ 
    7575        $height = 93; 
     
    126126</head> 
    127127<body> 
    128 <form method="post" action="<?=$blogURL?>/owner/setting/teamblog/profileImage/index.php" enctype="multipart/form-data"> 
    129   <input type="file" name="logo" onchange="document.forms[0].submit()" width="50" /> 
     128    <form method="post" action="<?=$blogURL?>/owner/setting/teamblog/profileImage/index.php" enctype="multipart/form-data"> 
     129        <input type="file" name="logo" onchange="document.forms[0].submit()" width="50" /> 
    130130 
    131 </form> 
     131    </form> 
    132132</body> 
    133133</html>