Example #1
0
function init_share_limits($sharer, $borrowers)
{
    global $default_limit;
    $share_limits = get_share_limits($sharer);
    if (count($share_limits) == 0) {
        foreach ($borrowers as $borrower) {
            add_share_limit($sharer, $borrower, $SHARE_LIMIT_DEFAULT);
        }
    }
}
$limit2text = array("{$SHARE_NONE}" => "no items", "20" => "items under \$20", "50" => "items under \$50", "100" => "items under \$100", "200" => "items under \$200", "500" => "items under \$500", "1000" => "items under \$1000", "{$SHARE_ALL}" => "all items");
global $SHARE_LIMIT_DEFAULT;
$user = $_REQUEST['fb_sig_user'];
$fb = FB::get($api_key, $secret);
echo render_menu("my_listings", $user);
echo render_tabs(2);
$checked = "";
if (isset($_GET['check']) && $_GET['check'] == "all") {
    $checked = "checked";
}
if (isset($_POST['share_limit'])) {
    if (isset($_POST['selected_friends'])) {
        $friends = $_POST['selected_friends'];
        $share_limit = $_POST['share_limit'];
        foreach ($friends as $friend) {
            add_share_limit($user, $friend, $share_limit);
        }
    } else {
        echo '<fb:error message="Must select at least one friend." />';
    }
}
$friends = $fb->api_client->friends_get();
$share_limits = get_share_limits($user);
?>

<div style="background-color: #EEEEEE;float:center;padding:10px 10px 10px 10px">
	Control which of your shared items will be visible to specific friends by
	setting a dollar limit on what items they can borrow from you.  You can even
	share nothing with friends you don't know very well.
	<br/><br/>
	By default friends are limited to items under $<?php