mirror of
https://github.com/friendica/friendica
synced 2024-12-27 06:00:15 +00:00
Merge remote branch 'upstream/master'
This commit is contained in:
commit
5fadf68fb4
12 changed files with 375 additions and 34 deletions
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)
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
<aside><?php if(x($page,'aside')) echo $page['aside']; ?></aside>
|
||||
<section><?php if(x($page,'content')) echo $page['content']; ?>
|
||||
<div id="page-footer"></div>
|
||||
</section>
|
||||
</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>
|
||||
|
|
42
view/theme/diabook/communityhome.tpl
Executable file
42
view/theme/diabook/communityhome.tpl
Executable file
|
@ -0,0 +1,42 @@
|
|||
{{ 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>
|
||||
|
||||
|
|
@ -385,7 +385,7 @@
|
|||
.hide-comments-outer {
|
||||
margin-left: 80px;
|
||||
margin-bottom: 5px;
|
||||
width: 684px;
|
||||
width: 484px;
|
||||
border-bottom: 1px solid #BDCDD4;
|
||||
border-top: 1px solid #BDCDD4;
|
||||
|
||||
|
@ -928,8 +928,8 @@ ul.menu-popup .empty {
|
|||
aside {
|
||||
display: table-cell;
|
||||
vertical-align: top;
|
||||
width: 180px;
|
||||
padding: 0px 10px 0px 20px;
|
||||
width: 160px;
|
||||
padding: 0px 10px 0px 10px;
|
||||
border-right: 1px solid #D2D2D2;
|
||||
float: left;
|
||||
/* background: #F1F1F1; */
|
||||
|
@ -988,13 +988,13 @@ aside #profiles-menu {
|
|||
width: 20em;
|
||||
}
|
||||
aside #search-text {
|
||||
width: 173px;
|
||||
width: 150px;
|
||||
}
|
||||
aside #side-follow-url {
|
||||
width: 173px;
|
||||
width: 150px;
|
||||
}
|
||||
aside #side-peoplefind-url {
|
||||
width: 173px;
|
||||
width: 150px;
|
||||
}
|
||||
#contact-block {
|
||||
overflow: auto;
|
||||
|
@ -1096,7 +1096,7 @@ aside #side-peoplefind-url {
|
|||
section {
|
||||
display: table-cell;
|
||||
vertical-align: top;
|
||||
width: 800px;
|
||||
width: auto;
|
||||
padding: 0px 0px 0px 12px;
|
||||
}
|
||||
|
||||
|
@ -1145,13 +1145,31 @@ body .pageheader{
|
|||
#birthday-notice, #event-notice, #birthday-wrapper, #event-wrapper{
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
right_aside {
|
||||
display: table-cell;
|
||||
vertical-align: top;
|
||||
width: 160px;
|
||||
padding-right: 10px;
|
||||
/*border-left: 1px solid #D2D2D2;*/
|
||||
|
||||
/* background: #F1F1F1; */
|
||||
}
|
||||
right_aside h3 {border-bottom: 1px solid #D2D2D2; padding-top: 5px; padding-bottom: 0px; padding-left: 5px; margin-bottom: 0px;
|
||||
margin-top:30px;}
|
||||
right_aside .directory-item { width: 50px; height: 50px; vertical-align: center; text-align: center; }
|
||||
right_aside .directory-photo { margin: 0px; }
|
||||
right_aside .directory-photo-img { max-width: 45px; max-height: 45px; }
|
||||
right_aside #likes { margin: 0px; padding: 0px; list-style: none; }
|
||||
right_aside .items-wrapper{ overflow: auto; width: 100%; border-bottom: 1px solid #D2D2D2;}
|
||||
|
||||
/* wall item */
|
||||
.tread-wrapper {
|
||||
border-bottom: 1px solid #D2D2D2;
|
||||
position: relative;
|
||||
padding: 5px;
|
||||
margin-bottom: 0px;
|
||||
width: 775px;
|
||||
width: 575px;
|
||||
}
|
||||
.wall-item-decor {
|
||||
position: absolute;
|
||||
|
@ -1162,7 +1180,7 @@ body .pageheader{
|
|||
|
||||
.wall-item-container {
|
||||
display: table;
|
||||
width: 780px;
|
||||
width: 580px;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1275,7 +1293,7 @@ body .pageheader{
|
|||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
margin-left: 80px;
|
||||
width: 700px;
|
||||
width: 500px;
|
||||
border-bottom: 1px solid hsl(198, 21%, 79%);
|
||||
}
|
||||
.wall-item-container.comment .contact-photo {
|
||||
|
@ -1450,7 +1468,7 @@ body .pageheader{
|
|||
display: none;
|
||||
}
|
||||
#jot {
|
||||
width: 785px;
|
||||
width: 585px;
|
||||
margin: 0px 2em 20px 0px;
|
||||
}
|
||||
#profile-jot-form #profile-jot-text {
|
||||
|
@ -1467,7 +1485,7 @@ body .pageheader{
|
|||
padding: 0px;
|
||||
height: 40px;
|
||||
overflow: none;
|
||||
width: 783px;
|
||||
width: 583px;
|
||||
background-color: #fff;
|
||||
border-bottom: 2px solid #9eabb0;
|
||||
}
|
||||
|
@ -1556,7 +1574,7 @@ body .pageheader{
|
|||
font-weight: normal;
|
||||
}
|
||||
#profile-jot-form #profile-jot-text_parent #profile-jot-text_tbl{
|
||||
width: 785px;
|
||||
width: 585px;
|
||||
height: 100px;
|
||||
}
|
||||
#jot #jot-title:hover {
|
||||
|
@ -1591,12 +1609,12 @@ body .pageheader{
|
|||
}
|
||||
#profile-jot-wrapper{
|
||||
margin: 0 2em 20px 0;
|
||||
width: 785px;
|
||||
width: 585px;
|
||||
}
|
||||
|
||||
#profile-jot-submit-wrapper {
|
||||
margin-bottom: 50px;
|
||||
width: 785px;
|
||||
width: 585px;
|
||||
}
|
||||
|
||||
#profile-jot-submit {
|
||||
|
|
|
@ -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,14 +37,241 @@ $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);
|
||||
|
||||
}
|
||||
|
||||
//js scripts
|
||||
|
|
Loading…
Reference in a new issue