Browse Source

- Fix more material design icons

- Fix fix the getTop ContactDAO request
- Fix a translation in the AccountNext widget
pull/16/head
Jaussoin Timothée 10 years ago
parent
commit
57b3c2ee39
  1. 312
      app/models/contact/ContactDAO.php
  2. 2
      app/widgets/AccountNext/_accountnext_oob.tpl
  3. 2
      app/widgets/AccountNext/accountnext.tpl
  4. 2
      app/widgets/AccountNext/locales.ini
  5. 2
      app/widgets/Chat/Chat.php
  6. 2
      app/widgets/Header/_header_chat.tpl
  7. 2
      app/widgets/Hello/Hello.php
  8. 2
      app/widgets/Hello/hello.tpl
  9. 6
      app/widgets/Menu/_menu_list.tpl
  10. 2
      app/widgets/Menu/_menu_refresh.tpl
  11. 2
      app/widgets/Post/_post_empty.tpl
  12. 4
      app/widgets/Publish/_publish_help.tpl
  13. 8
      app/widgets/Subscribe/subscribe.tpl

312
app/models/contact/ContactDAO.php

@ -6,23 +6,23 @@ class ContactDAO extends SQL {
function __construct() {
parent::__construct();
}
function get($jid = null, $empty = false) {
function get($jid = null, $empty = false) {
$this->_sql = '
select *, privacy.value as privacy from contact
left outer join privacy
on contact.jid = privacy.pkey
select *, privacy.value as privacy from contact
left outer join privacy
on contact.jid = privacy.pkey
where jid = :jid';
if($jid == null) $jid = $this->_user;
$this->prepare(
'Contact',
'Contact',
array(
'jid' => $jid
)
);
$contact = $this->run('Contact', 'item');
// If we cannot find the contact
@ -30,11 +30,11 @@ class ContactDAO extends SQL {
$contact = new Contact;
$contact->jid = $jid;
return $contact;
}
}
return $contact;
}
function set(Contact $contact) {
if(!isset($contact->created)) {
$contact->created = date(DATE_ISO8601);
@ -46,31 +46,31 @@ class ContactDAO extends SQL {
name = :name,
date = :date,
url = :url,
email = :email,
adrlocality = :adrlocality,
adrpostalcode = :adrpostalcode,
adrcountry = :adrcountry,
gender = :gender,
marital = :marital,
description = :description,
mood = :mood,
activity = :activity,
nickname = :nickname,
tuneartist = :tuneartist,
tunelenght = :tunelenght,
tunerating = :tunerating,
tunesource = :tunesource,
tunetitle = :tunetitle,
tunetrack = :tunetrack,
loclatitude = :loclatitude,
loclongitude = :loclongitude,
localtitude = :localtitude,
@ -91,35 +91,35 @@ class ContactDAO extends SQL {
created = :created,
updated = :updated
where contact.jid = :jid';
$this->prepare(
'Contact',
'Contact',
array(
'fn' => $contact->fn,
'name' => $contact->name,
'date' => $contact->date,
'url' => $contact->url,
'email' => $contact->email,
'adrlocality' => $contact->adrlocality,
'adrpostalcode' => $contact->adrpostalcode,
'adrcountry' => $contact->adrcountry,
'gender' => $contact->gender,
'marital' => $contact->marital,
'description' => $contact->description,
// User Mood (contain serialized array) - XEP 0107
'mood' => $contact->mood,
// User Activity (contain serialized array) - XEP 0108
'activity' => $contact->activity,
// User Nickname - XEP 0172
'nickname' => $contact->nickname,
// User Tune - XEP 0118
'tuneartist' => $contact->tuneartist,
'tunelenght' => $contact->tunelenght,
@ -127,8 +127,8 @@ class ContactDAO extends SQL {
'tunesource' => $contact->tunesource,
'tunetitle' => $contact->tunetitle,
'tunetrack' => $contact->tunetrack,
// User Location
// User Location
'loclatitude' => $contact->loclatitude,
'loclongitude' => $contact->loclongitude,
'localtitude' => $contact->localtitude,
@ -142,20 +142,20 @@ class ContactDAO extends SQL {
'loctext' => $contact->loctext,
'locuri' => $contact->locuri,
'loctimestamp' => $contact->loctimestamp,
'twitter' => $contact->twitter,
'skype' => $contact->skype,
'yahoo' => $contact->yahoo,
'avatarhash' => $contact->avatarhash,
'created' => $contact->created,
'updated' => date(DATE_ISO8601),
'jid' => $contact->jid
)
);
$this->run('Contact');
if(!$this->_effective) {
@ -166,31 +166,31 @@ class ContactDAO extends SQL {
name,
date,
url,
email,
adrlocality,
adrpostalcode,
adrcountry,
gender,
marital,
description,
mood,
activity,
nickname,
tuneartist,
tunelenght,
tunerating,
tunesource,
tunetitle,
tunetrack,
loclatitude,
loclongitude,
localtitude,
@ -213,38 +213,38 @@ class ContactDAO extends SQL {
created,
updated,
jid)
values (
:fn,
:name,
:date,
:url,
:email,
:adrlocality,
:adrpostalcode,
:adrcountry,
:gender,
:marital,
:description,
:mood,
:activity,
:nickname,
:tuneartist,
:tunelenght,
:tunerating,
:tunesource,
:tunetitle,
:tunetrack,
:loclatitude,
:loclongitude,
:localtitude,
@ -267,38 +267,38 @@ class ContactDAO extends SQL {
:created,
:updated,
:jid)';
$this->prepare(
'Contact',
'Contact',
array(
'fn' => $contact->fn,
'name' => $contact->name,
'date' => $contact->date,
'url' => $contact->url,
'email' => $contact->email,
'adrlocality' => $contact->adrlocality,
'adrpostalcode' => $contact->adrpostalcode,
'adrcountry' => $contact->adrcountry,
'gender' => $contact->gender,
'marital' => $contact->marital,
'description' => $contact->description,
// User Mood (contain serialized array) - XEP 0107
'mood' => $contact->mood,
// User Activity (contain serialized array) - XEP 0108
'activity' => $contact->activity,
// User Nickname - XEP 0172
'nickname' => $contact->nickname,
// User Tune - XEP 0118
'tuneartist' => $contact->tuneartist,
'tunelenght' => $contact->tunelenght,
@ -306,8 +306,8 @@ class ContactDAO extends SQL {
'tunesource' => $contact->tunesource,
'tunetitle' => $contact->tunetitle,
'tunetrack' => $contact->tunetrack,
// User Location
// User Location
'loclatitude' => $contact->loclatitude,
'loclongitude' => $contact->loclongitude,
'localtitude' => $contact->localtitude,
@ -321,7 +321,7 @@ class ContactDAO extends SQL {
'loctext' => $contact->loctext,
'locuri' => $contact->locuri,
'loctimestamp' => $contact->loctimestamp,
'twitter' => $contact->twitter,
'skype' => $contact->skype,
'yahoo' => $contact->yahoo,
@ -330,34 +330,34 @@ class ContactDAO extends SQL {
'created' => date(DATE_ISO8601),
'updated' => date(DATE_ISO8601),
'jid' => $contact->jid
)
);
$this->run('Contact');
$this->run('Contact');
}
}
function getAll() {
$this->_sql =
'select *, privacy.value as privacy from contact
left outer join privacy
$this->_sql =
'select *, privacy.value as privacy from contact
left outer join privacy
on contact.jid = privacy.pkey';
$this->prepare('Contact');
return $this->run('Contact');
}
function searchJid($search) {
$this->_sql =
function searchJid($search) {
$this->_sql =
'select *, privacy.value as privacy from contact
left outer join privacy
left outer join privacy
on contact.jid = privacy.pkey
where jid like :jid
and privacy.value = 1
order by jid';
$this->prepare(
'Contact',
array(
@ -366,26 +366,26 @@ class ContactDAO extends SQL {
);
return $this->run('Contact');
}
function getAllPublic($limitf = false, $limitr = false) {
$this->_sql =
'select *, privacy.value as privacy from contact
left outer join privacy
function getAllPublic($limitf = false, $limitr = false) {
$this->_sql =
'select *, privacy.value as privacy from contact
left outer join privacy
on contact.jid = privacy.pkey
where privacy.value = 1
order by updated desc';
if($limitr)
if($limitr)
$this->_sql = $this->_sql.' limit '.$limitr.' offset '.$limitf;
$this->prepare('Contact');
return $this->run('Contact');
}
function countAllPublic() {
$this->_sql =
'select count(*) from contact
left outer join privacy
function countAllPublic() {
$this->_sql =
'select count(*) from contact
left outer join privacy
on contact.jid = privacy.pkey
where privacy.value = 1';
@ -393,25 +393,25 @@ class ContactDAO extends SQL {
$results = $this->run(null, 'array');
$results = array_values($results[0]);
return (int)$results[0];
return (int)$results[0];
}
function cleanRoster() {
$this->_sql = '
delete from rosterlink
where session = :session';
$this->prepare(
'RosterLink',
'RosterLink',
array(
'session' => $this->_user
)
);
return $this->run('RosterLink');
}
function getRoster() {
$this->_sql = '
select
@ -439,14 +439,14 @@ class ContactDAO extends SQL {
on rosterlink.jid = contact.jid
where rosterlink.session = :session
order by groupname, rosterlink.jid, presence.value';
$this->prepare(
'RosterLink',
'RosterLink',
array(
'session' => $this->_user
)
);
return $this->run('RosterContact');
}
@ -469,60 +469,60 @@ class ContactDAO extends SQL {
on rosterlink.jid = contact.jid
where rosterlink.session = :session
order by groupname, rosterlink.jid';
$this->prepare(
'RosterLink',
'RosterLink',
array(
'session' => $this->_user
)
);
return $this->run('RosterContact');
}
function getRosterChat() {
$this->_sql = '
select * from rosterlink
select * from rosterlink
left outer join (
select * from presence
order by presence.priority desc
) as presence
on rosterlink.jid = presence.jid
on rosterlink.jid = presence.jid
left outer join contact
on rosterlink.jid = contact.jid
where rosterlink.session = :session
and rosterlink.chaton > 0
order by rosterlink.groupname, rosterlink.jid, presence.value';
$this->prepare(
'RosterLink',
'RosterLink',
array(
'session' => $this->_user
)
);
return $this->run('RosterContact');
return $this->run('RosterContact');
}
function getRosterFrom() {
$this->_sql = '
select * from rosterlink
select * from rosterlink
left outer join contact
on rosterlink.jid = contact.jid
where rosterlink.session = :session
and rosterlink.rostersubscription = :rostersubscription';
$this->prepare(
'RosterLink',
'RosterLink',
array(
'session' => $this->_user,
'rostersubscription' => 'from'
)
);
return $this->run('RosterContact');
return $this->run('RosterContact');
}
function getRosterItem($jid, $item = false) {
$this->_sql = '
select
@ -551,22 +551,22 @@ class ContactDAO extends SQL {
where rosterlink.session = :session
and rosterlink.jid = :jid
order by groupname, rosterlink.jid, presence.value';
$this->prepare(
'RosterLink',
'RosterLink',
array(
'session' => $this->_user,
'jid' => $jid
)
);
if($item)
return $this->run('RosterContact');
return $this->run('RosterContact');
else
return $this->run('RosterContact', 'item');
}
function getPresence($jid, $resource) {
function getPresence($jid, $resource) {
$this->_sql = '
select * from contact
right outer join presence on contact.jid = presence.mucjid
@ -574,35 +574,35 @@ class ContactDAO extends SQL {
and presence.jid = :jid
and presence.resource = :resource
order by mucaffiliation desc';
$this->prepare(
'Presence',
'Presence',
array(
'session' => $this->_user,
'jid' => $jid,
'resource' => $resource
)
);
return $this->run('PresenceContact', 'item');
}
function getPresences($jid) {
function getPresences($jid) {
$this->_sql = '
select * from contact
right outer join presence on contact.jid = presence.mucjid
where presence.session = :session
and presence.jid = :jid
order by mucaffiliation desc';
$this->prepare(
'Presence',
'Presence',
array(
'session' => $this->_user,
'jid' => $jid
)
);
return $this->run('PresenceContact');
}
@ -612,76 +612,76 @@ class ContactDAO extends SQL {
left outer join presence on contact.jid = presence.jid
where contact.jid = :jid
and presence.session = :session';
$this->prepare(
'RosterLink',
'RosterLink',
array(
'session' => $this->_user,
'jid' => $this->_user
)
);
if($item)
return $this->run('RosterContact');
return $this->run('RosterContact');
else
return $this->run('RosterContact', 'item');
}
function getTop($limit = 5) {
function getTop($limit = 6) {
$this->_sql = '
select *, jidfrom from (
select jidfrom, count(*) as count from message
where jidfrom not like :jid
and session = :jid
and type != \'groupchat\'
group by jidfrom
group by jidfrom
order by count desc
limit :tunelenght
) as top
join (
select *
from rosterlink
where session = :jid
) as rosterlink on jidfrom = rosterlink.jid
left outer join contact on jidfrom = contact.jid
left outer join (
select a.*
from presence a
join (
select a.*
from presence a
join (
select jid, min( id ) as id
from presence
from presence
where session = :jid
group by jid
group by jid
) as b on ( a.id = b.id )
) presence on jidfrom = presence.jid
left outer join (
select *
from rosterlink
where session = :jid
) as rosterlink on jidfrom = rosterlink.jid
order by value is null';
order by count desc
limit :tunelenght';
$this->prepare(
'Contact',
'Contact',
array(
'jid' => $this->_user,
'tunelenght' => $limit // And an another hack…
)
);
return $this->run('RosterContact');
return $this->run('RosterContact');
}
function getStatistics() {
$this->_sql = '
select
select
(select count(*) from postn where postn.session = :session ) as post,
(select count(*) from rosterlink where rosterlink.session= :session ) as rosterlink,
(select count(*) from presence where presence.session= :session ) as presence,
(select count(*) from message where message.session = :session) as message;';
$this->prepare(
'Postn',
'Postn',
array(
'session' => $this->_user
)
);
return $this->run(null, 'array');
return $this->run(null, 'array');
}
}

2
app/widgets/AccountNext/_accountnext_oob.tpl

@ -1,7 +1,7 @@
<ul class="thick">
<li class="condensed">
<span class="icon bubble color blue">
<i class="zmdi zmdi-keyboard-arrow-right"></i>
<i class="zmdi zmdi-chevron-right"></i>
</span>
<p>
{$c->__('oob.about')}

2
app/widgets/AccountNext/accountnext.tpl

@ -2,7 +2,7 @@
<div id="subscription_form" class="padded_right">
<ul class="simple thick">
<li>
<span>{$c->__('create.title')} {$c->__('on')} {$host}</span>
<span>{$c->__('create.title')} {$c->__('create.server_on')} {$host}</span>
<p>{$c->__('create.loading')}</p>
</li>
</ul>

2
app/widgets/AccountNext/locales.ini

@ -1,7 +1,7 @@
[create]
title = Create a new account
notfound = No account creation form found on the server
on = on
server_on = on
successfull = Your acccount has been successfully registered
loading = Loading

2
app/widgets/Chat/Chat.php

@ -507,7 +507,7 @@ class Chat extends WidgetBase
$cd = new \Modl\ContactDAO;
$view->assign('presencestxt', getPresencesTxt());
$view->assign('top', $cd->getTop(10));
$view->assign('top', $cd->getTop(8));
return $view->draw('_chat_empty', true);
}

2
app/widgets/Header/_header_chat.tpl

@ -2,7 +2,7 @@
<ul class="active">
<li onclick="Rooms_ajaxAdd()">
<span class="icon">
<i class="zmdi zmdi-group-add"></i>
<i class="zmdi zmdi-accounts-add"></i>
</span>
</li>
</ul>

2
app/widgets/Hello/Hello.php

@ -10,7 +10,7 @@ class Hello extends WidgetBase
{
$c = new Chats;
$c->ajaxOpen($jid);
RPC::call('movim_redirect', $this->route('chat', $jid));
}

2
app/widgets/Hello/hello.tpl

@ -79,7 +79,7 @@
{/if}
<span class="info">{$value->published|strtotime|prepareDate}</span>
<p class="more">
{if="current(explode('.', $value->origin)) != 'nsfw'"}
{$value->contentcleaned|strip_tags:'<img><img/>'}

6
app/widgets/Menu/_menu_list.tpl

@ -3,7 +3,7 @@
<div id="menu_refresh"></div>
<ul class="thick active divided spaced" id="menu_wrapper">
{/if}
{loop="$items"}
<li
tabindex="{$page*$paging+$key+1}"
@ -56,11 +56,11 @@
{/loop}
{if="count($items) == $paging"}
<li id="history" onclick="{$history} this.parentNode.removeChild(this);">
<span class="icon"><i class="zmdi zmdi-history"></i></span>
<span class="icon"><i class="zmdi zmdi-time-restore"></i></span>
{$c->__('post.older')}
</li>
{/if}
{if="$page == 0"}
</ul>
{/if}

2
app/widgets/Menu/_menu_refresh.tpl

@ -1,6 +1,6 @@
<ul class="thick active">
<li class="condensed" onclick="{$refresh} Notification_ajaxClear('news');">
<span class="icon"><i class="zmdi zmdi-loop"></i></span>
<span class="icon"><i class="zmdi zmdi-refresh-sync"></i></span>
<span> {$c->__('button.refresh')}</span>
<p>{$c->__('post.new_items', $count)}</p>
</li>

2
app/widgets/Post/_post_empty.tpl

@ -29,12 +29,12 @@
{$value->node}
{/if}
</span>
<!--<span class="info">{$value->published|strtotime|prepareDate}</span>-->
<p class="more">
{if="current(explode('.', $value->origin)) != 'nsfw'"}
{$value->contentcleaned|strip_tags:'<img><img/>'}
{/if}
</p>
<span class="info">{$value->published|strtotime|prepareDate}</span>
</li>
{/if}
{/loop}

4
app/widgets/Publish/_publish_help.tpl

@ -51,13 +51,13 @@
</li>
<li class="block large">
<span class="icon">
<i class="zmdi zmdi-insert-link"></i>
<i class="zmdi zmdi-link"></i>
</span>
<p>[my text](http://my_url/)</p>
</li>
<li class="block large">
<span class="icon">
<i class="zmdi zmdi-insert-photo"></i>
<i class="zmdi zmdi zmdi-image"></i>
</span>
<p>![Alt text](http://my_image_url/)</p>
</li>

8
app/widgets/Subscribe/subscribe.tpl

@ -21,9 +21,9 @@
<span class="info">
<img
class="flag"
title="{$value->geo_country}"
alt="{$value->geo_country}"
src="{$c->flagPath($value->geo_country)}"/>
title="{$value->geo_country}"
alt="{$value->geo_country}"
src="{$c->flagPath($value->geo_country)}"/>
</span>
<span>{$value->domain}</span>
<p>
@ -37,7 +37,7 @@
<li class="block condensed">
<span class="icon bubble color orange">
<i class="zmdi zmdi-plus-circle-outline"></i>
<i class="zmdi zmdi-globe-alt"></i>
</span>
<span>{$c->__('subscribe.server_question')}</span>
<p>

Loading…
Cancel
Save