Browse Source

- Merge with edhelas

pull/16/head
Jaussoin Timothée 11 years ago
parent
commit
e36654521c
  1. 11
      app/controllers/FeedController.php
  2. 26
      app/models/postn/PostnDAO.php
  3. 1
      app/views/feed.tpl
  4. 8
      app/widgets/About/About.php
  5. 2
      app/widgets/About/about.tpl
  6. 18
      app/widgets/AdminTest/admintest.tpl
  7. 11
      app/widgets/AdminTest/locales.ini
  8. 8
      app/widgets/Blog/Blog.php
  9. 24
      app/widgets/Blog/blog.tpl
  10. 20
      linker.php
  11. 10
      system/Route.php

11
app/controllers/FeedController.php

@ -0,0 +1,11 @@
<?php
class FeedController extends BaseController {
function load() {
$this->session_only = false;
$this->raw = true;
}
function dispatch() {
}
}

26
app/models/postn/PostnDAO.php

@ -383,6 +383,32 @@ class PostnDAO extends SQL {
return $this->run('ContactPostn');
}
function getPublicItem($origin, $node, $nodeid, $limitf = false, $limitr = false) {
$this->_sql = '
select *, postn.aid, privacy.value as privacy from postn
left outer join contact on postn.aid = contact.jid
left outer join privacy on postn.nodeid = privacy.pkey
where postn.origin = :origin
and postn.node = :node
and privacy.value = 1
and postn.nodeid = :nodeid
order by postn.published desc';
if($limitr)
$this->_sql = $this->_sql.' limit '.$limitr.' offset '.$limitf;
$this->prepare(
'Postn',
array(
'origin' => $origin,
'node' => $node,
'nodeid' => $nodeid,
)
);
return $this->run('ContactPostn');
}
// TODO: fixme
function getComments($posts) {
$commentsid = '';

1
app/views/feed.tpl

@ -0,0 +1 @@
<?php $this->widget('Syndication');?>

8
app/widgets/About/About.php

@ -15,6 +15,12 @@
class About extends WidgetBase
{
function load() {
function load()
{
}
function display()
{
$this->view->assign('version', APP_VERSION);
}
}

2
app/widgets/About/about.tpl

@ -1,5 +1,5 @@
<div class="tabelem" title="{$c->__('page.about')}" id="about">
<h2 class="padded_top_bottom">{$c->__('page.about')} </h2>
<h2 class="padded_top_bottom">Movim {$version} - {$c->__('page.about')} </h2>
<ul class="thick divided">
<li class="condensed">

18
app/widgets/AdminTest/admintest.tpl

@ -13,22 +13,22 @@
</div>
<div id="movim-api" class="link horizontal disabled"><i class="md md-cloud"></i></div>
<div id="browser_block">
Browser
{$c->__('schema.browser')}
</div>
<div id="movim_block">
Movim Core
{$c->__('schema.movim')}
</div>
<div id="daemon_block">
Movim Daemon
{$c->__('schema.daemon')}
</div>
<div id="database_block" class="{if="$dbconnected"}success {if="$dbinfos > 0"}warning{/if} {else}error{/if}">
Database
{$c->__('schema.database')}
</div>
<div id="api_block">
API
{$c->__('schema.api')}
</div>
<div id="xmpp_block">
XMPP
{$c->__('schema.xmpp')}
</div>
</figure>
</div>
@ -42,7 +42,7 @@
{if="$dbinfos > 0"}
<li>
<span class="icon bubble color orange"><i class="md md-refresh"></i></span>
<span>The database need to be updated, go to the database panel to fix this</span>
<span>{$c->__('compatibility.db')}</span>
</li>
{else}
<script type="text/javascript">AdminTest.databaseOK = true</script>
@ -60,7 +60,7 @@
<i class="md md-settings-ethernet"></i>
</span>
<span>
WebSocket connection error, check if the Movim Daemon is running and is reacheable
{$c->__('compatibility.websocket')}
</span>
</li>
@ -69,7 +69,7 @@
<i class="md md-settings-ethernet"></i>
</span>
<span>
XMPP Websocket connection error, please check the validity of the URL given in the General Configuration. <code>{$websocketurl}</code>
{$c->__('compatibility.xmpp_websocket')} <code>{$websocketurl}</code>
</span>
</li>

11
app/widgets/AdminTest/locales.ini

@ -8,3 +8,14 @@ compatibility.curl = 'Install the php5-curl library'
compatibility.imagick = 'Install the php5-imagick library'
compatibility.rights = "Read and write rights for the webserver in Movim's root directory"
compatibility.rewrite = 'The URL Rewriting support is currently disabled'
compatibility.db = 'The database need to be updated, go to the database panel to fix this'
compatibility.websocket = 'WebSocket connection error, check if the Movim Daemon is running and is reacheable'
compatibility.xmpp_websocket = 'XMPP Websocket connection error, please check the validity of the URL given in the General Configuration'
[schema]
schema.browser = 'Browser'
schema.movim = 'Movim Core'
schema.daemon = 'Movim Daemon'
schema.database = 'Database'
schema.api = 'API'
schema.xmpp = 'XMPP'

8
app/widgets/Blog/Blog.php

@ -24,8 +24,12 @@ class Blog extends WidgetCommon {
$this->view->assign('contact', $c);
$pd = new \modl\PostnDAO();
$messages = $pd->getPublic($from, $node, 10, 0);
if($id = $this->get('i')) {
$messages = $pd->getPublicItem($from, $node, $id, 10, 0);
} else {
$messages = $pd->getPublic($from, $node, 10, 0);
}
$this->view->assign('posts', $messages);
}
}

24
app/widgets/Blog/blog.tpl

@ -15,9 +15,17 @@
</span>
<span>
{if="$contact"}
<h2>{$c->__('blog.title', $contact->getTrueName())}</h2>
<h2>
<a href="{$c->route('blog', array($contact->jid))}">
{$c->__('blog.title', $contact->getTrueName())}
</a>
</h2>
{else}
<h2>{$c->__('page.blog')}</h2>
<h2>
<a href="{$c->route('blog', array($contact->jid))}">
{$c->__('page.blog')}
</a>
</h2>
{/if}
</span>
</li>
@ -39,11 +47,13 @@
</span>
{/if}
<h2>
{if="$value->title != null"}
{$value->title}
{else}
{$c->__('post.default_title')}
{/if}
<a href="{$c->route('blog', array($value->origin, $value->nodeid))}">
{if="$value->title != null"}
{$value->title}
{else}
{$c->__('post.default_title')}
{/if}
</a>
</h2>
<p>
{if="$value->node == 'urn:xmpp:microblog:0' && $value->getContact()->getTrueName() != ''"}

20
linker.php

@ -29,11 +29,11 @@ fwrite(STDERR, colorize(getenv('sid'), 'yellow')." widgets : ".\sizeToCleanSize(
$conn = null;
//$parser = new \Moxl\Parser;
$parser = new \Moxl\Parser;
$buffer = '';
$stdin_behaviour = function ($data) use (/*&*/&$conn, $loop, &$buffer, &$connector, &$xmpp_behaviour/*, &$parser*/) {
$stdin_behaviour = function ($data) use (/*&*/&$conn, $loop, &$buffer, &$connector, &$xmpp_behaviour, &$parser) {
//if(!isset($buffer)) $buffer = '';
if(substr($data, -1) == "") {
$messages = explode("", $buffer . substr($data, 0, -1));
@ -92,7 +92,7 @@ $stdin_behaviour = function ($data) use (/*&*/&$conn, $loop, &$buffer, &$connect
};
//$xmpp_behaviour = function (React\Stream\Stream $stream) use (&$conn, $loop, &$stdin, $stdin_behaviour, $parser) {
$xmpp_behaviour = function (Ratchet\Client\WebSocket $stream) use (&$conn, $loop, &$stdin, $stdin_behaviour/*, $parser*/) {
$xmpp_behaviour = function (Ratchet\Client\WebSocket $stream) use (&$conn, $loop, &$stdin, $stdin_behaviour, $parser) {
$conn = $stream;
fwrite(STDERR, colorize(getenv('sid'), 'yellow')." : ".colorize('linker launched', 'blue')."\n");
fwrite(STDERR, colorize(getenv('sid'), 'yellow')." launched : ".\sizeToCleanSize(memory_get_usage())."\n");
@ -100,14 +100,12 @@ $xmpp_behaviour = function (Ratchet\Client\WebSocket $stream) use (&$conn, $loop
$stdin->removeAllListeners('data');
$stdin->on('data', $stdin_behaviour);
$conn->bufferSize = 4096*256;
#$conn->bufferSize = 4096;
$conn->on('message', function($message) use (&$conn, $loop, $parser/*, $stream*/) {
//$conn->pause();
if(!empty($message)) {
#fwrite(STDERR, colorize($message, 'yellow')." : ".colorize('received', 'green')."\n");
$restart = false;
if($message == '</stream:stream>') {
@ -120,13 +118,15 @@ $xmpp_behaviour = function (Ratchet\Client\WebSocket $stream) use (&$conn, $loop
$restart = true;
}
#fwrite(STDERR, colorize($message, 'yellow')." : ".colorize('received', 'green')."\n");
\Moxl\API::clear();
\RPC::clear();
/*if(!$parser->parse($message)) {
fwrite(STDERR, colorize(getenv('sid'), 'yellow')." ".$parser->getError());
}*/
\Moxl\Xec\Handler::handleStanza($message);
if(!$parser->parse($message)) {
fwrite(STDERR, colorize(getenv('sid'), 'yellow')." ".$parser->getError()."\n");
}
#\Moxl\Xec\Handler::handleStanza($message);
if($restart) {
$session = \Sessionx::start();

10
system/Route.php

@ -9,7 +9,7 @@ class Route extends \BaseController {
'account' => false,
'accountnext' => array('s', 'err'),
'admin' => false,
'blog' => array('f'),
'blog' => array('f', 'i'),
'chat' => array('f'),
'conf' => false,
'contact' => array('f'),
@ -74,9 +74,9 @@ class Route extends \BaseController {
return BASE_URI;
if(isset($routes[$page])) {
if($params != false && count($routes[$page]) != count($params)) {
throw new Exception(__('error.route', $page));
} else {
//if($params != false && count($routes[$page]) != count($params)) {
//throw new Exception(__('error.route', $page));
//} else {
if($tab != false)
$tab = '#'.$tab;
//We construct a classic URL if the rewriting is disabled
@ -103,7 +103,7 @@ class Route extends \BaseController {
$uri .= '/'.$params;
}
return $uri.$tab;
}
//}
} else {
throw new Exception(__('Route not set for the page %s', $page));
}

Loading…
Cancel
Save