Ejemplo n.º 1
0
 /**
  * Run the controller and parse the login template
  */
 public function run()
 {
     $this->Template = new BackendTemplate('be_login');
     // Show a cookie warning
     if (Input::get('referer', true) != '' && empty($_COOKIE)) {
         $this->Template->noCookies = $GLOBALS['TL_LANG']['MSC']['noCookies'];
     }
     $strHeadline = sprintf($GLOBALS['TL_LANG']['MSC']['loginTo'], Config::get('websiteTitle'));
     $this->Template->theme = Backend::getTheme();
     $this->Template->messages = Message::generate();
     $this->Template->base = Environment::get('base');
     $this->Template->language = $GLOBALS['TL_LANGUAGE'];
     $this->Template->languages = System::getLanguages(true);
     $this->Template->title = specialchars($strHeadline);
     $this->Template->charset = Config::get('characterSet');
     $this->Template->action = ampersand(Environment::get('request'));
     $this->Template->userLanguage = $GLOBALS['TL_LANG']['tl_user']['language'][0];
     $this->Template->headline = $strHeadline;
     $this->Template->curLanguage = Input::post('language') ?: str_replace('-', '_', $GLOBALS['TL_LANGUAGE']);
     $this->Template->curUsername = Input::post('username') ?: '';
     $this->Template->uClass = $_POST && empty($_POST['username']) ? ' class="login_error"' : '';
     $this->Template->pClass = $_POST && empty($_POST['password']) ? ' class="login_error"' : '';
     $this->Template->loginButton = specialchars($GLOBALS['TL_LANG']['MSC']['loginBT']);
     $this->Template->username = $GLOBALS['TL_LANG']['tl_user']['username'][0];
     $this->Template->password = $GLOBALS['TL_LANG']['MSC']['password'][0];
     $this->Template->feLink = $GLOBALS['TL_LANG']['MSC']['feLink'];
     $this->Template->frontendFile = Environment::get('base');
     $this->Template->disableCron = Config::get('disableCron');
     $this->Template->ie6warning = sprintf($GLOBALS['TL_LANG']['ERR']['ie6warning'], '<a href="http://ie6countdown.com">', '</a>');
     $this->Template->default = $GLOBALS['TL_LANG']['MSC']['default'];
     $this->Template->output();
 }
    /**
     * Generate a list for the dcaWizard displaying the languages
     * @param   \Database_Result
     * @param   string
     * @return  string
     */
    public function generateWizardList($objRecords, $strId, $widget)
    {
        $strReturn = '
<table class="tl_listing showColumns">
<thead>
    <td class="tl_folder_tlist">' . $GLOBALS['TL_LANG']['tl_nc_language']['language'][0] . '</td>
    <td class="tl_folder_tlist">' . $GLOBALS['TL_LANG']['tl_nc_language']['fallback'][0] . '</td>
    <td class="tl_folder_tlist"></td>
</thead>
<tbody>';
        $arrLanguages = \System::getLanguages();
        while ($objRecords->next()) {
            $row = $objRecords->row();
            $strReturn .= '
<tr>
    <td class="tl_file_list">' . $arrLanguages[$objRecords->language] . '</td>
    <td class="tl_file_list">' . ($objRecords->fallback ? '&#10004;' : '') . '</td>
    <td class="tl_file_list">' . $widget->generateRowOperation('edit', $row) . '</td>
</tr>
';
        }
        $strReturn .= '
</tbody>
</table>';
        return $strReturn;
    }
Ejemplo n.º 3
0
 /**
  * Initialize the object
  * @param string
  */
 public function __construct($strTable)
 {
     $this->import('Session');
     $this->intGroupId = (int) \Session::getInstance()->get('iso_products_gid');
     // Check if the group exists
     if ($this->intGroupId > 0) {
         $objGroup = \Isotope\Model\Group::findByPk($this->intGroupId);
         if (null === $objGroup) {
             if (\BackendUser::getInstance()->isAdmin || !is_array(\BackendUser::getInstance()->iso_groups)) {
                 $this->intGroupId = 0;
             } elseif (!\BackendUser::getInstance()->isAdmin) {
                 $this->intGroupId = (int) \Database::getInstance()->prepare("SELECT id FROM tl_iso_group WHERE id IN ('" . implode("','", \BackendUser::getInstance()->iso_groups) . "') ORDER BY " . \Database::getInstance()->findInSet('id', \BackendUser::getInstance()->iso_groups))->limit(1)->execute()->id;
             }
         }
     }
     // Redirect if the product was not found
     if (isset($_GET['id'])) {
         $objProduct = \Database::getInstance()->prepare("SELECT id FROM {$strTable} WHERE id=?")->limit(1)->execute(\Input::get('id', true));
         if (!$objProduct->numRows) {
             \Controller::redirect(preg_replace('/(&amp;)?id=[^&]*/i', '', \Environment::get('request')));
         }
     }
     $arrClipboard = $this->Session->get('CLIPBOARD');
     // Cut all records
     if ($arrClipboard[$strTable]['mode'] == 'cutAll' && \Input::get('act') != 'cutAll') {
         \Controller::redirect(\Backend::addToUrl('&act=cutAll'));
     }
     parent::__construct($strTable);
     // Allow to customize languages via the onload_callback
     if (isset($GLOBALS['TL_DCA'][$this->strTable]['config']['languages'])) {
         $arrPageLanguages = $GLOBALS['TL_DCA'][$this->strTable]['config']['languages'];
     } else {
         $arrPageLanguages = array_map(function ($strLang) {
             return str_replace('-', '_', $strLang);
         }, $this->Database->execute("SELECT DISTINCT language FROM tl_page WHERE type='root' AND language!=''")->fetchEach('language'));
     }
     if (count($arrPageLanguages) > 1) {
         $this->arrTranslationLabels = \System::getLanguages();
         $this->arrTranslations = array_intersect(array_keys($this->arrTranslationLabels), $arrPageLanguages);
     }
 }
    /**
     * child_record_callback
     * @param   array
     * @return  string
     */
    public function listRows($arrRow)
    {
        if (empty($this->arrTranslations)) {
            $this->arrTranslations = \System::getLanguages();
        }
        if (empty($this->arrGateways)) {
            $objGateways = \Database::getInstance()->execute('SELECT id,title FROM tl_nc_gateway');
            while ($objGateways->next()) {
                $this->arrGateways[$objGateways->id] = $objGateways->title;
            }
        }
        $arrTranslations = \Database::getInstance()->prepare('SELECT language FROM tl_nc_language WHERE pid=?')->execute($arrRow['id'])->fetchEach('language');
        $strBuffer = '
<div class="cte_type ' . ($arrRow['published'] ? 'published' : 'unpublished') . '"><strong>' . $arrRow['title'] . '</strong> - ' . $this->arrGateways[$arrRow['gateway']] . '</div>
<div>
<ul>';
        foreach ($arrTranslations as $strLang) {
            $strBuffer .= '<li>&#10148; ' . $this->arrTranslations[$strLang] . '</li>';
        }
        $strBuffer .= '</ul></div>';
        return $strBuffer;
    }
Ejemplo n.º 5
0
<?php

/**
 * Contao Open Source CMS
 *
 * Copyright (c) 2005-2016 Leo Feyer
 *
 * @license LGPL-3.0+
 */
/**
 * Table tl_user
 */
