4 new revisions:
Revision: 70b905660c
Author:
tvsd...@gmail.com
Date: Fri Aug 28 03:36:36 2009
Log: Добавлена функция получения списка отправленных сообщений
http://code.google.com/p/endspiel/source/detail?r=70b905660c
Revision: ac22b425fd
Author:
tvsd...@gmail.com
Date: Sun Aug 30 02:55:29 2009
Log: Исправлена ошибка с выходом из игры - теперь сессионные куки
удаляются...
http://code.google.com/p/endspiel/source/detail?r=ac22b425fd
Revision: 8f9fc4e288
Author:
tvsd...@gmail.com
Date: Sun Aug 30 06:09:31 2009
Log: Добавлена возможность чтения содержания входящего сообщения.
http://code.google.com/p/endspiel/source/detail?r=8f9fc4e288
Revision: 29054e0cf6
Author:
tvsd...@gmail.com
Date: Sun Aug 30 06:13:17 2009
Log: Добавлена возможность просмотра списка и чтения отправленных
сообщений...
http://code.google.com/p/endspiel/source/detail?r=29054e0cf6
==============================================================================
Revision: 70b905660c
Author:
tvsd...@gmail.com
Date: Fri Aug 28 03:36:36 2009
Log: Добавлена функция получения списка отправленных сообщений
http://code.google.com/p/endspiel/source/detail?r=70b905660c
Modified:
/lib/messaging.class.php
=======================================
--- /lib/messaging.class.php Tue Aug 25 14:10:28 2009
+++ /lib/messaging.class.php Fri Aug 28 03:36:36 2009
@@ -88,6 +88,14 @@
$stmt->execute();
return $stmt->fetchAll(PDO::FETCH_ASSOC);
}
+
+ public function listSent()
+ {
+ $stmt = Engine::get()->db->prepare('SELECT m.`id`, m.`rid`, u.`name`,
m.`message` FROM `messages` AS m LEFT JOIN `users` AS u ON u.`id` = m.`rid`
WHERE m.`sid` = :id;');
+ $stmt->bindValue(':id', $this->id);
+ $stmt->execute();
+ return $stmt->fetchAll(PDO::FETCH_ASSOC);
+ }
}
==============================================================================
Revision: ac22b425fd
Author:
tvsd...@gmail.com
Date: Sun Aug 30 02:55:29 2009
Log: Исправлена ошибка с выходом из игры - теперь сессионные куки удаляются
правильно.
http://code.google.com/p/endspiel/source/detail?r=ac22b425fd
Modified:
/lib/access.class.php
=======================================
--- /lib/access.class.php Sun Aug 23 11:20:09 2009
+++ /lib/access.class.php Sun Aug 30 02:55:29 2009
@@ -73,6 +73,7 @@
$_SESSION['signedin'] = false;
$_SESSION['id'] = 0;
@session_destroy();
+ setcookie('ESID',0,1);
$stmt = Engine::get()->db->prepare('UPDATE `users` SET `logged` = false
WHERE `id` = :id LIMIT 1;');
$stmt->bindValue(':id', $this->id);
$stmt->execute();
==============================================================================
Revision: 8f9fc4e288
Author:
tvsd...@gmail.com
Date: Sun Aug 30 06:09:31 2009
Log: Добавлена возможность чтения содержания входящего сообщения.
http://code.google.com/p/endspiel/source/detail?r=8f9fc4e288
Added:
/tpl/tpl/base.pda.readmsg.tpl
Modified:
/lib/c.idle.class.php
/lib/messaging.class.php
/lib/str.php
=======================================
--- /dev/null
+++ /tpl/tpl/base.pda.readmsg.tpl Sun Aug 30 06:09:31 2009
@@ -0,0 +1,70 @@
+{* Smarty *}
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="
http://www.w3.org/1999/xhtml" dir="ltr" lang="{$str.locale}">
+<head>
+ <title>{$title}</title>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+ <link rel="stylesheet" href="/css/base.css" media="all" />
+</head>
+<body>
+ <div class="cwrap">
+ <form action="/" method="POST">
+ <input type="hidden" name="m" value="logout" />
+ <input type="submit" class="exit" value="Выйти" />
+ </form>
+ <h4>{$str.PDA}: {$str.readmsg}</h4>
+ <table>
+ <tr>
+ <td>
+ <form action="/" method="POST">
+ <input type="hidden" name="m" value="pda" />
+ <input type="hidden" name="d" value="map" />
+ <input type="submit" value="{$str.map}" />
+ </form>
+ </td>
+ <td>
+ <form action="/" method="POST">
+ <input type="hidden" name="m" value="pda" />
+ <input type="hidden" name="d" value="top" />
+ <input type="submit" value="{$str.top}" />
+ </form>
+ </td>
+ <td>
+ <form action="/" method="POST">
+ <input type="hidden" name="m" value="pda" />
+ <input type="hidden" name="d" value="sms" />
+ <input type="submit" value="{$str.sms}" />
+ </form>
+ </td>
+ <td>
+ <form action="/" method="POST">
+ <input type="hidden" name="m" value="pda" />
+ <input type="hidden" name="d" value="glossary" />
+ <input type="submit" value="{$str.glossary}" />
+ </form>
+ </td>
+ </tr>
+ </table>
+ <table class="aw">
+ <tr>
+ <td>
+ {if $
message.in}
+ <h4>{$str.sender}: {$
message.name}</h4>
+ {else}
+ <h4>{$str.recepient}: {$
message.name}</h4>
+ {/if}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <p>{$str.msgtext}:</p>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <p>{$message.message}</p>
+ </td>
+ </tr>
+ </table>
+ </div>
+</body>
=======================================
--- /lib/c.idle.class.php Tue Aug 25 14:12:02 2009
+++ /lib/c.idle.class.php Sun Aug 30 06:09:31 2009
@@ -111,6 +111,17 @@
Engine::get()->smarty->display('base.pda.inbox.tpl'); //Генерация
страницы
break;
}
+ case "msgread":
+ {
+ if (!is_numeric($_POST['i']))
+ {
+ throw new Application_Exception('Trying to send to anything but
player.');
+ }
+ $msg = Engine::get()->messaging->getMessage($_POST['i']);
+ Engine::get()->smarty->assign('message',$msg);
+ Engine::get()->smarty->display('base.pda.readmsg.tpl');
+ break;
+ }
case "touch":
{
switch ($this->state['who'])
@@ -205,8 +216,12 @@
$this->state['mode'] = 'msginbox';
break;
}
- case "sent":
case "msgread":
+ {
+ $this->state['mode'] = 'msgread';
+ break;
+ }
+ case "sent":
case "top":
case "glossary":
{
=======================================
--- /lib/messaging.class.php Fri Aug 28 03:36:36 2009
+++ /lib/messaging.class.php Sun Aug 30 06:09:31 2009
@@ -96,7 +96,38 @@
$stmt->execute();
return $stmt->fetchAll(PDO::FETCH_ASSOC);
}
-
+
+ public function getMessage($msgid)
+ {
+ $stmt = Engine::get()->db->prepare('SELECT m.`id`, m.`sid`, m.`rid`,
ur.`name` as rname, us.`name` as sname, m.`message` FROM `messages` AS m
LEFT JOIN `users` AS ur ON ur.`id` = m.`rid` LEFT JOIN `users` AS us ON
us.`id` = m.`sid` WHERE m.`id` = :msgid LIMIT 1;');
+ $stmt->bindValue(':msgid',$msgid);
+ $stmt->execute();
+ if ($stmt->rowCount() != 1)
+ {
+ throw new Application_Exception('Wrong msg number specified');
+ }
+ $r = $stmt->fetch(PDO::FETCH_ASSOC);
+ $stmt->closeCursor();
+ if (($r['sid'] != $this->id) && ($r['rid'] != $this->id))
+ {
+ throw new Application_Exception('Wrong msg number specified');
+ }
+ $result = array();
+ $result['message'] = $r['message'];
+ if ($r['sid'] == $this->id)
+ {
+ $result['name'] = $r['rname'];
+ $result['pid'] = $r['rid'];
+ $result['in'] = false;
+ }
+ elseif ($r['rid'] == $this->id)
+ {
+ $result['name'] = $r['sname'];
+ $result['pid'] = $r['sid'];
+ $result['in'] = true;
+ }
+ return $result;
+ }
}
?>
=======================================
--- /lib/str.php Thu Aug 27 13:47:02 2009
+++ /lib/str.php Sun Aug 30 06:09:31 2009
@@ -49,11 +49,13 @@
'close_PDA' => 'Убрать PDA',
'contactlist' => 'Список контактов',
'newpmessage' => 'Новое личное сообщение',
+ 'sender' => 'Отправитель',
'recepient' => 'Получатель',
'msgtext' => 'Текст сообщения',
'send' => 'Отправить',
'inbox' => 'Входящие',
- 'sent' => 'Отправленные'
+ 'sent' => 'Отправленные',
+ 'readmsg' => 'Просмотр сообщения'
);
}
==============================================================================
Revision: 29054e0cf6
Author:
tvsd...@gmail.com
Date: Sun Aug 30 06:13:17 2009
Log: Добавлена возможность просмотра списка и чтения отправленных сообщений.
http://code.google.com/p/endspiel/source/detail?r=29054e0cf6
Added:
/tpl/tpl/base.pda.sent.tpl
Modified:
/lib/c.idle.class.php
=======================================
--- /dev/null
+++ /tpl/tpl/base.pda.sent.tpl Sun Aug 30 06:13:17 2009
@@ -0,0 +1,80 @@
+{* Smarty *}
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="
http://www.w3.org/1999/xhtml" dir="ltr" lang="{$str.locale}">
+<head>
+ <title>{$title}</title>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+ <link rel="stylesheet" href="/css/base.css" media="all" />
+</head>
+<body>
+ <div class="cwrap">
+ <form action="/" method="POST">
+ <input type="hidden" name="m" value="logout" />
+ <input type="submit" class="exit" value="Выйти" />
+ </form>
+ <h4>{$str.PDA}: {$str.sent}</h4>
+ <table>
+ <tr>
+ <td>
+ <form action="/" method="POST">
+ <input type="hidden" name="m" value="idle" />
+ <input type="submit" value="{$str.close_PDA}" />
+ </form>
+ </td>
+ <td>
+ <form action="/" method="POST">
+ <input type="hidden" name="m" value="pda" />
+ <input type="hidden" name="d" value="map" />
+ <input type="submit" value="{$str.map}" />
+ </form>
+ </td>
+ <td>
+ <form action="/" method="POST">
+ <input type="hidden" name="m" value="pda" />
+ <input type="hidden" name="d" value="top" />
+ <input type="submit" value="{$str.top}" />
+ </form>
+ </td>
+ <td>
+ <form action="/" method="POST">
+ <input type="hidden" name="m" value="pda" />
+ <input type="hidden" name="d" value="glossary" />
+ <input type="submit" value="{$str.glossary}" />
+ </form>
+ </td>
+ </tr>
+ </table>
+ <table>
+ <tr>
+ <td>
+ <form action="/" method="POST">
+ <input type="hidden" name="m" value="pda" />
+ <input type="hidden" name="d" value="inbox" />
+ <input type="submit" value="{$str.inbox}" />
+ </form>
+ </td>
+ <td>
+ <form action="/" method="POST">
+ <input type="hidden" name="m" value="pda" />
+ <input type="hidden" name="d" value="sms" />
+ <input type="submit" value="{$str.contactlist}" />
+ </form>
+ </td>
+ </tr>
+ </table>
+ <table>
+ {foreach from=$messages item=m}
+ <tr>
+ <td class="alef">
+ <form action="/" method="POST">
+ <input type="hidden" name="m" value="pda" />
+ <input type="hidden" name="d" value="msgread" />
+ <input type="hidden" name="i" value="{$
m.id}" />
+ <input type="submit" value="{$
m.name}: {$m.message|truncate:60}" />
+ </form>
+ </td>
+ </tr>
+ {/foreach}
+ </table>
+ </div>
+</body>
=======================================
--- /lib/c.idle.class.php Sun Aug 30 06:09:31 2009
+++ /lib/c.idle.class.php Sun Aug 30 06:13:17 2009
@@ -111,6 +111,12 @@
Engine::get()->smarty->display('base.pda.inbox.tpl'); //Генерация
страницы
break;
}
+ case "msgsent":
+ {
+
Engine::get()->smarty->assign('messages',Engine::get()->messaging->listSent());
+ Engine::get()->smarty->display('base.pda.sent.tpl'); //Генерация
страницы
+ break;
+ }
case "msgread":
{
if (!is_numeric($_POST['i']))
@@ -216,12 +222,16 @@
$this->state['mode'] = 'msginbox';
break;
}
+ case "sent":
+ {
+ $this->state['mode'] = 'msgsent';
+ break;
+ }
case "msgread":
{
$this->state['mode'] = 'msgread';
break;
}
- case "sent":
case "top":
case "glossary":
{