<?php
/* setup includes */
require_once('includes/master.inc.php');

/* setup page */
define("PAGE_NAME", t("report_url_page_name"));
define("PAGE_DESCRIPTION", t("report_url_meta_description"));
define("PAGE_KEYWORDS", t("report_url_meta_keywords"));

/* send report if submitted */
if ((int) $_REQUEST['submitme'])
{
    if (!strlen($_REQUEST['problemUrl']))
    {
        setError(t("report_url_error_no_url", "Please enter the problem url."));
    }
    else
    {
        $subject = "New abuse report on " . SITE_CONFIG_SITE_NAME;
        $plainMsg = "There is a new abuse report on " . SITE_CONFIG_SITE_NAME . " for the following url:\n\n";
        $plainMsg .= $_REQUEST['problemUrl'] . " " . ((int) $_REQUEST['url'] ? $_REQUEST['url'] : "") . "\n\n";
        $plainMsg .= "Please login via " . WEB_ROOT . "/admin/ to investigate further.";
        send_html_mail(SITE_CONFIG_REPORT_ABUSE_EMAIL, $subject, str_replace("\n", "<br/>", $plainMsg), SITE_CONFIG_REPORT_ABUSE_EMAIL, $plainMsg);
        redirect(WEB_ROOT);
    }
}

require_once('_header.php');
?>

<div class="contentPageWrapper">

    <?php
    if (isErrors())
    {
        echo outputErrors();
    }
    ?>

    <!-- report url form -->
    <div class="pageSectionMain ui-corner-all">
        <div class="pageSectionMainInternal">
            <div id="pageHeader">
                <h2><?php echo t("report_url", "Report Url"); ?></h2>
            </div>
            <div>
                <p class="introText">
<?php echo t("report_abuse_intro"); ?>
                </p>
                <form class="international" method="post" action="http://<?php echo _CONFIG_SITE_FULL_URL; ?>/report_url.<?php echo SITE_CONFIG_PAGE_EXTENSION; ?>" id="form-join" AUTOCOMPLETE="off">
                    <ul>
                        <li class="field-container"><label for="problemUrl">
                                <span class="field-name"><?php echo t("problem_url"); ?></span>
                                <input type="text" tabindex="1" value="<?php echo isset($_REQUEST['problemUrl']) ? $_REQUEST['problemUrl'] : ''; ?>" id="problemUrlMain" name="problemUrl" class="uiStyle" onFocus="showHideTip(this);"></label>
                            <div id="problemUrlMainTip" class="hidden formTip">
<?php echo t("problem_url_requirements", "Enter the short url you wish to report."); ?>
                            </div>
                        </li>

                        <li class="field-container">
                            <span class="field-name"></span>
                            <input name="url" id="url" type="hidden" value="<?php echo (int) $_REQUEST['url']; ?>"/>
                            <input name="submitme" type="hidden" value="1"/>
                            <input tabindex="99" type="submit" name="submit" value="<?php echo t("submit_report"); ?>" class="submitInput" />
                        </li>
                    </ul>
                </form>

                <div class="clear"></div>
            </div>
        </div>
    </div>
    <?php include_once("_bannerRightContent.inc.php"); ?>
    <div class="clear"><!-- --></div>
</div>

<?php
require_once('_footer.php');
?>