$GLOBALS['TL_DCA']['tl_user'] = array('config' => array('dataContainer' => 'Table', 'enableVersioning' => true, 'onload_callback' => array(array('tl_user', 'checkPermission')), 'onsubmit_callback' => array(array('tl_user', 'storeDateAdded'), array('tl_user', 'checkRemoveSession')), 'ondelete_callback' => array(array('tl_user', 'removeSession')), 'sql' => array('keys' => array('id' => 'primary', 'username' => 'unique', 'email' => 'index'))), 'list' => array('sorting' => array('mode' => 2, 'fields' => array('dateAdded DESC'), 'flag' => 1, 'panelLayout' => 'filter;sort,search,limit'), 'label' => array('fields' => array('icon', 'name', 'username', 'dateAdded'), 'showColumns' => true, 'label_callback' => array('tl_user', 'addIcon')), 'global_operations' => array('all' => array('label' => &$GLOBALS['TL_LANG']['MSC']['all'], 'href' => 'act=select', 'class' => 'header_edit_all', 'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"')), 'operations' => array('edit' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['edit'], 'href' => 'act=edit', 'icon' => 'edit.gif', 'button_callback' => array('tl_user', 'editUser')), 'copy' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['copy'], 'href' => 'act=copy', 'icon' => 'copy.gif', 'button_callback' => array('tl_user', 'copyUser')), 'delete' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['delete'], 'href' => 'act=delete', 'icon' => 'delete.gif', 'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\'))return false;Backend.getScrollOffset()"', 'button_callback' => array('tl_user', 'deleteUser')), 'toggle' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['toggle'], 'icon' => 'visible.gif', 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', 'button_callback' => array('tl_user', 'toggleIcon')), 'show' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['show'], 'href' => 'act=show', 'icon' => 'show.gif'), 'su' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['su'], 'href' => 'key=su', 'icon' => 'su.gif', 'button_callback' => array('tl_user', 'switchUser')))), 'palettes' => array('__selector__' => array('inherit', 'admin'), 'login' => '{name_legend},name,email;{backend_legend},language,uploader,showHelp,thumbnails,useRTE,useCE;{session_legend},session;{theme_legend:hide},backendTheme;{password_legend},password', 'admin' => '{name_legend},username,name,email;{backend_legend:hide},language,uploader,showHelp,thumbnails,useRTE,useCE;{theme_legend:hide},backendTheme;{password_legend:hide},pwChange,password;{admin_legend},admin;{account_legend},disable,start,stop', 'default' => '{name_legend},username,name,email;{backend_legend:hide},language,uploader,showHelp,thumbnails,useRTE,useCE;{theme_legend:hide},backendTheme;{password_legend:hide},pwChange,password;{admin_legend},admin;{groups_legend},groups,inherit;{account_legend},disable,start,stop', 'group' => '{name_legend},username,name,email;{backend_legend:hide},language,uploader,showHelp,thumbnails,useRTE,useCE;{theme_legend:hide},backendTheme;{password_legend:hide},pwChange,password;{admin_legend},admin;{groups_legend},groups,inherit;{account_legend},disable,start,stop', 'extend' => '{name_legend},username,name,email;{backend_legend:hide},language,uploader,showHelp,thumbnails,useRTE,useCE;{theme_legend:hide},backendTheme;{password_legend:hide},pwChange,password;{admin_legend},admin;{groups_legend},groups,inherit;{modules_legend},modules,themes;{pagemounts_legend},pagemounts,alpty;{filemounts_legend},filemounts,fop;{forms_legend},forms,formp;{account_legend},disable,start,stop', 'custom' => '{name_legend},username,name,email;{backend_legend:hide},language,uploader,showHelp,thumbnails,useRTE,useCE;{theme_legend:hide},backendTheme;{password_legend:hide},pwChange,password;{admin_legend},admin;{groups_legend},groups,inherit;{modules_legend},modules,themes;{pagemounts_legend},pagemounts,alpty;{filemounts_legend},filemounts,fop;{forms_legend},forms,formp;{account_legend},disable,start,stop'), 'fields' => array('id' => array('sql' => "int(10) unsigned NOT NULL auto_increment"), 'tstamp' => array('sql' => "int(10) unsigned NOT NULL default '0'"), 'username' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['username'], 'exclude' => true, 'search' => true, 'sorting' => true, 'flag' => 1, 'inputType' => 'text', 'eval' => array('mandatory' => true, 'rgxp' => 'extnd', 'nospace' => true, 'unique' => true, 'maxlength' => 64), 'sql' => "varchar(64) COLLATE utf8_bin NULL"), 'name' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['name'], 'exclude' => true, 'search' => true, 'sorting' => true, 'flag' => 1, 'inputType' => 'text', 'eval' => array('mandatory' => true, 'maxlength' => 255, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'email' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['email'], 'exclude' => true, 'search' => true, 'inputType' => 'text', 'eval' => array('mandatory' => true, 'rgxp' => 'email', 'maxlength' => 255, 'unique' => true, 'decodeEntities' => true, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'language' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['language'], 'default' => str_replace('-', '_', $GLOBALS['TL_LANGUAGE']), 'exclude' => true, 'filter' => true, 'inputType' => 'select', 'options' => System::getLanguages(true), 'eval' => array('rgxp' => 'locale', 'tl_class' => 'w50'), 'sql' => "varchar(5) NOT NULL default ''"), 'backendTheme' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['backendTheme'], 'exclude' => true, 'inputType' => 'select', 'options' => Backend::getThemes(), 'sql' => "varchar(32) NOT NULL default ''"), 'uploader' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['uploader'], 'exclude' => true, 'inputType' => 'select', 'options' => array('DropZone', 'FileUpload'), 'reference' => &$GLOBALS['TL_LANG']['tl_user'], 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(32) NOT NULL default ''"), 'showHelp' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['showHelp'], 'default' => 1, 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''"), 'thumbnails' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['thumbnails'], 'default' => 1, 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''"), 'useRTE' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['useRTE'], 'default' => 1, 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''"), 'useCE' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['useCE'], 'default' => 1, 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''"), 'password' => array('label' => &$GLOBALS['TL_LANG']['MSC']['password'], 'exclude' => true, 'inputType' => 'password', 'eval' => array('mandatory' => true, 'preserveTags' => true, 'minlength' => Config::get('minPasswordLength')), 'sql' => "varchar(128) NOT NULL default ''"), 'pwChange' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['pwChange'], 'exclude' => true, 'inputType' => 'checkbox', 'filter' => true, 'sql' => "char(1) NOT NULL default ''"), 'admin' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['admin'], 'exclude' => true, 'inputType' => 'checkbox', 'filter' => true, 'eval' => array('submitOnChange' => true), 'save_callback' => array(array('tl_user', 'checkAdminStatus')), 'sql' => "char(1) NOT NULL default ''"), 'groups' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['groups'], 'exclude' => true, 'filter' => true, 'inputType' => 'checkboxWizard', 'foreignKey' => 'tl_user_group.name', 'eval' => array('multiple' => true), 'sql' => "blob NULL", 'relation' => array('type' => 'belongsToMany', 'load' => 'lazy')), 'inherit' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['inherit'], 'exclude' => true, 'default' => 'group', 'inputType' => 'radio', 'options' => array('group', 'extend', 'custom'), 'reference' => &$GLOBALS['TL_LANG']['tl_user'], 'eval' => array('helpwizard' => true, 'submitOnChange' => true), 'sql' => "varchar(12) NOT NULL default ''"), 'modules' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['modules'], 'exclude' => true, 'filter' => true, 'inputType' => 'checkbox', 'options_callback' => array('tl_user', 'getModules'), 'reference' => &$GLOBALS['TL_LANG']['MOD'], 'eval' => array('multiple' => true, 'helpwizard' => true), 'sql' => "blob NULL"), 'themes' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['themes'], 'exclude' => true, 'inputType' => 'checkbox', 'options' => array('css', 'modules', 'layout', 'image_sizes', 'theme_import', 'theme_export'), 'reference' => &$GLOBALS['TL_LANG']['MOD'], 'eval' => array('multiple' => true), 'sql' => "blob NULL"), 'pagemounts' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['pagemounts'], 'exclude' => true, 'inputType' => 'pageTree', 'eval' => array('multiple' => true, 'fieldType' => 'checkbox'), 'sql' => "blob NULL"), 'alpty' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['alpty'], 'default' => array('regular', 'redirect', 'forward'), 'exclude' => true, 'inputType' => 'checkbox', 'options' => array_keys($GLOBALS['TL_PTY']), 'reference' => &$GLOBALS['TL_LANG']['PTY'], 'eval' => array('multiple' => true, 'helpwizard' => true), 'sql' => "blob NULL"), 'filemounts' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['filemounts'], 'exclude' => true, 'inputType' => 'fileTree', 'eval' => array('multiple' => true, 'fieldType' => 'checkbox'), 'sql' => "blob NULL"), 'fop' => array('label' => &$GLOBALS['TL_LANG']['FOP']['fop'], 'default' => array('f1', 'f2', 'f3'), 'exclude' => true, 'inputType' => 'checkbox', 'options' => array('f1', 'f2', 'f3', 'f4', 'f5', 'f6'), 'reference' => &$GLOBALS['TL_LANG']['FOP'], 'eval' => array('multiple' => true), 'sql' => "blob NULL"), 'forms' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['forms'], 'exclude' => true, 'inputType' => 'checkbox', 'foreignKey' => 'tl_form.title', 'eval' => array('multiple' => true), 'sql' => "blob NULL"), 'formp' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['formp'], 'exclude' => true, 'inputType' => 'checkbox', 'options' => array('create', 'delete'), 'reference' => &$GLOBALS['TL_LANG']['MSC'], 'eval' => array('multiple' => true), 'sql' => "blob NULL"), 'disable' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['disable'], 'exclude' => true, 'filter' => true, 'flag' => 2, 'inputType' => 'checkbox', 'save_callback' => array(array('tl_user', 'checkAdminDisable')), 'sql' => "char(1) NOT NULL default ''"), 'start' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['start'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('rgxp' => 'datim', 'datepicker' => true, 'tl_class' => 'w50 wizard'), 'sql' => "varchar(10) NOT NULL default ''"), 'stop' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['stop'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('rgxp' => 'datim', 'datepicker' => true, 'tl_class' => 'w50 wizard'), 'sql' => "varchar(10) NOT NULL default ''"), 'session' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['session'], 'exclude' => true, 'input_field_callback' => array('tl_user', 'sessionField'), 'eval' => array('doNotShow' => true, 'doNotCopy' => true), 'sql' => "blob NULL"), '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('eval' => array('rgxp' => 'datim', 'doNotShow' => true, 'doNotCopy' => true), 'sql' => "int(10) unsigned NOT NULL default '0'"), 'currentLogin' => array('label' => &$GLOBALS['TL_LANG']['MSC']['lastLogin'], 'sorting' => true, 'flag' => 6, 'eval' => array('rgxp' => 'datim', 'doNotCopy' => true), 'sql' => "int(10) unsigned NOT NULL default '0'"), 'loginCount' => array('default' => 3, 'eval' => array('doNotCopy' => true), 'sql' => "smallint(5) unsigned NOT NULL default '3'"), 'locked' => array('eval' => array('rgxp' => 'datim', 'doNotCopy' => true), 'sql' => "int(10) unsigned NOT NULL default '0'")));
/**
 * Provide miscellaneous methods that are used by the data configuration array.
 *
 * @author Leo Feyer <https://github.com/leofeyer>
 */
