<?PHP
#
#   FILE:  ShareResource.php
#
#   Part of the Collection Workflow Integration System (CWIS)
#   Copyright 2012-2013 Edward Almasy and Internet Scout Research Group
#   http://scout.wisc.edu/cwis/
#

# ----- MAIN -----------------------------------------------------------------

# get the parameters from the URL
$ResourceId = GetArrayValue($_GET, "ResourceId");
$Site = GetArrayValue($_GET, "Site");
$UserId = GetArrayValue($_GET, "UserId");

# get the resource and SocialMedia plugin
if (Resource::ItemExists($ResourceId))
{
    $Resource = new Resource($ResourceId);
    $Plugin = $G_PluginManager->GetPlugin("SocialMedia");

    # share the resource
    $Plugin->ShareResource($Resource, $Site, $UserId);
}
else
{
    CheckAuthorization(-1);
    return;
}
