<?php

namespace {
/*
 * This file is part of Contao.
 *
 * (c) Leo Feyer
 *
 * @license LGPL-3.0-or-later
 */
$GLOBALS['TL_DCA']['tl_member'] = array(
    // Config
    'config' => array('dataContainer' => \Contao\DC_Table::class, 'enableVersioning' => \true, 'onsubmit_callback' => array(array('tl_member', 'storeDateAdded')), 'sql' => array('keys' => array('id' => 'primary', 'username' => 'unique', 'email' => 'index'))),
    // List
    'list' => array('sorting' => array('mode' => 2, 'fields' => array('dateAdded'), 'panelLayout' => 'filter;sort,search,limit'), 'label' => array('fields' => array('icon', 'firstname', 'lastname', 'username', 'dateAdded'), 'showColumns' => \true, 'label_callback' => array('tl_member', 'addIcon')), 'global_operations' => array('all' => array('href' => 'act=select', 'class' => 'header_edit_all', 'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"')), 'operations' => array('edit' => array('href' => 'act=edit', 'icon' => 'edit.svg'), 'copy' => array('href' => 'act=copy', 'icon' => 'copy.svg'), 'delete' => array('href' => 'act=delete', 'icon' => 'delete.svg', 'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\'))return false;Backend.getScrollOffset()"'), 'toggle' => array('icon' => 'visible.svg', 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', 'button_callback' => array('tl_member', 'toggleIcon')), 'show' => array('href' => 'act=show', 'icon' => 'show.svg'), 'su' => array('href' => 'key=su', 'icon' => 'su.svg', 'button_callback' => array('tl_member', 'switchUser')))),
    // Palettes
    'palettes' => array('__selector__' => array('login', 'assignDir'), 'default' => '{personal_legend},firstname,lastname,dateOfBirth,gender;{address_legend:hide},company,street,postal,city,state,country;{contact_legend},phone,mobile,fax,email,website,language;{groups_legend},groups;{login_legend},login;{homedir_legend:hide},assignDir;{account_legend},disable,start,stop'),
    // Subpalettes
    'subpalettes' => array('login' => 'username,password', 'assignDir' => 'homeDir'),
    // Fields
    'fields' => array('id' => array('sql' => "int(10) unsigned NOT NULL auto_increment"), 'tstamp' => array('sql' => "int(10) unsigned NOT NULL default 0"), 'firstname' => array('exclude' => \true, 'search' => \true, 'sorting' => \true, 'flag' => 1, 'inputType' => 'text', 'eval' => array('mandatory' => \true, 'maxlength' => 255, 'feEditable' => \true, 'feViewable' => \true, 'feGroup' => 'personal', 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'lastname' => array('exclude' => \true, 'search' => \true, 'sorting' => \true, 'flag' => 1, 'inputType' => 'text', 'eval' => array('mandatory' => \true, 'maxlength' => 255, 'feEditable' => \true, 'feViewable' => \true, 'feGroup' => 'personal', 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'dateOfBirth' => array('exclude' => \true, 'inputType' => 'text', 'eval' => array('rgxp' => 'date', 'datepicker' => \true, 'feEditable' => \true, 'feViewable' => \true, 'feGroup' => 'personal', 'tl_class' => 'w50 wizard'), 'sql' => "varchar(11) NOT NULL default ''"), 'gender' => array('exclude' => \true, 'inputType' => 'select', 'options' => array('male', 'female', 'other'), 'reference' => &$GLOBALS['TL_LANG']['MSC'], 'eval' => array('includeBlankOption' => \true, 'feEditable' => \true, 'feViewable' => \true, 'feGroup' => 'personal', 'tl_class' => 'w50'), 'sql' => "varchar(32) NOT NULL default ''"), 'company' => array('exclude' => \true, 'search' => \true, 'sorting' => \true, 'flag' => 1, 'inputType' => 'text', 'eval' => array('maxlength' => 255, 'feEditable' => \true, 'feViewable' => \true, 'feGroup' => 'address', 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'street' => array('exclude' => \true, 'search' => \true, 'inputType' => 'text', 'eval' => array('maxlength' => 255, 'feEditable' => \true, 'feViewable' => \true, 'feGroup' => 'address', 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'postal' => array('exclude' => \true, 'search' => \true, 'inputType' => 'text', 'eval' => array('maxlength' => 32, 'feEditable' => \true, 'feViewable' => \true, 'feGroup' => 'address', 'tl_class' => 'w50'), 'sql' => "varchar(32) NOT NULL default ''"), 'city' => array('exclude' => \true, 'filter' => \true, 'search' => \true, 'sorting' => \true, 'inputType' => 'text', 'eval' => array('maxlength' => 255, 'feEditable' => \true, 'feViewable' => \true, 'feGroup' => 'address', 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'state' => array('exclude' => \true, 'sorting' => \true, 'inputType' => 'text', 'eval' => array('maxlength' => 64, 'feEditable' => \true, 'feViewable' => \true, 'feGroup' => 'address', 'tl_class' => 'w50'), 'sql' => "varchar(64) NOT NULL default ''"), 'country' => array('exclude' => \true, 'filter' => \true, 'sorting' => \true, 'inputType' => 'select', 'eval' => array('includeBlankOption' => \true, 'chosen' => \true, 'feEditable' => \true, 'feViewable' => \true, 'feGroup' => 'address', 'tl_class' => 'w50'), 'options_callback' => static function () {
        return \Contao\System::getCountries();
    }, 'sql' => "varchar(2) NOT NULL default ''"), 'phone' => array('exclude' => \true, 'search' => \true, 'inputType' => 'text', 'eval' => array('maxlength' => 64, 'rgxp' => 'phone', 'decodeEntities' => \true, 'feEditable' => \true, 'feViewable' => \true, 'feGroup' => 'contact', 'tl_class' => 'w50'), 'sql' => "varchar(64) NOT NULL default ''"), 'mobile' => array('exclude' => \true, 'search' => \true, 'inputType' => 'text', 'eval' => array('maxlength' => 64, 'rgxp' => 'phone', 'decodeEntities' => \true, 'feEditable' => \true, 'feViewable' => \true, 'feGroup' => 'contact', 'tl_class' => 'w50'), 'sql' => "varchar(64) NOT NULL default ''"), 'fax' => array('exclude' => \true, 'search' => \true, 'inputType' => 'text', 'eval' => array('maxlength' => 64, 'rgxp' => 'phone', 'decodeEntities' => \true, 'feEditable' => \true, 'feViewable' => \true, 'feGroup' => 'contact', 'tl_class' => 'w50'), 'sql' => "varchar(64) NOT NULL default ''"), 'email' => array('exclude' => \true, 'search' => \true, 'inputType' => 'text', 'eval' => array('mandatory' => \true, 'maxlength' => 255, 'rgxp' => 'email', 'unique' => \true, 'decodeEntities' => \true, 'feEditable' => \true, 'feViewable' => \true, 'feGroup' => 'contact', 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'website' => array('exclude' => \true, 'search' => \true, 'inputType' => 'text', 'eval' => array('rgxp' => 'url', 'maxlength' => 255, 'feEditable' => \true, 'feViewable' => \true, 'feGroup' => 'contact', 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'language' => array('exclude' => \true, 'filter' => \true, 'inputType' => 'select', 'eval' => array('includeBlankOption' => \true, 'chosen' => \true, 'rgxp' => 'locale', 'feEditable' => \true, 'feViewable' => \true, 'feGroup' => 'personal', 'tl_class' => 'w50'), 'options_callback' => static function () {
        return \Contao\System::getLanguages();
    }, 'sql' => "varchar(5) NOT NULL default ''"), 'groups' => array('exclude' => \true, 'filter' => \true, 'inputType' => 'checkboxWizard', 'foreignKey' => 'tl_member_group.name', 'eval' => array('multiple' => \true, 'feEditable' => \true, 'feGroup' => 'login'), 'sql' => "blob NULL", 'relation' => array('type' => 'belongsToMany', 'load' => 'lazy')), 'login' => array('exclude' => \true, 'filter' => \true, 'inputType' => 'checkbox', 'eval' => array('submitOnChange' => \true), 'sql' => "char(1) NOT NULL default ''"), 'username' => array('exclude' => \true, 'search' => \true, 'sorting' => \true, 'flag' => 1, 'inputType' => 'text', 'eval' => array('mandatory' => \true, 'unique' => \true, 'rgxp' => 'extnd', 'nospace' => \true, 'maxlength' => 64, 'feEditable' => \true, 'feViewable' => \true, 'feGroup' => 'login', 'tl_class' => 'w50', 'autocapitalize' => 'off', 'autocomplete' => 'username'), 'sql' => 'varchar(64) BINARY NULL'), 'password' => array('label' => &$GLOBALS['TL_LANG']['MSC']['password'], 'exclude' => \true, 'inputType' => 'password', 'eval' => array('mandatory' => \true, 'preserveTags' => \true, 'minlength' => \Contao\Config::get('minPasswordLength'), 'feEditable' => \true, 'feGroup' => 'login', 'tl_class' => 'clr'), 'save_callback' => array(array('tl_member', 'setNewPassword')), 'sql' => "varchar(255) NOT NULL default ''"), 'assignDir' => array('exclude' => \true, 'inputType' => 'checkbox', 'eval' => array('submitOnChange' => \true), 'sql' => "char(1) NOT NULL default ''"), 'homeDir' => array('exclude' => \true, 'inputType' => 'fileTree', 'eval' => array('fieldType' => 'radio', 'tl_class' => 'clr'), 'sql' => "binary(16) NULL"), 'disable' => array('exclude' => \true, 'filter' => \true, 'inputType' => 'checkbox', 'sql' => "char(1) NOT NULL default ''"), 'start' => array('exclude' => \true, 'inputType' => 'text', 'eval' => array('rgxp' => 'datim', 'datepicker' => \true, 'tl_class' => 'w50 wizard'), 'sql' => "varchar(10) NOT NULL default ''"), 'stop' => array('exclude' => \true, 'inputType' => 'text', 'eval' => array('rgxp' => 'datim', 'datepicker' => \true, 'tl_class' => 'w50 wizard'), 'sql' => "varchar(10) NOT NULL default ''"), 'dateAdded' => array('label' => &$GLOBALS['TL_LANG']['MSC']['dateAdded'], 'default' => \time(), 'sorting' => \true, 'flag' => 6, 'eval' => array('rgxp' => 'datim', 'doNotCopy' => \true), 'sql' => "int(10) unsigned NOT NULL default 0"), 'lastLogin' => array('label' => &$GLOBALS['TL_LANG']['MSC']['lastLogin'], 'eval' => array('rgxp' => 'datim', 'doNotCopy' => \true), 'sql' => "int(10) unsigned NOT NULL default 0"), 'currentLogin' => array('label' => &$GLOBALS['TL_LANG']['MSC']['currentLogin'], 'sorting' => \true, 'flag' => 6, 'eval' => array('rgxp' => 'datim', 'doNotCopy' => \true), 'sql' => "int(10) unsigned NOT NULL default 0"), 'loginAttempts' => array('eval' => array('doNotCopy' => \true), 'sql' => "smallint(5) unsigned NOT NULL default 0"), 'locked' => array('eval' => array('rgxp' => 'datim', 'doNotCopy' => \true), 'sql' => "int(10) unsigned NOT NULL default 0"), 'session' => array('eval' => array('doNotShow' => \true, 'doNotCopy' => \true), 'sql' => "blob NULL"), 'secret' => array('eval' => array('doNotShow' => \true, 'doNotCopy' => \true), 'sql' => "binary(128) NULL default NULL"), 'useTwoFactor' => array('eval' => array('isBoolean' => \true, 'doNotCopy' => \true, 'tl_class' => 'w50 m12'), 'sql' => "char(1) NOT NULL default ''"), 'backupCodes' => array('eval' => array('doNotCopy' => \true, 'doNotShow' => \true), 'sql' => "text NULL"), 'trustedTokenVersion' => array('eval' => array('doNotCopy' => \true, 'doNotShow' => \true), 'sql' => "int(10) unsigned NOT NULL default 0")),
);
// Filter disabled groups in the front end (see #6757)
if (\defined('TL_MODE') && \TL_MODE == 'FE') {
    $GLOBALS['TL_DCA']['tl_member']['fields']['groups']['options_callback'] = array('tl_member', 'getActiveGroups');
}
/**
 * Provide miscellaneous methods that are used by the data configuration array.
 *
 * @author Leo Feyer <https://github.com/leofeyer>
 */
class tl_member extends \Contao\Backend
{
    /**
     * Import the back end user object
     */
    public function __construct()
    {
        parent::__construct();
        $this->import('Contao\\BackendUser', 'User');
    }
    /**
     * Filter disabled groups
     *
     * @return array
     */
    public function getActiveGroups()
    {
        $arrGroups = array();
        $objGroup = \Contao\MemberGroupModel::findAllActive();
        if ($objGroup !== \null) {
            while ($objGroup->next()) {
                $arrGroups[$objGroup->id] = $objGroup->name;
            }
        }
        return $arrGroups;
    }
    /**
     * Add an image to each record
     *
     * @param array                $row
     * @param string               $label
     * @param Contao\DataContainer $dc
     * @param array                $args
     *
     * @return array
     */
    public function addIcon($row, $label, \Contao\DataContainer $dc, $args)
    {
        $image = 'member';
        $disabled = $row['start'] !== '' && $row['start'] > \time() || $row['stop'] !== '' && $row['stop'] <= \time();
        if ($row['useTwoFactor']) {
            $image .= '_two_factor';
        }
        if ($disabled || $row['disable']) {
            $image .= '_';
        }
        $args[0] = \sprintf('<div class="list_icon_new" style="background-image:url(\'%ssystem/themes/%s/icons/%s.svg\')" data-icon="%s.svg" data-icon-disabled="%s.svg">&nbsp;</div>', \Contao\System::getContainer()->get('contao.assets.assets_context')->getStaticUrl(), \Contao\Backend::getTheme(), $image, $disabled ? $image : \rtrim($image, '_'), \rtrim($image, '_') . '_');
        return $args;
    }
    /**
     * Generate a "switch account" button and return it as string
     *
     * @param array  $row
     * @param string $href
     * @param string $label
     * @param string $title
     * @param string $icon
     *
     * @return string
     */
    public function switchUser($row, $href, $label, $title, $icon)
    {
        $blnCanSwitchUser = $this->User->isAdmin || !empty($this->User->amg) && \is_array($this->User->amg);
        if (!$blnCanSwitchUser) {
            return '';
        }
        if (!$row['login'] || !$row['username'] || !$this->User->isAdmin && \count(\array_intersect(\Contao\StringUtil::deserialize($row['groups'], \true), $this->User->amg)) < 1) {
            return \Contao\Image::getHtml(\preg_replace('/\\.svg$/i', '_.svg', $icon)) . ' ';
        }
        return '<a href="contao/preview.php?user=' . \rawurlencode($row['username']) . '" title="' . \Contao\StringUtil::specialchars($title) . '" target="_blank">' . \Contao\Image::getHtml($icon, $label) . '</a> ';
    }
    /**
     * Call the "setNewPassword" callback
     *
     * @param string                                  $strPassword
     * @param Contao\DataContainer|Contao\MemberModel $user
     *
     * @return string
     */
    public function setNewPassword($strPassword, $user)
    {
        // Return if there is no user (e.g. upon registration)
        if (!$user) {
            return $strPassword;
        }
        $objUser = $this->Database->prepare("SELECT * FROM tl_member WHERE id=?")->limit(1)->execute($user->id);
        // HOOK: set new password callback
        if ($objUser->numRows && isset($GLOBALS['TL_HOOKS']['setNewPassword']) && \is_array($GLOBALS['TL_HOOKS']['setNewPassword'])) {
            foreach ($GLOBALS['TL_HOOKS']['setNewPassword'] as $callback) {
                $this->import($callback[0]);
                $this->{$callback[0]}->{$callback[1]}($objUser, $strPassword);
            }
        }
        return $strPassword;
    }
    /**
     * Store the date when the account has been added
     *
     * @param Contao\DataContainer|Contao\FrontendUser $dc
     */
    public function storeDateAdded($dc)
    {
        // Front end call
        if (!$dc instanceof \Contao\DataContainer) {
            return;
        }
        // Return if there is no active record (override all)
        if (!$dc->activeRecord || $dc->activeRecord->dateAdded > 0) {
            return;
        }
        // Fallback solution for existing accounts
        if ($dc->activeRecord->lastLogin > 0) {
            $time = $dc->activeRecord->lastLogin;
        } else {
            $time = \time();
        }
        $this->Database->prepare("UPDATE tl_member SET dateAdded=? WHERE id=?")->execute($time, $dc->id);
    }
    /**
     * Return the "toggle visibility" button
     *
     * @param array  $row
     * @param string $href
     * @param string $label
     * @param string $title
     * @param string $icon
     * @param string $attributes
     *
     * @return string
     */
    public function toggleIcon($row, $href, $label, $title, $icon, $attributes)
    {
        if (\Contao\Input::get('tid')) {
            $this->toggleVisibility(\Contao\Input::get('tid'), \Contao\Input::get('state') == 1, \func_num_args() <= 12 ? \null : \func_get_arg(12));
            $this->redirect($this->getReferer());
        }
        // Check permissions AFTER checking the tid, so hacking attempts are logged
        if (!$this->User->hasAccess('tl_member::disable', 'alexf')) {
            return '';
        }
        $href .= '&amp;tid=' . $row['id'] . '&amp;state=' . $row['disable'];
        if ($row['disable']) {
            $icon = 'invisible.svg';
        }
        return '<a href="' . $this->addToUrl($href) . '" title="' . \Contao\StringUtil::specialchars($title) . '"' . $attributes . '>' . \Contao\Image::getHtml($icon, $label, 'data-state="' . ($row['disable'] ? 0 : 1) . '"') . '</a> ';
    }
    /**
     * Disable/enable a user group
     *
     * @param integer              $intId
     * @param boolean              $blnVisible
     * @param Contao\DataContainer $dc
     *
     * @throws Contao\CoreBundle\Exception\AccessDeniedException
     */
    public function toggleVisibility($intId, $blnVisible, \Contao\DataContainer $dc = \null)
    {
        // Set the ID and action
        \Contao\Input::setGet('id', $intId);
        \Contao\Input::setGet('act', 'toggle');
        if ($dc) {
            $dc->id = $intId;
            // see #8043
        }
        // Trigger the onload_callback
        if (\is_array($GLOBALS['TL_DCA']['tl_member']['config']['onload_callback'])) {
            foreach ($GLOBALS['TL_DCA']['tl_member']['config']['onload_callback'] as $callback) {
                if (\is_array($callback)) {
                    $this->import($callback[0]);
                    $this->{$callback[0]}->{$callback[1]}($dc);
                } elseif (\is_callable($callback)) {
                    $callback($dc);
                }
            }
        }
        // Check the field access
        if (!$this->User->hasAccess('tl_member::disable', 'alexf')) {
            throw new \Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to activate/deactivate member ID ' . $intId . '.');
        }
        $objRow = $this->Database->prepare("SELECT * FROM tl_member WHERE id=?")->limit(1)->execute($intId);
        if ($objRow->numRows < 1) {
            throw new \Contao\CoreBundle\Exception\AccessDeniedException('Invalid member ID ' . $intId . '.');
        }
        // Set the current record
        if ($dc) {
            $dc->activeRecord = $objRow;
        }
        $objVersions = new \Contao\Versions('tl_member', $intId);
        $objVersions->initialize();
        // Reverse the logic (members have disabled=1)
        $blnVisible = !$blnVisible;
        // Trigger the save_callback
        if (\is_array($GLOBALS['TL_DCA']['tl_member']['fields']['disable']['save_callback'])) {
            foreach ($GLOBALS['TL_DCA']['tl_member']['fields']['disable']['save_callback'] as $callback) {
                if (\is_array($callback)) {
                    $this->import($callback[0]);
                    $blnVisible = $this->{$callback[0]}->{$callback[1]}($blnVisible, $dc);
                } elseif (\is_callable($callback)) {
                    $blnVisible = $callback($blnVisible, $dc);
                }
            }
        }
        $time = \time();
        // Update the database
        $this->Database->prepare("UPDATE tl_member SET tstamp={$time}, disable='" . ($blnVisible ? '1' : '') . "' WHERE id=?")->execute($intId);
        if ($dc) {
            $dc->activeRecord->tstamp = $time;
            $dc->activeRecord->disable = $blnVisible ? '1' : '';
        }
        // Trigger the onsubmit_callback
        if (\is_array($GLOBALS['TL_DCA']['tl_member']['config']['onsubmit_callback'])) {
            foreach ($GLOBALS['TL_DCA']['tl_member']['config']['onsubmit_callback'] as $callback) {
                if (\is_array($callback)) {
                    $this->import($callback[0]);
                    $this->{$callback[0]}->{$callback[1]}($dc);
                } elseif (\is_callable($callback)) {
                    $callback($dc);
                }
            }
        }
        $objVersions->create();
        if ($dc) {
            $dc->invalidateCacheTags();
        }
    }
}
}

namespace {
/*
 * This file is part of con4gis,
 * the gis-kit for Contao CMS.
 *
 * @package    con4gis
 * @version    6
 * @author     con4gis contributors (see "authors.txt")
 * @license    LGPL-3.0-or-later
 * @copyright  Küstenschmiede GmbH Software & Design
 * @link       https://www.con4gis.org
 */
if (@\class_exists("tl_member")) {
    /**
     * Change palettes
     */
    $disabledObjects = \deserialize($GLOBALS['TL_CONFIG']['disabledC4gMapObjects'], \true);
    if (!\in_array('tl_member', $disabledObjects)) {
        \Contao\CoreBundle\DataContainer\PaletteManipulator::create()->addLegend('c4g_maps_legend', 'homedir_legend', \Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_BEFORE)->addField(array('c4g_loc_geox', 'c4g_loc_geoy', 'c4g_loc_label', 'c4g_locstyle'), 'c4g_maps_legend', \Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_APPEND)->applyToPalette('default', 'tl_member');
        $GLOBALS['TL_DCA']['tl_member']['fields']['c4g_loc_geox'] = ['label' => &$GLOBALS['TL_LANG']['tl_member']['c4g_loc_geox'], 'exclude' => \true, 'inputType' => 'c4g_text', 'eval' => ['mandatory' => \false, 'maxlength' => 20, 'tl_class' => 'w50 wizard'], 'save_callback' => [['tl_member_c4g_maps', 'setLocLon']], 'wizard' => [['\\con4gis\\MapsBundle\\Resources\\contao\\classes\\GeoPicker', 'getPickerLink']], 'sql' => "varchar(20) NOT NULL default ''"];
        $GLOBALS['TL_DCA']['tl_member']['fields']['c4g_loc_geoy'] = ['label' => &$GLOBALS['TL_LANG']['tl_member']['c4g_loc_geoy'], 'exclude' => \true, 'inputType' => 'c4g_text', 'eval' => ['mandatory' => \false, 'maxlength' => 20, 'tl_class' => 'w50 wizard'], 'save_callback' => [['tl_member_c4g_maps', 'setLocLat']], 'wizard' => [['\\con4gis\\MapsBundle\\Resources\\contao\\classes\\GeoPicker', 'getPickerLink']], 'sql' => "varchar(20) NOT NULL default ''"];
        $GLOBALS['TL_DCA']['tl_member']['fields']['c4g_loc_label'] = ['label' => &$GLOBALS['TL_LANG']['tl_member']['c4g_loc_label'], 'exclude' => \true, 'inputType' => 'text', 'eval' => ['tl_class' => 'clr'], 'sql' => "varchar(100) NOT NULL default ''"];
        $GLOBALS['TL_DCA']['tl_member']['fields']['c4g_locstyle'] = ['label' => &$GLOBALS['TL_LANG']['tl_member']['c4g_locstyle'], 'exclude' => \true, 'inputType' => 'select', 'options_callback' => ['tl_member_c4g_maps', 'getLocStyles'], 'eval' => array('chosen' => \true, 'includeBlankOption' => \true), 'sql' => "int(10) unsigned NOT NULL default '0'"];
    }
}
/**
 * Class tl_member_c4g_maps
 */
class tl_member_c4g_maps extends \Backend
{
    /**
     * Return all Location Styles as array
     * @param object
     * @return array
     */
    public function getLocStyles(\DataContainer $dc)
    {
        $locStyles = $this->Database->prepare("SELECT id,name FROM tl_c4g_map_locstyles ORDER BY name")->execute();
        $return[''] = '-';
        while ($locStyles->next()) {
            $return[$locStyles->id] = $locStyles->name;
        }
        return $return;
    }
    /**
     * Validate Longitude
     */
    public function setLocLon($varValue, \DataContainer $dc)
    {
        if ($varValue != 0) {
            if (!\con4gis\MapsBundle\Resources\contao\classes\Utils::validateLon($varValue)) {
                throw new \Exception($GLOBALS['TL_LANG']['c4g_maps']['geox_invalid']);
            }
        }
        return $varValue;
    }
    /**
     * Validate Latitude
     */
    public function setLocLat($varValue, \DataContainer $dc)
    {
        if ($varValue != 0) {
            if (!\con4gis\MapsBundle\Resources\contao\classes\Utils::validateLat($varValue)) {
                throw new \Exception($GLOBALS['TL_LANG']['c4g_maps']['geoy_invalid']);
            }
        }
        return $varValue;
    }
}
}

namespace {
/**
 * notification_center extension for Contao Open Source CMS
 *
 * @copyright  Copyright (c) 2008-2015, terminal42
 * @author     terminal42 gmbh <info@terminal42.ch>
 * @license    LGPL
 */
/**
 * Add the global callbacks
 */
if ('FE' === \TL_MODE) {
    $GLOBALS['TL_DCA']['tl_member']['config']['onload_callback'][] = array('NotificationCenter\\tl_member', 'storePersonalData');
}
}
