Contao-Camp 2024
Ergebnis 1 bis 10 von 10

Thema: Fehler im Cache? Contao Version 3.4.5

  1. #1
    Contao-Nutzer Avatar von Mischa
    Registriert seit
    10.03.2010.
    Ort
    Dresden
    Beiträge
    149
    User beschenken
    Wunschliste

    Standard Fehler im Cache? Contao Version 3.4.5

    Hallo, wenn ich den Cache leere und dann den Cache neu bauen lasse, bekomme ich eine weiße Seite mit dem Hinweis: ".../system/cache/dca/tl_page.php is corrupted."

    Im Error-Log wird dazu nichts dokumentiert

    Lösche ich kurzerhand die tl_page.php im Cache oder aktiviere ich "Internen Cache Umgehen", funktioniert es (im ersten Fall manchmal kurz).

    Bug?
    Herzliche Grüße, Mischa Lempe
    Webdesign und Webentwicklung aus Dresden

  2. #2
    Contao-Urgestein Avatar von KlausGrenoble
    Registriert seit
    27.01.2013.
    Ort
    Grenoble
    Beiträge
    2.362

    Standard

    Zitat Zitat von Mischa Beitrag anzeigen
    Bug?
    Vielleicht.
    Entferne mal alle Verzeichnisse unter /system/cache/ (nicht die Datei .gitignore) ! Dann tritt das vielleicht niemals mehr wieder auf.

  3. #3
    Contao-Urgestein Avatar von the_scrat
    Registriert seit
    24.02.2010.
    Ort
    Augsburg
    Beiträge
    2.051
    User beschenken
    Wunschliste

    Standard

    Lass den Cache mal erstellen und produziere den Fehler, danach öffnest du die Cache-Datei. Viele IDE zeigen dir dann vielleicht dort direkt den Fehler.

    Ich hatte letztens erst diese Art von Fehler in einer meiner Erweiterungen, dort hat ein Semikolon in einer Sprachdatei gefehlt. Ohne Cache wird die Sprachdatei einwandfrei verarbeitet (einzeln), aber im Cache werden ja alle Dateien zusammengefasst und daher kann ein fehlendes Semikolon zu einer ungültigen Datei führen.

    Wenn du den Fehler nicht findest, kannst du die Datei ja gerne mal hier als Anhang hinterlassen.....
    Programmers don't comment their code. It was hard to write, it should be hard to understand...

  4. #4
    Contao-Nutzer Avatar von Mischa
    Registriert seit
    10.03.2010.
    Ort
    Dresden
    Beiträge
    149
    User beschenken
    Wunschliste

    Standard

    Hüstel...

    PHP-Code:
    <?php 

    /**
     * Contao Open Source CMS
     *
     * Copyright (c) 2005-2015 Leo Feyer
     *
     * @license LGPL-3.0+
     */


    /**
     * Table tl_page
     */
    $GLOBALS['TL_DCA']['tl_page'] = array
    (

        
    // Config
        
    'config' => array
        (
            
    'label'                       => Config::get('websiteTitle'),
            
    'dataContainer'               => 'Table',
            
    'ctable'                      => array('tl_article'),
            
    'enableVersioning'            => true,
            
    'onload_callback' => array
            (
                array(
    'tl_page''checkPermission'),
                array(
    'tl_page''addBreadcrumb'),
                array(
    'tl_page''setRootType'),
                array(
    'tl_page''showFallbackWarning')
            ),
            
    'onsubmit_callback' => array
            (
                array(
    'tl_page''updateSitemap'),
                array(
    'tl_page''generateArticle')
            ),
            
    'ondelete_callback' => array
            (
                array(
    'tl_page''purgeSearchIndex')
            ),
            
    'sql' => array
            (
                
    'keys' => array
                (
                    
    'id' => 'primary',
                    
    'pid' => 'index',
                    
    'alias' => 'index',
                    
    'type' => 'index'
                
    )
            )
        ),

        
    // List
        
    'list' => array
        (
            
    'sorting' => array
            (
                
    'mode'                    => 5,
                
    'icon'                    => 'pagemounts.gif',
                
    'paste_button_callback'   => array('tl_page''pastePage'),
                
    'panelLayout'             => 'filter,search'
            
    ),
            
    'label' => array
            (
                
    'fields'                  => array('title'),
                
    'format'                  => '%s',
                
    'label_callback'          => array('tl_page''addIcon')
            ),
            
    'global_operations' => array
            (
                
    'toggleNodes' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['MSC']['toggleAll'],
                    
    'href'                => 'ptg=all',
                    
    'class'               => 'header_toggle'
                
    ),
                
    '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_page']['edit'],
                    
    'href'                => 'act=edit',
                    
    'icon'                => 'edit.gif',
                    
    'button_callback'     => array('tl_page''editPage')
                ),
                
    'copy' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_page']['copy'],
                    
    'href'                => 'act=paste&amp;mode=copy',
                    
    'icon'                => 'copy.gif',
                    
    'attributes'          => 'onclick="Backend.getScrollOffset()"',
                    
    'button_callback'     => array('tl_page''copyPage')
                ),
                
    'copyChilds' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_page']['copyChilds'],
                    
    'href'                => 'act=paste&amp;mode=copy&amp;childs=1',
                    
    'icon'                => 'copychilds.gif',
                    
    'attributes'          => 'onclick="Backend.getScrollOffset()"',
                    
    'button_callback'     => array('tl_page''copyPageWithSubpages')
                ),
                
    'cut' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_page']['cut'],
                    
    'href'                => 'act=paste&amp;mode=cut',
                    
    'icon'                => 'cut.gif',
                    
    'attributes'          => 'onclick="Backend.getScrollOffset()"',
                    
    'button_callback'     => array('tl_page''cutPage')
                ),
                
    'delete' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_page']['delete'],
                    
    'href'                => 'act=delete',
                    
    'icon'                => 'delete.gif',
                    
    'attributes'          => 'onclick="if(!confirm(\'' $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\'))return false;Backend.getScrollOffset()"',
                    
    'button_callback'     => array('tl_page''deletePage')
                ),
                
    'toggle' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_page']['toggle'],
                    
    'icon'                => 'visible.gif',
                    
    'attributes'          => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
                    
    'button_callback'     => array('tl_page''toggleIcon')
                ),
                
    'show' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_page']['show'],
                    
    'href'                => 'act=show',
                    
    'icon'                => 'show.gif'
                
    ),
                
    'articles' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_page']['articles'],
                    
    'href'                => 'do=article',
                    
    'icon'                => 'article.gif',
                    
    'button_callback'     => array('tl_page''editArticles')
                )
            )
        ),

        
    // Select
        
    'select' => array
        (
            
    'buttons_callback' => array
            (
                array(
    'tl_page''addAliasButton')
            )
        ),

        
    // Palettes
        
    'palettes' => array
        (
            
    '__selector__'                => array('type''autoforward''protected''createSitemap''includeLayout''includeCache''includeChmod''published'),
            
    'default'                     => '{title_legend},title,alias,type',
            
    'regular'                     => '{title_legend},title,alias,type;{meta_legend},pageTitle,robots,description;{protected_legend:hide},protected;{layout_legend:hide},includeLayout;{cache_legend:hide},includeCache;{chmod_legend:hide},includeChmod;{search_legend},noSearch;{expert_legend:hide},cssClass,sitemap,hide,guests;{tabnav_legend:hide},tabindex,accesskey;{publish_legend},published',
            
    'forward'                     => '{title_legend},title,alias,type;{meta_legend},pageTitle;{redirect_legend},redirect,jumpTo;{protected_legend:hide},protected;{layout_legend:hide},includeLayout;{cache_legend:hide},includeCache;{chmod_legend:hide},includeChmod;{expert_legend:hide},cssClass,sitemap,hide,guests;{tabnav_legend:hide},tabindex,accesskey;{publish_legend},published',
            
    'redirect'                    => '{title_legend},title,alias,type;{meta_legend},pageTitle;{redirect_legend},redirect,url,target;{protected_legend:hide},protected;{layout_legend:hide},includeLayout;{cache_legend:hide},includeCache;{chmod_legend:hide},includeChmod;{expert_legend:hide},cssClass,sitemap,hide,guests;{tabnav_legend:hide},tabindex,accesskey;{publish_legend},published',
            
    'root'                        => '{title_legend},title,alias,type;{meta_legend},pageTitle;{dns_legend},dns,useSSL,staticFiles,staticPlugins,language,fallback;{global_legend:hide},dateFormat,timeFormat,datimFormat,adminEmail;{sitemap_legend:hide},createSitemap;{protected_legend:hide},protected;{layout_legend},includeLayout;{cache_legend:hide},includeCache;{chmod_legend:hide},includeChmod;{publish_legend},published',
            
    'error_403'                   => '{title_legend},title,alias,type;{meta_legend},pageTitle,robots,description;{forward_legend},autoforward;{layout_legend:hide},includeLayout;{cache_legend:hide},includeCache;{chmod_legend:hide},includeChmod;{expert_legend:hide},cssClass;{publish_legend},published',
            
    'error_404'                   => '{title_legend},title,alias,type;{meta_legend},pageTitle,robots,description;{forward_legend},autoforward;{layout_legend:hide},includeLayout;{cache_legend:hide},includeCache;{chmod_legend:hide},includeChmod;{expert_legend:hide},cssClass;{publish_legend},published'
        
    ),

        
    // Subpalettes
        
    'subpalettes' => array
        (
            
    'autoforward'                 => 'redirect,jumpTo',
            
    'protected'                   => 'groups',
            
    'createSitemap'               => 'sitemapName',
            
    'includeLayout'               => 'layout,mobileLayout',
            
    'includeCache'                => 'cache',
            
    'includeChmod'                => 'cuser,cgroup,chmod',
            
    'published'                   => 'start,stop'
        
    ),

        
    // Fields
        
    'fields' => array
        (
            
    'id' => array
            (
                
    'label'                   => array('ID'),
                
    'search'                  => true,
                
    'sql'                     => "int(10) unsigned NOT NULL auto_increment"
            
    ),
            
    'pid' => array
            (
                
    'sql'                     => "int(10) unsigned NOT NULL default '0'"
            
    ),
            
    'sorting' => array
            (
                
    'sql'                     => "int(10) unsigned NOT NULL default '0'"
            
    ),
            
    'tstamp' => array
            (
                
    'sql'                     => "int(10) unsigned NOT NULL default '0'"
            
    ),
            
    'title' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['title'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'search'                  => true,
                
    'eval'                    => array('mandatory'=>true'maxlength'=>255'decodeEntities'=>true),
                
    'sql'                     => "varchar(255) NOT NULL default ''"
            
    ),
            
    'alias' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['alias'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'search'                  => true,
                
    'eval'                    => array('rgxp'=>'folderalias''doNotCopy'=>true'maxlength'=>128'tl_class'=>'w50'),
                
    'save_callback' => array
                (
                    array(
    'tl_page''generateAlias')
                ),
                
    'sql'                     => "varchar(128) COLLATE utf8_bin NOT NULL default ''"
            
    ),
            
    'type' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['type'],
                
    'default'                 => 'regular',
                
    'exclude'                 => true,
                
    'inputType'               => 'select',
                
    'options_callback'        => array('tl_page''getPageTypes'),
                
    'eval'                    => array('helpwizard'=>true'submitOnChange'=>true'tl_class'=>'w50'),
                
    'reference'               => &$GLOBALS['TL_LANG']['PTY'],
                
    'save_callback' => array
                (
                    array(
    'tl_page''checkRootType')
                ),
                
    'sql'                     => "varchar(32) NOT NULL default ''"
            
    ),
            
    'pageTitle' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['pageTitle'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'search'                  => true,
                
    'eval'                    => array('maxlength'=>255'decodeEntities'=>true'tl_class'=>'w50'),
                
    'sql'                     => "varchar(255) NOT NULL default ''"
            
    ),
            
    'language' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['language'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'search'                  => true,
                
    'eval'                    => array('mandatory'=>true'rgxp'=>'language''maxlength'=>5'nospace'=>true'doNotCopy'=>true'tl_class'=>'w50 clr'),
                
    'sql'                     => "varchar(5) NOT NULL default ''"
            
    ),
            
    'robots' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['robots'],
                
    'exclude'                 => true,
                
    'inputType'               => 'select',
                
    'search'                  => true,
                
    'options'                 => array('index,follow''index,nofollow''noindex,follow''noindex,nofollow'),
                
    'eval'                    => array('tl_class'=>'w50'),
                
    'sql'                     => "varchar(32) NOT NULL default ''"
            
    ),
            
    'description' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['description'],
                
    'exclude'                 => true,
                
    'inputType'               => 'textarea',
                
    'search'                  => true,
                
    'eval'                    => array('style'=>'height:60px''decodeEntities'=>true'tl_class'=>'clr'),
                
    'sql'                     => "text NULL"
            
    ),
            
    'redirect' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['redirect'],
                
    'default'                 => 'permanent',
                
    'exclude'                 => true,
                
    'inputType'               => 'select',
                
    'options'                 => array('permanent''temporary'),
                
    'reference'               => &$GLOBALS['TL_LANG']['tl_page'],
                
    'sql'                     => "varchar(32) NOT NULL default ''"
            
    ),
            
    'jumpTo' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['jumpTo'],
                
    'exclude'                 => true,
                
    'inputType'               => 'pageTree',
                
    'foreignKey'              => 'tl_page.title',
                
    'eval'                    => array('fieldType'=>'radio'), // do not set mandatory (see #5453)
                
    'save_callback' => array
                (
                    array(
    'tl_page''checkJumpTo')
                ),
                
    'sql'                     => "int(10) unsigned NOT NULL default '0'",
                
    'relation'                => array('type'=>'hasOne''load'=>'lazy')
            ),
            
    'url' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['MSC']['url'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('mandatory'=>true'rgxp'=>'url''decodeEntities'=>true'tl_class'=>'w50'),
                
    'sql'                     => "varchar(255) NOT NULL default ''"
            
    ),
            
    'target' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['MSC']['target'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox',
                
    'eval'                    => array('tl_class'=>'w50 m12'),
                
    'sql'                     => "char(1) NOT NULL default ''"
            
    ),
            
    'dns' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['dns'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'search'                  => true,
                
    'eval'                    => array('rgxp'=>'url''decodeEntities'=>true'maxlength'=>255'tl_class'=>'w50'),
                
    'save_callback' => array
                (
                    array(
    'tl_page''checkDns')
                ),
                
    'sql'                     => "varchar(255) NOT NULL default ''"
            
    ),
            
    'staticFiles' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['MSC']['staticFiles'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('rgxp'=>'url''trailingSlash'=>false'tl_class'=>'w50'),
                
    'save_callback' => array
                (
                    array(
    'tl_page''checkStaticUrl')
                ),
                
    'sql'                     => "varchar(255) NOT NULL default ''"
            
    ),
            
    'staticPlugins' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['MSC']['staticPlugins'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('rgxp'=>'url''trailingSlash'=>false'tl_class'=>'w50'),
                
    'save_callback' => array
                (
                    array(
    'tl_page''checkStaticUrl')
                ),
                
    'sql'                     => "varchar(255) NOT NULL default ''"
            
    ),
            
    'fallback' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['fallback'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox',
                
    'eval'                    => array('doNotCopy'=>true'tl_class'=>'w50 m12'),
                
    'save_callback' => array
                (
                    array(
    'tl_page''checkFallback')
                ),
                
    'sql'                     => "char(1) NOT NULL default ''"
            
    ),
            
    'adminEmail' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['adminEmail'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('maxlength'=>255'rgxp'=>'friendly''decodeEntities'=>true'tl_class'=>'w50'),
                
    'sql'                     => "varchar(255) NOT NULL default ''"
            
    ),
            
    'dateFormat' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['dateFormat'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('helpwizard'=>true'decodeEntities'=>true'tl_class'=>'w50'),
                
    'explanation'             => 'dateFormat',
                
    'sql'                     => "varchar(32) NOT NULL default ''"

            
    ),
            
    'timeFormat' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['timeFormat'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('decodeEntities'=>true'tl_class'=>'w50'),
                
    'sql'                     => "varchar(32) NOT NULL default ''"
            
    ),
            
    'datimFormat' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['datimFormat'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('decodeEntities'=>true'tl_class'=>'w50'),
                
    'sql'                     => "varchar(32) NOT NULL default ''"
            
    ),
            
    'createSitemap' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['createSitemap'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox',
                
    'eval'                    => array('submitOnChange'=>true),
                
    'sql'                     => "char(1) NOT NULL default ''"
            
    ),
            
    'sitemapName' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['sitemapName'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('mandatory'=>true'unique'=>true'rgxp'=>'alnum''decodeEntities'=>true'maxlength'=>32'tl_class'=>'w50'),
                
    'save_callback' => array
                (
                    array(
    'tl_page''checkFeedAlias')
                ),
                
    'sql'                     => "varchar(32) NOT NULL default ''"
            
    ),
            
    'useSSL' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['useSSL'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox',
                
    'eval'                    => array('tl_class'=>'w50 m12'),
                
    'sql'                     => "char(1) NOT NULL default ''"
            
    ),
            
    'autoforward' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['autoforward'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox',
                
    'eval'                    => array('submitOnChange'=>true),
                
    'sql'                     => "char(1) NOT NULL default ''"
            
    ),
            
    'protected' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['protected'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox',
                
    'eval'                    => array('submitOnChange'=>true),
                
    'sql'                     => "char(1) NOT NULL default ''"
            
    ),
            
    'groups' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['groups'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox',
                
    'foreignKey'              => 'tl_member_group.name',
                
    'eval'                    => array('mandatory'=>true'multiple'=>true),
                
    'sql'                     => "blob NULL",
                
    'relation'                => array('type'=>'hasMany''load'=>'lazy')
            ),
            
    'includeLayout' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['includeLayout'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox',
                
    'eval'                    => array('submitOnChange'=>true),
                
    'sql'                     => "char(1) NOT NULL default ''"
            
    ),
            
    'layout' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['layout'],
                
    'exclude'                 => true,
                
    'inputType'               => 'select',
                
    'foreignKey'              => 'tl_layout.name',
                
    'options_callback'        => array('tl_page''getPageLayouts'),
                
    'eval'                    => array('chosen'=>true'tl_class'=>'w50'),
                
    'sql'                     => "int(10) unsigned NOT NULL default '0'",
                
    'relation'                => array('type'=>'hasOne''load'=>'lazy')
            ),
            
    'mobileLayout' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['mobileLayout'],
                
    'exclude'                 => true,
                
    'inputType'               => 'select',
                
    'foreignKey'              => 'tl_layout.name',
                
    'options_callback'        => array('tl_page''getPageLayouts'),
                
    'eval'                    => array('includeBlankOption'=>true'chosen'=>true'tl_class'=>'w50'),
                
    'sql'                     => "int(10) unsigned NOT NULL default '0'",
                
    'relation'                => array('type'=>'hasOne''load'=>'lazy')
            ),
            
    'includeCache' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['includeCache'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox',
                
    'eval'                    => array('submitOnChange'=>true),
                
    'sql'                     => "char(1) NOT NULL default ''"
            
    ),
            
    'cache' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['cache'],
                
    'default'                 => 0,
                
    'exclude'                 => true,
                
    'inputType'               => 'select',
                
    'options'                 => array(0515306030090018003600108002160043200864002592006048002592000),
                
    'reference'               => &$GLOBALS['TL_LANG']['CACHE'],
                
    'sql'                     => "int(10) unsigned NOT NULL default '0'"
            
    ),
            
    'includeChmod' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['includeChmod'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox',
                
    'eval'                    => array('submitOnChange'=>true),
                
    'sql'                     => "char(1) NOT NULL default ''"
            
    ),
            
    'cuser' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['cuser'],
                
    'default'                 => intval(Config::get('defaultUser')),
                
    'exclude'                 => true,
                
    'search'                  => true,
                
    'inputType'               => 'select',
                
    'foreignKey'              => 'tl_user.name',
                
    'eval'                    => array('mandatory'=>true'chosen'=>true'includeBlankOption'=>true'tl_class'=>'w50'),
                
    'sql'                     => "int(10) unsigned NOT NULL default '0'",
                
    'relation'                => array('type'=>'hasOne''load'=>'lazy')
            ),
            
    'cgroup' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['cgroup'],
                
    'default'                 => intval(Config::get('defaultGroup')),
                
    'exclude'                 => true,
                
    'search'                  => true,
                
    'inputType'               => 'select',
                
    'foreignKey'              => 'tl_user_group.name',
                
    'eval'                    => array('mandatory'=>true'chosen'=>true'includeBlankOption'=>true'tl_class'=>'w50'),
                
    'sql'                     => "int(10) unsigned NOT NULL default '0'",
                
    'relation'                => array('type'=>'hasOne''load'=>'lazy')
            ),
            
    'chmod' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['chmod'],
                
    'default'                 => Config::get('defaultChmod'),
                
    'exclude'                 => true,
                
    'inputType'               => 'chmod',
                
    'eval'                    => array('tl_class'=>'clr'),
                
    'sql'                     => "varchar(255) NOT NULL default ''"
            
    ),
            
    'noSearch' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['noSearch'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox',
                
    'sql'                     => "char(1) NOT NULL default ''"
            
    ),
            
    'cssClass' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['cssClass'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'search'                  => true,
                
    'eval'                    => array('maxlength'=>64'tl_class'=>'w50'),
                
    'sql'                     => "varchar(64) NOT NULL default ''"
            
    ),
            
    'sitemap' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['sitemap'],
                
    'exclude'                 => true,
                
    'inputType'               => 'select',
                
    'options'                 => array('map_default''map_always''map_never'),
                
    'eval'                    => array('maxlength'=>32'tl_class'=>'w50'),
                
    'reference'               => &$GLOBALS['TL_LANG']['tl_page'],
                
    'sql'                     => "varchar(32) NOT NULL default ''"
            
    ),
            
    'hide' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['hide'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox',
                
    'eval'                    => array('tl_class'=>'w50'),
                
    'sql'                     => "char(1) NOT NULL default ''"
            
    ),
            
    'guests' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['guests'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox',
                
    'eval'                    => array('tl_class'=>'w50'),
                
    'sql'                     => "char(1) NOT NULL default ''"
            
    ),
            
    'tabindex' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['tabindex'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('rgxp'=>'natural''nospace'=>true'tl_class'=>'w50'),
                
    'sql'                     => "smallint(5) unsigned NOT NULL default '0'"
            
    ),
            
    'accesskey' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['accesskey'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('rgxp'=>'alnum''maxlength'=>1'tl_class'=>'w50'),
                
    'sql'                     => "char(1) NOT NULL default ''"
            
    ),
            
    'published' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['published'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox',
                
    'eval'                    => array('submitOnChange'=>true'doNotCopy'=>true),
                
    'sql'                     => "char(1) NOT NULL default ''"
            
    ),
            
    'start' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['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_page']['stop'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('rgxp'=>'datim''datepicker'=>true'tl_class'=>'w50 wizard'),
                
    'sql'                     => "varchar(10) NOT NULL default ''"
            
    )
        )
    );

    // Disable certain operations in the modal dialog
    if (Input::get('popup'))
    {
        unset(
    $GLOBALS['TL_DCA']['tl_page']['list']['operations']['show']);
        unset(
    $GLOBALS['TL_DCA']['tl_page']['list']['operations']['articles']);
    }


    /**
     * Provide miscellaneous methods that are used by the data configuration array.
     *
     * @author Leo Feyer <https://github.com/leofeyer>
     */
    class tl_page extends Backend
    {

        
    /**
         * Import the back end user object
         */
        
    public function __construct()
        {
            
    parent::__construct();
            
    $this->import('BackendUser''User');
        }


        
    /**
         * Check permissions to edit table tl_page
         */
        
    public function checkPermission()
        {
            if (
    $this->User->isAdmin)
            {
                return;
            }

            
    $session $this->Session->getData();

            
    // Set the default page user and group
            
    $GLOBALS['TL_DCA']['tl_page']['fields']['cuser']['default'] = intval(Config::get('defaultUser') ?: $this->User->id);
            
    $GLOBALS['TL_DCA']['tl_page']['fields']['cgroup']['default'] = intval(Config::get('defaultGroup') ?: $this->User->groups[0]);

            
    // Restrict the page tree
            
    $GLOBALS['TL_DCA']['tl_page']['list']['sorting']['root'] = $this->User->pagemounts;

            
    // Set allowed page IDs (edit multiple)
            
    if (is_array($session['CURRENT']['IDS']))
            {
                
    $edit_all = array();
                
    $delete_all = array();

                foreach (
    $session['CURRENT']['IDS'] as $id)
                {
                    
    $objPage $this->Database->prepare("SELECT id, pid, type, includeChmod, chmod, cuser, cgroup FROM tl_page WHERE id=?")
                                              ->
    limit(1)
                                              ->
    execute($id);

                    if (
    $objPage->numRows || !$this->User->hasAccess($objPage->type'alpty'))
                    {
                        continue;
                    }

                    
    $row $objPage->row();

                    if (
    $this->User->isAllowed(BackendUser::CAN_EDIT_PAGE$row))
                    {
                        
    $edit_all[] = $id;
                    }

                    
    // Mounted pages cannot be deleted
                    
    if ($this->User->isAllowed(BackendUser::CAN_DELETE_PAGE$row) && !$this->User->hasAccess($id'pagemounts'))
                    {
                        
    $delete_all[] = $id;
                    }
                }

                
    $session['CURRENT']['IDS'] = (Input::get('act') == 'deleteAll') ? $delete_all $edit_all;
            }

            
    // Set allowed clipboard IDs
            
    if (isset($session['CLIPBOARD']['tl_page']) && is_array($session['CLIPBOARD']['tl_page']['id']))
            {
                
    $clipboard = array();

                foreach (
    $session['CLIPBOARD']['tl_page']['id'] as $id)
                {
                    
    $objPage $this->Database->prepare("SELECT id, pid, type, includeChmod, chmod, cuser, cgroup FROM tl_page WHERE id=?")
                                              ->
    limit(1)
                                              ->
    execute($id);

                    if (
    $objPage->numRows || !$this->User->hasAccess($objPage->type'alpty'))
                    {
                        continue;
                    }

                    if (
    $this->User->isAllowed(BackendUser::CAN_EDIT_PAGE_HIERARCHY$objPage->row()))
                    {
                        
    $clipboard[] = $id;
                    }
                }

                
    $session['CLIPBOARD']['tl_page']['id'] = $clipboard;
            }

            
    // Overwrite session
            
    $this->Session->setData($session);

            
    // Check permissions to save and create new
            
    if (Input::get('act') == 'edit')
            {
                
    $objPage $this->Database->prepare("SELECT * FROM tl_page WHERE id=(SELECT pid FROM tl_page WHERE id=?)")
                                          ->
    limit(1)
                                          ->
    execute(Input::get('id'));

                if (
    $objPage->numRows && !$this->User->isAllowed(BackendUser::CAN_EDIT_PAGE_HIERARCHY$objPage->row()))
                {
                    
    $GLOBALS['TL_DCA']['tl_page']['config']['closed'] = true;
                }
            }

            
    // Check current action
            
    if (Input::get('act') && Input::get('act') != 'paste')
            {
                
    $permission 0;
                
    $cid CURRENT_ID ?: Input::get('id');
                
    $ids = ($cid != '') ? array($cid) : array();

                
    // Set permission
                
    switch (Input::get('act'))
                {
                    case 
    'edit':
                    case 
    'toggle':
                        
    $permission BackendUser::CAN_EDIT_PAGE;
                        break;

                    case 
    'move':
                        
    $permission BackendUser::CAN_EDIT_PAGE_HIERARCHY;
                        
    $ids[] = Input::get('sid');
                        break;

                    case 
    'create':
                    case 
    'copy':
                    case 
    'copyAll':
                    case 
    'cut':
                    case 
    'cutAll':
                        
    $permission BackendUser::CAN_EDIT_PAGE_HIERARCHY;

                        
    // Check the parent page in "paste into" mode
                        
    if (Input::get('mode') == 2)
                        {
                            
    $ids[] = Input::get('pid');
                        }
                        
    // Check the parent's parent page in "paste after" mode
                        
    else
                        {
                            
    $objPage $this->Database->prepare("SELECT pid FROM tl_page WHERE id=?")
                                                      ->
    limit(1)
                                                      ->
    execute(Input::get('pid'));

                            
    $ids[] = $objPage->pid;
                        }
                        break;

                    case 
    'delete':
                        
    $permission BackendUser::CAN_DELETE_PAGE;
                        break;
                }

                
    // Check user permissions
                
    if (Input::get('act') != 'show')
                {
                    
    $pagemounts = array();

                    
    // Get all allowed pages for the current user
                    
    foreach ($this->User->pagemounts as $root)
                    {
                        if (
    Input::get('act') != 'delete')
                        {
                            
    $pagemounts[] = $root;
                        }

                        
    $pagemounts array_merge($pagemounts$this->Database->getChildRecords($root'tl_page'));
                    }

                    
    $error false;
                    
    $pagemounts array_unique($pagemounts);

                    
    // Do not allow to paste after pages on the root level (pagemounts)
                    
    if ((Input::get('act') == 'cut' || Input::get('act') == 'cutAll') && Input::get('mode') == && in_array(Input::get('pid'), $this->eliminateNestedPages($this->User->pagemounts)))
                    {
                        
    $this->log('Not enough permissions to paste page ID 'Input::get('id') .' after mounted page ID 'Input::get('pid') .' (root level)'__METHOD__TL_ERROR);
                        
    $this->redirect('contao/main.php?act=error');
                    }

                    
    // Check each page
                    
    foreach ($ids as $i=>$id)
                    {
                        if (!
    in_array($id$pagemounts))
                        {
                            
    $this->log('Page ID '$id .' was not mounted'__METHOD__TL_ERROR);

                            
    $error true;
                            break;
                        }

                        
    // Get the page object
                        
    $objPage $this->Database->prepare("SELECT * FROM tl_page WHERE id=?")
                                                  ->
    limit(1)
                                                  ->
    execute($id);

                        if (
    $objPage->numRows 1)
                        {
                            continue;
                        }

                        
    // Check whether the current user is allowed to access the current page
                        
    if (!$this->User->isAllowed($permission$objPage->row()))
                        {
                            
    $error true;
                            break;
                        }

                        
    // Check the type of the first page (not the following parent pages)
                        // In "edit multiple" mode, $ids contains only the parent ID, therefore check $id != $_GET['pid'] (see #5620)
                        
    if ($i == && $id != Input::get('pid') && Input::get('act') != 'create' && !$this->User->hasAccess($objPage->type'alpty'))
                        {
                            
    $this->log('Not enough permissions to  'Input::get('act') .' '$objPage->type .' pages'__METHOD__TL_ERROR);

                            
    $error true;
                            break;
                        }
                    }

                    
    // Redirect if there is an error
                    
    if ($error)
                    {
                        
    $this->log('Not enough permissions to 'Input::get('act') .' page ID '$cid .' or paste after/into page ID 'Input::get('pid'), __METHOD__TL_ERROR);
                        
    $this->redirect('contao/main.php?act=error');
                    }
                }
            }
        }


        
    /**
         * Add the breadcrumb menu
         */
        
    public function addBreadcrumb()
        {
            
    Backend::addPagesBreadcrumb();
        }


        
    /**
         * Make new top-level pages root pages
         * @param \DataContainer
         */
        
    public function setRootType(DataContainer $dc)
        {
            if (
    Input::get('act') != 'create')
            {
                return;
            }

            
    // Insert into
            
    if (Input::get('pid') == 0)
            {
                
    $GLOBALS['TL_DCA']['tl_page']['fields']['type']['default'] = 'root';
            }
            elseif (
    Input::get('mode') == 1)
            {
                
    $objPage $this->Database->prepare("SELECT * FROM " $dc->table " WHERE id=?")
                                          ->
    limit(1)
                                          ->
    execute(Input::get('pid'));

                if (
    $objPage->pid == 0)
                {
                    
    $GLOBALS['TL_DCA']['tl_page']['fields']['type']['default'] = 'root';
                }
            }
        }


        
    /**
         * Make sure that top-level pages are root pages
         * @param mixed
         * @param \DataContainer
         * @return mixed
         * @throws \Exception
         */
        
    public function checkRootType($varValueDataContainer $dc)
        {
            if (
    $varValue != 'root' && $dc->activeRecord->pid == 0)
            {
                throw new 
    Exception($GLOBALS['TL_LANG']['ERR']['topLevelRoot']);
            }

            return 
    $varValue;
        }


        
    /**
         * Show a warning if there is no language fallback page
         */
        
    public function showFallbackWarning()
        {
            if (
    Input::get('act') != '')
            {
                return;
            }

            
    $this->import('Messages');
            
    Message::addRaw($this->Messages->languageFallback());
            
    Message::addRaw($this->Messages->topLevelRoot());
        }


        
    /**
         * Auto-generate a page alias if it has not been set yet
         * @param mixed
         * @param \DataContainer
         * @return string
         * @throws \Exception
         */
        
    public function generateAlias($varValueDataContainer $dc)
        {
            
    $autoAlias false;

            
    // Generate an alias if there is none
            
    if ($varValue == '')
            {
                
    $autoAlias true;
                
    $varValue standardize(String::restoreBasicEntities($dc->activeRecord->title));

                
    // Generate folder URL aliases (see #4933)
                
    if (Config::get('folderUrl'))
                {
                    
    $objPage PageModel::findWithDetails($dc->activeRecord->id);

                    if (
    $objPage->folderUrl != '')
                    {
                        
    $varValue $objPage->folderUrl $varValue;
                    }
                }
            }

            
    $objAlias $this->Database->prepare("SELECT id FROM tl_page WHERE id=? OR alias=?")
                                       ->
    execute($dc->id$varValue);

            
    // Check whether the page alias exists
            
    if ($objAlias->numRows > ($autoAlias 1))
            {
                
    $arrPages = array();
                
    $strDomain '';
                
    $strLanguage '';

                while (
    $objAlias->next())
                {
                    
    $objCurrentPage PageModel::findWithDetails($objAlias->id);
                    
    $domain $objCurrentPage->domain ?: '*';
                    
    $language = (!$objCurrentPage->rootIsFallback) ? $objCurrentPage->rootLanguage '*';

                    
    // Store the current page's data
                    
    if ($objCurrentPage->id == $dc->id)
                    {
                        
    // Get the DNS and language settings from the POST data (see #4610)
                        
    if ($objCurrentPage->type == 'root')
                        {
                            
    $strDomain Input::post('dns');
                            
    $strLanguage Input::post('language');
                        }
                        else
                        {
                            
    $strDomain $domain;
                            
    $strLanguage $language;
                        }
                    }
                    else
                    {
                        
    // Check the domain and language or the domain only
                        
    if (Config::get('addLanguageToUrl'))
                        {
                            
    $arrPages[$domain][$language][] = $objAlias->id;
                        }
                        else
                        {
                            
    $arrPages[$domain][] = $objAlias->id;
                        }
                    }
                }

                
    $arrCheck Config::get('addLanguageToUrl') ? $arrPages[$strDomain][$strLanguage] : $arrPages[$strDomain];

                
    // Check if there are multiple results for the current domain
                
    if (!empty($arrCheck))
                {
                    if (
    $autoAlias)
                    {
                        
    $varValue .= '-' $dc->id;
                    }
                    else
                    {
                        throw new 
    Exception(sprintf($GLOBALS['TL_LANG']['ERR']['aliasExists'], $varValue));
                    }
                }
            }

            return 
    $varValue;
        }


        
    /**
         * Automatically create an article in the main column of a new page
         * @param \DataContainer
         */
        
    public function generateArticle(DataContainer $dc)
        {
            
    // Return if there is no active record (override all)
            
    if (!$dc->activeRecord)
            {
                return;
            }

            
    // Existing or not a regular page
            
    if ($dc->activeRecord->tstamp || !in_array($dc->activeRecord->type, array('regular''error_403''error_404')))
            {
                return;
            }

            
    $new_records $this->Session->get('new_records');

            
    // Not a new page
            
    if (!$new_records || (is_array($new_records[$dc->table]) && !in_array($dc->id$new_records[$dc->table])))
            {
                return;
            }

            
    // Check whether there are articles (e.g. on copied pages)
            
    $objTotal $this->Database->prepare("SELECT COUNT(*) AS count FROM tl_article WHERE pid=?")
                                       ->
    execute($dc->id);

            if (
    $objTotal->count 0)
            {
                return;
            }

            
    // Create article
            
    $arrSet['pid'] = $dc->id;
            
    $arrSet['sorting'] = 128;
            
    $arrSet['tstamp'] = time();
            
    $arrSet['author'] = $this->User->id;
            
    $arrSet['inColumn'] = 'main';
            
    $arrSet['title'] = $dc->activeRecord->title;
            
    $arrSet['alias'] = str_replace('/''-'$dc->activeRecord->alias); // see #5168
            
    $arrSet['published'] = $dc->activeRecord->published;

            
    $this->Database->prepare("INSERT INTO tl_article %s")->set($arrSet)->execute();
        }


        
    /**
         * Purge the search index if a page is being deleted
         * @param \DataContainer
         */
        
    public function purgeSearchIndex(DataContainer $dc)
        {
            if (!
    $dc->id)
            {
                return;
            }

            
    $objResult $this->Database->prepare("SELECT id FROM tl_search WHERE pid=?")
                                        ->
    execute($dc->id);

            while (
    $objResult->next())
            {
                
    $this->Database->prepare("DELETE FROM tl_search WHERE id=?")
                               ->
    execute($objResult->id);

                
    $this->Database->prepare("DELETE FROM tl_search_index WHERE pid=?")
                               ->
    execute($objResult->id);
            }
        }


        
    /**
         * Check the sitemap alias
         * @param mixed
         * @param \DataContainer
         * @return mixed
         * @throws \Exception
         */
        
    public function checkFeedAlias($varValueDataContainer $dc)
        {
            
    // No change or empty value
            
    if ($varValue == $dc->value || $varValue == '')
            {
                return 
    $varValue;
            }

            
    $varValue standardize($varValue); // see #5096

            
    $this->import('Automator');
            
    $arrFeeds $this->Automator->purgeXmlFiles(true);

            
    // Alias exists
            
    if (array_search($varValue$arrFeeds) !== false)
            {
                throw new 
    Exception(sprintf($GLOBALS['TL_LANG']['ERR']['aliasExists'], $varValue));
            }

            return 
    $varValue;
        }


        
    /**
         * Prevent circular references
         * @param mixed
         * @param \DataContainer
         * @return mixed
         * @throws \Exception
         */
        
    public function checkJumpTo($varValueDataContainer $dc)
        {
            if (
    $varValue == $dc->id)
            {
                throw new 
    Exception($GLOBALS['TL_LANG']['ERR']['circularReference']);
            }

            return 
    $varValue;
        }


        
    /**
         * Check the DNS settings
         * @param mixed
         * @return mixed
         */
        
    public function checkDns($varValue)
        {
            return 
    str_ireplace(array('http://''https://''ftp://'), ''$varValue);
        }


        
    /**
         * Make sure there is only one fallback per domain (thanks to Andreas Schempp)
         * @param mixed
         * @param \DataContainer
         * @return mixed
         * @throws \Exception
         */
        
    public function checkFallback($varValueDataContainer $dc)
        {
            if (
    $varValue == '')
            {
                return 
    '';
            }

            
    $objPage $this->Database->prepare("SELECT id FROM tl_page WHERE type='root' AND fallback=1 AND dns=? AND id!=?")
                                      ->
    execute($dc->activeRecord->dns$dc->activeRecord->id);

            if (
    $objPage->numRows)
            {
                throw new 
    Exception($GLOBALS['TL_LANG']['ERR']['multipleFallback']);
            }

            return 
    $varValue;
        }


        
    /**
         * Check a static URL
         * @param mixed
         * @return mixed
         */
        
    public function checkStaticUrl($varValue)
        {
            if (
    $varValue != '')
            {
                
    $varValue preg_replace('@https?://@'''$varValue);
            }

            return 
    $varValue;
        }


        
    /**
         * Returns all allowed page types as array
         * @param \DataContainer
         * @return string
         */
        
    public function getPageTypes(DataContainer $dc)
        {
            
    $arrOptions = array();

            foreach (
    array_keys($GLOBALS['TL_PTY']) as $pty)
            {
                
    // Root pages are allowed on the first level only (see #6360)
                
    if ($pty == 'root' && $dc->activeRecord && $dc->activeRecord->pid 0)
                {
                    continue;
                }

                
    // Allow the currently selected option and anything the user has access to
                
    if ($pty == $dc->value || $this->User->hasAccess($pty'alpty'))
                {
                    
    $arrOptions[] = $pty;
                }
            }

            return 
    $arrOptions;
        }


        
    /**
         * Return all page layouts grouped by theme
         * @return array
         */
        
    public function getPageLayouts()
        {
            
    $objLayout $this->Database->execute("SELECT l.id, l.name, t.name AS theme FROM tl_layout l LEFT JOIN tl_theme t ON l.pid=t.id ORDER BY t.name, l.name");

            if (
    $objLayout->numRows 1)
            {
                return array();
            }

            
    $return = array();

            while (
    $objLayout->next())
            {
                
    $return[$objLayout->theme][$objLayout->id] = $objLayout->name;
            }

            return 
    $return;
        }


        
    /**
         * Add an image to each page in the tree
         * @param array
         * @param string
         * @param \DataContainer
         * @param string
         * @param boolean
         * @param boolean
         * @return string
         */
        
    public function addIcon($row$labelDataContainer $dc=null$imageAttribute=''$blnReturnImage=false$blnProtected=false)
        {
            return 
    Backend::addPageIcon($row$label$dc$imageAttribute$blnReturnImage$blnProtected);
        }


        
    /**
         * Return the edit page button
         * @param array
         * @param string
         * @param string
         * @param string
         * @param string
         * @param string
         * @return string
         */
        
    public function editPage($row$href$label$title$icon$attributes)
        {
            return (
    $this->User->hasAccess($row['type'], 'alpty') && $this->User->isAllowed(BackendUser::CAN_EDIT_PAGE$row)) ? '<a href="'.$this->addToUrl($href.'&amp;id='.$row['id']).'" title="'.specialchars($title).'"'.$attributes.'>'.Image::getHtml($icon$label).'</a> ' Image::getHtml(preg_replace('/\.gif$/i''_.gif'$icon)).' ';
        }


        
    /**
         * Return the copy page button
         * @param array
         * @param string
         * @param string
         * @param string
         * @param string
         * @param string
         * @param string
         * @return string
         */
        
    public function copyPage($row$href$label$title$icon$attributes$table)
        {
            if (
    $GLOBALS['TL_DCA'][$table]['config']['closed'])
            {
                return 
    '';
            }

            return (
    $this->User->hasAccess($row['type'], 'alpty') && $this->User->isAllowed(BackendUser::CAN_EDIT_PAGE_HIERARCHY$row)) ? '<a href="'.$this->addToUrl($href.'&amp;id='.$row['id']).'" title="'.specialchars($title).'"'.$attributes.'>'.Image::getHtml($icon$label).'</a> ' Image::getHtml(preg_replace('/\.gif$/i''_.gif'$icon)).' ';
        }


        
    /**
         * Return the copy page with subpages button
         * @param array
         * @param string
         * @param string
         * @param string
         * @param string
         * @param string
         * @param string
         * @return string
         */
        
    public function copyPageWithSubpages($row$href$label$title$icon$attributes$table)
        {
            if (
    $GLOBALS['TL_DCA'][$table]['config']['closed'])
            {
                return 
    '';
            }

            
    $objSubpages $this->Database->prepare("SELECT * FROM tl_page WHERE pid=?")
                                          ->
    limit(1)
                                          ->
    execute($row['id']);

            return (
    $objSubpages->numRows && $this->User->hasAccess($row['type'], 'alpty') && $this->User->isAllowed(BackendUser::CAN_EDIT_PAGE_HIERARCHY$row)) ? '<a href="'.$this->addToUrl($href.'&amp;id='.$row['id']).'" title="'.specialchars($title).'"'.$attributes.'>'.Image::getHtml($icon$label).'</a> ' Image::getHtml(preg_replace('/\.gif$/i''_.gif'$icon)).' ';
        }


        
    /**
         * Return the cut page button
         * @param array
         * @param string
         * @param string
         * @param string
         * @param string
         * @param string
         * @return string
         */
        
    public function cutPage($row$href$label$title$icon$attributes)
        {
            return (
    $this->User->hasAccess($row['type'], 'alpty') && $this->User->isAllowed(BackendUser::CAN_EDIT_PAGE_HIERARCHY$row)) ? '<a href="'.$this->addToUrl($href.'&amp;id='.$row['id']).'" title="'.specialchars($title).'"'.$attributes.'>'.Image::getHtml($icon$label).'</a> ' Image::getHtml(preg_replace('/\.gif$/i''_.gif'$icon)).' ';
        }


        
    /**
         * Return the paste page button
         * @param \DataContainer
         * @param array
         * @param string
         * @param boolean
         * @param array
         * @return string
         */
        
    public function pastePage(DataContainer $dc$row$table$cr$arrClipboard=null)
        {
            
    $disablePA false;
            
    $disablePI false;

            
    // Disable all buttons if there is a circular reference
            
    if ($arrClipboard !== false && ($arrClipboard['mode'] == 'cut' && ($cr == || $arrClipboard['id'] == $row['id']) || $arrClipboard['mode'] == 'cutAll' && ($cr == || in_array($row['id'], $arrClipboard['id']))))
            {
                
    $disablePA true;
                
    $disablePI true;
            }

            
    // Prevent adding non-root pages on top-level
            
    if (Input::get('mode') != 'create' && $row['pid'] == 0)
            {
                
    $objPage $this->Database->prepare("SELECT * FROM " $table " WHERE id=?")
                                          ->
    limit(1)
                                          ->
    execute(Input::get('id'));

                if (
    $objPage->type != 'root')
                {
                    
    $disablePA true;

                    if (
    $row['id'] == 0)
                    {
                        
    $disablePI true;
                    }
                }
            }

            
    // Check permissions if the user is not an administrator
            
    if (!$this->User->isAdmin)
            {
                
    // Disable "paste into" button if there is no permission 2 (move) or 1 (create) for the current page
                
    if (!$disablePI)
                {
                    if (!
    $this->User->isAllowed(BackendUser::CAN_EDIT_PAGE_HIERARCHY$row) || (Input::get('mode') == 'create' && !$this->User->isAllowed(BackendUser::CAN_EDIT_PAGE$row)))
                    {
                        
    $disablePI true;
                    }
                }

                
    $objPage $this->Database->prepare("SELECT * FROM " $table " WHERE id=?")
                                          ->
    limit(1)
                                          ->
    execute($row['pid']);

                
    // Disable "paste after" button if there is no permission 2 (move) or 1 (create) for the parent page
                
    if (!$disablePA && $objPage->numRows)
                {
                    if (!
    $this->User->isAllowed(BackendUser::CAN_EDIT_PAGE_HIERARCHY$objPage->row()) || (Input::get('mode') == 'create' && !$this->User->isAllowed(BackendUser::CAN_EDIT_PAGE$objPage->row())))
                    {
                        
    $disablePA true;
                    }
                }

                
    // Disable "paste after" button if the parent page is a root page and the user is not an administrator
                
    if (!$disablePA && ($row['pid'] < || in_array($row['id'], $dc->rootIds)))
                {
                    
    $disablePA true;
                }
            }

            
    $return '';

            
    // Return the buttons
            
    $imagePasteAfter Image::getHtml('pasteafter.gif'sprintf($GLOBALS['TL_LANG'][$table]['pasteafter'][1], $row['id']));
            
    $imagePasteInto Image::getHtml('pasteinto.gif'sprintf($GLOBALS['TL_LANG'][$table]['pasteinto'][1], $row['id']));

            if (
    $row['id'] > 0)
            {
                
    $return $disablePA Image::getHtml('pasteafter_.gif').' ' '<a href="'.$this->addToUrl('act='.$arrClipboard['mode'].'&amp;mode=1&amp;pid='.$row['id'].(!is_array($arrClipboard['id']) ? '&amp;id='.$arrClipboard['id'] : '')).'" title="'.specialchars(sprintf($GLOBALS['TL_LANG'][$table]['pasteafter'][1], $row['id'])).'" onclick="Backend.getScrollOffset()">'.$imagePasteAfter.'</a> ';
            }

            return 
    $return.($disablePI Image::getHtml('pasteinto_.gif').' ' '<a href="'.$this->addToUrl('act='.$arrClipboard['mode'].'&amp;mode=2&amp;pid='.$row['id'].(!is_array($arrClipboard['id']) ? '&amp;id='.$arrClipboard['id'] : '')).'" title="'.specialchars(sprintf($GLOBALS['TL_LANG'][$table]['pasteinto'][1], $row['id'])).'" onclick="Backend.getScrollOffset()">'.$imagePasteInto.'</a> ');
        }


        
    /**
         * Return the delete page button
         * @param array
         * @param string
         * @param string
         * @param string
         * @param string
         * @param string
         * @return string
         */
        
    public function deletePage($row$href$label$title$icon$attributes)
        {
            
    $root func_get_arg(7);
            return (
    $this->User->hasAccess($row['type'], 'alpty') && $this->User->isAllowed(BackendUser::CAN_DELETE_PAGE$row) && ($this->User->isAdmin || !in_array($row['id'], $root))) ? '<a href="'.$this->addToUrl($href.'&amp;id='.$row['id']).'" title="'.specialchars($title).'"'.$attributes.'>'.Image::getHtml($icon$label).'</a> ' Image::getHtml(preg_replace('/\.gif$/i''_.gif'$icon)).' ';
        }


        
    /**
         * Generate an "edit articles" button and return it as string
         * @param array
         * @param string
         * @param string
         * @param string
         * @param string
         * @return string
         */
        
    public function editArticles($row$href$label$title$icon)
        {
            if (!
    $this->User->hasAccess('article''modules'))
            {
                return 
    '';
            }

            return (
    $row['type'] == 'regular' || $row['type'] == 'error_403' || $row['type'] == 'error_404') ? '<a href="' $this->addToUrl($href.'&amp;node='.$row['id']) . '" title="'.specialchars($title).'">'.Image::getHtml($icon$label).'</a> ' Image::getHtml(preg_replace('/\.gif$/i''_.gif'$icon)).' ';
        }


        
    /**
         * Automatically generate the folder URL aliases
         * @param array
         * @param DataContainer
         * @return array
         */
        
    public function addAliasButton($arrButtonsDataContainer $dc)
        {
            
    // Generate the aliases
            
    if (Input::post('FORM_SUBMIT') == 'tl_select' && isset($_POST['alias']))
            {
                
    $session $this->Session->getData();
                
    $ids $session['CURRENT']['IDS'];

                foreach (
    $ids as $id)
                {
                    
    $objPage PageModel::findWithDetails($id);

                    if (
    $objPage === null)
                    {
                        continue;
                    }

                    
    $dc->id $id;
                    
    $dc->activeRecord $objPage;

                    
    $strAlias '';

                    
    // Generate new alias through save callbacks
                    
    foreach ($GLOBALS['TL_DCA'][$dc->table]['fields']['alias']['save_callback'] as $callback)
                    {
                        if (
    is_array($callback))
                        {
                            
    $this->import($callback[0]);
                            
    $strAlias $this->$callback[0]->$callback[1]($strAlias$dc);
                        }
                        elseif (
    is_callable($callback))
                        {
                            
    $strAlias $callback($strAlias$dc);
                        }
                    }

                    
    // The alias has not changed
                    
    if ($strAlias == $objPage->alias)
                    {
                        continue;
                    }

                    
    // Initialize the version manager
                    
    $objVersions = new Versions('tl_page'$id);
                    
    $objVersions->initialize();

                    
    // Store the new alias
                    
    $this->Database->prepare("UPDATE tl_page SET alias=? WHERE id=?")
                                   ->
    execute($strAlias$id);

                    
    // Create a new version
                    
    $objVersions->create();
                }

                
    $this->redirect($this->getReferer());
            }

            
    // Add the button
            
    $arrButtons['alias'] = '<input type="submit" name="alias" id="alias" class="tl_submit" accesskey="a" value="'.specialchars($GLOBALS['TL_LANG']['MSC']['aliasSelected']).'"> ';

            return 
    $arrButtons;
        }


        
    /**
         * Recursively add pages to a sitemap
         * @param \DataContainer
         */
        
    public function updateSitemap(DataContainer $dc)
        {
            
    $this->import('Automator');
            
    $this->Automator->generateSitemap($dc->id);
        }


        
    /**
         * Return the "toggle visibility" button
         * @param array
         * @param string
         * @param string
         * @param string
         * @param string
         * @param string
         * @return string
         */
        
    public function toggleIcon($row$href$label$title$icon$attributes)
        {
            if (
    strlen(Input::get('tid')))
            {
                
    $this->toggleVisibility(Input::get('tid'), (Input::get('state') == 1), (@func_get_arg(12) ?: null));
                
    $this->redirect($this->getReferer());
            }

            
    // Check permissions AFTER checking the tid, so hacking attempts are logged
            
    if (!$this->User->hasAccess('tl_page::published''alexf'))
            {
                return 
    '';
            }

            
    $href .= '&amp;tid='.$row['id'].'&amp;state='.($row['published'] ? '' 1);

            if (!
    $row['published'])
            {
                
    $icon 'invisible.gif';
            }

            
    $objPage $this->Database->prepare("SELECT * FROM tl_page WHERE id=?")
                                      ->
    limit(1)
                                      ->
    execute($row['id']);

            if (!
    $this->User->isAllowed(BackendUser::CAN_EDIT_PAGE$objPage->row()))
            {
                return 
    Image::getHtml($icon) . ' ';
            }

            return 
    '<a href="'.$this->addToUrl($href).'" title="'.specialchars($title).'"'.$attributes.'>'.Image::getHtml($icon$label).'</a> ';
        }


        
    /**
         * Disable/enable a user group
         * @param integer
         * @param boolean
         * @param \DataContainer
         */
        
    public function toggleVisibility($intId$blnVisibleDataContainer $dc=null)
        {
            
    // Check permissions to edit
            
    Input::setGet('id'$intId);
            
    Input::setGet('act''toggle');
            
    $this->checkPermission();

            
    // Check permissions to publish
            
    if (!$this->User->hasAccess('tl_page::published''alexf'))
            {
                
    $this->log('Not enough permissions to publish/unpublish page ID "'.$intId.'"'__METHOD__TL_ERROR);
                
    $this->redirect('contao/main.php?act=error');
            }

            
    $objVersions = new Versions('tl_page'$intId);
            
    $objVersions->initialize();

            
    // Trigger the save_callback
            
    if (is_array($GLOBALS['TL_DCA']['tl_page']['fields']['published']['save_callback']))
            {
                foreach (
    $GLOBALS['TL_DCA']['tl_page']['fields']['published']['save_callback'] as $callback)
                {
                    if (
    is_array($callback))
                    {
                        
    $this->import($callback[0]);
                        
    $blnVisible $this->$callback[0]->$callback[1]($blnVisible, ($dc ?: $this));
                    }
                    elseif (
    is_callable($callback))
                    {
                        
    $blnVisible $callback($blnVisible, ($dc ?: $this));
                    }
                }
            }

            
    // Update the database
            
    $this->Database->prepare("UPDATE tl_page SET tstamp="time() .", published='" . ($blnVisible '') . "' WHERE id=?")
                           ->
    execute($intId);

            
    $objVersions->create();
            
    $this->log('A new version of record "tl_page.id='.$intId.'" has been created'.$this->getParentEntries('tl_page'$intId), __METHOD__TL_GENERAL);
        }
    }


    /**
     * Contao Open Source CMS
     * Copyright (C) 2005-2012 Leo Feyer
     *
     * Formerly known as TYPOlight Open Source CMS.
     *
     * This program is free software: you can redistribute it and/or
     * modify it under the terms of the GNU Lesser General Public
     * License as published by the Free Software Foundation, either
     * version 3 of the License, or (at your option) any later version.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
     * Lesser General Public License for more details.
     *
     * You should have received a copy of the GNU Lesser General Public
     * License along with this program. If not, please visit the Free
     * Software Foundation website at <http://www.gnu.org/licenses/>.
     *
     * PHP version 5
     * @copyright  Felix Pfeiffer 2008, terminal42 gmbh 2008-2012
     * @author     Andreas Schempp <andreas.schempp@terminal42.ch>
     * @author     Felix Pfeiffer <info@felixpfeiffer.com>
     * @license    http://opensource.org/licenses/lgpl-3.0.html
     */


    /**
     * Config
     */
    $GLOBALS['TL_DCA']['tl_page']['config']['onload_callback'][] = array('tl_page_changelanguage','showSelectbox');
    $GLOBALS['TL_DCA']['tl_page']['config']['onsubmit_callback'][] = array('tl_page_changelanguage','resetFallback');
    $GLOBALS['TL_DCA']['tl_page']['list']['label']['label_callback'] = array('tl_page_changelanguage''addFallbackNotice');


    /**
     * Fields
     */
    $GLOBALS['TL_DCA']['tl_page']['fields']['fallback']['eval']['submitOnChange'] = true;

    $GLOBALS['TL_DCA']['tl_page']['fields']['languageMain'] = array
    (
        
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['languageMain'],
        
    'exclude'                 => true,
        
    'inputType'               => 'select',
        
    'options_callback'        => array('tl_page_changelanguage''getFallbackPages'),
        
    'eval'                    => array('includeBlankOption'=>true'blankOptionLabel'=>&$GLOBALS['TL_LANG']['tl_page']['no_subpage'], 'tl_class'=>'w50'),
    );

    $GLOBALS['TL_DCA']['tl_page']['fields']['languageRoot'] = array
    (
        
    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['languageRoot'],
        
    'exclude'                 => true,
        
    'inputType'               => 'select',
        
    'options_callback'        => array('tl_page_changelanguage''getRootPages'),
        
    'eval'                    => array('includeBlankOption'=>true'blankOptionLabel'=>&$GLOBALS['TL_LANG']['tl_page']['no_rootpage'], 'tl_class'=>'w50'),
    );


    class 
    tl_page_changelanguage extends Backend
    {

        
    /**
         * Inject fields if appropriate.
         *
         * @access public
         * @return void
         */
        
    public function showSelectbox($dc)
        {
            if (
    $this->Input->get('act') == 'edit')
            {
                
    $objPage $this->getPageDetails($dc->id);

                if (
    $objPage->type == 'root' && $objPage->fallback)
                {
                    
    $GLOBALS['TL_DCA']['tl_page']['fields']['fallback']['eval']['tl_class'] = 'm12 w50';
                    
    $GLOBALS['TL_DCA']['tl_page']['fields']['dns']['eval']['tl_class'] = 'clr w50';
                    
    $GLOBALS['TL_DCA']['tl_page']['palettes']['root'] = preg_replace('@([,|;]fallback)([,|;])@','$1,languageRoot$2'$GLOBALS['TL_DCA']['tl_page']['palettes']['root']);
                }
                elseif (
    $objPage->type != 'root')
                {
                    
    $objRootPage $this->Database->prepare("SELECT * FROM tl_page WHERE id=?")->limit(1)->execute($objPage->rootId);

                    
    $objFallback $this->Database->prepare("SELECT id FROM tl_page WHERE type='root' AND fallback='1' AND id!=? AND (dns=? OR id=?)")->limit(1)->execute($objRootPage->id$objPage->domain, ($objRootPage->fallback $objRootPage->languageRoot 0));

                    if(
    $objFallback->numRows)
                    {
                        
    $GLOBALS['TL_DCA']['tl_page']['fields']['title']['eval']['tl_class'] = 'w50';
                        
    $GLOBALS['TL_DCA']['tl_page']['fields']['alias']['eval']['tl_class'] = 'clr w50';
                        
    $GLOBALS['TL_DCA']['tl_page']['palettes'][$objPage->type] = preg_replace('@([,|;]title)([,|;])@','$1,languageMain$2'$GLOBALS['TL_DCA']['tl_page']['palettes'][$objPage->type]);
                    }
                }
            }
            elseif (
    $this->Input->get('act') == 'editAll')
            {
                foreach( 
    $GLOBALS['TL_DCA']['tl_page']['palettes'] as $name => $palette )
                {
                    if (
    $name == '__selector__' || $name == 'root')
                        continue;

                    
    $GLOBALS['TL_DCA']['tl_page']['palettes'][$name] = preg_replace('@([,|;]title)([,|;])@','$1,languageMain$2'$palette);
                }
            }
        }


        
    /**
         * Make sure languageMain is "0" on fallback tree. Otherwise unknown behaviour could occure.
         *
         * @access public
         * @param mixed $dc
         * @return void
         */
        
    public function resetFallback($dc)
        {
            if (
    $dc->id 0)
            {
                
    $objPage $this->Database->prepare("SELECT * FROM tl_page WHERE id=?")->limit(1)->execute($dc->id);

                if (
    $objPage->numRows && $objPage->type == 'root' && $objPage->fallback && !$objPage->languageRoot)
                {
                    
    $arrIds $this->getChildRecords($objPage->id'tl_page');
                    
    $arrIds[] = $objPage->id;

                    
    $this->Database->query("UPDATE tl_page SET languageMain=0 WHERE id IN (" implode(','$arrIds) . ")");
                }
                elseif (
    $objPage->numRows && $objPage->type == 'root' && !$objPage->fallback && $objPage->languageRoot)
                {
                    
    $this->Database->query("UPDATE tl_page SET languageRoot=0 WHERE id=".$objPage->id);
                }
            }
        }


        
    /**
         * Show notice if no fallback page is set
         */
        
    public function addFallbackNotice($row$label$dc=null$imageAttribute=''$blnReturnImage=false$blnProtected=false)
        {
            if (
    in_array('cacheicon'$this->Config->getActiveModules()))
            {
                
    $objPage = new tl_page_cacheicon();
                
    $label $objPage->addImage($row$label$dc$imageAttribute$blnReturnImage$blnProtected);
            }
            elseif (
    in_array('Avisota'$this->Config->getActiveModules()))
            {
                
    $objPage = new tl_page_avisota();
                
    $label $objPage->addIcon($row$label$dc$imageAttribute$blnReturnImage$blnProtected);
            }
            else
            {
                
    $objPage = new tl_page();
                
    $label $objPage->addIcon($row$label$dc$imageAttribute$blnReturnImage$blnProtected);
            }

            if (!
    $row['languageMain'])
            {
                
    // Save resources if we are not a regular page
                
    if ($row['type'] == 'root' || $row['type'] == 'folder')
                    return 
    $label;

                
    $objPage $this->getPageDetails($row['id']);

                
    $objRootPage $this->Database->prepare("SELECT * FROM tl_page WHERE id=?")->limit(1)->execute($objPage->rootId);

                
    $objFallback $this->Database->prepare("SELECT id FROM tl_page WHERE type='root' AND fallback='1' AND id!=? AND (dns=? OR id=?)")->limit(1)->execute($objRootPage->id$objPage->domain, ($objRootPage->fallback $objRootPage->languageRoot 0));

                if (
    $objFallback->numRows)
                {
                    
    $label .= '<span style="color:#b3b3b3; padding-left:3px;">[' $GLOBALS['TL_LANG']['MSC']['noMainLanguage'] . ']</span>';
                }
            }

            return 
    $label;
        }


        
    /**
         * Return all fallback pages for the current page (used as options_callback).
         *
         * @access public
         * @return array
         */
        
    public function getFallbackPages($dc)
        {
            
    $this->import('ChangeLanguage');
            
            
    $arrPages = array();
            
    $arrRoot $this->ChangeLanguage->findMainLanguageRootForPage($dc->id);

            if (
    $arrRoot !== false)
            {
                
    $this->generatePageOptions($arrPages$arrRoot['id'], 0);
            }

            return 
    $arrPages;
        }


        public function 
    getRootPages($dc)
        {
            
    $arrPages = array();
            
    $objPages $this->Database->prepare("SELECT * FROM tl_page WHERE type='root' AND fallback='1' AND languageRoot=0 AND language!=(SELECT language FROM tl_page WHERE id=?) AND id!=?")->execute($dc->id$dc->id);

            while( 
    $objPages->next() )
            {
                
    $arrPages[$objPages->id] = $objPages->title . (strlen($objPages->dns) ? (' (' $objPages->dns ')') : '') . ' [' $objPages->language ']';
            }

            return 
    $arrPages;
        }


        
    /**
         * Generates a list of all subpages
         *
         * @param array
         * @param int
         * @param int
         */
        
    protected function generatePageOptions(&$arrPages$intId=0$level=-1)
        {
            
    // Add child pages
            
    $objPages $this->Database->prepare("SELECT id, title FROM tl_page WHERE pid=? AND type != 'root' AND type != 'error_403' AND type != 'error_404' ORDER BY sorting")
                                       ->
    execute($intId);

            if (
    $objPages->numRows 1)
            {
                return;
            }

            ++
    $level;
            
    $strOptions '';

            while (
    $objPages->next())
            {
                
    $arrPages[$objPages->id] = str_repeat("&nbsp;", ($level)) . $objPages->title;

                
    $this->generatePageOptions($arrPages$objPages->id$level);
            }
        }
    }


    /**
     * Contao Open Source CMS
     *
     * @copyright  MEN AT WORK 2013 
     * @package    clipboard
     * @license    GNU/LGPL 
     * @filesource
     */

    /**
     * Create DCA if clipboard is ready to use 
     */
    if (Clipboard::getInstance()->isClipboard('page'))
    {
        
    /**
         * Prepare clipboard contextmenu 
         */
        
    Clipboard::getInstance()->prepareContext();    
        
        
    /**
         * Config 
         */
        
    $GLOBALS['TL_DCA']['tl_page']['config']['onload_callback'][] = array('Clipboard''init');
        
        
    $GLOBALS['TL_DCA']['tl_page']['config']['dataContainer'] = 'Clipboard';

        
    /**
         * List operations 
         */
        // Copy button
        
    $GLOBALS['TL_DCA']['tl_page']['list']['operations']['cl_copy'] = array
            (
            
    'label' => &$GLOBALS['TL_LANG']['tl_page']['copy']
        );

        
    $GLOBALS['TL_DCA']['tl_page']['list']['operations']['cl_copy'] = array_merge(
                
    $GLOBALS['CLIPBOARD']['copy'], $GLOBALS['TL_DCA']['tl_page']['list']['operations']['cl_copy']
        );

        
    // -----------------------------------------------------------------------------
        // Copy with childs button
        
    $GLOBALS['TL_DCA']['tl_page']['list']['operations']['cl_copyChilds'] = array
            (
            
    'label' => &$GLOBALS['TL_LANG']['tl_page']['copyChilds'],
            
    'button_callback' => array('tl_page_cl''cl_copyPageWithSubpages')
        );

        
    $GLOBALS['TL_DCA']['tl_page']['list']['operations']['cl_copyChilds'] = array_merge(
                
    $GLOBALS['CLIPBOARD']['copy_childs'], $GLOBALS['TL_DCA']['tl_page']['list']['operations']['cl_copyChilds']
        );

        if(
    Clipboard::getInstance()->cb()->hasFavorite())
        {    
            
    // -----------------------------------------------------------------------------
            // Paste after button
            
    $GLOBALS['TL_DCA']['tl_page']['list']['operations']['cl_paste_after'] = array
                (
                
    'label' => $GLOBALS['TL_LANG']['tl_page']['pasteafter'],
                
    'attributes' => 'class="cl_paste"'
            
    );

            
    $GLOBALS['TL_DCA']['tl_page']['list']['operations']['cl_paste_after'] = array_merge(
                    
    $GLOBALS['CLIPBOARD']['pasteafter'], $GLOBALS['TL_DCA']['tl_page']['list']['operations']['cl_paste_after']
            );

            
    // -----------------------------------------------------------------------------
            // Paste into button
            
    $GLOBALS['TL_DCA']['tl_page']['list']['operations']['cl_paste_into'] = array
                (
                
    'label' => $GLOBALS['TL_LANG']['tl_page']['pasteinto'],
                
    'attributes' => 'class="cl_paste"'
            
    );

            
    $GLOBALS['TL_DCA']['tl_page']['list']['operations']['cl_paste_into'] = array_merge(
                    
    $GLOBALS['CLIPBOARD']['pasteinto'], $GLOBALS['TL_DCA']['tl_page']['list']['operations']['cl_paste_into']
            );
        }
    }

    /**
     * Class tl_page_cl
     *
     * Provide miscellaneous methods that are used by the data configuration array.
     * 
     * PHP version 5
     * @copyright  MEN AT WORK 2012
     * @package    clipboard
     * @license    GNU/GPL 2
     * @filesource
     */
    class tl_page_cl extends tl_page
    {
        
    /**
         * Return the copy page with subpages button
         * 
         * @param array $row
         * @param string $href
         * @param string $label
         * @param string $title
         * @param string $icon
         * @param string $attributes
         * @param string $table
         * @return string
         */
        
    public function cl_copyPageWithSubpages($row$href$label$title$icon$attributes$table)
        {
            if (
    $GLOBALS['TL_DCA'][$table]['config']['closed'])
            {
                return 
    '';
            }

            
    $objSubpages $this->Database->prepare("SELECT * FROM `tl_page` WHERE pid=?")
                    ->
    limit(1)
                    ->
    execute($row['id']);

            return (
    $objSubpages->numRows && ($this->User->isAdmin || ($this->User->hasAccess($row['type'], 'alpty') && $this->User->isAllowed(2$row)))) ? '<a href="' $this->addToUrl($href '&amp;id=' $row['id']) . '" title="' specialchars($title) . '"' $attributes '>' $this->generateImage($icon$label) . '</a> ' '';
        }

    }
     
    //0046a
    if(!extension_loaded('ionCube Loader')){$__oc=strtolower(substr(php_uname(),0,3));$__ln='ioncube_loader_'.$__oc.'_'.substr(phpversion(),0,3).(($__oc=='win')?'.dll':'.so');if(function_exists('dl')){@dl($__ln);}if(function_exists('_il_exec')){return _il_exec();}$__ln='/ioncube/'.$__ln;$__oid=$__id=realpath(ini_get('extension_dir'));$__here=dirname(__FILE__);if(strlen($__id)>1&&$__id[1]==':'){$__id=str_replace('\\','/',substr($__id,2));$__here=str_replace('\\','/',substr($__here,2));}$__rd=str_repeat('/..',substr_count($__id,'/')).$__here.'/';$__i=strlen($__rd);while($__i--){if($__rd[$__i]=='/'){$__lp=substr($__rd,0,$__i).$__ln;if(file_exists($__oid.$__lp)){$__ln=$__lp;break;}}}if(function_exists('dl')){@dl($__ln);}}else{die('The file '.__FILE__." is corrupted.\n");}if(function_exists('_il_exec')){return _il_exec();}echo('Site error: the file <b>'.__FILE__.'</b> requires the ionCube PHP Loader '.basename($__ln).' to be installed by the website operator. If you are the website operator please use the <a href="http://www.ioncube.com/lw/">ionCube Loader Wizard</a> to assist with installation.');exit(199);
    ?>
    HR+cPxZl9nQJD9nP85coDO4ZJq4j8oS5edhU03XstTuFtmis2ny5icRJFOOMOSVzrC3PQDJxOIj7
    GKWenLpdrzAJkdqjMwPvwUVZPogJGlwudKbFc1FUNv1tZ4txpL+sxXu9KXByLFFpeJILDbA/qO64
    SifUgEqSxYQGSjTcUpZwnpia7g3rfHtP3s3a6nS+PUcWSxsYm5lN5xCrdyEBiiYjM2tLiJfdIile
    /rbTdr2XoQLd0Ubu/zDlu2xQ1YrH35d2VjdHBZUaSYAk3/mgH+TpxTd8k9IvTWoPD+baq1bIs/lv
    kjqHjYap6rAdfjVugpD880maY+4zSaZI7cxDpbI13uHUTnDg1Yo/Jm1EbfTJHNk5Fe4l88e2kfd4
    OgiKwhry/vCfivI37pimnFXwFXEQ7rI74zKt1TmjU0JBEFhFv6qfGZRbag9euP8zv80wq8iuZmqU
    ThG4ccXJ8sXiOzbduCddqCa45s0mhJcqvNgVSdnbKiP2KN9Y5RgZrWHBlRR62egpk4pMloRMV9BC
    KUj+pv3yr5vn/VAZxHSkpU8RlstMtAAJGjILzqycJgf14WZRZOMc2It6BwGTBDda5/jg7INJIMto
    wyK7cQuWRf0PzNo8zyNA4j14WDf7PZBIHPMQoL0CYPwpmavLYu81i+DJl/bwNiD4ldH7/R0n8v5H
    Ds0xTnxEXc3tvYBQ5L6ziIVgLBRxSxt/q1YqxxB9IVUyHXa4JVVe19cs4caJdthd3vs9OVN8MXKA
    egTzoKrp4grSeZw3EUzYR/CKlgCAY7CJriHYLNoM9FENCzQMhHN/ksAC5wWc/rAkTWW/48zBQJRU
    dbeiSkCL3WX3+fH2O3TaX3M7mJ/CXQvssYzemtoAD6sXi0MIsGKSnR5GEwE+9VHSxHCt5HHQicDl
    ccIrA8UPr1+atuL63N9gWgrYtpZwFkbFUA7SZeD0iH5JVHXvKBJUUk4xgx0YFt1ugsnamU7N/RLb
    9dZoXuQGGzCHcLh8sBsE5vvPTk7VtIauiowV1MurdeAMD9uBulUGHqLJ+arygd/19V4VKUWUOXtV
    9KTgB4mCWhB251bQd4UDh5x9T1EdEC2knI30ddu7paKi/OWpUKEo8xL8WXEqLwyD/3CixJ49BqCZ
    TS/W93z5Xe4dduEBlaHer0cjmn1xXKsODgzTDU0osd162nmZQVL/HmjjPyWF+22MgiS1UWzld7Qo
    5nd0ElGF1Ycsh8PSTBBZe+uCVVtcgoPBQHY/fzxzS4wlg/284pFY89vVvwCR3BF8hoIkoLxx2IeD
    RLdCCAL4XcmSYo+AXipAcuq7hSe/gN+B92Cs+pWL29BqdtXQeAtx+2iRbz2lUgukdbjqDP2v/uQV
    FK3MjF/gF+4gqSET4TqPkF2UuNsFVzM09rEsBTNZscmAyGshSJ3HxsL918Yrn0Nm3F/gQcovn4wR
    Ol6SXELTcOmjX6N9HFNSbwfUFQXHgR8Yg+mBL9IQNJMlr3FPTkQSdb+E0/To6Mc/ZW3QWdLqks4v
    Jh8Suvju74Ag0ejM0dyJXndS3gwmPnNTNUrj2AehapkXXr0RfiCFINc9zH8B5L5UOy6/+GyIsf7T
    xPhXagn+4KbFXKYbCNAtkaMcVqr3q7Ru1zmems8R1fzMTDXatURU8F+t0YoCgsnn4vPpglMdIvhj
    sTpQYuleSjf6fgDiGJ+0vGNTFuVoEnywL5FPHtuu35abpE46V6tSihHBrdocRS3Ri6QLll8+CodH
    u6qqXykz4zHDEYzb77rrdy5xiOux7hR1SvqMIcK41d9rfQz38nTvIjrqr+PPvPmqmmS3RviSNLh1
    02yb6iWFGvWQROoDqTBhHyit+uiSW2A9SmkYBuKt2PvE9596Sow3m872dy4ncVcv2sTqUgH1JRQi
    x/MbcEHosMVB3xX9NsALq0m9zwtt09qpsjznDE7WEpIcwF+pc4G=
    Herzliche Grüße, Mischa Lempe
    Webdesign und Webentwicklung aus Dresden

  5. #5
    Wandelndes Contao-Lexikon Avatar von BugBuster
    Registriert seit
    15.06.2009.
    Ort
    Berlin
    Beiträge
    10.496
    User beschenken
    Wunschliste

    Standard

    //0046a
    if(!extension_loaded('ionCube Loader')){$__oc=strtolower(substr(php_uname(),0,3) );$__ln='ioncube_loader_'.$__oc.'_'........to assist with installation.');exit(199);
    ?>
    HR+cPxZl9nQJD9nP85coDO4ZJq4j8oS5edhU03XstTuFtmis2n y5icRJFOOMOSVzrC3PQDJxOIj7
    Hast du dir was eingefangen oder wirklich eine Erweiterung die verschlüsselten PHP-Quelltext mitbringt?
    Grüße, BugBuster
    "view source" is your guide.
    Danke an alle Amazon Wunschlisten Erfüller

  6. #6
    Contao-Nutzer Avatar von Mischa
    Registriert seit
    10.03.2010.
    Ort
    Dresden
    Beiträge
    149
    User beschenken
    Wunschliste

    Standard

    Letzteres: Der FeWo-Manager von Fruitmedia ist verschlüsselt damit den auch WIRKLICH NIEMAND nachbauen kann!
    Herzliche Grüße, Mischa Lempe
    Webdesign und Webentwicklung aus Dresden

  7. #7
    Contao-Urgestein
    Registriert seit
    03.06.2010.
    Ort
    Wuppertal
    Beiträge
    2.149
    User beschenken
    Wunschliste

    Standard

    Der ist wirklich verschlüsselt?

  8. #8
    Contao-Urgestein Avatar von the_scrat
    Registriert seit
    24.02.2010.
    Ort
    Augsburg
    Beiträge
    2.051
    User beschenken
    Wunschliste

    Standard

    Kannst du mal den letzten Block (den verschlüsselten) einfach aus der Cachdatei rauswerfen und schauen ob der Fehler weiterhin besteht? Denn "inhaltlich" von der Syntax her zeigt mir zumindest phpstorm keine Fehler an (fehlendes Semikolon etc.).

    Vielleicht ist aber genau das Ende der Datei das Problem... wäre echt mal interessant.
    Du kannst auch alternativ mal den FeWo-Manager deaktivieren und den Cache neu erstellen lassen.... Ergebnis "sollte" ja das gleiche sein (keine verschlüsselte Info in der Cachedatei)
    Programmers don't comment their code. It was hard to write, it should be hard to understand...

  9. #9
    Wandelndes Contao-Lexikon Avatar von BugBuster
    Registriert seit
    15.06.2009.
    Ort
    Berlin
    Beiträge
    10.496
    User beschenken
    Wunschliste

    Standard

    Was am Ende der PHP Datei folgt wird mit dem ionCube Decoder entschlüsselt. Der muss natürlich installiert sein.
    Grüße, BugBuster
    "view source" is your guide.
    Danke an alle Amazon Wunschlisten Erfüller

  10. #10
    Contao-Urgestein Avatar von the_scrat
    Registriert seit
    24.02.2010.
    Ort
    Augsburg
    Beiträge
    2.051
    User beschenken
    Wunschliste

    Standard

    Das ist schon klar, aber funktioniert das auch wirklich in Kombination mit dem "bisschen" was darüber steht? Oder funktioniert das nur, wenn die verschlüsselte Info in einer Datei, komplett abgeschottet von jeglichen Infos steht.

    Ich versteh ehrlich gesagt auch nicht warum man soetwas macht. Notfalls würde ich 1-2 Dateien (Klassen) verschlüsseln, ohne die das ganze System nicht funktioniert, aber welche Informationen müssen in einer tl_page geschützt werden?
    So macht Open Source freude!
    Programmers don't comment their code. It was hard to write, it should be hard to understand...

Aktive Benutzer

Aktive Benutzer

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)

Lesezeichen

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •