Пример #1
0
 public function main()
 {
     if (!Dura::user()->isUser()) {
         Dura::redirect();
     }
     $this->_default();
 }
Пример #2
0
 protected function _profile()
 {
     $user =& Dura::user();
     $icon = $user->getIcon();
     $icon = Dura_Class_Icon::getIconUrl($icon);
     $profile = array('icon' => $icon, 'name' => $user->getName());
     $this->output['profile'] = $profile;
 }
Пример #3
0
 public function main()
 {
     if (Dura::user()->isUser()) {
         Dura::redirect('lounge');
     }
     if (Dura::post('name')) {
         try {
             $this->_login();
         } catch (Exception $e) {
             $this->error = $e->getMessage();
         }
     }
     $this->_default();
 }
Пример #4
0
 protected function _default()
 {
     $talks = array();
     $userId = Dura::user()->getId();
     foreach ($this->roomModels as $roomModel) {
         foreach ($roomModel->talks as $talk) {
             $time = (int) $talk->time;
             $id = (string) $talk->id;
             if (isset($talks[$time][$id])) {
                 continue;
             }
             $talks[$time][$id] = (array) $talk;
         }
     }
     ksort($talks);
     $talks = array_reverse($talks);
     $this->output['talks'] = $talks;
     $this->_view();
 }
Пример #5
0
 protected function _createRoom()
 {
     $userName = Dura::user()->getName();
     $userId = Dura::user()->getId();
     $userIcon = Dura::user()->getIcon();
     $roomHandler = new Dura_Model_RoomHandler();
     $roomModel = $roomHandler->create();
     $roomModel->name = $this->input['name'];
     $roomModel->update = time();
     $roomModel->limit = $this->input['limit'];
     $roomModel->host = $userId;
     $roomModel->language = $this->input['language'];
     $users = $roomModel->addChild('users');
     $users->addChild('name', $userName);
     $users->addChild('id', $userId);
     $users->addChild('icon', $userIcon);
     $users->addChild('update', time());
     if (Dura::$language != $this->input['language']) {
         $langFile = DURA_TRUST_PATH . '/language/' . $this->input['language'] . '.php';
         Dura::$catalog = (require $langFile);
     }
     $talk = $roomModel->addChild('talks');
     $talk->addChild('id', md5(microtime() . mt_rand()));
     $talk->addChild('uid', 0);
     $talk->addChild('name', $userName);
     $talk->addChild('message', "{1} logged in.");
     $talk->addChild('icon', '');
     $talk->addChild('time', time());
     $id = md5(microtime() . mt_rand());
     if (!$roomHandler->save($id, $roomModel)) {
         throw new Exception(t("Data Error: Room creating failed."));
     }
     Dura_Class_RoomSession::create($id);
     Dura::redirect('room');
 }
Пример #6
0
 protected function _validateAdmin()
 {
     if (!Dura::user()->isAdmin()) {
         Dura::redirect();
     }
 }
?>
</select>
</td>
</tr>

<tr style="position:fixed; top:99999%;">
<td>
<select name="language">
<?php 
foreach ($dura['languages'] as $langcode => $language) {
    ?>
<option value="<?php 
    e($langcode);
    ?>
"<?php 
    if ($langcode == Dura::user()->getLanguage()) {
        ?>
 selected="selected"<?php 
    }
    ?>
><?php 
    e($language);
    ?>
</option>
<?php 
}
?>
</select>
</td>
</tr>
Пример #8
0
 protected function _isHost($userId = null)
 {
     if ($userId === null) {
         $userId = Dura::user()->getId();
     }
     return $userId == (string) $this->roomModel->host;
 }
Пример #9
0
<li class="icon"><img src="<?php 
echo $dura['profile']['icon'];
?>
" /></li>
<li class="name"><?php 
echo $dura['profile']['name'];
?>
</li>
<li class="logout">
<form action="<?php 
echo Dura::url('logout');
?>
" method="post">

<?php 
if (Dura::user()->isAdmin()) {
    ?>
<a href="<?php 
    e(Dura::url('admin_announce'));
    ?>
" style="font:12px UbuntuMonoBold,'Microsoft YaHei'; color:#F90; text-decoration:none;"><?php 
    e(t("Announce"));
    ?>
</a>
<?php 
}
?>
<input type="submit" class="input" value="<?php 
e(t("LOGOUT"));
?>
" />