class tl_user extends Backend
{
    /**
     * Import the back end user object
     */
    public function __construct()
    {
        parent::__construct();
        $this->import('BackendUser', 'User');
    }
    /**
     * Check permissions to edit table tl_user
     */
Ejemplo n.º 6
0
    /**
     * Auto-generate a form to edit the current database record
     * @param integer
     * @param integer
     * @return string
     */
    public function edit($intID = false, $ajaxId = false)
    {
        if ($GLOBALS['TL_DCA'][$this->strTable]['config']['notEditable']) {
            \System::log('Table ' . $this->strTable . ' is not editable', 'DC_ProductData edit()', TL_ERROR);
            \Controller::redirect('contao/main.php?act=error');
        }
        if ($intID) {
            $this->intId = $intID;
        }
        $return = '';
        $this->values[] = $this->intId;
        $this->procedure[] = 'id=?';
        $this->blnCreateNewVersion = false;
        $this->blnEditLanguage = false;
        // Get the current record
        $objRow = \Database::getInstance()->prepare("SELECT * FROM " . $this->strTable . " WHERE id=?")->limit(1)->execute($this->intId);
        // Redirect if there is no record with the given ID
        if ($objRow->numRows < 1) {
            \System::log('Could not load record ID "' . $this->intId . '" of table "' . $this->strTable . '"!', 'DC_ProductData edit()', TL_ERROR);
            \Controller::redirect('contao/main.php?act=error');
        } elseif ($objRow->language != '') {
            \System::log('Cannot edit language record ID "' . $this->intId . '" of table "' . $this->strTable . '"!', 'DC_ProductData edit()', TL_ERROR);
            \Controller::redirect('contao/main.php?act=error');
        }
        $this->objActiveRecord = $objRow;
        // Load and/or change language
        // Add support for i18nl10n extension
        if (in_array('i18nl10n', \Config::getInstance()->getActiveModules())) {
            $arrPageLanguages = array_filter(array_unique(deserialize($GLOBALS['TL_CONFIG']['i18nl10n_languages'], true)));
        } else {
            $arrPageLanguages = $this->Database->execute("SELECT DISTINCT language FROM tl_page WHERE type='root'")->fetchEach('language');
            $arrPageLanguages = array_map(function ($strLang) {
                return str_replace('-', '_', $strLang);
            }, $arrPageLanguages);
        }
        if (count($arrPageLanguages) > 1) {
            $this->arrTranslationLabels = \System::getLanguages();
            $this->arrTranslations = array_intersect(array_keys($this->arrTranslationLabels), $arrPageLanguages);
            if (\Input::post('FORM_SUBMIT') == 'tl_language') {
                $session = $this->Session->getData();
                if (in_array(\Input::post('language'), $this->arrTranslations)) {
                    $session['language'][$this->strTable][$this->intId] = \Input::post('language');
                    if (\Input::post('deleteLanguage') != '') {
                        $this->Database->prepare("DELETE FROM " . $this->strTable . " WHERE pid=? AND language=?")->execute($this->intId, \Input::post('language'));
                        unset($session['language'][$this->strTable][$this->intId]);
                    }
                } else {
                    unset($session['language'][$this->strTable][$this->intId]);
                }
                $this->Session->setData($session);
                $_SESSION['TL_INFO'] = '';
                \Controller::reload();
            }
            if ($_SESSION['BE_DATA']['language'][$this->strTable][$this->intId] != '' && in_array($_SESSION['BE_DATA']['language'][$this->strTable][$this->intId], $this->arrTranslations)) {
                $objRow = $this->Database->prepare("SELECT * FROM " . $this->strTable . " WHERE pid=? AND language=?")->execute($this->intId, $_SESSION['BE_DATA']['language'][$this->strTable][$this->intId]);
                if (!$objRow->numRows) {
                    $intId = $this->Database->prepare("INSERT INTO " . $this->strTable . " (pid,tstamp,language) VALUES (?,?,?)")->execute($this->intId, time(), $_SESSION['BE_DATA']['language'][$this->strTable][$this->intId])->insertId;
                    $objRow = $this->Database->prepare("SELECT * FROM " . $this->strTable . " WHERE id=?")->execute($intId);
                }
                $this->objActiveRecord = $objRow;
                $this->values = array($this->intId, $_SESSION['BE_DATA']['language'][$this->strTable][$this->intId]);
                $this->procedure = array('pid=?', 'language=?');
                $this->blnEditLanguage = true;
            }
        }
        $this->createInitialVersion($this->strTable, $this->objActiveRecord->id);
        // Change version
        if ($GLOBALS['TL_DCA'][$this->strTable]['config']['enableVersioning'] && \Input::post('FORM_SUBMIT') == 'tl_version' && \Input::post('version') != '') {
            $objData = $this->Database->prepare("SELECT * FROM tl_version WHERE fromTable=? AND pid=? AND version=?")->limit(1)->execute($this->strTable, $this->objActiveRecord->id, \Input::post('version'));
            if ($objData->numRows) {
                $data = deserialize($objData->data);
                if (is_array($data)) {
                    $this->Database->prepare("UPDATE " . $objData->fromTable . " %s WHERE id=?")->set($data)->execute($this->objActiveRecord->id);
                    $this->Database->prepare("UPDATE tl_version SET active='' WHERE pid=?")->execute($this->objActiveRecord->id);
                    $this->Database->prepare("UPDATE tl_version SET active=1 WHERE pid=? AND version=?")->execute($this->objActiveRecord->id, \Input::post('version'));
                    \System::log(sprintf('Version %s of record ID %s (table %s) has been restored', \Input::post('version'), $this->objActiveRecord->id, $this->strTable), 'DC_ProductData edit()', TL_GENERAL);
                    // Trigger the onrestore_callback
                    if (is_array($GLOBALS['TL_DCA'][$this->strTable]['config']['onrestore_callback'])) {
                        foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onrestore_callback'] as $callback) {
                            if (is_array($callback)) {
                                $this->import($callback[0]);
                                $this->{$callback}[0]->{$callback}[1]($this->objActiveRecord->id, $this->strTable, $data, \Input::post('version'));
                            } elseif (is_callable($callback)) {
                                call_user_func($callback, $this->objActiveRecord->id, $this->strTable, $data, \Input::post('version'));
                            }
                        }
                    }
                }
            }
            \Controller::reload();
        }
        // Build an array from boxes and rows
        $this->strPalette = $this->getPalette();
        $boxes = trimsplit(';', $this->strPalette);
        $legends = array();
        if (!empty($boxes)) {
            foreach ($boxes as $k => $v) {
                $eCount = 1;
                $boxes[$k] = trimsplit(',', $v);
                foreach ($boxes[$k] as $kk => $vv) {
                    if (preg_match('/^\\[.*\\]$/i', $vv)) {
                        ++$eCount;
                        continue;
                    }
                    if (preg_match('/^\\{.*\\}$/i', $vv)) {
                        $legends[$k] = substr($vv, 1, -1);
                        unset($boxes[$k][$kk]);
                    } elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$vv]['exclude'] || !is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$vv])) {
                        unset($boxes[$k][$kk]);
                    } elseif ($this->blnEditLanguage && !$GLOBALS['TL_DCA'][$this->strTable]['fields'][$vv]['attributes']['multilingual']) {
                        unset($boxes[$k][$kk]);
                    }
                }
                // Unset a box if it does not contain any fields
                if (count($boxes[$k]) < $eCount) {
                    unset($boxes[$k]);
                }
            }
            $class = 'tl_tbox block';
            $fs = $this->Session->get('fieldset_states');
            $blnIsFirst = true;
            // Render boxes
            foreach ($boxes as $k => $v) {
                $strAjax = '';
                $blnAjax = false;
                $legend = '';
                if (isset($legends[$k])) {
                    list($key, $cls) = explode(':', $legends[$k]);
                    $legend = "\n" . '<legend onclick="AjaxRequest.toggleFieldset(this, \'' . $key . '\', \'' . $this->strTable . '\')">' . (isset($GLOBALS['TL_LANG'][$this->strTable][$key]) ? $GLOBALS['TL_LANG'][$this->strTable][$key] : $key) . '</legend>';
                }
                if (!$GLOBALS['TL_CONFIG']['oldBeTheme']) {
                    if (isset($fs[$this->strTable][$key])) {
                        $class .= $fs[$this->strTable][$key] ? '' : ' collapsed';
                    } else {
                        $class .= $cls && $legend ? ' ' . $cls : '';
                    }
                    $return .= "\n\n" . '<fieldset' . ($key ? ' id="pal_' . $key . '"' : '') . ' class="' . $class . ($legend ? '' : ' nolegend') . '">' . $legend;
                } else {
                    $return .= "\n\n" . '<div class="' . $class . '">';
                }
                // Build rows of the current box
                foreach ($v as $vv) {
                    if ($vv == '[EOF]') {
                        if ($blnAjax && \Environment::get('isAjaxRequest')) {
                            return $strAjax . '<input type="hidden" name="FORM_FIELDS[]" value="' . specialchars($this->strPalette) . '">';
                        }
                        $blnAjax = false;
                        $return .= "\n" . '</div>';
                        continue;
                    }
                    if (preg_match('/^\\[.*\\]$/i', $vv)) {
                        $thisId = 'sub_' . substr($vv, 1, -1);
                        $blnAjax = $ajaxId == $thisId && \Environment::get('isAjaxRequest') ? true : false;
                        $return .= "\n" . '<div id="' . $thisId . '">';
                        continue;
                    }
                    $this->strField = $vv;
                    $this->strInputName = $vv;
                    $this->varValue = $this->objActiveRecord->{$vv};
                    // Autofocus the first field
                    if ($blnIsFirst && $GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['inputType'] == 'text') {
                        $GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['eval']['autofocus'] = 'autofocus';
                        $blnIsFirst = false;
                    }
                    // Convert CSV fields (see #2890)
                    if ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['eval']['multiple'] && isset($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['eval']['csv'])) {
                        $this->varValue = trimsplit($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['eval']['csv'], $this->varValue);
                    }
                    // Call load_callback
                    if (is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['load_callback'])) {
                        foreach ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['load_callback'] as $callback) {
                            if (is_array($callback)) {
                                $this->import($callback[0]);
                                $this->varValue = $this->{$callback}[0]->{$callback}[1]($this->varValue, $this);
                            } elseif (is_callable($callback)) {
                                $this->varValue = call_user_func($callback, $this->varValue, $this);
                            }
                        }
                        $this->objActiveRecord->{$this->strField} = $this->varValue;
                    }
                    // Build row
                    $blnAjax ? $strAjax .= $this->row() : ($return .= $this->row());
                }
                $class = 'tl_box block';
                if (!$GLOBALS['TL_CONFIG']['oldBeTheme']) {
                    $return .= "\n" . '</fieldset>';
                } else {
                    $return .= "\n" . '</div>';
                }
            }
        }
        $version = '';
        // Check versions
        if ($GLOBALS['TL_DCA'][$this->strTable]['config']['enableVersioning']) {
            $objVersion = $this->Database->prepare("SELECT tstamp, version, username, active FROM tl_version WHERE fromTable=? AND pid=? ORDER BY version DESC")->execute($this->strTable, $this->objActiveRecord->id);
            if ($objVersion->numRows > 1) {
                $versions = '';
                while ($objVersion->next()) {
                    $versions .= '
  <option value="' . $objVersion->version . '"' . ($objVersion->active ? ' selected="selected"' : '') . '>' . $GLOBALS['TL_LANG']['MSC']['version'] . ' ' . $objVersion->version . ' (' . \System::parseDate($GLOBALS['TL_CONFIG']['datimFormat'], $objVersion->tstamp) . ') ' . $objVersion->username . '</option>';
                }
                $version = '<form action="' . ampersand(\Environment::get('request'), true) . '" id="tl_version" class="tl_form" method="post" style="float:right;">
<div class="tl_formbody">
<input type="hidden" name="FORM_SUBMIT" value="tl_version">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">
<select name="version" class="tl_select">' . $versions . '
</select>
<input type="submit" name="showVersion" id="showVersion" class="tl_submit" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['restore']) . '">
</div>
</form>';
            }
        }
        // Check languages
        if (is_array($this->arrTranslations) && !empty($this->arrTranslations)) {
            $arrAvailableLanguages = $this->Database->prepare("SELECT language FROM " . $this->strTable . " WHERE pid=?")->execute($this->intId)->fetchEach('language');
            $available = '';
            $undefined = '';
            foreach ($this->arrTranslations as $language) {
                if (in_array($language, $arrAvailableLanguages)) {
                    if ($_SESSION['BE_DATA']['language'][$this->strTable][$this->intId] == $language) {
                        $available .= '<option value="' . $language . '" selected="selected">' . $this->arrTranslationLabels[$language] . '</option>';
                        $_SESSION['TL_INFO'] = array($GLOBALS['TL_LANG']['MSC']['editingLanguage']);
                    } else {
                        $available .= '<option value="' . $language . '">' . $this->arrTranslationLabels[$language] . '</option>';
                    }
                } else {
                    $undefined .= '<option value="' . $language . '">' . $this->arrTranslationLabels[$language] . ' (' . $GLOBALS['TL_LANG']['MSC']['undefinedLanguage'] . ')' . '</option>';
                }
            }
            $version .= '<form action="' . ampersand(\Environment::get('request'), true) . '" id="tl_language" class="tl_form" method="post" style="float:left;margin-left:20px;">
<div class="tl_formbody">
<input type="hidden" name="FORM_SUBMIT" value="tl_language">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">
<select name="language" class="tl_select' . ($_SESSION['BE_DATA']['language'][$this->strTable][$this->intId] == '' ? '' : ' active') . '">
    <option value="">' . $GLOBALS['TL_LANG']['MSC']['defaultLanguage'] . '</option>' . $available . $undefined . '
</select>
<input type="submit" name="editLanguage" class="tl_submit" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['editLanguage']) . '">
<input type="submit" name="deleteLanguage" class="tl_submit" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['deleteLanguage']) . '" onclick="return confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteLanguageConfirm'] . '\')">
</div>
</form>';
        }
        if ($version != '') {
            $version = '
<div class="tl_version_panel">

' . $version . '
<div class="clear"></div>
</div>';
        }
        // Add some buttons and end the form
        $return .= '
