<?php
/*
NetworX - open-source social networks platform
Copyright (C) 2009 SocialABC, Inc. http://www.socialabc.com
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 this program in a file called LICENSE; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
include('includes/application_top.php');
$template->loadTemplateFile("video_report.html");
if ($user->isAuthorised())
{
if (UserBlock::checkUserBlockResources(USER_BLOCKED_RESOURCES, USERBLOCK_RESOURCE_MEDIA))
{
cmn_unathorized_action();
}
$video = new Video($_GET['video_id']);
if ($video->VideoID == -1)
{
cmn_unathorized_action();
}
$album = new VideoAlbum($video->VideoAlbumID);
if (!$album->checkPermission('view'))
{
cmn_unathorized_action();
}
if (isset($_POST['submited']))
{
$owner = $album->getOwner();
while (get_class($owner) != 'User')
{
$owner = $owner->getOwner();
}
Message::sendUserMessage($owner->UserID, $user->UserID,
'Video ' . $video->VideoName . ': violation report',
'User ' . db_get_entity_display_name($user) . " reports you about a violation in this video: \n\"" . $_POST['MessageText'] . "\"");
$complaint = new Complaint();
$complaint->UserID = $user->UserID;
$complaint->ComplaintSource = COMPLAINT_SOURCE_VIDEO;
$complaint->ComplaintSourceID = $video->VideoID;
$complaint->ComplaintStatus = COMPLAINT_STATUS_NEW;
$complaint->ComplaintMessage = $_POST['MessageText'];
$complaint->saveToDB();
$template->touchBlock('success');
}
else
{
$template->touchBlock('report_form');
}
$template->setVariable('VideoName', $video->VideoName);
}
else
{
cmn_unathorized_action();
}
include('includes/application_bottom.php');
?>