template와 message 클래스 변수가 일치하도록 수정
This commit is contained in:
+36
-24
@@ -1,48 +1,60 @@
|
||||
<?php
|
||||
require_once(__dir__.'/d_setting/conf.php');
|
||||
require_once(__dir__.'/../e_lib/util.php');
|
||||
require_once(__dir__.'/../e_lib/plates.php');
|
||||
|
||||
class Message{
|
||||
//기본 정보
|
||||
public $id;
|
||||
public $address;
|
||||
public $mailbox;
|
||||
public $type;
|
||||
public $src;
|
||||
public $dest;
|
||||
public $time;
|
||||
public $message;
|
||||
|
||||
//부가 정보
|
||||
public $src_name;
|
||||
public $src_nation;
|
||||
public $src_color;
|
||||
public $src_icon;
|
||||
public $dest_name;
|
||||
public $dest_nation;
|
||||
public $dest_color;
|
||||
|
||||
public $bg_color;
|
||||
public $rawType;
|
||||
|
||||
function __construct($row){
|
||||
$this->id = $row['id'];
|
||||
$this->address = $row['address'];
|
||||
$this->type = $row['type'];
|
||||
$this->src = $row['src'];
|
||||
$this->dest = $row['dest'];
|
||||
$this->time = $row['time'];
|
||||
$this->message = $row['message'];
|
||||
$this->raw_type = $row['type'];
|
||||
|
||||
$this->src_name = $row['src_name'];
|
||||
$this->id = $row['id'];
|
||||
$this->mailbox = $row['mailbox'];
|
||||
|
||||
if($this->rawType === 'public'){
|
||||
$this->type = 'public';
|
||||
}
|
||||
else if(util::ends_with($this->rawType, 'national')){
|
||||
$this->type = 'national';
|
||||
}
|
||||
else{
|
||||
$this->type = 'private';
|
||||
}
|
||||
|
||||
$this->src = [
|
||||
'id' => $row['src'],
|
||||
'name' => $row['src_name'],
|
||||
'nation' => $row['src_nation'],
|
||||
'color' => $row['src_color']
|
||||
];
|
||||
$this->dest = [
|
||||
'id' => $row['dest'],
|
||||
'name' => $row['dest_name'],
|
||||
'nation' => $row['dest_nation'],
|
||||
'color' => $row['dest_color']
|
||||
];
|
||||
$this->datetime = $row['time'];
|
||||
$this->message = $row['message'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getRawMessage($address, $limit=30, $fromTime=NULL){
|
||||
//'select * from `message` where `address` = 90 and `time` < "2018-01-21 04:47:20" ORDER BY `time` desc LIMIT 3 ';
|
||||
function getRawMessage($mailbox, $limit=30, $fromTime=NULL){
|
||||
//'select * from `message` where `mailbox` = 90 and `time` < "2018-01-21 04:47:20" ORDER BY `time` desc LIMIT 3 ';
|
||||
|
||||
|
||||
$sql = 'select * from `message` where `address` = %d_address';
|
||||
$sql = 'select * from `message` where `mailbox` = %d_mailbox';
|
||||
if($fromTime !== NULL){
|
||||
$sql .= ' and `time` <= %s_time';
|
||||
}
|
||||
@@ -55,7 +67,7 @@ function getRawMessage($address, $limit=30, $fromTime=NULL){
|
||||
$db = newDB();
|
||||
//TODO: table 네임의 prefix를 처리할 수 있도록 개선
|
||||
$result = $db->query($sql, array(
|
||||
'address' => $address,
|
||||
'mailbox' => $mailbox,
|
||||
'limit' => $limit,
|
||||
'time' => $fromTime
|
||||
));
|
||||
@@ -319,7 +331,7 @@ function MsgDip($connect, $bg) {
|
||||
}
|
||||
|
||||
function ShowMsgEx($msgType, $src, $dest, $msg, $datetime){
|
||||
|
||||
new Plates('templates');
|
||||
}
|
||||
|
||||
function ShowMsg($skin, $bgcolor, $type, $picture, $imgsvr, $me, $mycolor, $you, $youcolor, $msg, $date, $num=0, $who=0, $when=0, $level=0, $note="") {
|
||||
|
||||
+16
-10
@@ -11,18 +11,18 @@
|
||||
cellspacing="0"
|
||||
<?php if($msgType == 'private'): ?>
|
||||
bgcolor="#CC6600"
|
||||
<?php elseif($msgType == 'public'): ?>
|
||||
bgcolor="#000055"
|
||||
<?php else: /*$msgType == 'national'*/?>
|
||||
bgcolor="#336600"
|
||||
<?php elseif($msgType == 'national'): ?>
|
||||
bgcolor="#336600"
|
||||
<?php else: /*$msgType == 'public'*/?>
|
||||
bgcolor="#000055"
|
||||
<?php endif; ?>
|
||||
style="font-size:13;table-layout:fixed;word-break:break-all;"
|
||||
data-num="<?=$num?>" <?php /*NOTE: 사용되지 않을 num인데 필요한가? */ ?>
|
||||
data-id="<?=$id?>"
|
||||
>
|
||||
<tbody><tr>
|
||||
<td width="64px" height="64px">
|
||||
<?php if ($src['iconPath'] !== NULL): ?>
|
||||
<img src="<?=urlencode($src['iconPath'])?>">
|
||||
<img src="<?=$this->e(urlencode($src['iconPath']))?>">
|
||||
<?php else: ?>
|
||||
<img src="/image/default.jpg"> <?php /*NOTE: image 폴더는 어느 단에서 다뤄야하는가? */?>
|
||||
<?php endif; ?>
|
||||
@@ -30,18 +30,24 @@
|
||||
<td width="434px" valign="top">
|
||||
<?php if($msgType == 'private'): ?>
|
||||
<b>[
|
||||
<font color="<?=$src['color']?>"><?=$src['name']?>:<?=$src['nation']?>
|
||||
<font color="<?=$src['color']?>"><?=$this->e($src['name'])?>:<?=$this->e($src['nation'])?></font>
|
||||
▶
|
||||
</font><font color="<?=$dest['color']?>"><?=$dest['name']?>:<?=$dest['nation']?></font>
|
||||
<font color="<?=$dest['color']?>"><?=$this->e($dest['name'])?>:<?=$this->e($dest['nation'])?></font>
|
||||
]</b>
|
||||
<?php elseif($msgType == 'national'): ?>
|
||||
<b>[
|
||||
<font color="<?=$src['color']?>"><?=$this->e($src['name'])?>:<?=$this->e($src['nation'])?></font>
|
||||
▶
|
||||
<font color="<?=$dest['color']?>"><?=$this->e($dest['nation'])?></font>
|
||||
]</b>
|
||||
<?php else: ?>
|
||||
<b>[
|
||||
<font color="<?=$src['color']?>"><?=$src['name']?>:<?=$src['nation']?>
|
||||
<font color="<?=$src['color']?>"><?=$this->e($src['name'])?>:<?=$this->e($src['nation'])?>
|
||||
]</b>
|
||||
<?php endif; ?>
|
||||
<font size="1"><<?=$datetime?>></font>
|
||||
<br>
|
||||
<?=$msg?>
|
||||
<?=$this->e($message)?>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table>
|
||||
Reference in New Issue
Block a user