</div>

<div class="tl_formbody_submit">

<div class="tl_submit_container">
<input type="submit" name="save" id="save" class="tl_submit" accesskey="s" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['save']) . '">
<input type="submit" name="saveNclose" id="saveNclose" class="tl_submit" accesskey="c" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['saveNclose']) . '">' . (!$GLOBALS['TL_DCA'][$this->strTable]['config']['closed'] ? '
<input type="submit" name="saveNcreate" id="saveNcreate" class="tl_submit" accesskey="n" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['saveNcreate']) . '">' : '') . (\Input::get('s2e') ? '
<input type="submit" name="saveNedit" id="saveNedit" class="tl_submit" accesskey="e" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['saveNedit']) . '">' : ($GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['mode'] == 4 || $this->ptable != '' || $GLOBALS['TL_DCA'][$this->strTable]['config']['switchToEdit'] ? '
<input type="submit" name="saveNback" id="saveNback" class="tl_submit" accesskey="g" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['saveNback']) . '">' : '')) . '
</div>

</div>
</form>

<script>
window.addEvent(\'domready\', function() {
  var first = $(\'' . $this->strTable . '\').getElement(\'input[type="text"]\');
  if (first) first.focus();
});
</script>';
        $copyFallback = $this->blnEditLanguage ? '&nbsp;&nbsp;::&nbsp;&nbsp;<a href="' . \Backend::addToUrl('act=copyFallback') . '" class="header_iso_copy" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['copyFallback']) . '" accesskey="d" onclick="Backend.getScrollOffset();">' . ($GLOBALS['TL_LANG']['MSC']['copyFallback'] ? $GLOBALS['TL_LANG']['MSC']['copyFallback'] : 'copyFallback') . '</a>' : '';
        // Begin the form (-> DO NOT CHANGE THIS ORDER -> this way the onsubmit attribute of the form can be changed by a field)
        $return = $version . '
<div id="tl_buttons">
<a href="' . \System::getReferer(true) . '" class="header_back" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['backBT']) . '" accesskey="b" onclick="Backend.getScrollOffset();">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a>' . $copyFallback . '
</div>

<h2 class="sub_headline">' . sprintf($GLOBALS['TL_LANG']['MSC']['editRecord'], $this->intId ? 'ID ' . $this->intId : '') . '</h2>
' . $this->getMessages() . '
<form action="' . ampersand(\Environment::get('request'), true) . '" id="' . $this->strTable . '" class="tl_form" method="post" enctype="' . ($this->blnUploadable ? 'multipart/form-data' : 'application/x-www-form-urlencoded') . '"' . (count($this->onsubmit) ? ' onsubmit="' . implode(' ', $this->onsubmit) . '"' : '') . '>
<div class="tl_formbody_edit">
<input type="hidden" name="FORM_SUBMIT" value="' . specialchars($this->strTable) . '">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">
<input type="hidden" name="FORM_FIELDS[]" value="' . specialchars($this->strPalette) . '">' . ($this->noReload ? '

<p class="tl_error">' . $GLOBALS['TL_LANG']['ERR']['general'] . '</p>' : '') . $return;
        // Reload the page to prevent _POST variables from being sent twice
        if (\Input::post('FORM_SUBMIT') == $this->strTable && !$this->noReload) {
            $arrValues = $this->values;
            array_unshift($arrValues, time());
            // Trigger the onsubmit_callback
            if (is_array($GLOBALS['TL_DCA'][$this->strTable]['config']['onsubmit_callback'])) {
                foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onsubmit_callback'] as $callback) {
                    if (is_array($callback)) {
                        $this->import($callback[0]);
                        $this->{$callback}[0]->{$callback}[1]($this);
                    } elseif (is_callable($callback)) {
                        call_user_func($callback, $this);
                    }
                }
            }
            // Save the current version
            if ($this->blnCreateNewVersion && \Input::post('SUBMIT_TYPE') != 'auto') {
                $this->createNewVersion($this->strTable, $this->objActiveRecord->id);
                // Call the onversion_callback
                if (is_array($GLOBALS['TL_DCA'][$this->strTable]['config']['onversion_callback'])) {
                    foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onversion_callback'] as $callback) {
                        if (is_array($callback)) {
                            $this->import($callback[0]);
                            $this->{$callback}[0]->{$callback}[1]($this->strTable, $this->objActiveRecord->id, $this);
                        } elseif (is_callable($callback)) {
                            call_user_func($callback, $this->strTable, $this->objActiveRecord->id, $this);
                        }
                    }
                }
                \System::log(sprintf('A new version of %s ID %s has been created', $this->strTable, $this->objActiveRecord->id), 'DC_ProductData edit()', TL_GENERAL);
            }
            // Set the current timestamp (-> DO NOT CHANGE THE ORDER version - timestamp)
            $this->Database->prepare("UPDATE " . $this->strTable . " SET tstamp=? WHERE id=?")->execute(time(), $this->activeRecord->id);
            // Redirect
            if (isset($_POST['saveNclose'])) {
                $_SESSION['TL_INFO'] = '';
                $_SESSION['TL_ERROR'] = '';
                $_SESSION['TL_CONFIRM'] = '';
                setcookie('BE_PAGE_OFFSET', 0, 0, '/');
                \Controller::redirect(\System::getReferer());
            } elseif (isset($_POST['saveNedit'])) {
                $_SESSION['TL_INFO'] = '';
                $_SESSION['TL_ERROR'] = '';
                $_SESSION['TL_CONFIRM'] = '';
                setcookie('BE_PAGE_OFFSET', 0, 0, '/');
                $strUrl = \Backend::addToUrl($GLOBALS['TL_DCA'][$this->strTable]['list']['operations']['edit']['href']);
                $strUrl = preg_replace('/(&amp;)?s2e=[^&]*/i', '', $strUrl);
                $strUrl = preg_replace('/(&amp;)?act=[^&]*/i', '', $strUrl);
                \Controller::redirect($strUrl);
            } elseif (isset($_POST['saveNback'])) {
                $_SESSION['TL_INFO'] = '';
                $_SESSION['TL_ERROR'] = '';
                $_SESSION['TL_CONFIRM'] = '';
                setcookie('BE_PAGE_OFFSET', 0, 0, '/');
                if ($this->ptable == '') {
                    \Controller::redirect(\Environment::get('script') . '?do=' . \Input::get('do'));
                } elseif ($this->ptable == 'tl_theme' && $this->strTable == 'tl_style_sheet') {
                    \Controller::redirect(\System::getReferer(false, $this->strTable));
                } else {
                    \Controller::redirect(\System::getReferer(false, $this->ptable));
                }
            } elseif (isset($_POST['saveNcreate'])) {
                $_SESSION['TL_INFO'] = '';
                $_SESSION['TL_ERROR'] = '';
                $_SESSION['TL_CONFIRM'] = '';
                setcookie('BE_PAGE_OFFSET', 0, 0, '/');
                $strUrl = \Environment::get('script') . '?do=' . \Input::get('do');
                if (isset($_GET['table'])) {
                    $strUrl .= '&amp;table=' . \Input::get('table');
                }
                // Tree view
                if ($this->treeView) {
                    $strUrl .= '&amp;act=create&amp;mode=1&amp;pid=' . $this->intId;
                } elseif ($GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['mode'] == 4 || $this->activeRecord->pid > 0) {
                    $strUrl .= $this->Database->fieldExists('sorting', $this->strTable) ? '&amp;act=create&amp;mode=1&amp;pid=' . $this->intId . '&amp;id=' . $this->activeRecord->pid : '&amp;act=create&amp;mode=2&amp;pid=' . $this->activeRecord->pid;
                } else {
                    $strUrl .= $this->ptable != '' ? '&amp;act=create&amp;mode=2&amp;pid=' . CURRENT_ID : '&amp;act=create';
                }
                \Controller::redirect($strUrl . '&amp;rt=' . REQUEST_TOKEN);
            }
            \Controller::reload();
        }
        // Set the focus if there is an error
        if ($this->noReload) {
            $return .= '

<script>
window.addEvent(\'domready\', function() {
  Backend.vScrollTo(($(\'' . $this->strTable . '\').getElement(\'label.error\').getPosition().y - 20));
});
</script>';
        }
        return $return;
    }
Ejemplo n.º 7
0
<?php

/**
 * Contao Open Source CMS
 *
 * Copyright (c) 2005-2016 Leo Feyer
 *
 * @license LGPL-3.0+
 */
/**
 * Table tl_member
 */
$GLOBALS['TL_DCA']['tl_member'] = array('config' => array('dataContainer' => 'Table', 'enableVersioning' => true, 'onsubmit_callback' => array(array('tl_member', 'storeDateAdded'), array('tl_member', 'checkRemoveSession')), 'ondelete_callback' => array(array('tl_member', 'removeSession')), 'sql' => array('keys' => array('id' => 'primary', 'username' => 'unique', 'email' => 'index', 'autologin' => 'unique', 'activation' => 'index'))), 'list' => array('sorting' => array('mode' => 2, 'fields' => array('dateAdded DESC'), 'flag' => 1, '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('label' => &$GLOBALS['TL_LANG']['MSC']['all'], 'href' => 'act=select', 'class' => 'header_edit_all', 'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"')), 'operations' => array('edit' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['edit'], 'href' => 'act=edit', 'icon' => 'edit.svg'), 'copy' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['copy'], 'href' => 'act=copy', 'icon' => 'copy.svg'), 'delete' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['delete'], 'href' => 'act=delete', 'icon' => 'delete.svg', 'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\'))return false;Backend.getScrollOffset()"'), 'toggle' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['toggle'], 'icon' => 'visible.svg', 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', 'button_callback' => array('tl_member', 'toggleIcon')), 'show' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['show'], 'href' => 'act=show', 'icon' => 'show.svg'), 'su' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['su'], 'href' => 'key=su', 'icon' => 'su.svg', 'button_callback' => array('tl_member', 'switchUser')))), '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' => array('login' => 'username,password', 'assignDir' => 'homeDir'), 'fields' => array('id' => array('sql' => "int(10) unsigned NOT NULL auto_increment"), 'tstamp' => array('sql' => "int(10) unsigned NOT NULL default '0'"), 'firstname' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['firstname'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['lastname'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['dateOfBirth'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['gender'], 'exclude' => true, 'inputType' => 'select', 'options' => array('male', 'female'), '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('label' => &$GLOBALS['TL_LANG']['tl_member']['company'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['street'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['postal'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['city'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['state'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['country'], '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' => function () {
    return System::getCountries();
}, 'sql' => "varchar(2) NOT NULL default ''"), 'phone' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['phone'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['mobile'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['fax'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['email'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['website'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['language'], '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' => function () {
    return System::getLanguages();
}, 'sql' => "varchar(5) NOT NULL default ''"), 'groups' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['groups'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['login'], 'exclude' => true, 'filter' => true, 'inputType' => 'checkbox', 'eval' => array('submitOnChange' => true), 'sql' => "char(1) NOT NULL default ''"), 'username' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['username'], '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'), 'sql' => "varchar(64) COLLATE utf8_bin NULL"), 'password' => array('label' => &$GLOBALS['TL_LANG']['MSC']['password'], 'exclude' => true, 'inputType' => 'password', 'eval' => array('mandatory' => true, 'preserveTags' => true, 'minlength' => Config::get('minPasswordLength'), 'feEditable' => true, 'feGroup' => 'login'), 'save_callback' => array(array('tl_member', 'setNewPassword')), 'sql' => "varchar(128) NOT NULL default ''"), 'assignDir' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['assignDir'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('submitOnChange' => true), 'sql' => "char(1) NOT NULL default ''"), 'homeDir' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['homeDir'], 'exclude' => true, 'inputType' => 'fileTree', 'eval' => array('fieldType' => 'radio', 'tl_class' => 'clr'), 'sql' => "binary(16) NULL"), 'disable' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['disable'], 'exclude' => true, 'filter' => true, 'inputType' => 'checkbox', 'sql' => "char(1) NOT NULL default ''"), 'start' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['start'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('rgxp' => 'datim', 'datepicker' => true, 'tl_class' => 'w50 wizard'), 'sql' => "varchar(10) NOT NULL default ''"), 'stop' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['stop'], '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'"), 'loginCount' => array('default' => 3, 'eval' => array('doNotCopy' => true), 'sql' => "smallint(5) unsigned NOT NULL default '3'"), '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"), 'autologin' => array('default' => null, 'eval' => array('doNotCopy' => true), 'sql' => "varchar(32) NULL"), 'createdOn' => array('eval' => array('rgxp' => 'datim', 'doNotCopy' => true), 'sql' => "int(10) unsigned NOT NULL default '0'"), 'activation' => array('eval' => array('doNotCopy' => true), 'sql' => "varchar(32) NOT NULL default ''")));
/**
 * Filter disabled groups in the front end (see #6757)
 */
