Browse Source

- Clean old commented codes

- Show subscription state in ServerNodes
- CSS fix
pull/16/head
Jaussoin Timothée 12 years ago
parent
commit
a0f8fe7184
  1. 60
      app/models/cache/CacheDAO.php
  2. 1
      app/models/caps/Caps.php
  3. 51
      app/models/caps/CapsDAO.php
  4. 178
      app/models/contact/ContactDAO.php
  5. 79
      app/models/message/MessageDAO.php
  6. 2
      app/models/node/Node.php
  7. 80
      app/models/node/NodeDAO.php
  8. 433
      app/models/postn/PostnDAO.php
  9. 186
      app/models/rosterlink/RosterLinkDAO.php
  10. 82
      app/models/session/SessionDAO.php
  11. 98
      app/models/subscription/SubscriptionDAO.php
  12. 10
      app/widgets/ServerNodes/ServerNodes.php
  13. 1
      bootstrap.php
  14. 2
      themes/movim/css/style.css

60
app/models/cache/CacheDAO.php

@ -3,28 +3,7 @@
namespace modl;
class CacheDAO extends ModlSQL {
/*function create() {
$sql = '
drop table if exists CacheVar';
$this->_db->query($sql);
$sql = '
create table if not exists `CacheVar` (
`id` binary(40) NOT NULL,
`key` varchar(128) DEFAULT NULL,
`data` LONGTEXT,
`checksum` varchar(64) DEFAULT NULL,
`timestamp` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) CHARACTER SET utf8 COLLATE utf8_bin
';
$this->_db->query($sql);
}*/
function get($key) {
//$sql = 'select * from CacheVar where CacheVar.key=\''.$key.'\'';
//return $this->mapper('Cache', $this->_db->query($sql), 'item');
$this->_sql = '
select * from cache
where
@ -41,7 +20,6 @@ class CacheDAO extends ModlSQL {
}
function set(Cache $cache) {
$this->_sql = '
update cache
set data = :data,
@ -79,43 +57,5 @@ class CacheDAO extends ModlSQL {
return $this->run('Cache');
}
/*$request = $this->_db->prepare('
update CacheVar
set data = ?,
checksum = ?,
timestamp = ?
where id = ?');
$hash = sha1($cache->key);
$request->bind_param(
'ssis',
$cache->data,
$cache->checksum,
$cache->timestamp,
$hash
);
$request->execute();
if($this->_db->affected_rows == 0) {
$request = $this->_db->prepare('
insert into CacheVar
(`id`,`key`, `data`, `checksum`, `timestamp`)
values (?,?,?,?,?)');
$request->bind_param(
'ssssi',
$hash,
$cache->key,
$cache->data,
$cache->checksum,
$cache->timestamp
);
$request->execute();
}
$request->close();*/
}
}

1
app/models/caps/Caps.php

@ -26,7 +26,6 @@ class Caps extends ModlModel {
}
public function set($query, $node = false) {
\movim_log($query);
if(!$node)
$this->node = (string)$query->query->attributes()->node;
else

51
app/models/caps/CapsDAO.php

@ -3,30 +3,7 @@
namespace modl;
class CapsDAO extends ModlSQL {
/*function create() {
$sql = '
drop table if exists Caps';
$this->_db->query($sql);
$sql = '
create table if not exists `Caps` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`node` varchar(256) DEFAULT NULL,
`category` varchar(128) DEFAULT NULL,
`type` varchar(128) DEFAULT NULL,
`name` varchar(128) DEFAULT NULL,
`features` text,
PRIMARY KEY (`id`)
) CHARACTER SET utf8 COLLATE utf8_bin
';
$this->_db->query($sql);
}*/
function get($node) {
//$sql = 'select * from Caps where node=\''.$node.'\'';
//return $this->mapper('Caps', $this->_db->query($sql), 'item');
$this->_sql = '
select * from caps
where
@ -43,9 +20,6 @@ class CapsDAO extends ModlSQL {
}
function getAll() {
//$sql = 'select * from Caps';
//return $this->mapper('Caps', $this->_db->query($sql));
$this->_sql = '
select * from caps';
@ -57,31 +31,6 @@ class CapsDAO extends ModlSQL {
}
function set(Caps $caps) {
/*$request = $this->prepare('
insert into Caps
(node,
category,
type,
name,
features
)
values(
?,?,?,?,?
)', $caps);
$request->bind_param(
'sssss',
$caps->node,
$caps->category,
$caps->type,
$caps->name,
$caps->features
);
$request->execute();
$request->close();*/
$this->_sql = '
insert into caps
(

178
app/models/contact/ContactDAO.php

@ -328,13 +328,13 @@ class ContactDAO extends ModlSQL {
function cleanRoster() {
$this->_sql = '
delete from RosterLink
where RosterLink.key = :key';
delete from rosterlink
where session = :session';
$this->prepare(
'RosterLink',
array(
'key' => $this->_user
'session' => $this->_user
)
);
@ -358,113 +358,9 @@ class ContactDAO extends ModlSQL {
);
return $this->run('RosterContact');
/*$this->_sql = '
select
RosterLink.jid,
contact.fn,
contact.nickname,
contact.name,
contact.phototype,
contact.photobin,
contact.loclatitude,
contact.loclongitude,
contact.localtitude,
contact.loccountry,
contact.loccountrycode,
contact.locregion,
contact.locpostalcode,
contact.loclocality,
contact.locstreet,
contact.locbuilding,
contact.loctext,
contact.locuri,
contact.loctimestamp,
contact.mood,
contact.tuneartist,
contact.tunelenght,
contact.tunerating,
contact.tunesource,
contact.tunetitle,
contact.tunetrack,
RosterLink.rostername,
RosterLink.group,
Presence.status,
Presence.ressource,
Presence.presence,
Presence.delay,
Presence.last,
Presence.node,
Presence.ver
from RosterLink left outer join
(
select * from Presence
where Presence.key=\''.$this->_user.'\'
group by jid, node, ver
order by presence) as Presence
on Presence.jid = RosterLink.jid
left join contact on RosterLink.jid = contact.jid
where RosterLink.key=\''.$this->_user.'\'
group by RosterLink.jid
order by RosterLink.group';
return $this->mapper('RosterContact', $this->_db->query($sql));*/
}
function getRosterChat() {
/*
* $sql = '
select
RosterLink.jid,
contact.fn,
contact.nickname,
contact.name,
contact.phototype,
contact.photobin,
contact.loclatitude,
contact.loclongitude,
contact.localtitude,
contact.loccountry,
contact.loccountrycode,
contact.locregion,
contact.locpostalcode,
contact.loclocality,
contact.locstreet,
contact.locbuilding,
contact.loctext,
contact.locuri,
contact.loctimestamp,
contact.mood,
contact.tuneartist,
contact.tunelenght,
contact.tunerating,
contact.tunesource,
contact.tunetitle,
contact.tunetrack,
RosterLink.rostername,
RosterLink.groupname,
RosterLink.chaton,
Presence.status,
Presence.ressource,
Presence.presence,
Presence.delay,
Presence.last,
Presence.node,
Presence.ver
from RosterLink left outer join
(
select * from Presence
where Presence.key=\''.$this->_user.'\'
group by jid, node, ver
order by presence) as Presence
on Presence.jid = RosterLink.jid
left join contact on RosterLink.jid = contact.jid
where RosterLink.key=\''.$this->_user.'\'
and RosterLink.chaton > 0
group by RosterLink.jid
order by RosterLink.groupname';
return $this->mapper('RosterContact', $this->_db->query($sql));
*/
$this->_sql = '
select * from rosterlink
left outer join (
@ -476,7 +372,7 @@ class ContactDAO extends ModlSQL {
left outer join contact
on rosterlink.jid = contact.jid
where rosterlink.session = :session
and rosterLink.chaton > 0
and rosterlink.chaton > 0
order by rosterlink.groupname, presence.value, rosterlink.jid';
$this->prepare(
@ -490,60 +386,6 @@ class ContactDAO extends ModlSQL {
}
function getRosterItem($jid) {
/*$sql = '
select
RosterLink.jid,
contact.fn,
contact.nickname,
contact.name,
contact.url,
contact.phototype,
contact.photobin,
contact.loclatitude,
contact.loclongitude,
contact.localtitude,
contact.loccountry,
contact.loccountrycode,
contact.locregion,
contact.locpostalcode,
contact.loclocality,
contact.locstreet,
contact.locbuilding,
contact.loctext,
contact.locuri,
contact.loctimestamp,
contact.mood,
contact.tuneartist,
contact.tunelenght,
contact.tunerating,
contact.tunesource,
contact.tunetitle,
contact.tunetrack,
RosterLink.rostername,
RosterLink.groupname,
RosterLink.chaton,
Presence.status,
Presence.ressource,
Presence.presence,
Presence.delay,
Presence.last,
Presence.node,
Presence.ver,
RosterLink.rosterask
from RosterLink
left outer join
(
select * from Presence
where Presence.key=\''.$this->_user.'\'
and Presence.jid=\''.$jid.'\'
group by jid, node, ver
order by presence) as Presence
on Presence.jid = RosterLink.jid
left outer join contact on RosterLink.jid = contact.jid
where RosterLink.key=\''.$this->_user.'\'
and RosterLink.jid=\''.$this->_db->real_escape_string($jid).'\';';
return $this->mapper('RosterContact', $this->_db->query($sql), 'item'); */
$this->_sql = '
select * from rosterlink
left outer join (
@ -632,7 +474,7 @@ class ContactDAO extends ModlSQL {
$this->_sql = '
select
(select count(*) from postn where postn.session = :session ) as post,
(select count(*) from rosterLink where rosterLink.session= :session ) as rosterLink,
(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;';
@ -644,15 +486,5 @@ class ContactDAO extends ModlSQL {
);
return $this->run(null, 'array');
/*
$sql = '
select
(select count(*) from Postn where Postn.key = \''.$this->_user.'\' ) as Post,
(select count(*) from RosterLink where RosterLink.key = \''.$this->_user.'\' ) as RosterLink,
(select count(*) from Presence where Presence.key = \''.$this->_user.'\' ) as Presence,
(select count(*) from Message where Message.key = \''.$this->_user.'\') as Message';
$resultset = $this->_db->query($sql);
return $resultset->fetch_array(MYSQLI_ASSOC); */
}
}

79
app/models/message/MessageDAO.php

@ -3,31 +3,6 @@
namespace modl;
class MessageDAO extends ModlSQL {
/*function create() {
$sql = '
drop table if exists Message';
$this->_db->query($sql);
$sql = '
create table if not exists Message (
`id` int(11) NOT NULL AUTO_INCREMENT,
`key` varchar(128) DEFAULT NULL,
`to` varchar(128) DEFAULT NULL,
`from` varchar(128) DEFAULT NULL,
`ressource` varchar(128) DEFAULT NULL,
`type` varchar(20) DEFAULT NULL,
`subject` text,
`thread` varchar(128) DEFAULT NULL,
`body` text,
`published` datetime DEFAULT NULL,
`delivered` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) AUTO_INCREMENT=10 CHARACTER SET utf8 COLLATE utf8_bin';
$this->_db->query($sql);
}*/
function set(Message $message) {
$this->_sql = '
insert into Message
@ -72,57 +47,9 @@ class MessageDAO extends ModlSQL {
);
return $this->run('Message');
/*$request = $this->_db->prepare('
insert into Message
(`key`,
`to`,
`from`,
`ressource`,
`type`,
`subject`,
`thread`,
`body`,
`published`,
`delivered`)
values(
?,?,?,?,?,
?,?,?,?,?
)');
$request->bind_param(
'ssssssssss',
$message->key,
$message->to,
$message->from,
$message->ressource,
$message->type,
$message->subject,
$message->thread,
$message->body,
$message->published,
$message->delivered
);
$request->execute();
$request->close();*/
}
function getContact($jid, $limitf = false, $limitr = false) {
/*
$sql = '
select * from Message
where Message.key = \''.$this->_user->getLogin().'\'
and (Message.from = \''.$this->_db->real_escape_string($jid).'\'
or Message.to = \''.$this->_db->real_escape_string($jid).'\')
order by Message.published desc';
if($limitr)
$sql = $sql.' limit '.$limitf.','.$limitr;
return array_reverse($this->mapper('Message', $this->_db->query($sql)));
*/
$this->_sql = '
select * from message
where session = :session
@ -158,11 +85,5 @@ class MessageDAO extends ModlSQL {
);
return $this->run('Message');
/*
$sql = '
delete from Message
where Message.key=\''.$this->_user->getLogin().'\'';
return $this->_db->query($sql);*/
}
}

2
app/models/node/Node.php

@ -8,7 +8,7 @@ class Node extends ModlModel {
public $title;
public $config;
public $updated;
public $number;
public $subscription;
public function __construct() {
$this->_struct = "

80
app/models/node/NodeDAO.php

@ -3,23 +3,6 @@
namespace modl;
class NodeDAO extends ModlSQL {
/*function create() {
$sql = '
drop table if exists Node';
$this->_db->query($sql);
$sql = '
create table if not exists Node (
serverid varchar(45) NOT NULL,
nodeid varchar(45) NOT NULL,
title varchar(128) DEFAULT NULL,
config text,
updated datetime NOT NULL
) CHARACTER SET utf8 COLLATE utf8_bin';
$this->_db->query($sql);
}*/
function set(Node $node) {
$this->_sql = '
update node
@ -72,64 +55,9 @@ class NodeDAO extends ModlSQL {
$this->run('Node');
}
/*$request = $this->_db->prepare('
update Node
set config = ?,
title = ?,
updated = ?
where serverid = ?
and nodeid = ?');
$request->bind_param(
'sssss',
$node->config,
$node->title,
$node->updated,
$node->serverid,
$node->nodeid
);
$result = $request->execute();
if($this->_db->affected_rows == 0) {
$request = $this->_db->prepare('
insert into Node
(serverid,
nodeid,
config,
title,
updated
)
values(
?,?,?,?,?
)');
$request->bind_param(
'sssss',
$node->serverid,
$node->nodeid,
$node->config,
$node->title,
$node->updated
);
$request->execute();
}
$request->close();*/
}
function getServers() {
/*$sql = '
select serverid, count(nodeid) as number
from Node
where nodeid not like \'urn:xmpp:microblog:0:comments/%\'
group by serverid
order by number desc';
$resultset = $this->_db->query($sql);
return $this->mapper('Server', $this->_db->query($sql));*/
$this->_sql = '
select serverid, count(nodeid) as number
from node
@ -167,11 +95,17 @@ class NodeDAO extends ModlSQL {
$this->_sql = '
select * from node
where serverid= :serverid';
left outer join (select server, node, subscription from subscription where jid = :nodeid)
as s on s.server = node.serverid
and s.node = node.nodeid
where serverid= :serverid
order by node.title, nodeid';
$this->prepare(
'Node',
array(
// Dirty hack, using nodeid param to inject the session key
'nodeid' => $this->_user,
'serverid' => $serverid
)
);

433
app/models/postn/PostnDAO.php

@ -3,46 +3,6 @@
namespace modl;
class PostnDAO extends ModlSQL {
/*function create() {
$sql = '
drop table if exists Postn';
$this->_db->query($sql);
$sql = '
create table if not exists Postn (
`id` binary(40) NOT NULL,
`key` varchar(128) DEFAULT NULL,
`from` varchar(128) DEFAULT NULL,
`node` varchar(128) DEFAULT NULL,
`nodeid` varchar(128) DEFAULT NULL,
`aname` varchar(128) DEFAULT NULL,
`aid` varchar(128) DEFAULT NULL,
`title` varchar(128) DEFAULT NULL,
`content` text,
`commentplace`varchar(128) DEFAULT NULL,
`published`datetime DEFAULT NULL,
`updated` datetime DEFAULT NULL,
`delay` datetime DEFAULT NULL,
`lat` varchar(128) DEFAULT NULL,
`lon` varchar(128) DEFAULT NULL,
`links` text,
`tags` text,
`hash` varchar(128) DEFAULT NULL,
PRIMARY KEY (id)
) CHARACTER SET utf8 COLLATE utf8_bin;';
$this->_db->query($sql);
}*/
function set(Postn $post) {
$this->_sql = '
update postn
@ -71,6 +31,95 @@ class PostnDAO extends ModlSQL {
and node = :node
and nodeid = :nodeid';
$this->prepare(
'Postn',
array(
'aname' => $post->aname,
'aid' => $post->aid,
'title' => $post->title,
'content' => $post->content,
'commentplace' => $post->commentplace,
'published' => $post->published,
'updated' => $post->updated,
'delay' => $post->delay,
'lat' => $post->lat,
'lon' => $post->lon,
'links' => $post->links,
'tags' => $post->tags,
'hash' => $post->hash,
'session' => $post->session,
'jid' => $post->jid,
'node' => $post->node,
'nodeid' => $post->nodeid
)
);
$this->run('Postn');
if(!$this->_effective) {
$this->_sql ='
insert into postn
(
session,
jid,
node,
nodeid,
aname,
aid,
title,
content,
commentplace,
published,
updated,
delay,
lat,
lon,
links,
tags,
hash)
values(
:session,
:jid,
:node,
:nodeid,
:aname,
:aid,
:title,
:content,
:commentplace,
:published,
:updated,
:delay,
:lat,
:lon,
:links,
:tags,
:hash
)';
$this->prepare(
'Postn',
array(
@ -102,215 +151,7 @@ class PostnDAO extends ModlSQL {
);
$this->run('Postn');
if(!$this->_effective) {
$this->_sql ='
insert into postn
(
session,
jid,
node,
nodeid,
aname,
aid,
title,
content,
commentplace,
published,
updated,
delay,
lat,
lon,
links,
tags,
hash)
values(
:session,
:jid,
:node,
:nodeid,
:aname,
:aid,
:title,
:content,
:commentplace,
:published,
:updated,
:delay,
:lat,
:lon,
:links,
:tags,
:hash
)';
$this->prepare(
'Postn',
array(
'aname' => $post->aname,
'aid' => $post->aid,
'title' => $post->title,
'content' => $post->content,
'commentplace' => $post->commentplace,
'published' => $post->published,
'updated' => $post->updated,
'delay' => $post->delay,
'lat' => $post->lat,
'lon' => $post->lon,
'links' => $post->links,
'tags' => $post->tags,
'hash' => $post->hash,
'session' => $post->session,
'jid' => $post->jid,
'node' => $post->node,
'nodeid' => $post->nodeid
)
);
$this->run('Postn');
}
/*
$request = $this->prepare('
update Postn
set `aname` = ?,
`aid` = ?,
`title` = ?,
`content` = ?,
`commentplace` = ?,
`published` = ?,
`updated` = ?,
`delay` = ?,
`lat` = ?,
`lon` = ?,
`links` = ?,
`tags` = ?,
`hash` = ?
where `id` = ?', $post);
where `key` = ?
and `from` = ?
and `node` = ?
and `nodeid` = ?', $post);
$hash = sha1(
$post->key.
$post->from.
$post->node.
$post->nodeid
);
$request->bind_param(
'ssssssssssssss',
$post->aname,
$post->aid,
$post->title,
$post->content,
$post->commentplace,
$post->published,
$post->updated,
$post->delay,
$post->lat,
$post->lon,
$post->links,
$post->tags,
$post->hash,
$hash
);
$result = $request->execute();
if($this->_db->affected_rows == 0) {
$request = $this->prepare('
insert into Postn
(
`id`,
`key`,
`from`,
`node`,
`nodeid`,
`aname`,
`aid`,
`title`,
`content`,
`commentplace`,
`published`,
`updated`,
`delay`,
`lat`,
`lon`,
`links`,
`tags`,
`hash`)
values(
?,?,?,?,?,
?,?,?,?,?,
?,?,?,?,?,
?,?,?
)', $post);
$request->bind_param(
'ssssssssssssssssss',
$hash,
$post->key,
$post->from,
$post->node,
$post->nodeid,
$post->aname,
$post->aid,
$post->title,
$post->content,
$post->commentplace,
$post->published,
$post->updated,
$post->delay,
$post->lat,
$post->lon,
$post->links,
$post->tags,
$post->hash
);
$request->execute();
}
$request->close();*/
}
function delete($nodeid) {
@ -326,30 +167,9 @@ class PostnDAO extends ModlSQL {
);
return $this->run('Message');
/*$from = $this->_db->real_escape_string($from);
$nodeid = $this->_db->real_escape_string($nodeid);
$sql = '
delete from Postn
where nodeid=\''.$nodeid.'\'';
return $this->_db->query($sql); */
}
function getNode($from, $node, $limitf = false, $limitr = false) {
/*$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.key
where Postn.key = \''.$this->_user->getLogin().'\'
and Postn.from = \''.$from.'\'
and Postn.node = \''.$node.'\'
order by Postn.published desc';
if($limitr)
$sql = $sql.' limit '.$limitf.','.$limitr;
return $this->mapper('ContactPostn', $this->_db->query($sql));*/
$this->_sql = '
select *, postn.aid, privacy.value as privacy from postn
left outer join contact on postn.aid = contact.jid
@ -375,23 +195,6 @@ class PostnDAO extends ModlSQL {
}
function getFeed($limitf = false, $limitr = false) {
/*
* $sql = '
select *, Postn.aid as jid, Privacy.value as privacy from Postn
left outer join Contact on Postn.aid = Contact.jid
left outer join Privacy on Postn.nodeid = Privacy.key
where Postn.key = \''.$this->_user->getLogin().'\'
and Postn.node like \'urn:xmpp:microblog:0\'
and (Postn.from in (select RosterLink.jid from RosterLink where RosterLink.key = \''.$this->_user->getLogin().'\')
or Postn.from = \''.$this->_user->getLogin().'\')
order by Postn.published desc';
if($limitr)
$sql = $sql.' limit '.$limitf.','.$limitr;
return $this->mapper('ContactPostn', $this->_db->query($sql));
*/
$this->_sql = '
select *, postn.aid as jid, privacy.value as privacy from postn
left outer join contact on postn.aid = contact.jid
@ -416,24 +219,6 @@ class PostnDAO extends ModlSQL {
}
function getNews($limitf = false, $limitr = false) {
/*$sql = '
select *, Postn.aid as jid from Postn
left outer join Contact on Postn.aid = Contact.jid
left outer join Subscription on
Postn.key = Subscription.jid and
Postn.from = Subscription.server and
Postn.node = Subscription.node
where Postn.key = \''.$this->_user->getLogin().'\'
and Postn.node not like \'urn:xmpp:microblog:0:comments/%\'
and Postn.node not like \'urn:xmpp:inbox\'
and subscription is not null
order by Postn.published desc';
if($limitr)
$sql = $sql.' limit '.$limitf.','.$limitr;
return $this->mapper('ContactPostn', $this->_db->query($sql));*/
$this->_sql = '
select *, postn.aid as jid from postn
left outer join contact on postn.aid = contact.jid
@ -462,40 +247,6 @@ class PostnDAO extends ModlSQL {
function getPublic($jid, $node) {
/*if($node != false)
$n = 'and Postn.node = \''.$node.'\' ';
$sql = '
select *, Postn.aid as jid, Privacy.value as privacy from Postn
left outer join Contact on Postn.aid = Contact.jid
join Privacy on Postn.nodeid = Privacy.key
where Postn.from = \''.$jid.'\'
'.$n.'
and Postn.node not like \'urn:xmpp:microblog:0:comments/%\'
and Privacy.value = 1
group by nodeid
order by Postn.published desc
limit 0, 20';
return $this->mapper('ContactPostn', $this->_db->query($sql)); */
/*if($node != false)
$n = 'and Postn.node = :node ';
else
$n = '';*/
/*$this->_sql = '
select *, postn.aid as jid, privacy.value as privacy from postn
left outer join contact on postn.aid = contact.jid
join privacy on postn.nodeid = privacy.pkey
where postn.jid = :jid
and Postn.node = :node
and postn.node not like \'urn:xmpp:microblog:0:comments/%\'
and privacy.value = 1
group by nodeid
order by postn.published desc';*/
//limit 0, 20';
$this->_sql = '
select *, postn.aid, privacy.value as privacy from postn
left outer join contact on postn.aid = contact.jid
@ -551,12 +302,6 @@ class PostnDAO extends ModlSQL {
}
function clearPost() {
/*$sql = '
delete from Postn
where Postn.key=\''.$this->_user->getLogin().'\'';
return $this->_db->query($sql);*/
$this->_sql = '
delete from postn
where session = :session';

186
app/models/rosterlink/RosterLinkDAO.php

@ -3,54 +3,7 @@
namespace modl;
class RosterLinkDAO extends ModlSQL {
/*function create() {
$sql = '
drop table if exists `RosterLink`';
$this->_db->query($sql);
$sql = '
create table if not exists `RosterLink` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`key` varchar(128) DEFAULT NULL,
`jid` varchar(128) DEFAULT NULL,
`rostername` varchar(128) DEFAULT NULL,
`rosterask` varchar(128) DEFAULT NULL,
`rostersubscription` varchar(128) DEFAULT NULL,
`realname` varchar(128) DEFAULT NULL,
`group` varchar(128) DEFAULT NULL,
`chaton` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) CHARACTER SET utf8 COLLATE utf8_bin';
$this->_db->query($sql);
}*/
function set(RosterLink $r) {
/*$r->key = $this->_user->getLogin();
$this->keepTransaction('
insert into RosterLink
(RosterLink.key,
jid,
rostername,
rosterask,
rostersubscription,
realname,
RosterLink.group,
chaton)
values (?,?,?,?,?,?,?,?)',
array(
'sssssssi',
$r->key,
$r->jid,
$r->rostername,
$r->rosterask,
$r->rostersubscription,
$r->realname,
$r->group,
$r->chaton),
$r
);*/
$this->_sql = '
insert into rosterlink
(
@ -117,83 +70,9 @@ class RosterLinkDAO extends ModlSQL {
);
return $this->run('RosterLink');
/*$r->key = $this->_user->getLogin();
$this->keepTransaction('
update RosterLink
set rostername = ?,
rosterask = ?,
rostersubscription = ?,
realname = ?,
RosterLink.group = ?,
chaton = ?
where RosterLink.key = ?
and jid = ?',
array(
'sssssiss',
$r->rostername,
$r->rosterask,
$r->rostersubscription,
$r->realname,
$r->group,
$r->chaton,
$r->key,
$r->jid),
$r
); */
}
function setNow(RosterLink $r) {
/*$request = $this->prepare('
update RosterLink
set rostername = ?,
rosterask = ?,
rostersubscription = ?,
realname = ?,
RosterLink.group = ?,
chaton = ?
where RosterLink.key = ?
and jid = ?', $r);
$request->bind_param(
'sssssiss',
$r->rostername,
$r->rosterask,
$r->rostersubscription,
$r->realname,
$r->group,
$r->chaton,
$r->key,
$r->jid);
$request->execute();
if($this->_db->affected_rows == 0) {
$request = $this->prepare('
insert into RosterLink
(RosterLink.key,
jid,
rostername,
rosterask,
rostersubscription,
realname,
RosterLink.group,
chaton)
values (?,?,?,?,?,?,?,?)', $r);
$request->bind_param(
'sssssssi',
$r->key,
$r->jid,
$r->rostername,
$r->rosterask,
$r->rostersubscription,
$r->realname,
$r->group,
$r->chaton);
$request->execute();
}
$request->close();*/
$this->update($r);
if(!$this->_effective)
@ -201,11 +80,6 @@ class RosterLinkDAO extends ModlSQL {
}
function setChat($jid, $chaton) {
/*$sql = 'update RosterLink set chaton ='.$chaton.'
where RosterLink.key=\''.$this->_user->getLogin().'\'
and jid=\''.$this->_db->real_escape_string($jid).'\'';
$this->_db->query($sql); */
$this->_sql = '
update rosterlink
set chaton = :chaton
@ -225,16 +99,6 @@ class RosterLinkDAO extends ModlSQL {
}
function get($jid) {
/*$key = $this->_user->getLogin();
$sql = '
select *
from RosterLink
where RosterLink.key=\''.$key.'\'
and jid =\''.$jid.'\'';
return $this->mapper('RosterLink', $this->_db->query($sql), 'item');*/
$this->_sql = '
select *
from rosterlink
@ -253,22 +117,6 @@ class RosterLinkDAO extends ModlSQL {
}
function getGroups() {
/*$key = $this->_user->getLogin();
$sql = '
select RosterLink.group
from RosterLink
where RosterLink.key=\''.$this->_db->real_escape_string($key).'\'
group by RosterLink.group';
$arr = array();
$resultset = $this->_db->query($sql);
while($r = $resultset->fetch_array( MYSQL_NUM))
array_push($arr, $r[0]);
return $arr;*/
$this->_sql = '
select groupname
from rosterlink
@ -296,14 +144,7 @@ class RosterLinkDAO extends ModlSQL {
$session = $to;
else
$session = $this->_user;
/*
$sql = '
select *
from RosterLink
where RosterLink.key=\''.$this->_db->real_escape_string($key).'\'';
return $this->mapper('RosterLink', $this->_db->query($sql));*/
$this->_sql = '
select *
from rosterlink
@ -320,16 +161,6 @@ class RosterLinkDAO extends ModlSQL {
}
function getChats() {
//$key = $this->_user->getLogin();
/*$sql = '
select *
from RosterLink
where RosterLink.key=\''.$this->_db->real_escape_string($key).'\'
and chaton > 0';
return $this->mapper('RosterLink', $this->_db->query($sql));*/
$this->_sql = '
select *
from rosterlink
@ -347,13 +178,6 @@ class RosterLinkDAO extends ModlSQL {
}
function clearRosterLink() {
/*
$sql = '
delete from RosterLink
where RosterLink.key=\''.$this->_user->getLogin().'\'';
return $this->_db->query($sql);
*/
$this->_sql = '
delete from rosterlink
where session = :session';
@ -369,14 +193,6 @@ class RosterLinkDAO extends ModlSQL {
}
function delete($jid) {
/*
$sql = '
delete from RosterLink
where RosterLink.key=\''.$this->_user->getLogin().'\'
and jid=\''.$this->_db->real_escape_string($jid).'\'';
return $this->_db->query($sql);
*/
$this->_sql = '
delete from rosterlink
where session = :session

82
app/models/session/SessionDAO.php

@ -3,76 +3,9 @@
namespace modl;
class SessionDAO extends ModlSQL {
/*function create() {
$sql = '
drop table if exists `SessionVar`';
$this->_db->query($sql);
$sql = '
create table if not exists `SessionVar` (
`id` binary(40) NOT NULL,
`name` varchar(128) DEFAULT NULL,
`value` text,
`session` varchar(128) DEFAULT NULL,
`container` varchar(128) DEFAULT NULL,
`timestamp` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) CHARACTER SET utf8 COLLATE utf8_bin';
$this->_db->query($sql);
}*/
function set($session, $container, $name, $value, $timestamp) {
$timestamp = date(DATE_ISO8601, $timestamp);
/*
$request = $this->prepare('
update SessionVar
set value = ?,
timestamp = ?
where id = ?', $session);
$hash = sha1(
$session.
$container.
$name
) ;
where session = ?
and container = ?
and name = ?', $session);
if(!$request)
return $request;
$request->bind_param(
'sis',
$value,
$timestamp,
$hash
);
$request->execute();
if($this->_db->affected_rows == 0) {
$request = $this->_db->prepare('
insert into SessionVar
(id, name, value, session, container, timestamp)
values (?,?,?,?,?,?)');
$request->bind_param(
'sssssi',
$hash,
$name,
$value,
$session,
$container,
$timestamp);
$request->execute();
}
$request->close();*/
$this->_sql = '
update session
set value = :value,
@ -136,14 +69,6 @@ class SessionDAO extends ModlSQL {
}
function delete($session, $container, $name) {
/*$sql = '
delete from SessionVar
where session = \''.$session.'\'
and container = \''.$container.'\'
and name = \''.$name.'\'';
return $this->_db->query($sql); */
$this->_sql = '
delete from session
where
@ -164,13 +89,6 @@ class SessionDAO extends ModlSQL {
}
function deleteContainer($session, $container) {
/*$sql = '
delete from SessionVar
where session = \''.$session.'\'
and container = \''.$container.'\'';
return $this->_db->query($sql);*/
$this->_sql = '
delete from session
where

98
app/models/subscription/SubscriptionDAO.php

@ -3,24 +3,6 @@
namespace modl;
class SubscriptionDAO extends ModlSQL {
/*function create() {
$sql = '
drop table if exists `Subscription`';
$this->_db->query($sql);
$sql = '
create table if not exists `Subscription` (
`jid` varchar(128) DEFAULT NULL,
`server` varchar(128) DEFAULT NULL,
`node` varchar(128) DEFAULT NULL,
`subscription` varchar(128) DEFAULT NULL,
`subid` varchar(128) DEFAULT NULL,
`timestamp` datetime DEFAULT NULL
) CHARACTER SET utf8 COLLATE utf8_bin';
$this->_db->query($sql);
}*/
function set(Subscription $s) {
$this->_sql = '
update subscription
@ -47,7 +29,7 @@ class SubscriptionDAO extends ModlSQL {
if(!$this->_effective) {
$this->_sql = '
insert into Subscription
insert into subscription
(jid, server, node, subscription, subid, timestamp)
values (:jid, :server, :node, :subscription, :subid, :timestamp)';
@ -65,58 +47,9 @@ class SubscriptionDAO extends ModlSQL {
$this->run('Subscription');
}
/*
$request = $this->_db->prepare('
update Subscription
set subscription = ?,
timestamp = ?
where jid = ?
and server = ?
and node = ?
and subid = ?');
$request->bind_param(
'ssssss',
$s->subscription,
$s->timestamp,
$s->jid,
$s->server,
$s->node,
$s->subid);
$request->execute();
if($this->_db->affected_rows == 0) {
$request = $this->_db->prepare('
insert into Subscription
(jid, server, node, subscription, subid, timestamp)
values (?,?,?,?,?,?)');
$request->bind_param(
'ssssss',
$s->jid,
$s->server,
$s->node,
$s->subscription,
$s->subid,
$s->timestamp);
$request->execute();
}
$request->close();
*/
}
function get($server, $node) {
/*$sql = '
select * from Subscription
where jid = \''.$this->_user.'\'
and server = \''.$server.'\'
and node = \''.$node.'\'';
return $this->mapper('Subscription', $this->_db->query($sql)); */
$this->_sql = '
select * from subscription
where jid = :jid
@ -136,15 +69,6 @@ class SubscriptionDAO extends ModlSQL {
}
function getSubscribed() {
/*
$sql = '
select * from Subscription
where jid = \''.$this->_user.'\'
group by server, node';
return $this->mapper('Subscription', $this->_db->query($sql));
*/
$this->_sql = '
select jid, server, node, subscription from subscription
where jid = :jid
@ -161,15 +85,6 @@ class SubscriptionDAO extends ModlSQL {
}
function deleteNode($server, $node) {
/*$sql = '
delete from Subscription
where jid = \''.$this->_user.'\'
and server = \''.$server.'\'
and node = \''.$node.'\'';
return $this->_db->query($sql);
* */
$this->_sql = '
delete from subscription
where jid = :jid
@ -189,17 +104,6 @@ class SubscriptionDAO extends ModlSQL {
}
function deleteNodeSubid($server, $node, $subid) {
/*
$sql = '
delete from Subscription
where jid = \''.$this->_user.'\'
and server = \''.$server.'\'
and node = \''.$node.'\'
and subid= \''.$subid.'\'';
return $this->_db->query($sql);
*/
$this->_sql = '
delete from subscription
where jid = :jid

10
app/widgets/ServerNodes/ServerNodes.php

@ -111,7 +111,7 @@ class ServerNodes extends WidgetCommon
$nodes = $nd->getNodes($server);
$html = '<ul class="list">';
foreach($nodes as $n) {
if (substr($n->nodeid, 0, 20) != 'urn:xmpp:microblog:0') {
@ -120,12 +120,16 @@ class ServerNodes extends WidgetCommon
$name = $n->title;
else
$name = $n->nodeid;
$tag = '';
if($n->subscription == 'subscribed')
$tag .= '<span class="tag">'.t('Subscribed').'</span>';
$html .= '
<li>
<a href="'.Route::urlize('node', array($n->serverid, $n->nodeid)).'">'.
$name.'
<span class="tag">'.$n->number.'</span>
$name.
$tag.'
</a>
</li>';
}

1
bootstrap.php

@ -241,7 +241,6 @@ class Bootstrap {
//$db->check();
return true;
//return $db->testConnection();
}
private function loadMoxl() {

2
themes/movim/css/style.css

@ -619,7 +619,7 @@ ul.list li a.action:hover {
ul.list li span.tag {
background-color: #555;
/*font-size: 0.9em;*/
padding: 0 1em;
color: white;
display: inline-block;
min-width: 3em;

Loading…
Cancel
Save