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(); }
/** * remote bookmark * * https://yoursite/rbmark?f=&title=&url=&private=&remote_return= * * This can be called via either GET or POST, use POST for long body content as suhosin often limits GET parameter length * * f= placeholder, often required * title= link text * url= URL to bookmark * ischat=1 if this bookmark is a chatroom * private= Don't share this link * remote_return= absolute URL to return after posting is finished * */ function rbmark_post(&$a) { if ($_POST['submit'] !== t('Save')) { return; } logger('rbmark_post: ' . print_r($_REQUEST, true)); $channel = $a->get_channel(); $t = array('url' => escape_tags($_REQUEST['url']), 'term' => escape_tags($_REQUEST['title'])); bookmark_add($channel, $channel, $t, x($_REQUEST, 'private') ? intval($_REQUEST['private']) : 0, array('menu_id' => x($_REQUEST, 'menu_id') ? intval($_REQUEST['menu_id']) : 0, 'menu_name' => x($_REQUEST, 'menu_name') ? escape_tags($_REQUEST['menu_name']) : '', 'ischat' => x($_REQUEST['ischat']) ? intval($_REQUEST['ischat']) : 0)); goaway(z_root() . '/bookmarks'); }
function init() { if (!local_channel()) { return; } $item_id = intval($_REQUEST['item']); $burl = trim($_REQUEST['burl']); if (!$item_id) { return; } $u = \App::get_channel(); $item_normal = item_normal(); $i = q("select * from item where id = %d and uid = %d {$item_normal} limit 1", intval($item_id), intval(local_channel())); if (!$i) { return; } $i = fetch_post_tags($i); $item = $i[0]; $terms = get_terms_oftype($item['term'], TERM_BOOKMARK); if ($terms) { 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) { if ($burl) { if ($burl == $t['url']) { bookmark_add($u, $s[0], $t, $item['item_private']); } } else { bookmark_add($u, $s[0], $t, $item['item_private']); } info(t('Bookmark added') . EOL); } } killme(); }
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GForge; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ require_once '../env.inc.php'; require_once $gfwww . 'include/pre.php'; require_once $gfwww . 'include/bookmarks.php'; site_user_header(array("title" => _('My Personal Page'))); $bookmark_url = trim(getStringFromRequest('bookmark_url')); $bookmark_title = trim(getStringFromRequest('bookmark_title')); if (getStringFromRequest('submit') && $bookmark_url && $bookmark_title) { printf(_('Added bookmark for <strong>%1$s</strong> with title <strong>%2$s</strong>'), htmlspecialchars(stripslashes($bookmark_url)), htmlspecialchars(stripslashes($bookmark_title))) . ".<p> </p>"; bookmark_add($bookmark_url, $bookmark_title); print "<a href=\"{$bookmark_url}\">" . _('Visit the bookmarked page') . "</a> - "; print "<a href=\"/my/\">" . _('Back to your homepage') . "</a>"; } else { ?> <form action="<?php echo getStringFromServer('PHP_SELF'); ?> " method="post"> <p><?php echo _('Bookmark URL'); ?> :<br /> <input type="text" name="bookmark_url" value="http://" /> </p> <p><?php
/** * Used to load the requested page from POST or GET * @global type $input */ function load_page() { global $input; $action = $input['action']; $redraw = false; // // Actions // // Controller goes here switch ($action) { // The user clicked on an album, we display its content to them // Display the help page case 'view_help': view_help(); break; case 'view_settings': view_settings(); break; // In case we want to log out // In case we want to log out case 'logout': user_logout(); break; // The only case when we could possibly arrive here with a session created // and a "login" action is when the user refreshed the page. In that case, // we redraw the page with the last information saved in the session variables. // The only case when we could possibly arrive here with a session created // and a "login" action is when the user refreshed the page. In that case, // we redraw the page with the last information saved in the session variables. case 'login': redraw_page(); break; case 'anonymous_login': anonymous_login(); break; case 'admin_mode_update': admin_mode_update(); break; case 'view_album_assets': view_album_assets(); break; case 'view_asset_details': view_asset_details(); break; case 'view_asset_bookmark': view_asset_bookmark(); break; case 'search_bookmark': bookmarks_search(); break; case 'sort_asset_bookmark': bookmarks_sort(); break; case 'add_asset_bookmark': bookmark_add(); break; case 'add_asset_thread': thread_add(); break; case 'add_thread_comment': comment_add(); break; case 'add_thread_comment_answer': comment_add_reply(); break; case 'update_thread_comment': comment_edit(); break; case 'update_asset_thread': thread_edit(); break; case 'thread_details_view': thread_details_update(); break; case 'delete_asset_thread': thread_delete(); break; case 'delete_thread_comment': comment_delete(); break; case 'edit_settings': preferences_update(); break; case 'edit_asset_meta': asset_edit_meta(); break; case 'vote': vote_add(); break; case 'approve': comment_edit_approval(); break; case 'threads_list_view': threads_list_update(); break; case 'copy_bookmark': bookmark_copy(); break; case 'share_popup': share_popup(); break; case 'bookmark_popup': bookmark_popup(); break; case 'bookmarks_popup': bookmarks_popup(); break; case 'remove_asset_bookmark': bookmark_delete(); break; case 'remove_asset_bookmarks': bookmarks_delete_all(); break; case 'view_import': view_import(); break; case 'upload_bookmarks': bookmarks_upload(); break; case 'import_bookmarks': bookmarks_import(); break; case 'export_bookmarks': bookmarks_export(); break; case 'export_album_bookmarks': bookmarks_export_all(); break; case 'export_asset_bookmarks': bookmarks_export_all(true); break; case 'delete_bookmarks': bookmarks_delete(); break; case 'move_album_token': album_token_move(); break; case 'delete_album_token': album_token_delete(); break; case 'client_trace': client_trace(); break; // No action selected: we choose to display the homepage again // No action selected: we choose to display the homepage again default: // TODO: check session var here view_main(); } }