if (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 Backend
{
    /**
<?php

/*
 * This file is part of the Translation Fields Bundle.
 *
 * (c) Daniel Kiesel <https://github.com/iCodr8>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
/**
 * Palettes
 */
$GLOBALS['TL_DCA']['tl_settings']['palettes']['__selector__'][] = 'chooseTranslationLanguages';
$GLOBALS['TL_DCA']['tl_settings']['palettes']['default'] .= ';{translation-fields_legend},dontfillEmptyTranslationFields,chooseTranslationLanguages;';
$GLOBALS['TL_DCA']['tl_settings']['subpalettes']['chooseTranslationLanguages'] = 'translationLanguages';
/**
 * Fields
 */
$GLOBALS['TL_DCA']['tl_settings']['fields']['dontfillEmptyTranslationFields'] = array('label' => &$GLOBALS['TL_LANG']['tl_settings']['dontfillEmptyTranslationFields'], 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'm12'));
$GLOBALS['TL_DCA']['tl_settings']['fields']['chooseTranslationLanguages'] = array('label' => &$GLOBALS['TL_LANG']['tl_settings']['chooseTranslationLanguages'], 'inputType' => 'checkbox', 'eval' => array('submitOnChange' => true));
$GLOBALS['TL_DCA']['tl_settings']['fields']['translationLanguages'] = array('label' => &$GLOBALS['TL_LANG']['tl_settings']['translationLanguages'], 'inputType' => 'checkboxWizard', 'options' => \System::getLanguages(), 'eval' => array('mandatory' => true, 'multiple' => true));
Ejemplo n.º 9
0
<?php

/**
 * Contao Open Source CMS
 *
 * Copyright (c) 2005-2015 Leo Feyer
 *
 * @license LGPL-3.0+
 */
/**
 * Table tl_member
 */
$GLOBALS['TL_DCA']['tl_member'] = array('config' => array('dataContainer' => 'Table', 'enableVersioning' => true, 'onsubmit_callback' => array(array('tl_member', 'storeDateAdded'), array('tl_member', 'checkRemoveSession')), 'ondelete_callback' => array(array('tl_member', 'removeSession')), 'sql' => array('keys' => array('id' => 'primary', 'username' => 'unique', 'email' => 'index', 'autologin' => 'unique', 'activation' => 'index'))), 'list' => array('sorting' => array('mode' => 2, 'fields' => array('dateAdded DESC'), 'flag' => 1, '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('label' => &$GLOBALS['TL_LANG']['MSC']['all'], 'href' => 'act=select', 'class' => 'header_edit_all', 'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"')), 'operations' => array('edit' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['edit'], 'href' => 'act=edit', 'icon' => 'edit.gif'), 'copy' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['copy'], 'href' => 'act=copy', 'icon' => 'copy.gif'), 'delete' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['delete'], 'href' => 'act=delete', 'icon' => 'delete.gif', 'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\'))return false;Backend.getScrollOffset()"'), 'toggle' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['toggle'], 'icon' => 'visible.gif', 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', 'button_callback' => array('tl_member', 'toggleIcon')), 'show' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['show'], 'href' => 'act=show', 'icon' => 'show.gif'), 'su' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['su'], 'href' => 'key=su', 'icon' => 'su.gif', 'button_callback' => array('tl_member', 'switchUser')))), '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' => array('login' => 'username,password', 'assignDir' => 'homeDir'), 'fields' => array('id' => array('sql' => "int(10) unsigned NOT NULL auto_increment"), 'tstamp' => array('sql' => "int(10) unsigned NOT NULL default '0'"), 'firstname' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['firstname'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['lastname'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['dateOfBirth'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['gender'], 'exclude' => true, 'inputType' => 'select', 'options' => array('male', 'female'), '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('label' => &$GLOBALS['TL_LANG']['tl_member']['company'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['street'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['postal'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['city'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['state'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['country'], 'exclude' => true, 'filter' => true, 'sorting' => true, 'inputType' => 'select', 'options' => System::getCountries(), 'eval' => array('includeBlankOption' => true, 'chosen' => true, 'feEditable' => true, 'feViewable' => true, 'feGroup' => 'address', 'tl_class' => 'w50'), 'sql' => "varchar(2) NOT NULL default ''"), 'phone' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['phone'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['mobile'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['fax'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['email'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['website'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['language'], 'exclude' => true, 'filter' => true, 'inputType' => 'select', 'options' => System::getLanguages(), 'eval' => array('includeBlankOption' => true, 'chosen' => true, 'rgxp' => 'locale', 'feEditable' => true, 'feViewable' => true, 'feGroup' => 'personal', 'tl_class' => 'w50'), 'sql' => "varchar(5) NOT NULL default ''"), 'groups' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['groups'], '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('label' => &$GLOBALS['TL_LANG']['tl_member']['login'], 'exclude' => true, 'filter' => true, 'inputType' => 'checkbox', 'eval' => array('submitOnChange' => true), 'sql' => "char(1) NOT NULL default ''"), 'username' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['username'], 'exclude' => true, 'search' => true, 'sorting' => true, 'flag' => 1, 'inputType' => 'text', 'eval' => array('mandatory' => true, 'unique' => true, 'nullIfEmpty' => true, 'rgxp' => 'extnd', 'nospace' => true, 'maxlength' => 64, 'feEditable' => true, 'feViewable' => true, 'feGroup' => 'login'), 'sql' => "varchar(64) COLLATE utf8_bin NULL"), 'password' => array('label' => &$GLOBALS['TL_LANG']['MSC']['password'], 'exclude' => true, 'inputType' => 'password', 'eval' => array('mandatory' => true, 'preserveTags' => true, 'minlength' => Config::get('minPasswordLength'), 'feEditable' => true, 'feGroup' => 'login'), 'save_callback' => array(array('tl_member', 'setNewPassword')), 'sql' => "varchar(128) NOT NULL default ''"), 'assignDir' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['assignDir'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('submitOnChange' => true), 'sql' => "char(1) NOT NULL default ''"), 'homeDir' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['homeDir'], 'exclude' => true, 'inputType' => 'fileTree', 'eval' => array('fieldType' => 'radio', 'tl_class' => 'clr'), 'sql' => "binary(16) NULL"), 'disable' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['disable'], 'exclude' => true, 'filter' => true, 'inputType' => 'checkbox', 'sql' => "char(1) NOT NULL default ''"), 'start' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['start'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('rgxp' => 'datim', 'datepicker' => true, 'tl_class' => 'w50 wizard'), 'sql' => "varchar(10) NOT NULL default ''"), 'stop' => array('label' => &$GLOBALS['TL_LANG']['tl_member']['stop'], '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'], 'sorting' => true, 'flag' => 6, 'eval' => array('rgxp' => 'datim'), 'sql' => "int(10) unsigned NOT NULL default '0'"), 'lastLogin' => array('label' => &$GLOBALS['TL_LANG']['MSC']['lastLogin'], 'eval' => array('rgxp' => 'datim'), 'sql' => "int(10) unsigned NOT NULL default '0'"), 'currentLogin' => array('label' => &$GLOBALS['TL_LANG']['MSC']['currentLogin'], 'sorting' => true, 'flag' => 6, 'eval' => array('rgxp' => 'datim'), 'sql' => "int(10) unsigned NOT NULL default '0'"), 'loginCount' => array('sql' => "smallint(5) unsigned NOT NULL default '3'"), 'locked' => array('eval' => array('rgxp' => 'datim'), 'sql' => "int(10) unsigned NOT NULL default '0'"), 'session' => array('eval' => array('doNotShow' => true), 'sql' => "blob NULL"), 'autologin' => array('default' => null, 'eval' => array('doNotCopy' => true), 'sql' => "varchar(32) NULL"), 'createdOn' => array('eval' => array('rgxp' => 'datim'), 'sql' => "int(10) unsigned NOT NULL default '0'"), 'activation' => array('eval' => array('doNotCopy' => true), 'sql' => "varchar(32) NOT NULL default ''")));
/**
 * Filter disabled groups in the front end (see #6757)
 */
