Merge remote-tracking branch 'friendica/master'
This commit is contained in:
commit
6f79cde024
2
boot.php
2
boot.php
|
@ -9,7 +9,7 @@ require_once('include/nav.php');
|
|||
require_once('include/cache.php');
|
||||
|
||||
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
||||
define ( 'FRIENDICA_VERSION', '2.3.1288' );
|
||||
define ( 'FRIENDICA_VERSION', '2.3.1289' );
|
||||
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
||||
define ( 'DB_UPDATE_VERSION', 1133 );
|
||||
|
||||
|
|
|
@ -1582,9 +1582,10 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
|||
|
||||
if(count($r)) {
|
||||
if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($datarray['title']),
|
||||
dbesc($datarray['body']),
|
||||
dbesc($datarray['tag']),
|
||||
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
|
||||
dbesc($item_id),
|
||||
intval($importer['uid'])
|
||||
|
@ -1727,9 +1728,10 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
|||
|
||||
if(count($r)) {
|
||||
if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($datarray['title']),
|
||||
dbesc($datarray['body']),
|
||||
dbesc($datarray['tag']),
|
||||
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
|
||||
dbesc($item_id),
|
||||
intval($importer['uid'])
|
||||
|
@ -1800,7 +1802,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
|||
// but otherwise there's a possible data mixup on the sender's system.
|
||||
// the tgroup delivery code called from item_store will correct it if it's a forum,
|
||||
// but we're going to unconditionally correct it here so that the post will always be owned by our contact.
|
||||
logger('local_delivery: Correcting item owner.', LOGGER_DEBUG);
|
||||
logger('consume_feed: Correcting item owner.', LOGGER_DEBUG);
|
||||
$datarray['owner-name'] = $contact['name'];
|
||||
$datarray['owner-link'] = $contact['url'];
|
||||
$datarray['owner-avatar'] = $contact['thumb'];
|
||||
|
@ -2332,9 +2334,10 @@ function local_delivery($importer,$data) {
|
|||
|
||||
if(count($r)) {
|
||||
if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($datarray['title']),
|
||||
dbesc($datarray['body']),
|
||||
dbesc($datarray['tag']),
|
||||
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
|
||||
dbesc($item_id),
|
||||
intval($importer['importer_uid'])
|
||||
|
@ -2497,9 +2500,10 @@ function local_delivery($importer,$data) {
|
|||
|
||||
if(count($r)) {
|
||||
if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($datarray['title']),
|
||||
dbesc($datarray['body']),
|
||||
dbesc($datarray['tag']),
|
||||
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
|
||||
dbesc($item_id),
|
||||
intval($importer['importer_uid'])
|
||||
|
|
|
@ -1338,3 +1338,16 @@ function file_tag_unsave_file($uid,$item,$file) {
|
|||
function normalise_openid($s) {
|
||||
return trim(str_replace(array('http://','https://'),array('',''),$s),'/');
|
||||
}
|
||||
|
||||
|
||||
function undo_post_tagging($s) {
|
||||
$matches = null;
|
||||
$cnt = preg_match_all('/([@#])\[url=(.*?)\](.*?)\[\/url\]/ism',$s,$matches,PREG_SET_ORDER);
|
||||
if($cnt) {
|
||||
foreach($matches as $mtch) {
|
||||
$s = str_replace($mtch[0], $mtch[1] . $mtch[3],$s);
|
||||
}
|
||||
}
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ function editpost_content(&$a) {
|
|||
'$wait' => t('Please wait'),
|
||||
'$permset' => t('Permission settings'),
|
||||
'$ptyp' => $itm[0]['type'],
|
||||
'$content' => $itm[0]['body'],
|
||||
'$content' => undo_post_tagging($itm[0]['body']),
|
||||
'$post_id' => $post_id,
|
||||
'$baseurl' => $a->get_baseurl(),
|
||||
'$defloc' => $a->user['default-location'],
|
||||
|
|
19
mod/item.php
19
mod/item.php
|
@ -177,10 +177,11 @@ function item_post(&$a) {
|
|||
$verb = $orig_post['verb'];
|
||||
$emailcc = $orig_post['emailcc'];
|
||||
$app = $orig_post['app'];
|
||||
|
||||
$categories = $orig_post['file'];
|
||||
$body = escape_tags(trim($_REQUEST['body']));
|
||||
$private = $orig_post['private'];
|
||||
$pubmail_enable = $orig_post['pubmail'];
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
|
@ -213,8 +214,10 @@ function item_post(&$a) {
|
|||
$coord = notags(trim($_REQUEST['coord']));
|
||||
$verb = notags(trim($_REQUEST['verb']));
|
||||
$emailcc = notags(trim($_REQUEST['emailcc']));
|
||||
|
||||
$body = escape_tags(trim($_REQUEST['body']));
|
||||
|
||||
// $categories = TODO
|
||||
|
||||
$private = ((strlen($str_group_allow) || strlen($str_contact_allow) || strlen($str_group_deny) || strlen($str_contact_deny)) ? 1 : 0);
|
||||
|
||||
if(($parent_item) &&
|
||||
|
@ -242,8 +245,6 @@ function item_post(&$a) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(! strlen($body)) {
|
||||
if($preview)
|
||||
killme();
|
||||
|
@ -500,6 +501,7 @@ function item_post(&$a) {
|
|||
$datarray['location'] = $location;
|
||||
$datarray['coord'] = $coord;
|
||||
$datarray['tag'] = $str_tags;
|
||||
$datarray['file'] = $categories;
|
||||
$datarray['inform'] = $inform;
|
||||
$datarray['verb'] = $verb;
|
||||
$datarray['allow_cid'] = $str_contact_allow;
|
||||
|
@ -559,9 +561,12 @@ function item_post(&$a) {
|
|||
|
||||
|
||||
if($orig_post) {
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
dbesc($title),
|
||||
dbesc($body),
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `attach` = '%s', `file` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
dbesc($datarray['title']),
|
||||
dbesc($datarray['body']),
|
||||
dbesc($datarray['tag']),
|
||||
dbesc($datarray['attach']),
|
||||
dbesc($datarray['file']),
|
||||
dbesc(datetime_convert()),
|
||||
intval($post_id),
|
||||
intval($profile_uid)
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<section><?php if(x($page,'content')) echo $page['content']; ?>
|
||||
<div id="page-footer"></div>
|
||||
</section>
|
||||
<right_aside><?php if(x($page,'right_aside')) echo $page['right_aside']; ?></right_aside>
|
||||
<footer><?php if(x($page,'footer')) echo $page['footer']; ?></footer>
|
||||
</body>
|
||||
</html>
|
||||
|
|
43
view/theme/diabook/communityhome.tpl
Executable file
43
view/theme/diabook/communityhome.tpl
Executable file
|
@ -0,0 +1,43 @@
|
|||
{{ if $lastusers_title }}
|
||||
<h3 style="margin-top:0px;">Help or #NewHere?</h3>
|
||||
<a href="https://helpers.pyxis.uberspace.de/profile/helpers" style="margin-left: 10px; color:#000;" title="Friendica Support" target="blank">Friendica Support</a><br>
|
||||
<a href="https://letstalk.pyxis.uberspace.de/profile/letstalk" style="margin-left: 10px; color:#000;" title="Let's talk" target="blank">Let's talk</a><br>
|
||||
<a href="http://kakste.com/profile/newhere" title="#NewHere" style="margin-left: 10px; color:#000;" target="blank">NewHere</a>
|
||||
{{ endif }}
|
||||
|
||||
{{ if $lastusers_title }}
|
||||
<h3>$lastusers_title</h3>
|
||||
<div class='items-wrapper'>
|
||||
{{ for $lastusers_items as $i }}
|
||||
$i
|
||||
{{ endfor }}
|
||||
</div>
|
||||
{{ endif }}
|
||||
|
||||
{{ if $activeusers_title }}
|
||||
<h3>$activeusers_title</h3>
|
||||
<div class='items-wrapper'>
|
||||
{{ for $activeusers_items as $i }}
|
||||
$i
|
||||
{{ endfor }}
|
||||
</div>
|
||||
{{ endif }}
|
||||
|
||||
{{ if $photos_title }}
|
||||
<h3>$photos_title</h3>
|
||||
<div class='items-wrapper'>
|
||||
{{ for $photos_items as $i }}
|
||||
$i
|
||||
{{ endfor }}
|
||||
</div>
|
||||
{{ endif }}
|
||||
|
||||
|
||||
{{ if $like_title }}
|
||||
<h3>$like_title</h3>
|
||||
<ul id='likes'>
|
||||
{{ for $like_items as $i }}
|
||||
<li>$i</li>
|
||||
{{ endfor }}
|
||||
</ul>
|
||||
{{ endif }}
|
10
view/theme/diabook/directory_item.tpl
Executable file
10
view/theme/diabook/directory_item.tpl
Executable file
|
@ -0,0 +1,10 @@
|
|||
|
||||
<div class="directory-item" id="directory-item-$id" >
|
||||
<div class="directory-photo-wrapper" id="directory-photo-wrapper-$id" >
|
||||
<div class="directory-photo" id="directory-photo-$id" >
|
||||
<a href="$profile-link" class="directory-profile-link" id="directory-profile-link-$id" >
|
||||
<img class="directory-photo-img" src="$photo" alt="$alt-text" title="$alt-text" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
{{ if $pdesc }}<div class="title">$profile.pdesc</div>{{ endif }}
|
||||
<div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="$profile.photo?rev=$profile.picdate" alt="$profile.name" /></div>
|
||||
<div id="profile-photo-wrapper"><img class="photo" width="155" height="155" src="$profile.photo?rev=$profile.picdate" alt="$profile.name" /></div>
|
||||
|
||||
|
||||
|
||||
|
|
20
view/theme/diabook/right_aside.tpl
Normal file
20
view/theme/diabook/right_aside.tpl
Normal file
|
@ -0,0 +1,20 @@
|
|||
<div id="profile_side">
|
||||
<div id="ps-usernameicon">
|
||||
<a href="$ps.usermenu.status.0" title="$userinfo.name">
|
||||
<img src="$userinfo.icon" id="ps-usericon" alt="$userinfo.name">
|
||||
</a>
|
||||
<a href="$ps.usermenu.status.0" id="ps-username" title="$userinfo.name">$userinfo.name</a>
|
||||
</div>
|
||||
|
||||
<ul id="profile-side-menu" class="menu-profile-side">
|
||||
<li id="profile-side-status" class="menu-profile-list home"><a class="menu-profile-list-item" href="$ps.usermenu.status.0">$ps.usermenu.status.1</a></li>
|
||||
<li id="profile-side-photos" class="menu-profile-list photos"><a class="menu-profile-list-item" href="$ps.usermenu.photos.0">$ps.usermenu.photos.1</a></li>
|
||||
<li id="profile-side-events" class="menu-profile-list events"><a class="menu-profile-list-item" href="$ps.usermenu.events.0">$ps.usermenu.events.1</a></li>
|
||||
<li id="profile-side-notes" class="menu-profile-list notes"><a class="menu-profile-list-item" href="$ps.usermenu.notes.0">$ps.usermenu.notes.1</a></li>
|
||||
<li id="profile-side-foren" class="menu-profile-list foren"><a class="menu-profile-list-item" href="http://dir.friendika.com/directory/forum" target="blanc">Public Groups</a></li>
|
||||
<li id="profile-side-foren" class="menu-profile-list com_side"><a class="menu-profile-list-item" href="$ps.usermenu.community.0">$ps.usermenu.community.1</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
|
2461
view/theme/diabook/style-network.css
Normal file
2461
view/theme/diabook/style-network.css
Normal file
File diff suppressed because it is too large
Load diff
2461
view/theme/diabook/style-profile.css
Normal file
2461
view/theme/diabook/style-profile.css
Normal file
File diff suppressed because it is too large
Load diff
|
@ -102,7 +102,6 @@
|
|||
.icon.recycle { background-image: url("../../../view/theme/diabook/icons/recycle.png");}
|
||||
.icon.remote-link { background-image: url("../../../view/theme/diabook/icons/remote.png");}
|
||||
.icon.tagged { background-image: url("../../../view/theme/diabook/icons/tagged.png");}
|
||||
.icon.file-as { background-image: url("../../../view/theme/diabook/icons/file_as.png");}
|
||||
.star-item.icon.unstarred { background-image: url("../../../view/theme/diabook/icons/unstarred.png");}
|
||||
.star-item.icon.starred { background-image: url("../../../view/theme/diabook/icons/starred.png");}
|
||||
.icon.link { background-image: url("../../../view/theme/diabook/icons/link.png");}
|
||||
|
|
|
@ -11,9 +11,10 @@ $a->theme_info = array(
|
|||
'extends' => 'diabook',
|
||||
);
|
||||
|
||||
//profile_side
|
||||
|
||||
//profile_side at networkpages
|
||||
|
||||
if($is_url = preg_match ("/\bnetwork\b/i", $_SERVER['REQUEST_URI'])) {
|
||||
//
|
||||
|
||||
$nav['usermenu']=array();
|
||||
$userinfo = null;
|
||||
|
@ -36,19 +37,261 @@ $ps['usermenu'][events] = Array('events/', t('Events'), "", t('Your events'));
|
|||
$ps['usermenu'][notes] = Array('notes/', t('Personal notes'), "", t('Your personal photos'));
|
||||
$ps['usermenu'][community] = Array('community/', t('Community'), "", "");
|
||||
|
||||
if($is_url = preg_match ("/\bnetwork\b/i", $_SERVER['REQUEST_URI'])) {
|
||||
|
||||
$tpl = get_markup_template('profile_side.tpl');
|
||||
|
||||
$a->page['aside'] .= replace_macros($tpl, array(
|
||||
'$userinfo' => $userinfo,
|
||||
'$ps' => $ps,
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
//right_aside at networkpages
|
||||
|
||||
// last 12 users
|
||||
$aside['$lastusers_title'] = t('Last users');
|
||||
$aside['$lastusers_items'] = array();
|
||||
$sql_extra = "";
|
||||
$publish = (get_config('system','publish_all') ? '' : " AND `publish` = 1 " );
|
||||
$order = " ORDER BY `register_date` DESC ";
|
||||
|
||||
$r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`
|
||||
FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
|
||||
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra $order LIMIT %d , %d ",
|
||||
0,
|
||||
12
|
||||
);
|
||||
$tpl = file_get_contents( dirname(__file__).'/directory_item.tpl');
|
||||
if(count($r)) {
|
||||
$photo = 'thumb';
|
||||
foreach($r as $rr) {
|
||||
$profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
|
||||
$entry = replace_macros($tpl,array(
|
||||
'$id' => $rr['id'],
|
||||
'$profile-link' => $profile_link,
|
||||
'$photo' => $rr[$photo],
|
||||
'$alt-text' => $rr['name'],
|
||||
));
|
||||
$aside['$lastusers_items'][] = $entry;
|
||||
}
|
||||
}
|
||||
|
||||
// last 10 liked items
|
||||
$aside['$like_title'] = t('Last likes');
|
||||
$aside['$like_items'] = array();
|
||||
$r = q("SELECT `T1`.`created`, `T1`.`liker`, `T1`.`liker-link`, `item`.* FROM
|
||||
(SELECT `parent-uri`, `created`, `author-name` AS `liker`,`author-link` AS `liker-link`
|
||||
FROM `item` WHERE `verb`='http://activitystrea.ms/schema/1.0/like' GROUP BY `parent-uri` ORDER BY `created` DESC) AS T1
|
||||
INNER JOIN `item` ON `item`.`uri`=`T1`.`parent-uri`
|
||||
WHERE `T1`.`liker-link` LIKE '%s%%' OR `item`.`author-link` LIKE '%s%%'
|
||||
GROUP BY `uri`
|
||||
ORDER BY `T1`.`created` DESC
|
||||
LIMIT 0,10",
|
||||
$a->get_baseurl(),$a->get_baseurl()
|
||||
);
|
||||
|
||||
foreach ($r as $rr) {
|
||||
$author = '<a href="' . $rr['liker-link'] . '">' . $rr['liker'] . '</a>';
|
||||
$objauthor = '<a href="' . $rr['author-link'] . '">' . $rr['author-name'] . '</a>';
|
||||
|
||||
//var_dump($rr['verb'],$rr['object-type']); killme();
|
||||
switch($rr['verb']){
|
||||
case 'http://activitystrea.ms/schema/1.0/post':
|
||||
switch ($rr['object-type']){
|
||||
case 'http://activitystrea.ms/schema/1.0/event':
|
||||
$post_type = t('event');
|
||||
break;
|
||||
default:
|
||||
$post_type = t('status');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if ($rr['resource-id']){
|
||||
$post_type = t('photo');
|
||||
$m=array(); preg_match("/\[url=([^]]*)\]/", $rr['body'], $m);
|
||||
$rr['plink'] = $m[1];
|
||||
} else {
|
||||
$post_type = t('status');
|
||||
}
|
||||
}
|
||||
$plink = '<a href="' . $rr['plink'] . '">' . $post_type . '</a>';
|
||||
|
||||
$aside['$like_items'][] = sprintf( t('%1$s likes %2$s\'s %3$s'), $author, $objauthor, $plink);
|
||||
|
||||
}
|
||||
// last 12 photos
|
||||
$aside['$photos_title'] = t('Last photos');
|
||||
$aside['$photos_items'] = array();
|
||||
$r = q("SELECT `photo`.`id`, `photo`.`resource-id`, `photo`.`scale`, `photo`.`desc`, `user`.`nickname`, `user`.`username` FROM
|
||||
(SELECT `resource-id`, MAX(`scale`) as maxscale FROM `photo`
|
||||
WHERE `profile`=0 AND `contact-id`=0 AND `album` NOT IN ('Contact Photos', '%s', 'Profile Photos', '%s')
|
||||
AND `allow_cid`='' AND `allow_gid`='' AND `deny_cid`='' AND `deny_gid`='' GROUP BY `resource-id`) AS `t1`
|
||||
INNER JOIN `photo` ON `photo`.`resource-id`=`t1`.`resource-id` AND `photo`.`scale` = `t1`.`maxscale`,
|
||||
`user`
|
||||
WHERE `user`.`uid` = `photo`.`uid`
|
||||
AND `user`.`blockwall`=0
|
||||
ORDER BY `photo`.`edited` DESC
|
||||
LIMIT 0, 12",
|
||||
dbesc(t('Contact Photos')),
|
||||
dbesc(t('Profile Photos'))
|
||||
);
|
||||
if(count($r)) {
|
||||
$tpl = file_get_contents( dirname(__file__).'/directory_item.tpl');
|
||||
foreach($r as $rr) {
|
||||
$photo_page = $a->get_baseurl() . '/photos/' . $rr['nickname'] . '/image/' . $rr['resource-id'];
|
||||
$photo_url = $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] .'.jpg';
|
||||
|
||||
$entry = replace_macros($tpl,array(
|
||||
'$id' => $rr['id'],
|
||||
'$profile-link' => $photo_page,
|
||||
'$photo' => $photo_url,
|
||||
'$alt-text' => $rr['username']." : ".$rr['desc'],
|
||||
));
|
||||
|
||||
$aside['$photos_items'][] = $entry;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$tpl = file_get_contents(dirname(__file__).'/communityhome.tpl');
|
||||
$a->page['right_aside'] = replace_macros($tpl, $aside);
|
||||
|
||||
}
|
||||
|
||||
//right_aside at profile pages
|
||||
|
||||
if($is_url = preg_match ("/\bprofile\b/i", $_SERVER['REQUEST_URI'])) {
|
||||
//right_aside
|
||||
|
||||
// last 12 users
|
||||
$aside['$lastusers_title'] = t('Last users');
|
||||
$aside['$lastusers_items'] = array();
|
||||
$sql_extra = "";
|
||||
$publish = (get_config('system','publish_all') ? '' : " AND `publish` = 1 " );
|
||||
$order = " ORDER BY `register_date` DESC ";
|
||||
|
||||
$r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`
|
||||
FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
|
||||
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra $order LIMIT %d , %d ",
|
||||
0,
|
||||
12
|
||||
);
|
||||
$tpl = file_get_contents( dirname(__file__).'/directory_item.tpl');
|
||||
if(count($r)) {
|
||||
$photo = 'thumb';
|
||||
foreach($r as $rr) {
|
||||
$profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
|
||||
$entry = replace_macros($tpl,array(
|
||||
'$id' => $rr['id'],
|
||||
'$profile-link' => $profile_link,
|
||||
'$photo' => $rr[$photo],
|
||||
'$alt-text' => $rr['name'],
|
||||
));
|
||||
$aside['$lastusers_items'][] = $entry;
|
||||
}
|
||||
}
|
||||
|
||||
// last 10 liked items
|
||||
$aside['$like_title'] = t('Last likes');
|
||||
$aside['$like_items'] = array();
|
||||
$r = q("SELECT `T1`.`created`, `T1`.`liker`, `T1`.`liker-link`, `item`.* FROM
|
||||
(SELECT `parent-uri`, `created`, `author-name` AS `liker`,`author-link` AS `liker-link`
|
||||
FROM `item` WHERE `verb`='http://activitystrea.ms/schema/1.0/like' GROUP BY `parent-uri` ORDER BY `created` DESC) AS T1
|
||||
INNER JOIN `item` ON `item`.`uri`=`T1`.`parent-uri`
|
||||
WHERE `T1`.`liker-link` LIKE '%s%%' OR `item`.`author-link` LIKE '%s%%'
|
||||
GROUP BY `uri`
|
||||
ORDER BY `T1`.`created` DESC
|
||||
LIMIT 0,10",
|
||||
$a->get_baseurl(),$a->get_baseurl()
|
||||
);
|
||||
|
||||
foreach ($r as $rr) {
|
||||
$author = '<a href="' . $rr['liker-link'] . '">' . $rr['liker'] . '</a>';
|
||||
$objauthor = '<a href="' . $rr['author-link'] . '">' . $rr['author-name'] . '</a>';
|
||||
|
||||
//var_dump($rr['verb'],$rr['object-type']); killme();
|
||||
switch($rr['verb']){
|
||||
case 'http://activitystrea.ms/schema/1.0/post':
|
||||
switch ($rr['object-type']){
|
||||
case 'http://activitystrea.ms/schema/1.0/event':
|
||||
$post_type = t('event');
|
||||
break;
|
||||
default:
|
||||
$post_type = t('status');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if ($rr['resource-id']){
|
||||
$post_type = t('photo');
|
||||
$m=array(); preg_match("/\[url=([^]]*)\]/", $rr['body'], $m);
|
||||
$rr['plink'] = $m[1];
|
||||
} else {
|
||||
$post_type = t('status');
|
||||
}
|
||||
}
|
||||
$plink = '<a href="' . $rr['plink'] . '">' . $post_type . '</a>';
|
||||
|
||||
$aside['$like_items'][] = sprintf( t('%1$s likes %2$s\'s %3$s'), $author, $objauthor, $plink);
|
||||
|
||||
}
|
||||
// last 12 photos
|
||||
$aside['$photos_title'] = t('Last photos');
|
||||
$aside['$photos_items'] = array();
|
||||
$r = q("SELECT `photo`.`id`, `photo`.`resource-id`, `photo`.`scale`, `photo`.`desc`, `user`.`nickname`, `user`.`username` FROM
|
||||
(SELECT `resource-id`, MAX(`scale`) as maxscale FROM `photo`
|
||||
WHERE `profile`=0 AND `contact-id`=0 AND `album` NOT IN ('Contact Photos', '%s', 'Profile Photos', '%s')
|
||||
AND `allow_cid`='' AND `allow_gid`='' AND `deny_cid`='' AND `deny_gid`='' GROUP BY `resource-id`) AS `t1`
|
||||
INNER JOIN `photo` ON `photo`.`resource-id`=`t1`.`resource-id` AND `photo`.`scale` = `t1`.`maxscale`,
|
||||
`user`
|
||||
WHERE `user`.`uid` = `photo`.`uid`
|
||||
AND `user`.`blockwall`=0
|
||||
ORDER BY `photo`.`edited` DESC
|
||||
LIMIT 0, 12",
|
||||
dbesc(t('Contact Photos')),
|
||||
dbesc(t('Profile Photos'))
|
||||
);
|
||||
if(count($r)) {
|
||||
$tpl = file_get_contents( dirname(__file__).'/directory_item.tpl');
|
||||
foreach($r as $rr) {
|
||||
$photo_page = $a->get_baseurl() . '/photos/' . $rr['nickname'] . '/image/' . $rr['resource-id'];
|
||||
$photo_url = $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] .'.jpg';
|
||||
|
||||
$entry = replace_macros($tpl,array(
|
||||
'$id' => $rr['id'],
|
||||
'$profile-link' => $photo_page,
|
||||
'$photo' => $photo_url,
|
||||
'$alt-text' => $rr['username']." : ".$rr['desc'],
|
||||
));
|
||||
|
||||
$aside['$photos_items'][] = $entry;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$tpl = file_get_contents(dirname(__file__).'/communityhome.tpl');
|
||||
$a->page['right_aside'] = replace_macros($tpl, $aside);
|
||||
|
||||
}
|
||||
|
||||
//change css on network and profilepages
|
||||
$cssFile = null;
|
||||
|
||||
if($is_url = preg_match ("/\bnetwork\b/i", $_SERVER['REQUEST_URI'])) {
|
||||
$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook/style-network.css";
|
||||
}
|
||||
|
||||
if($is_url = preg_match ("/\bprofile\b/i", $_SERVER['REQUEST_URI'])) {
|
||||
$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook/style-profile.css";
|
||||
}
|
||||
|
||||
|
||||
|
||||
//js scripts
|
||||
$a->page['htmlhead'] .= <<< EOT
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="$cssFile" />
|
||||
|
||||
<script>
|
||||
|
||||
//contacts
|
||||
|
|
Loading…
Reference in a new issue