Source for file bookmark.php
Documentation is available at bookmark.php
* A universal helper to bookmark any content object for a user
* Currently only accessible through ajax/json
* Those wishing for a non-js implementation feel free to modify
require_once( '../kernel/setup_inc.php' );
if( $gBitUser->isRegistered() ){
// verify user has access to view this content
if( $gContent->hasViewPermission() ){
if( $gContent->hasService( CONTENT_SERVICE_USERS_FAVS ) ){
// default action is to add the favorite
$_REQUEST['action'] = empty( $_REQUEST['action'] )? 'add': $_REQUEST['action'];
switch( $_REQUEST['action'] ){
$gBitUser->storeFavorite( $_REQUEST['content_id'] );
$msg = tra( 'This content has been added to your favorites' );
$gBitUser->expungeFavorite( $_REQUEST['content_id'] );
$msg = tra( 'This content has been removed from your favorites' );
$gBitSmarty->assign( 'bookmarkState', $bookmarkState );
$gBitSmarty->assign( 'contentId', $_REQUEST['content_id'] );
$msg = tra( 'You can not bookmark this type of content, bookmarking denied' );
$msg = tra( 'You do not have permission to view this content, bookmarking denied' );
$msg = tra( 'No content was specified to bookmark' );
$msg = tra( 'You must be a registered user to bookmark content' );
$gBitSmarty->assign( 'statusCode', $statusCode );
$gBitSmarty->assign( 'error', $error );
$gBitSmarty->assign( 'msg', $msg );
$gBitThemes->setFormatHeader( 'json' );
$gBitSystem->display('bitpackage:users/edit_user_fav_json.tpl', null, array( 'format' => 'center_only', 'display_mode' => 'edit' ));
|