if (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 Backend
{
    /**
     * Import the back end user object
     */
    public function __construct()
    {
<?php

/*
 * This file is part of the TranslationFields Bundle.
 *
 * (c) Daniel Kiesel <https://github.com/iCodr8>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
/**
 * Palettes
 */
$GLOBALS['TL_DCA']['tl_translation_fields'] = array('config' => array('dataContainer' => 'Table', 'enableVersioning' => true, 'sql' => array('keys' => array('id' => 'primary', 'fid,language' => 'unique', 'fid' => 'index'))), 'list' => array('sorting' => array('mode' => 2, 'fields' => array('language'), 'panelLayout' => 'filter;sort,search'), 'label' => array('fields' => array('language', 'fid', 'content'), 'showColumns' => true), 'global_operations' => array('all' => array('label' => &$GLOBALS['TL_LANG']['MSC']['all'], 'href' => 'act=select', 'class' => 'header_edit_all', 'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"')), 'operations' => array('edit' => array('label' => &$GLOBALS['TL_LANG']['tl_content']['edit'], 'href' => 'act=edit', 'icon' => 'edit.gif'), 'delete' => array('label' => &$GLOBALS['TL_LANG']['tl_content']['delete'], 'href' => 'act=delete', 'icon' => 'delete.gif', 'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\'))return false;Backend.getScrollOffset()"'), 'show' => array('label' => &$GLOBALS['TL_LANG']['tl_content']['show'], 'href' => 'act=show', 'icon' => 'show.gif'))), 'palettes' => array('default' => '{translation_legend},fid,language,content'), 'fields' => array('id' => array('sql' => "int(10) unsigned NOT NULL auto_increment"), 'tstamp' => array('inputType' => 'text', 'sql' => "int(10) unsigned NOT NULL default '0'"), 'fid' => array('label' => &$GLOBALS['TL_LANG']['tl_translation_fields']['fid'], 'exclude' => true, 'search' => true, 'sorting' => true, 'inputType' => 'text', 'eval' => array('tl_class' => 'w50'), 'sql' => "int(10) unsigned NOT NULL default '0'"), 'language' => array('label' => &$GLOBALS['TL_LANG']['tl_translation_fields']['language'], 'exclude' => true, 'filter' => true, 'sorting' => true, 'inputType' => 'select', 'options' => \System::getLanguages(), 'eval' => array('chosen' => true, 'tl_class' => 'w50'), 'sql' => "varchar(5) NOT NULL default ''"), 'content' => array('label' => &$GLOBALS['TL_LANG']['tl_translation_fields']['content'], 'exclude' => true, 'search' => true, 'inputType' => 'textarea', 'eval' => array('mandatory' => true), 'sql' => "text NOT NULL")));
 private static function setTranslationLanguages()
 {
     // Get all languages
     $arrLanguages = \System::getLanguages();
     // Get all used languages
     $arrLng = array();
     // If languages are specified
     if ($GLOBALS['TL_CONFIG']['chooseTranslationLanguages'] == '1') {
         $arrTranslationLanguages = deserialize($GLOBALS['TL_CONFIG']['translationLanguages']);
         if (is_array($arrTranslationLanguages) && $arrTranslationLanguages > 0) {
             foreach ($arrTranslationLanguages as $strLng) {
                 $arrLng[$strLng] = $arrLanguages[$strLng];
             }
         }
     } else {
         $objRootPages = \TranslationFieldsPageModel::findRootPages();
         if ($objRootPages !== null) {
             while ($objRootPages->next()) {
                 $arrLng[$objRootPages->language] = $arrLanguages[$objRootPages->language];
             }
         }
         // If langauge array is empty
         if (count($arrLng) < 1) {
             // Set all available languages
             $arrLng = \System::getLanguages(true);
             // Set the language of the user to the top
             if (\BackendUser::getInstance()->language != null) {
                 // Get langauge value
                 $strLngValue = $arrLng[\BackendUser::getInstance()->language];
                 // Remove the current language from the array
                 unset($arrLng[\BackendUser::getInstance()->language]);
                 // Add old array to a temp array
                 $arrLngTemp = $arrLng;
                 // Generate a new array
                 $arrLng = array(\BackendUser::getInstance()->language => $strLngValue);
                 // Merge the old array into the new array
                 $arrLng = array_merge($arrLng, $arrLngTemp);
             }
         }
     }
     self::$arrLng = $arrLng;
 }
Ejemplo n.º 12
0
<?php

/**
 * Contao Open Source CMS
 *
 * Copyright (c) 2005-2016 Leo Feyer
 *
 * @license LGPL-3.0+
 */
/**
 * Table tl_user
 */
$GLOBALS['TL_DCA']['tl_user'] = array('config' => array('dataContainer' => 'Table', 'enableVersioning' => true, 'onload_callback' => array(array('tl_user', 'checkPermission')), 'onsubmit_callback' => array(array('tl_user', 'storeDateAdded'), array('tl_user', 'checkRemoveSession')), 'ondelete_callback' => array(array('tl_user', 'removeSession')), 'sql' => array('keys' => array('id' => 'primary', 'username' => 'unique', 'email' => 'index'))), 'list' => array('sorting' => array('mode' => 2, 'fields' => array('dateAdded DESC'), 'flag' => 1, 'panelLayout' => 'filter;sort,search,limit'), 'label' => array('fields' => array('icon', 'name', 'username', 'dateAdded'), 'showColumns' => true, 'label_callback' => array('tl_user', 'addIcon')), 'global_operations' => array('all' => array('label' => &$GLOBALS['TL_LANG']['MSC']['all'], 'href' => 'act=select', 'class' => 'header_edit_all', 'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"')), 'operations' => array('edit' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['edit'], 'href' => 'act=edit', 'icon' => 'edit.svg', 'button_callback' => array('tl_user', 'editUser')), 'copy' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['copy'], 'href' => 'act=copy', 'icon' => 'copy.svg', 'button_callback' => array('tl_user', 'copyUser')), 'delete' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['delete'], 'href' => 'act=delete', 'icon' => 'delete.svg', 'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\'))return false;Backend.getScrollOffset()"', 'button_callback' => array('tl_user', 'deleteUser')), 'toggle' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['toggle'], 'icon' => 'visible.svg', 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', 'button_callback' => array('tl_user', 'toggleIcon')), 'show' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['show'], 'href' => 'act=show', 'icon' => 'show.svg'), 'su' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['su'], 'href' => 'key=su', 'icon' => 'su.svg', 'button_callback' => array('tl_user', 'switchUser')))), 'palettes' => array('__selector__' => array('inherit', 'admin'), 'login' => '{name_legend},name,email;{backend_legend},language,uploader,showHelp,thumbnails,useRTE,useCE;{session_legend},session;{theme_legend:hide},backendTheme;{password_legend},password', 'admin' => '{name_legend},username,name,email;{backend_legend:hide},language,uploader,showHelp,thumbnails,useRTE,useCE;{theme_legend:hide},backendTheme;{password_legend:hide},pwChange,password;{admin_legend},admin;{account_legend},disable,start,stop', 'default' => '{name_legend},username,name,email;{backend_legend:hide},language,uploader,showHelp,thumbnails,useRTE,useCE;{theme_legend:hide},backendTheme;{password_legend:hide},pwChange,password;{admin_legend},admin;{groups_legend},groups,inherit;{account_legend},disable,start,stop', 'group' => '{name_legend},username,name,email;{backend_legend:hide},language,uploader,showHelp,thumbnails,useRTE,useCE;{theme_legend:hide},backendTheme;{password_legend:hide},pwChange,password;{admin_legend},admin;{groups_legend},groups,inherit;{account_legend},disable,start,stop', 'extend' => '{name_legend},username,name,email;{backend_legend:hide},language,uploader,showHelp,thumbnails,useRTE,useCE;{theme_legend:hide},backendTheme;{password_legend:hide},pwChange,password;{admin_legend},admin;{groups_legend},groups,inherit;{modules_legend},modules,themes;{pagemounts_legend},pagemounts,alpty;{filemounts_legend},filemounts,fop;{imageSizes_legend},imageSizes;{forms_legend},forms,formp;{account_legend},disable,start,stop', 'custom' => '{name_legend},username,name,email;{backend_legend:hide},language,uploader,showHelp,thumbnails,useRTE,useCE;{theme_legend:hide},backendTheme;{password_legend:hide},pwChange,password;{admin_legend},admin;{groups_legend},groups,inherit;{modules_legend},modules,themes;{pagemounts_legend},pagemounts,alpty;{filemounts_legend},filemounts,fop;{imageSizes_legend},imageSizes;{forms_legend},forms,formp;{account_legend},disable,start,stop'), 'fields' => array('id' => array('sql' => "int(10) unsigned NOT NULL auto_increment"), 'tstamp' => array('sql' => "int(10) unsigned NOT NULL default '0'"), 'username' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['username'], 'exclude' => true, 'search' => true, 'sorting' => true, 'flag' => 1, 'inputType' => 'text', 'eval' => array('mandatory' => true, 'rgxp' => 'extnd', 'nospace' => true, 'unique' => true, 'maxlength' => 64), 'sql' => "varchar(64) COLLATE utf8_bin NULL"), 'name' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['name'], 'exclude' => true, 'search' => true, 'sorting' => true, 'flag' => 1, 'inputType' => 'text', 'eval' => array('mandatory' => true, 'maxlength' => 255, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'email' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['email'], 'exclude' => true, 'search' => true, 'inputType' => 'text', 'eval' => array('mandatory' => true, 'rgxp' => 'email', 'maxlength' => 255, 'unique' => true, 'decodeEntities' => true, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'language' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['language'], 'default' => str_replace('-', '_', $GLOBALS['TL_LANGUAGE']), 'exclude' => true, 'filter' => true, 'inputType' => 'select', 'eval' => array('rgxp' => 'locale', 'tl_class' => 'w50'), 'options_callback' => function () {
    return System::getLanguages(true);
}, 'sql' => "varchar(5) NOT NULL default ''"), 'backendTheme' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['backendTheme'], 'exclude' => true, 'inputType' => 'select', 'options_callback' => function () {
    return Backend::getThemes();
}, 'sql' => "varchar(32) NOT NULL default ''"), 'uploader' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['uploader'], 'exclude' => true, 'inputType' => 'select', 'options' => array('DropZone', 'FileUpload'), 'reference' => &$GLOBALS['TL_LANG']['tl_user'], 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(32) NOT NULL default ''"), 'showHelp' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['showHelp'], 'default' => 1, 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''"), 'thumbnails' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['thumbnails'], 'default' => 1, 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''"), 'useRTE' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['useRTE'], 'default' => 1, 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''"), 'useCE' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['useCE'], 'default' => 1, 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''"), 'password' => array('label' => &$GLOBALS['TL_LANG']['MSC']['password'], 'exclude' => true, 'inputType' => 'password', 'eval' => array('mandatory' => true, 'preserveTags' => true, 'minlength' => Config::get('minPasswordLength')), 'sql' => "varchar(128) NOT NULL default ''"), 'pwChange' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['pwChange'], 'exclude' => true, 'inputType' => 'checkbox', 'filter' => true, 'sql' => "char(1) NOT NULL default ''"), 'admin' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['admin'], 'exclude' => true, 'inputType' => 'checkbox', 'filter' => true, 'eval' => array('submitOnChange' => true), 'save_callback' => array(array('tl_user', 'checkAdminStatus')), 'sql' => "char(1) NOT NULL default ''"), 'groups' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['groups'], 'exclude' => true, 'filter' => true, 'inputType' => 'checkboxWizard', 'foreignKey' => 'tl_user_group.name', 'eval' => array('multiple' => true), 'sql' => "blob NULL", 'relation' => array('type' => 'belongsToMany', 'load' => 'lazy')), 'inherit' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['inherit'], 'exclude' => true, 'default' => 'group', 'inputType' => 'radio', 'options' => array('group', 'extend', 'custom'), 'reference' => &$GLOBALS['TL_LANG']['tl_user'], 'eval' => array('helpwizard' => true, 'submitOnChange' => true), 'sql' => "varchar(12) NOT NULL default ''"), 'modules' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['modules'], 'exclude' => true, 'filter' => true, 'inputType' => 'checkbox', 'options_callback' => array('tl_user', 'getModules'), 'reference' => &$GLOBALS['TL_LANG']['MOD'], 'eval' => array('multiple' => true, 'helpwizard' => true), 'sql' => "blob NULL"), 'themes' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['themes'], 'exclude' => true, 'inputType' => 'checkbox', 'options' => array('css', 'modules', 'layout', 'image_sizes', 'theme_import', 'theme_export'), 'reference' => &$GLOBALS['TL_LANG']['MOD'], 'eval' => array('multiple' => true), 'sql' => "blob NULL"), 'pagemounts' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['pagemounts'], 'exclude' => true, 'inputType' => 'pageTree', 'eval' => array('multiple' => true, 'fieldType' => 'checkbox'), 'sql' => "blob NULL"), 'alpty' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['alpty'], 'default' => array('regular', 'redirect', 'forward'), 'exclude' => true, 'inputType' => 'checkbox', 'options' => array_keys($GLOBALS['TL_PTY']), 'reference' => &$GLOBALS['TL_LANG']['PTY'], 'eval' => array('multiple' => true, 'helpwizard' => true), 'sql' => "blob NULL"), 'filemounts' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['filemounts'], 'exclude' => true, 'inputType' => 'fileTree', 'eval' => array('multiple' => true, 'fieldType' => 'checkbox'), 'sql' => "blob NULL"), 'fop' => array('label' => &$GLOBALS['TL_LANG']['FOP']['fop'], 'default' => array('f1', 'f2', 'f3'), 'exclude' => true, 'inputType' => 'checkbox', 'options' => array('f1', 'f2', 'f3', 'f4', 'f5', 'f6'), 'reference' => &$GLOBALS['TL_LANG']['FOP'], 'eval' => array('multiple' => true), 'sql' => "blob NULL"), 'imageSizes' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['imageSizes'], 'exclude' => true, 'inputType' => 'checkbox', 'reference' => &$GLOBALS['TL_LANG']['MSC'], 'eval' => array('multiple' => true), 'options_callback' => function () {
    return System::getContainer()->get('contao.image.image_sizes')->getAllOptions();
}, 'sql' => "blob NULL"), 'forms' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['forms'], 'exclude' => true, 'inputType' => 'checkbox', 'foreignKey' => 'tl_form.title', 'eval' => array('multiple' => true), 'sql' => "blob NULL"), 'formp' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['formp'], 'exclude' => true, 'inputType' => 'checkbox', 'options' => array('create', 'delete'), 'reference' => &$GLOBALS['TL_LANG']['MSC'], 'eval' => array('multiple' => true), 'sql' => "blob NULL"), 'disable' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['disable'], 'exclude' => true, 'filter' => true, 'flag' => 2, 'inputType' => 'checkbox', 'save_callback' => array(array('tl_user', 'checkAdminDisable')), 'sql' => "char(1) NOT NULL default ''"), 'start' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['start'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('rgxp' => 'datim', 'datepicker' => true, 'tl_class' => 'w50 wizard'), 'sql' => "varchar(10) NOT NULL default ''"), 'stop' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['stop'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('rgxp' => 'datim', 'datepicker' => true, 'tl_class' => 'w50 wizard'), 'sql' => "varchar(10) NOT NULL default ''"), 'session' => array('label' => &$GLOBALS['TL_LANG']['tl_user']['session'], 'exclude' => true, 'input_field_callback' => array('tl_user', 'sessionField'), 'eval' => array('doNotShow' => true, 'doNotCopy' => true), 'sql' => "blob NULL"), '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('eval' => array('rgxp' => 'datim', 'doNotShow' => true, 'doNotCopy' => true), 'sql' => "int(10) unsigned NOT NULL default '0'"), 'currentLogin' => array('label' => &$GLOBALS['TL_LANG']['MSC']['lastLogin'], 'sorting' => true, 'flag' => 6, 'eval' => array('rgxp' => 'datim', 'doNotCopy' => true), 'sql' => "int(10) unsigned NOT NULL default '0'"), 'loginCount' => array('default' => 3, 'eval' => array('doNotCopy' => true), 'sql' => "smallint(5) unsigned NOT NULL default '3'"), 'locked' => array('eval' => array('rgxp' => 'datim', 'doNotCopy' => true), 'sql' => "int(10) unsigned NOT NULL default '0'")));
/**
 * Provide miscellaneous methods that are used by the data configuration array.
 *
 * @author Leo Feyer <https://github.com/leofeyer>
 */
