Browse Source
- New widget, LoginAnonymous
- New widget, LoginAnonymous
- New page, room, to login anonymously on XMPP chatrooms - Add a new column in Sessionx model (mechanism)pull/16/head
25 changed files with 336 additions and 63 deletions
-
10app/controllers/RoomController.php
-
5app/models/sessionx/Sessionx.php
-
15app/models/sessionx/SessionxDAO.php
-
1app/views/login.tpl
-
11app/views/room.tpl
-
11app/widgets/Chat/Chat.php
-
26app/widgets/Chat/_chat_header_room.tpl
-
1app/widgets/Chat/chat.js
-
7app/widgets/Chat/chat.tpl
-
5app/widgets/Header/_header_room.tpl
-
5app/widgets/Login/Login.php
-
58app/widgets/LoginAnonymous/LoginAnonymous.php
-
1app/widgets/LoginAnonymous/loginanonymous.tpl
-
5app/widgets/Presence/Presence.php
-
37app/widgets/Rooms/Rooms.php
-
42app/widgets/Rooms/_rooms.tpl
-
2app/widgets/Rooms/_rooms_list.tpl
-
8app/widgets/Rooms/locales.ini
-
35app/widgets/Rooms/rooms.js
-
2linker.php
-
1locales/locales.ini
-
1system/Route.php
-
6system/Sessionx.php
-
4system/User.php
-
8system/widget/WidgetBase.php
@ -0,0 +1,10 @@ |
|||
<?php |
|||
|
|||
class RoomController extends BaseController { |
|||
function load() { |
|||
} |
|||
|
|||
function dispatch() { |
|||
$this->page->setTitle(__('page.room')); |
|||
} |
|||
} |
@ -0,0 +1,11 @@ |
|||
<?php $this->widget('Presence'); ?> |
|||
<?php $this->widget('LoginAnonymous'); ?> |
|||
<main> |
|||
<?php $this->widget('Header');?> |
|||
<section> |
|||
<div> |
|||
<?php $this->widget('Rooms'); ?> |
|||
</div> |
|||
<?php $this->widget('Chat'); ?> |
|||
</section> |
|||
</main> |
@ -0,0 +1,5 @@ |
|||
<div> |
|||
<span id="menu" class="on_mobile icon active" onclick="MovimTpl.toggleMenu()"><i class="md md-menu"></i></span> |
|||
<span class="on_desktop icon"><i class="md md-forum"></i></span> |
|||
<h2 class="r1">{$c->__('page.room')}</h2> |
|||
</div> |
@ -0,0 +1,58 @@ |
|||
<?php |
|||
|
|||
use Respect\Validation\Validator; |
|||
|
|||
class LoginAnonymous extends WidgetBase |
|||
{ |
|||
function load() |
|||
{ |
|||
$this->registerEvent('session_start_handle', 'onStart'); |
|||
} |
|||
|
|||
function onStart($packet) |
|||
{ |
|||
$session = \Sessionx::start(); |
|||
$session->load(); |
|||
|
|||
if($session->mechanism == 'ANONYMOUS') { |
|||
RPC::call('Rooms.anonymousJoin'); |
|||
} |
|||
} |
|||
|
|||
function display() |
|||
{ |
|||
|
|||
} |
|||
|
|||
function ajaxLogin($username) |
|||
{ |
|||
$validate_user = Validator::string()->length(4, 40); |
|||
if(!$validate_user->validate($username)) { |
|||
Notification::append(null, 'bad username'); |
|||
return; |
|||
} |
|||
|
|||
// We get the Server Configuration
|
|||
$cd = new \Modl\ConfigDAO; |
|||
$config = $cd->get(); |
|||
|
|||
$host = 'anonymous.jappix.com'; |
|||
$password = 'AmISnowden?'; |
|||
|
|||
// We try to get the domain
|
|||
$domain = \Moxl\Utils::getDomain($host); |
|||
|
|||
// We launch the XMPP socket
|
|||
RPC::call('register', $host); |
|||
|
|||
// We set the username in the session
|
|||
$s = Session::start(); |
|||
$s->set('username', $username); |
|||
|
|||
// We create a new session or clear the old one
|
|||
$s = Sessionx::start(); |
|||
$s->init($username, $password, $host, $domain); |
|||
|
|||
\Moxl\Stanza\Stream::init($host); |
|||
} |
|||
} |
@ -0,0 +1 @@ |
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue