Exemple #1
0
function siteaccess_register_hook($hook, $type, $result, $params)
{
    $error = false;
    if (elgg_get_plugin_setting('icreg', 'siteaccess', false)) {
        $params = array('friend_guid' => get_input('friend_guid'), 'invitecode' => get_input('invitecode'));
        if (!siteaccess_validate_invitecode($params)) {
            register_error(elgg_echo('siteaccess:reg:ic:required'));
            return false;
        }
    }
    if (siteaccess_reg_captcha_enabled()) {
        if (!siteaccess_validate_captcha()) {
            $error = true;
        }
    }
    if (siteaccess_site_password_enabled()) {
        $sitepassword = elgg_get_plugin_setting('sitepassword_value', 'siteaccess', false);
        $inputpassword = get_input('siteaccesspassword');
        if (trim($inputpassword) == "" || strcmp($inputpassword, $sitepassword) != 0) {
            register_error(elgg_echo('siteaccess:sitepassword:invalid'));
            $error = true;
        }
    }
    if (siteaccess_coppa_enabled()) {
        $coppa = get_input('coppa');
        if (!$coppa) {
            $age = elgg_get_plugin_setting('coppa_age', 'siteaccess', '13');
            if (!$age) {
                $age = 13;
            }
            register_error(elgg_echo('siteaccess:coppa:fail', array($age)));
            $error = true;
        }
    }
    return $error ? false : true;
}
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
?>
<div>
    <?php 
if (siteaccess_site_password_enabled()) {
    echo "<br /><label>" . elgg_echo('siteaccess:sitepassword:text') . "<br />" . elgg_view('input/password', array('name' => 'siteaccesspassword', 'value' => $siteaccesspassword, 'class' => "general-textarea")) . "</label><br />";
}
if (siteaccess_coppa_enabled()) {
    $age = elgg_get_plugin_setting('coppa_age', 'siteaccess', '13');
    if (!$age) {
        $age = 13;
    }
    echo "<br /><label>" . elgg_view('input/checkbox', array('name' => 'coppa', 'value' => true, 'label' => elgg_echo('siteaccess:coppa:text', array($age)))) . "</label><br />";
}
if (siteaccess_reg_captcha_enabled()) {
    echo elgg_view('siteaccess/code', $vars);
}
?>
</div>