<?php
PA::showHeader();

$registration = $data['registration'];
    echo '
    <h1 class="headline">
        '.Text::get('USERS_HEADLINE').'
        <div id="admin_new_button">
            <a href="'.Admin::adminGetLink('user_add').'" title="'.Text::get('USERS_NEWUSER_BUTTON').'">
                <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADkAAAA5CAYAAACMGIOFAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAzdJREFUeNrsmk1IVUEUx59ZKoKh9iz6WrwM5QlFlGnfC0MiXPSB0CbC3FaLFrWLamcFfT1aG9SmEiSoiD4QTQshiDLCRZbkJitJK/rAj9t/6Dw43N693Ttv5jrkHPjhU87cO/87Z+adc645juPE/nebFZsBZkVakVakFWlFWpFWpLfNjuAeJWAHWAcqwHzwCwyBPnAfdGmdgUjrNFEIToK3zr/tIdiuay66BFaAXiecTYHTOuaToyFBT1IILpYc3wqaTT54xP67noVAYfvBCZWTUr2SKXBQwXXGQTV4YdpKloN9iq41Bxw3MVz3grkKr1cPFpgmcpPi/V0EtpgkMh8kNHyNbzZJZKHiUE3bPJNE6uqGOSaJ/AHGNIgcMUmkSLgHNYh8ZNrp2q1Y4FcTRV6liamyB2DYNJEDlFyrCn9l+avq3LWEwrYq5DhRtVwDveAjRcR3k4vmSvAuYA35CjRoLNy11ZPCloPLYKOPj2h5NNLKpXPVPaAWlIFcMAr6QTu4Ib3nNT7BfHAMDGZYwU4QJ78kuBVg1fvBTpNWkptI97aCBirHPlPlP0oJeButXFA7Cs5M18GzHuwGd0BHAH/RuesBcdffReb0jD2g1RnGirr1SpThWgQugAkKq3HQAsp8xoiHe9cjLLuY30oPn09gUVTdugR47DGRIXAe1IEC17g6n73XzfzW+Pi1RCFyIR0GQew1uMeefquP71N2jxofv4Ggc5XtoBfQkV4Zov9TTg0qYTWuPfiS/d7HPn+hfcsPsRX0uVT3njznyFkpjf/A/tYR4r61bNxI0HEyuetacCjLkziXfZ4KMW5C5mYy4XrKNUkZG2PhVkw91rR9oywn3VapYl2CVfzrT1e41tM7C1lL0HVu+/j0sPtV+/gN6wrX5lBP8G9L0s82BclH4Nd9YUTGKT3LxhqZyDcePpOu3pFXg+usDpHbQuaYXiKXUTVx2MOnmKqXDbE/L24z2UXwRMeeTDlq7Ca75hGJ8e0gT9dL2E5HnfGXrU3gfYAxk5Qm5ukstZ6DJQpLsBTr4ywFB8CuDFXJTzpkLsl2BKOoJ6fd7P/xWJFWpBVpRVqRVuQMF/lbgAEAcaeokv0WIMEAAAAASUVORK5CYII=">
            </a>
        </div>
    </h1>';
    echo '
    <div id="login_box" class="">';
    if (Text::get('REGISTER_HEADLINE') != '') {
        echo '<h2>'.Text::get('REGISTER_HEADLINE').'</h2>';
    }

    if (empty($registration)) {
        $registration = new stdClass();
        $registration->user_name = '';
        $registration->user_email = '';
        $registration->user_password_new = '';
        $registration->user_password_repeat = '';
    }
    echo '
    <form method="post" action="'.PA::getURL().'admin/users/add_action" id="login_form">
        <input type="text"
               pattern="[a-zA-Z0-9]{2,64}"
               name="user_name"
               class="form_element"
               placeholder="'.Text::get('REGISTER_INPUT_PLACEHOLDER_USERNAME').'"
               value="'.$registration->user_name.'"
               required />
        <input type="email"
               name="user_email"
               class="form_element"
               placeholder="'.Text::get('REGISTER_INPUT_PLACEHOLDER_EMAIL').'"
               value="'.$registration->user_email.'" />
        <input type="password"
               name="user_password_new"
               class="form_element"
               pattern=".{6,}"
               placeholder="'.Text::get('REGISTER_INPUT_PLACEHOLDER_PASSWORD').'"
               value="'.$registration->user_password_new.'"
               autocomplete="off"
               required />
        <input type="password"
               name="user_password_repeat"
               class="form_element"
               pattern=".{6,}"
               placeholder="'.Text::get('REGISTER_INPUT_PLACEHOLDER_PASSWORD2').'"
               value="'.$registration->user_password_repeat.'"
               autocomplete="off"
               required />
        <input type="submit" value="'.Text::get('REGISTER_SUBMIT_VALUE').'" id="login_submit" class="form_submit">
    </form>';
    PA::validateInput('user_name', Text::get('FEEDBACK_USERNAME_EMPTY'), Text::get('FEEDBACK_USERNAME_DOES_NOT_FIT_PATTERN'));
    PA::validateInput('user_password_new', Text::get('FEEDBACK_PASSWORD_FIELD_EMPTY'), Text::get('FEEDBACK_PASSWORD_TOO_SHORT'));
    PA::validateInput('user_password_repeat', Text::get('FEEDBACK_PASSWORD_FIELD_EMPTY'), Text::get('FEEDBACK_PASSWORD_TOO_SHORT'));
    echo '
</div>';
PA::showFooter();
