mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-24 13:15:24 +00:00
4e9bd8b8f0
adding of .generic-content-wrapper is needed and useful for derivative themes but it should not contain any styling information for redbasic theme. therefor i added .generic-content-wrapper-styled as a quickfix for spots where redbasic is not finished yet. Sidenote: please avoid opening a div in one *.tpl and close it in another or (even worse) open a div in a *.tpl and close it in an already templatified mod/*.php. This will really make the code and templates very, very confusing.
88 lines
1.6 KiB
PHP
88 lines
1.6 KiB
PHP
<?php
|
|
|
|
function bookmarks_init(&$a) {
|
|
if(! local_user())
|
|
return;
|
|
$item_id = intval($_REQUEST['item']);
|
|
if(! $item_id)
|
|
return;
|
|
|
|
$u = $a->get_channel();
|
|
|
|
$i = q("select * from item where id = %d and uid = %d limit 1",
|
|
intval($item_id),
|
|
intval(local_user())
|
|
);
|
|
|
|
if(! $i)
|
|
return;
|
|
|
|
$i = fetch_post_tags($i);
|
|
|
|
$item = $i[0];
|
|
|
|
$terms = get_terms_oftype($item['term'],TERM_BOOKMARK);
|
|
|
|
if($terms && (! $item['item_restrict'])) {
|
|
require_once('include/bookmarks.php');
|
|
|
|
$s = q("select * from xchan where xchan_hash = '%s' limit 1",
|
|
dbesc($item['author_xchan'])
|
|
);
|
|
if(! $s) {
|
|
logger('mod_bookmarks: author lookup failed.');
|
|
killme();
|
|
}
|
|
foreach($terms as $t) {
|
|
bookmark_add($u,$s[0],$t,$item['item_private']);
|
|
info( t('Bookmark added') . EOL);
|
|
}
|
|
}
|
|
killme();
|
|
}
|
|
|
|
function bookmarks_content(&$a) {
|
|
if(! local_user()) {
|
|
notice( t('Permission denied.') . EOL);
|
|
return;
|
|
}
|
|
|
|
|
|
require_once('include/menu.php');
|
|
require_once('include/conversation.php');
|
|
|
|
$channel = $a->get_channel();
|
|
|
|
$o = profile_tabs($a,true,$channel['channel_address']);
|
|
|
|
$o .= '<div class="generic-content-wrapper-styled">';
|
|
|
|
$o .= '<h3>' . t('My Bookmarks') . '</h3>';
|
|
|
|
$x = menu_list(local_user(),'',MENU_BOOKMARK);
|
|
|
|
if($x) {
|
|
foreach($x as $xx) {
|
|
$y = menu_fetch($xx['menu_name'],local_user(),get_observer_hash());
|
|
$o .= menu_render($y,'',true);
|
|
}
|
|
}
|
|
|
|
$o .= '<h3>' . t('My Connections Bookmarks') . '</h3>';
|
|
|
|
|
|
$x = menu_list(local_user(),'',MENU_SYSTEM|MENU_BOOKMARK);
|
|
|
|
if($x) {
|
|
foreach($x as $xx) {
|
|
$y = menu_fetch($xx['menu_name'],local_user(),get_observer_hash());
|
|
$o .= menu_render($y,'',true);
|
|
}
|
|
}
|
|
|
|
$o .= '</div>';
|
|
|
|
return $o;
|
|
|
|
}
|
|
|