| | 38 | |
| | 39 | |
| | 40 | class teamblogUser{ |
| | 41 | function name(){ |
| | 42 | requireComponent('Eolin.PHP.Core'); |
| | 43 | global $database, $owner, $entry, $_SESSION; |
| | 44 | |
| | 45 | $res = DBQuery::queryRow("SELECT * FROM ".$database['prefix']."Teamblog WHERE teams='$owner' and userid='$owner' " ); |
| | 46 | |
| | 47 | $is_style = $res['font_style'] & 1; |
| | 48 | $is_admin = $res['font_style'] & 2; |
| | 49 | $font_style = $res['font_style'] & 4; |
| | 50 | $isname = $res['font_style'] & 8; |
| | 51 | $is_ch = $res['font_style'] & 16; |
| | 52 | $name = array(4); |
| | 53 | $name[0] = ''; |
| | 54 | $name[1] = ''; |
| | 55 | $name[2] = 0; |
| | 56 | $name[3] = ''; |
| | 57 | |
| | 58 | $styleS = ''; |
| | 59 | $styleE = ''; |
| | 60 | |
| | 61 | $ttmp = DBQuery::queryRow("SELECT * FROM ".$database['prefix']."Teamblog WHERE teams='".$owner."' and userid='".$_SESSION['admin']."' " ); |
| | 62 | $stmp = DBQuery::queryRow("SELECT * FROM ".$database['prefix']."TeamEntryRelations WHERE owner='".$owner."' and id='".$entry['id']."'"); |
| | 63 | $itmp = DBQuery::queryRow("SELECT a.*, b.name FROM {$database['prefix']}Teamblog a, {$database['prefix']}Users b WHERE a.teams='".$owner."' and a.userid='".$stmp['team']."' AND a.userid=b.userid"); |
| | 64 | |
| | 65 | if(empty($font_style)){ |
| | 66 | if(empty($is_style)){ |
| | 67 | if(empty($is_admin)) $ures = $itmp; |
| | 68 | else $ures = $res; |
| | 69 | |
| | 70 | $font_bold = $ures['font_bold'] & 1; |
| | 71 | if(empty($font_bold)) $font_bold = ''; |
| | 72 | else $font_bold = 'bold'; |
| | 73 | |
| | 74 | $font_italic = $ures['font_bold'] & 2; |
| | 75 | if(empty($font_italic)) $font_italic = ''; |
| | 76 | else $font_italic = 'italic'; |
| | 77 | |
| | 78 | |
| | 79 | $styleS = '<font style="font-Weight:'.$font_bold.';font-Style:'.$font_italic.';font-Size:'.$ures['font_size'].'pt;color:'.$ures['font_color'].';">'; |
| | 80 | $styleE = '</font>'; |
| | 81 | } |
| | 82 | if(empty($is_ch)){ |
| | 83 | if(empty($isname)) $name[0] = ' by ' . $styleS . $itmp['name'] . $styleE; |
| | 84 | else $name[1] = ' by ' . $styleS . $itmp['name'] . $styleE; |
| | 85 | } else { |
| | 86 | $name[3] = $styleS . $itmp['name'] . $styleE; |
| | 87 | } |
| | 88 | } |
| | 89 | |
| | 90 | if(($ttmp['Posting'] == 1) || ($stmp['Team'] == $_SESSION['admin'])) $name[2] = 1; |
| | 91 | |
| | 92 | return $name; |
| | 93 | } |
| | 94 | |
| | 95 | function PC(){ |
| | 96 | global $database, $owner, $_SESSION; |
| | 97 | $itmp = DBQuery::queryRow("SELECT * FROM ".$database['prefix']."Teamblog WHERE teams='".$owner."' and userid='".$_SESSION['admin']."'"); |
| | 98 | $access = 0; |
| | 99 | if(!empty($itmp['Posting'])) $access = 1; |
| | 100 | return $access; |
| | 101 | } |
| | 102 | |
| | 103 | function AC(){ |
| | 104 | global $database, $owner, $_SESSION; |
| | 105 | $itmp = DBQuery::queryRow("SELECT * FROM ".$database['prefix']."Teamblog WHERE teams='".$owner."' and userid='".$_SESSION['admin']."'"); |
| | 106 | $access = 0; |
| | 107 | if(!empty($itmp['admin'])) $access = 1; |
| | 108 | if(($itmp['userid'] == $itmp['teams']) && ($itmp['enduser'] !=0)) $access = 2; |
| | 109 | return $access; |
| | 110 | } |
| | 111 | |
| | 112 | function myBlog(){ |
| | 113 | global $database, $owner, $_SESSION, $blogURL, $_SERVER, $blog, $service; |
| | 114 | |
| | 115 | if($service['type'] == "path") |
| | 116 | $Path = str_replace($service['path']."/".$blog['name'], "", $_SERVER["REQUEST_URI"]); |
| | 117 | else |
| | 118 | $Path = str_replace("/".$blog['name'], "", $_SERVER["REQUEST_URI"]); |
| | 119 | |
| | 120 | $blogn = ('<script type="text/javascript"> |
| | 121 | function teamblog(){ |
| | 122 | var bs = document.getElementById("teamblog"); |
| | 123 | if(bs.value != "") |
| | 124 | location.href = "'.$blogURL.'/owner/setting/teamblog/changeBlog/?bs=" + bs.value + "&path='.$Path.'"; |
| | 125 | } |
| | 126 | </script>'); |
| | 127 | $blogn .= '<select id="teamblog" onChange="teamblog();"><optgroup label="'._t('내가 가입한 팀블로그').'">'; |
| | 128 | |
| | 129 | $isEnd = $_SESSION['admin']+1; |
| | 130 | $myres = DBQuery::queryRow("SELECT * FROM `{$database['prefix']}Teamblog` WHERE `userid`='".$_SESSION['admin']."' and enduser='".$isEnd."'"); |
| | 131 | if(!empty($myres['profile'])){ |
| | 132 | if($owner == $_SESSION['admin'] && $myres['userid'] > 1) $myblogsel = " selected "; |
| | 133 | $blogn .= '<option value="'.$myres['userid'].'" '. $myblogsel .'/>'._t('내 블로그').'</option>'; |
| | 134 | } |
| | 135 | |
| | 136 | $result = DBQuery::query("SELECT * FROM ".$database['prefix']."Teamblog WHERE userid='".$_SESSION['admin']."'"); |
| | 137 | while($res = mysql_fetch_array($result)){ |
| | 138 | if($res['teams'] == $res['userid'] && $res['enduser'] > '0'){ |
| | 139 | continue; |
| | 140 | } else { |
| | 141 | $itmp = DBQuery::queryCell("SELECT title FROM ".$database['prefix']."BlogSettings WHERE owner='".$res['teams']."'"); |
| | 142 | if(empty($itmp['title'])){ |
| | 143 | $itmp = DBQuery::queryCell("SELECT name FROM ".$database['prefix']."Users WHERE userid='".$res['teams']."'"); |
| | 144 | $title = $itmp['name'] .'님의 블로그'; |
| | 145 | } else { |
| | 146 | $title = $itmp['title']; |
| | 147 | } |
| | 148 | $blogn .= '<option value="' . $res['teams'] . '"'; |
| | 149 | if($res['teams'] == $owner) $blogn .= ' selected'; |
| | 150 | $blogn .= ' />' . $title . '</option>'; |
| | 151 | } |
| | 152 | } |
| | 153 | $blogn .= '</optgroup> </select> '; |
| | 154 | |
| | 155 | return $blogn; |
| | 156 | } |
| | 157 | } |