class tl_user extends Backend
{
    /**
     * Import the back end user object
     */
    public function __construct()
    {
<?php

/**
 * notification_center extension for Contao Open Source CMS
 *
 * @copyright  Copyright (c) 2008-2015, terminal42
 * @author     terminal42 gmbh <*****@*****.**>
 * @license    LGPL
 */
$this->loadDataContainer('tl_nc_gateway');
/**
 * Table tl_nc_language
 */
$GLOBALS['TL_DCA']['tl_nc_language'] = array('config' => array('ptable' => 'tl_nc_message', 'dataContainer' => 'Table', 'enableVersioning' => true, 'nc_type_query' => "SELECT type FROM tl_nc_notification WHERE id=(SELECT pid FROM tl_nc_message WHERE id=(SELECT pid FROM tl_nc_language WHERE id=?))", 'oncreate_callback' => array(array('NotificationCenter\\tl_nc_language', 'insertGatewayType')), 'onload_callback' => array(array('NotificationCenter\\tl_nc_language', 'modifyPalette'), array('NotificationCenter\\AutoSuggester', 'load')), 'sql' => array('keys' => array('id' => 'primary', 'pid' => 'index', 'language' => 'index'))), 'list' => array('sorting' => array('mode' => 1, 'fields' => array('language'), 'flag' => 1), 'label' => array('fields' => array('language', 'fallback'), 'format' => '%s <span style="color:#b3b3b3; padding-left:3px;">[%s]</span>'), 'global_operations' => array('all' => array('label' => &$GLOBALS['TL_LANG']['MSC']['all'], 'href' => 'act=select', 'class' => 'header_edit_all', 'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"')), 'operations' => array('edit' => array('label' => &$GLOBALS['TL_LANG']['tl_nc_language']['edit'], 'href' => 'act=edit', 'icon' => 'edit.gif'), 'copy' => array('label' => &$GLOBALS['TL_LANG']['tl_nc_language']['copy'], 'href' => 'act=copy', 'icon' => 'copy.gif'), 'delete' => array('label' => &$GLOBALS['TL_LANG']['tl_nc_language']['delete'], 'href' => 'act=delete', 'icon' => 'delete.gif', 'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\'))return false;Backend.getScrollOffset()"'), 'show' => array('label' => &$GLOBALS['TL_LANG']['tl_nc_language']['show'], 'href' => 'act=show', 'icon' => 'show.gif'))), 'palettes' => array('__selector__' => array('gateway_type', 'email_mode'), 'default' => '{general_legend},language,fallback', 'email' => '{general_legend},language,fallback;{meta_legend},email_sender_name,email_sender_address,recipients,email_recipient_cc,email_recipient_bcc,email_replyTo;{content_legend},email_subject,email_mode;{attachments_legend},attachments,attachment_tokens', 'file' => '{general_legend},language,fallback;{meta_legend},file_name,file_storage_mode;{content_legend},file_content', 'postmark' => '{general_legend},language,fallback;{meta_legend},email_sender_name,email_sender_address,recipients,email_recipient_cc,email_recipient_bcc,email_replyTo;{content_legend},email_subject,email_mode'), 'subpalettes' => array('email_mode_textOnly' => 'email_text', 'email_mode_textAndHtml' => 'email_text,email_html'), 'fields' => array('id' => array('sql' => "int(10) unsigned NOT NULL auto_increment"), 'pid' => array('foreignKey' => 'tl_nc_message.title', 'sql' => "int(10) unsigned NOT NULL default '0'", 'relation' => array('type' => 'belongsTo', 'load' => 'lazy')), 'tstamp' => array('sql' => "int(10) unsigned NOT NULL default '0'"), 'gateway_type' => array('eval' => array('doNotShow' => true), 'sql' => &$GLOBALS['TL_DCA']['tl_nc_gateway']['fields']['type']['sql']), 'language' => array('label' => &$GLOBALS['TL_LANG']['tl_nc_language']['language'], 'exclude' => true, 'default' => $GLOBALS['TL_LANGUAGE'], 'inputType' => 'select', 'options' => \System::getLanguages(), 'eval' => array('mandatory' => true, 'chosen' => true, 'tl_class' => 'w50'), 'sql' => "varchar(5) NOT NULL default ''", 'save_callback' => array(array('NotificationCenter\\tl_nc_language', 'validateLanguageField'))), 'fallback' => array('label' => &$GLOBALS['TL_LANG']['tl_nc_language']['fallback'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50 m12'), 'sql' => "char(1) NOT NULL default ''", 'save_callback' => array(array('NotificationCenter\\tl_nc_language', 'validateFallbackField'))), 'recipients' => array('label' => &$GLOBALS['TL_LANG']['tl_nc_language']['recipients'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('rgxp' => 'nc_tokens', 'tl_class' => 'long clr', 'decodeEntities' => true, 'mandatory' => true), 'sql' => "varchar(255) NOT NULL default ''", 'save_callback' => array(array('NotificationCenter\\tl_nc_language', 'validateEmailList'))), 'attachment_tokens' => array('label' => &$GLOBALS['TL_LANG']['tl_nc_language']['attachment_tokens'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('rgxp' => 'nc_tokens', 'tl_class' => 'long clr', 'decodeEntities' => true), 'sql' => "varchar(255) NOT NULL default ''"), 'attachments' => array('label' => &$GLOBALS['TL_LANG']['tl_nc_language']['attachments'], 'exclude' => true, 'inputType' => 'fileTree', 'eval' => array('multiple' => true, 'fieldType' => 'checkbox', 'files' => true, 'filesOnly' => true, 'tl_class' => 'clr'), 'sql' => "blob NULL"), 'email_sender_name' => array('label' => &$GLOBALS['TL_LANG']['tl_nc_language']['email_sender_name'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('rgxp' => 'nc_tokens', 'decodeEntities' => true, 'maxlength' => 255, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'email_sender_address' => array('label' => &$GLOBALS['TL_LANG']['tl_nc_language']['email_sender_address'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('rgxp' => 'nc_tokens', 'maxlength' => 255, 'decodeEntities' => true, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''", 'save_callback' => array(array('NotificationCenter\\tl_nc_language', 'validateEmailList'))), 'email_recipient_cc' => array('label' => &$GLOBALS['TL_LANG']['tl_nc_language']['email_recipient_cc'], 'exclude' => true, 'inputType' => 'textarea', 'eval' => array('rgxp' => 'nc_tokens', 'style' => 'height:40px; width:314px', 'decodeEntities' => true, 'tl_class' => 'w50" style="height:auto'), 'sql' => "text NULL", 'save_callback' => array(array('NotificationCenter\\tl_nc_language', 'validateEmailList'))), 'email_recipient_bcc' => array('label' => &$GLOBALS['TL_LANG']['tl_nc_language']['email_recipient_bcc'], 'exclude' => true, 'inputType' => 'textarea', 'eval' => array('rgxp' => 'nc_tokens', 'style' => 'height:40px; width:314px', 'decodeEntities' => true, 'tl_class' => 'w50" style="height:auto'), 'sql' => "text NULL", 'save_callback' => array(array('NotificationCenter\\tl_nc_language', 'validateEmailList'))), 'email_replyTo' => array('label' => &$GLOBALS['TL_LANG']['tl_nc_language']['email_replyTo'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('rgxp' => 'nc_tokens', 'decodeEntities' => true, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''", 'save_callback' => array(array('NotificationCenter\\tl_nc_language', 'validateEmailList'))), 'email_subject' => array('label' => &$GLOBALS['TL_LANG']['tl_nc_language']['email_subject'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('rgxp' => 'nc_tokens', 'tl_class' => 'long clr', 'decodeEntities' => true, 'mandatory' => true), 'sql' => "varchar(255) NOT NULL default ''"), 'email_mode' => array('label' => &$GLOBALS['TL_LANG']['tl_nc_language']['email_mode'], 'exclude' => true, 'default' => 'textOnly', 'inputType' => 'radio', 'options' => array('textOnly', 'textAndHtml'), 'reference' => &$GLOBALS['TL_LANG']['tl_nc_language']['email_mode'], 'eval' => array('tl_class' => 'clr', 'submitOnChange' => true), 'sql' => "varchar(16) NOT NULL default ''"), 'email_text' => array('label' => &$GLOBALS['TL_LANG']['tl_nc_language']['email_text'], 'exclude' => true, 'inputType' => 'textarea', 'eval' => array('rgxp' => 'nc_tokens', 'tl_class' => 'clr', 'decodeEntities' => true, 'mandatory' => true), 'sql' => "text NULL"), 'email_html' => array('label' => &$GLOBALS['TL_LANG']['tl_nc_language']['email_html'], 'exclude' => true, 'inputType' => 'textarea', 'eval' => array('rgxp' => 'nc_tokens', 'tl_class' => 'clr', 'rte' => 'tinyMCE', 'decodeEntities' => true, 'allowHtml' => true, 'mandatory' => true), 'sql' => "text NULL"), 'file_name' => array('label' => &$GLOBALS['TL_LANG']['tl_nc_language']['file_name'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('rgxp' => 'nc_tokens', 'tl_class' => 'w50', 'decodeEntities' => true, 'mandatory' => true), 'sql' => "varchar(255) NOT NULL default ''"), 'file_storage_mode' => array('label' => &$GLOBALS['TL_LANG']['tl_nc_language']['file_storage_mode'], 'exclude' => true, 'inputType' => 'select', 'options' => array(\NotificationCenter\Gateway\File::FILE_STORAGE_OVERRIDE, \NotificationCenter\Gateway\File::FILE_STORAGE_APPEND), 'reference' => &$GLOBALS['TL_LANG']['tl_nc_language']['file_storage_mode'], 'eval' => array('includeBlankOption' => true, 'blankOptionLabel' => &$GLOBALS['TL_LANG']['tl_nc_language']['file_storage_mode']['create'], 'tl_class' => 'w50'), 'sql' => "varchar(8) NOT NULL default ''"), 'file_content' => array('label' => &$GLOBALS['TL_LANG']['tl_nc_language']['file_content'], 'exclude' => true, 'inputType' => 'textarea', 'eval' => array('rgxp' => 'nc_tokens', 'tl_class' => 'clr', 'decodeEntities' => true, 'preserveTags' => true, 'mandatory' => true, 'style' => 'min-height:100px'), 'sql' => "text NULL")));
Ejemplo n.º 14
0
 /**
  * Override the default "show" dialog.
  *
  * @param $dc
  *
  * @return string
  */
 public function show($dc)
 {
     $arrLanguages = \System::getLanguages();
     $objForm = \Database::getInstance()->prepare("\n            SELECT l.*, s.title AS form_title, f.title AS master_title, CONCAT(m.firstname, ' ', m.lastname) AS member_name\n            FROM tl_lead l\n            LEFT OUTER JOIN tl_form s ON l.form_id=s.id\n            LEFT OUTER JOIN tl_form f ON l.master_id=f.id\n            LEFT OUTER JOIN tl_member m ON l.member_id=m.id\n            WHERE l.id=?\n        ")->execute($dc->id);
     $objData = \Database::getInstance()->prepare("\n            SELECT d.*, IF(ff.label IS NULL OR ff.label='', d.name, ff.label) AS name\n            FROM tl_lead_data d\n            LEFT OUTER JOIN tl_form_field ff ON d.master_id=ff.id\n            WHERE d.pid=?\n            ORDER BY d.sorting\n        ")->execute($dc->id);
     $template = new \BackendTemplate('be_leads_show');
     $template->recordId = $dc->id;
     $template->referer = \System::getReferer(true);
     $template->subheadline = sprintf($GLOBALS['TL_LANG']['MSC']['showRecord'], 'ID ' . $dc->id);
     $template->createdLabel = $GLOBALS['TL_LANG']['tl_lead']['created'][0];
     $template->createdValue = \Date::parse($GLOBALS['TL_CONFIG']['datimFormat'], $objForm->created);
     $template->formLabel = $GLOBALS['TL_LANG']['tl_lead']['form_id'][0];
     $template->formTitle = $objForm->form_title;
     $template->formId = $objForm->form_id;
     $template->isMasterForm = $objForm->master_id == $objForm->form_id;
     $template->masterLabel = $GLOBALS['TL_LANG']['tl_lead']['master_id'][0];
     $template->masterTitle = $objForm->master_title;
     $template->masterId = $objForm->master_id;
     $template->languageLabel = $GLOBALS['TL_LANG']['tl_lead']['language'][0];
     $template->languageTrans = $arrLanguages[$objForm->language];
     $template->languageValue = $objForm->language;
     $template->hasMember = $objForm->member_id > 0;
     $template->memberLabel = $GLOBALS['TL_LANG']['tl_lead']['member'][0];
     $template->memberName = $objForm->member_name;
     $template->memberId = $objForm->member_id;
     $i = 0;
     $rows = array();
     while ($objData->next()) {
         $rows[] = array('label' => $objData->name, 'value' => \Leads\Leads::formatValue($objData), 'class' => $i % 2 ? 'tl_bg' : '');
         ++$i;
     }
     $template->data = $rows;
     return $template->parse();
 }