/**
     * Constructor
     * For more info see {@link eZXMLInputHandler::eZXMLInputHandler()}
     *
     * @param string $xmlData
     * @param string $aliasedType
     * @param eZContentObjectAttribute $contentObjectAttribute
     */
    function eZOEXMLInput( &$xmlData, $aliasedType, $contentObjectAttribute )
    {
        $this->eZXMLInputHandler( $xmlData, $aliasedType, $contentObjectAttribute );

        $contentIni = eZINI::instance( 'content.ini' );
        if ( $contentIni->hasVariable( 'header', 'UseStrictHeaderRule' ) === true )
        {
            if ( $contentIni->variable( 'header', 'UseStrictHeaderRule' ) === 'true' )
                $this->IsStrictHeader = true;
        }

        $this->eZPublishVersion = eZPublishSDK::majorVersion() + eZPublishSDK::minorVersion() * 0.1;

        $ezxmlIni = eZINI::instance( 'ezxml.ini' );
        if ( $ezxmlIni->hasVariable( 'InputSettings', 'AllowMultipleSpaces' ) === true )
        {
            $allowMultipleSpaces = $ezxmlIni->variable( 'InputSettings', 'AllowMultipleSpaces' );
            $this->allowMultipleSpaces = $allowMultipleSpaces === 'true' ? true : false;
        }
        if ( $ezxmlIni->hasVariable( 'InputSettings', 'AllowNumericEntities' ) )
        {
            $allowNumericEntities = $ezxmlIni->variable( 'InputSettings', 'AllowNumericEntities' );
            $this->allowNumericEntities = $allowNumericEntities === 'true' ? true : false;
        }
    }
 /**
  * Abstract method to initialize a template and eventually takes advantage of new 4.3 TPL API
  * @return eZTemplate
  */
 public static function templateInit()
 {
     $tpl = null;
     if (eZPublishSDK::majorVersion() >= 4 && eZPublishSDK::minorVersion() < 3) {
         include_once 'kernel/common/template.php';
         $tpl = templateInit();
     } else {
         $tpl = eZTemplate::factory();
     }
     return $tpl;
 }
 static function version($withRelease = true, $asAlias = false, $withState = true)
 {
     if ($asAlias) {
         $versionText = eZPublishSDK::alias();
         if ($withState) {
             $versionText .= "-" . eZPublishSDK::state();
         }
     } else {
         $versionText = 'Community Project ' . eZPublishSDK::majorVersion() . '.' . eZPublishSDK::minorVersion();
         //            $development = eZPublishSDK::developmentVersion();
         //            if ( $development !== false )
         //                $versionText .= '.' . $development;
     }
     return $versionText;
 }
 function fetchMinorVersion()
 {
     return array('result' => eZPublishSDK::minorVersion());
 }
 function eZXMLInputParser($validateErrorLevel = self::ERROR_NONE, $detectErrorLevel = self::ERROR_NONE, $parseLineBreaks = false, $removeDefaultAttrs = false)
 {
     // Back-compatibility fixes:
     if ($detectErrorLevel === self::SHOW_SCHEMA_ERRORS) {
         $detectErrorLevel = self::ERROR_SCHEMA;
     } elseif ($detectErrorLevel === self::SHOW_ALL_ERRORS) {
         $detectErrorLevel = self::ERROR_ALL;
     }
     if ($validateErrorLevel === false) {
         $validateErrorLevel = self::ERROR_NONE;
     } elseif ($validateErrorLevel === true) {
         $validateErrorLevel = $detectErrorLevel;
     }
     $this->ValidateErrorLevel = $validateErrorLevel;
     $this->DetectErrorLevel = $detectErrorLevel;
     $this->RemoveDefaultAttrs = $removeDefaultAttrs;
     $this->ParseLineBreaks = $parseLineBreaks;
     $this->XMLSchema = eZXMLSchema::instance();
     $this->eZPublishVersion = eZPublishSDK::majorVersion() + eZPublishSDK::minorVersion() * 0.1;
     $ini = eZINI::instance('ezxml.ini');
     if ($ini->hasVariable('InputSettings', 'TrimSpaces')) {
         $trimSpaces = $ini->variable('InputSettings', 'TrimSpaces');
         $this->TrimSpaces = $trimSpaces == 'true' ? true : false;
     }
     if ($ini->hasVariable('InputSettings', 'AllowMultipleSpaces')) {
         $allowMultipleSpaces = $ini->variable('InputSettings', 'AllowMultipleSpaces');
         $this->AllowMultipleSpaces = $allowMultipleSpaces == 'true' ? true : false;
     }
     if ($ini->hasVariable('InputSettings', 'AllowNumericEntities')) {
         $allowNumericEntities = $ini->variable('InputSettings', 'AllowNumericEntities');
         $this->AllowNumericEntities = $allowNumericEntities == 'true' ? true : false;
     }
     $contentIni = eZINI::instance('content.ini');
     $useStrictHeaderRule = $contentIni->variable('header', 'UseStrictHeaderRule');
     $this->StrictHeaders = $useStrictHeaderRule == 'true' ? true : false;
 }
示例#6
0
    /**
     * @param \eZTemplate $mailTpl
     * @param array $userData
     *
     * @return array|null|string
     */
    function generateRegistration( eZTemplate $mailTpl, array $userData )
    {
        $databaseMap = eZSetupDatabaseMap();
        $databaseInfo = $this->PersistenceList['database_info'];
        $databaseInfo['info'] = $databaseMap[$databaseInfo['type']];
        $regionalInfo = $this->PersistenceList['regional_info'];
        if ( !isset( $regionalInfo['languages'] ) )
            $regionalInfo['languages'] = array();

        $emailInfo = $this->PersistenceList['email_info'];

        $siteType = $this->chosenSiteType();


        $url = $siteType['url'];
        if ( !preg_match( "#^[a-zA-Z0-9]+://(.*)$#", $url ) )
        {
            $url = 'http://' . $url;
        }
        $currentURL = $url;
        $adminURL = $url;
        if ( $siteType['access_type'] == 'url' )
        {
            $url .= '/' . $siteType['access_type_value'];
            $adminURL .= '/' . $siteType['admin_access_type_value'];
        }
        else if ( $siteType['access_type'] == 'hostname' )
        {
            $url = eZHTTPTool::createRedirectURL( 'http://' . $siteType['access_type_value'] );
            $adminURL = eZHTTPTool::createRedirectURL( 'http://' . $siteType['admin_access_type_value'] );
        }
        else if ( $siteType['access_type'] == 'port' )
        {
            $url = eZHTTPTool::createRedirectURL( $currentURL, array( 'override_port' => $siteType['access_type_value'] ) );
            $adminURL = eZHTTPTool::createRedirectURL( $currentURL, array( 'override_port' => $siteType['admin_access_type_value'] ) );
        }
        $siteType['url'] = $url;
        $siteType['admin_url'] = $adminURL;


        $testsRun = $this->PersistenceList['tests_run'];
        $imageMagickProgram = $this->PersistenceList['imagemagick_program'];
        $imageGDExtension = $this->PersistenceList['imagegd_extension'];
        $phpVersion = $this->PersistenceList['phpversion'];
        $phpVersion['sapi'] = PHP_SAPI;

        $webserverInfo = false;
        if ( function_exists( 'apache_get_version' ) )
        {
            $webserverInfo = array( 'version' => apache_get_version() );
        }
        else if ( !empty( $_SERVER['SERVER_SOFTWARE'] ) )
        {
            $webserverInfo = array( 'version' => $_SERVER['SERVER_SOFTWARE'] );
        }

        $systemInfo = new eZSysInfo();
        $systemInfo->scan();

        $optionalTests = eZSetupOptionalTests();
        $runResult = eZSetupRunTests( $optionalTests, 'eZSetup:init:send_registration', $this->PersistenceList );
        $testResults = $runResult['results'];

        // Generate email body e-mail
        $mailTpl->setVariable( 'user_data', $userData );
        $mailTpl->setVariable( 'database_info', $databaseInfo );
        $mailTpl->setVariable( 'regional_info', $regionalInfo );
        $mailTpl->setVariable( 'email_info', $emailInfo );
        $mailTpl->setVariable( 'site_type', $siteType );
        $mailTpl->setVariable( 'tests_run', $testsRun );
        $mailTpl->setVariable( 'imagemagick_program', $imageMagickProgram );
        $mailTpl->setVariable( 'imagegd_extension', $imageGDExtension );
        $mailTpl->setVariable( 'phpversion', $phpVersion );
        $mailTpl->setVariable( 'webserver', $webserverInfo );
        $mailTpl->setVariable( 'system', $systemInfo );
        $mailTpl->setVariable( 'os', array( 'name' => php_uname() ) );
        $mailTpl->setVariable( 'optional_tests', $testResults );
        $mailTpl->setVariable( "version", array( "text" => eZPublishSDK::version(),
                                                 "major" => eZPublishSDK::majorVersion(),
                                                 "minor" => eZPublishSDK::minorVersion(),
                                                 "release" => eZPublishSDK::release() ) );

        return $mailTpl->fetch( 'design:setup/registration_email.tpl' );
    }
示例#7
0
 function eZXMLSchema()
 {
     $ini = eZINI::instance('content.ini');
     // Get inline custom tags list
     $this->Schema['custom']['isInline'] = $ini->variable('CustomTagSettings', 'IsInline');
     if (!is_array($this->Schema['custom']['isInline'])) {
         $this->Schema['custom']['isInline'] = array();
     }
     $this->Schema['custom']['tagList'] = $ini->variable('CustomTagSettings', 'AvailableCustomTags');
     if (!is_array($this->Schema['custom']['tagList'])) {
         $this->Schema['custom']['tagList'] = array();
     }
     $eZPublishVersion = eZPublishSDK::majorVersion() + eZPublishSDK::minorVersion() * 0.1;
     // Get all tags available classes list
     foreach (array_keys($this->Schema) as $tagName) {
         if ($ini->hasVariable($tagName, 'AvailableClasses')) {
             $avail = $ini->variable($tagName, 'AvailableClasses');
             if (is_array($avail) && count($avail)) {
                 $this->Schema[$tagName]['classesList'] = $avail;
             } else {
                 $this->Schema[$tagName]['classesList'] = array();
             }
         } else {
             $this->Schema[$tagName]['classesList'] = array();
         }
     }
     // Fix for empty paragraphs setting
     $allowEmptyParagraph = $ini->variable('paragraph', 'AllowEmpty');
     $this->Schema['paragraph']['childrenRequired'] = $allowEmptyParagraph == 'true' ? false : true;
     // Get all tags custom attributes list
     $ini = eZINI::instance('content.ini');
     foreach (array_keys($this->Schema) as $tagName) {
         if ($tagName == 'custom') {
             // Custom attributes of custom tags
             foreach ($this->Schema['custom']['tagList'] as $customTagName) {
                 if ($ini->hasVariable($customTagName, 'CustomAttributes')) {
                     $avail = $ini->variable($customTagName, 'CustomAttributes');
                     if (is_array($avail) && count($avail)) {
                         $this->Schema['custom']['customAttributes'][$customTagName] = $avail;
                     } else {
                         $this->Schema['custom']['customAttributes'][$customTagName] = array();
                     }
                 } else {
                     $this->Schema['custom']['customAttributes'][$customTagName] = array();
                 }
             }
         } else {
             // Custom attributes of regular tags
             if ($ini->hasVariable($tagName, 'CustomAttributes')) {
                 $avail = $ini->variable($tagName, 'CustomAttributes');
                 if (is_array($avail) && count($avail)) {
                     $this->Schema[$tagName]['customAttributes'] = $avail;
                 } else {
                     $this->Schema[$tagName]['customAttributes'] = array();
                 }
             } else {
                 $this->Schema[$tagName]['customAttributes'] = array();
             }
         }
     }
 }
 function generateRegistration($mailTpl, $comments)
 {
     $databaseMap = eZSetupDatabaseMap();
     $databaseInfo = $this->PersistenceList['database_info'];
     $databaseInfo['info'] = $databaseMap[$databaseInfo['type']];
     $regionalInfo = $this->PersistenceList['regional_info'];
     if (!isset($regionalInfo['languages'])) {
         $regionalInfo['languages'] = array();
     }
     //        $demoData = $this->PersistenceList['demo_data'];
     $emailInfo = $this->PersistenceList['email_info'];
     $siteTemplates = array();
     $siteType = $this->chosenSiteType();
     /* $typeFunctionality = eZSetupFunctionality( $siteType['identifier'] );
        $additionalPackages = array();
        if ( isset( $this->PersistenceList['additional_packages'] ) )
            $additionalPackages = $this->PersistenceList['additional_packages'];
        $extraFunctionality = array_merge( $additionalPackages,
                                           $typeFunctionality['required'] );
        $extraFunctionality = array_unique( $extraFunctionality );*/
     $url = $siteType['url'];
     if (!preg_match("#^[a-zA-Z0-9]+://(.*)\$#", $url)) {
         $url = 'http://' . $url;
     }
     $currentURL = $url;
     $adminURL = $url;
     if ($siteType['access_type'] == 'url') {
         $url .= '/' . $siteType['access_type_value'];
         $adminURL .= '/' . $siteType['admin_access_type_value'];
     } else {
         if ($siteType['access_type'] == 'hostname') {
             $url = eZHTTPTool::createRedirectURL('http://' . $siteType['access_type_value']);
             $adminURL = eZHTTPTool::createRedirectURL('http://' . $siteType['admin_access_type_value']);
         } else {
             if ($siteType['access_type'] == 'port') {
                 $url = eZHTTPTool::createRedirectURL($currentURL, array('override_port' => $siteType['access_type_value']));
                 $adminURL = eZHTTPTool::createRedirectURL($currentURL, array('override_port' => $siteType['admin_access_type_value']));
             }
         }
     }
     $siteType['url'] = $url;
     $siteType['admin_url'] = $adminURL;
     //$siteType['extra_functionality'] = $extraFunctionality;
     $testsRun = $this->PersistenceList['tests_run'];
     $imageMagickProgram = $this->PersistenceList['imagemagick_program'];
     $imageGDExtension = $this->PersistenceList['imagegd_extension'];
     $phpVersion = $this->PersistenceList['phpversion'];
     $webserverInfo = false;
     if (function_exists('apache_get_version')) {
         $webserverInfo = array('version' => apache_get_version());
     }
     $systemInfo = new eZSysInfo();
     $systemInfo->scan();
     $optionalTests = eZSetupOptionalTests();
     $testTable = eZSetupTestTable();
     $runResult = eZSetupRunTests($optionalTests, 'eZSetup:init:send_registration', $this->PersistenceList);
     $testResults = $runResult['results'];
     $testResult = $runResult['result'];
     $successCount = $runResult['success_count'];
     $persistenceData = $runResult['persistence_list'];
     // Send e-mail
     $mailTpl->setVariable('comments', $comments);
     $mailTpl->setVariable('database_info', $databaseInfo);
     $mailTpl->setVariable('regional_info', $regionalInfo);
     //        $mailTpl->setVariable( 'demo_data', $demoData );
     $mailTpl->setVariable('email_info', $emailInfo);
     $mailTpl->setVariable('site_type', $siteType);
     $mailTpl->setVariable('tests_run', $testsRun);
     $mailTpl->setVariable('imagemagick_program', $imageMagickProgram);
     $mailTpl->setVariable('imagegd_extension', $imageGDExtension);
     $mailTpl->setVariable('phpversion', $phpVersion);
     $mailTpl->setVariable('webserver', $webserverInfo);
     $mailTpl->setVariable('system', $systemInfo);
     $mailTpl->setVariable('os', array('name' => php_uname()));
     $mailTpl->setVariable('optional_tests', $testResults);
     $mailTpl->setVariable("version", array("text" => eZPublishSDK::version(), "major" => eZPublishSDK::majorVersion(), "minor" => eZPublishSDK::minorVersion(), "release" => eZPublishSDK::release()));
     return $mailTpl->fetch('design:setup/registration_email.tpl');
 }
示例#9
0
 /**
  * Wrapper method to initialize a template and eventually takes advantage of new 4.3 TPL API
  * @return eZTemplate
  */
 public static function eZTemplateFactory()
 {
     if (eZPublishSDK::majorVersion() == 4 && eZPublishSDK::minorVersion() < 3) {
         include_once 'kernel/common/template.php';
         return templateInit();
     } else {
         return eZTemplate::factory();
     }
 }
示例#10
0
文件: ezsetup.php 项目: legende91/ez
    }
}
$done = false;
$result = null;
while (!$done && $step != null) {
    // Some common variables for all steps
    $tpl->setVariable("script", eZSys::serverVariable('PHP_SELF'));
    $siteBasics = $GLOBALS['eZSiteBasics'];
    $useIndex = $siteBasics['validity-check-required'];
    if ($useIndex) {
        $script = eZSys::wwwDir() . eZSys::indexFileName();
    } else {
        $script = eZSys::indexFile() . "/setup/{$partName}";
    }
    $tpl->setVariable('script', $script);
    $tpl->setVariable("version", array("text" => eZPublishSDK::version(), "major" => eZPublishSDK::majorVersion(), "minor" => eZPublishSDK::minorVersion(), "release" => eZPublishSDK::release(), "alias" => eZPublishSDK::alias()));
    if ($persistenceList === null) {
        $persistenceList = eZSetupFetchPersistenceList();
    }
    $tpl->setVariable('persistence_list', $persistenceList);
    // Try to include the relevant file
    $includeFile = $baseDir . 'steps/ezstep_' . $step['file'] . '.php';
    $stepClass = false;
    if (file_exists($includeFile)) {
        include_once $includeFile;
        $className = 'eZStep' . $step['class'];
        if ($step == $currentStep) {
            $stepInstaller = $previousStepClass;
        } else {
            $stepInstaller = new $className($tpl, $http, $ini, $persistenceList);
        }
示例#11
0
 $method = '';
 if ($protocol == 'ezjscore') {
     $uri = "ezjscore/call";
 } elseif ($protocol == 'soap') {
     $wsINI = eZINI::instance('soap.ini');
     $uri = "webservices/wsdl";
 } else {
     if ($protocol == 'rest v1') {
         $uri = "api/ezp/v1";
         $restv1 = in_array('ezprestapiprovider', eZExtension::activeExtensions());
         $method = '/';
     } else {
         if ($protocol == 'rest v2') {
             $uri = "api/ezp/v2";
             $ver = eZPublishSDK::majorVersion();
             $restv2 = $ver >= 2012 & eZPublishSDK::minorVersion() >= 9 || $ver >= 5 && $ver < 2011;
             $method = '/';
         } else {
             $uri = "webservices/execute/{$protocol}";
         }
     }
 }
 eZURI::transformURI($uri, false, 'full');
 if ($protocol == 'rest v2' || $protocol == 'rest v1') {
     // for now, manually remove siteaccess name if found in url
     $sa = $GLOBALS['eZCurrentAccess']['name'];
     $uri = str_replace("/{$sa}/", "/", $uri);
 }
 /// @todo disable link if ezjscore not active, enable rest v1 and rest v2 ...
 if ($protocol == 'ezjscore' && in_array('ezjscore', eZExtension::activeExtensions()) || $protocol != 'ezjscore' && $protocol != 'rest v1' && $protocol != 'rest v2' && $wsINI->variable('GeneralSettings', 'Enable' . strtoupper($protocol)) == 'true' || $protocol == 'rest v1' && $restv1 || $protocol == 'rest v2' && $restv2) {
     $url = parse_url($uri);
示例#12
0
{
// Some common variables for all steps
    $tpl->setVariable( "script", eZSys::serverVariable( 'PHP_SELF' ) );

    $siteBasics = $GLOBALS['eZSiteBasics'];
    $useIndex = $siteBasics['validity-check-required'];

    if ( $useIndex )
        $script = eZSys::wwwDir() . eZSys::indexFileName();
    else
        $script = eZSys::indexFile() . "/setup/$partName";
    $tpl->setVariable( 'script', $script );

    $tpl->setVariable( "version", array( "text" => eZPublishSDK::version(),
                                         "major" => eZPublishSDK::majorVersion(),
                                         "minor" => eZPublishSDK::minorVersion(),
                                         "release" => eZPublishSDK::release(),
                                         "alias" => eZPublishSDK::alias() ) );

    if ( $persistenceList === null )
        $persistenceList = eZSetupFetchPersistenceList();
    $tpl->setVariable( 'persistence_list', $persistenceList );

    // Try to include the relevant file
    $includeFile = $baseDir . 'steps/ezstep_'.$step['file'].'.php';
    $stepClass = false;
    if ( file_exists( $includeFile ) )
    {
        include_once( $includeFile );
        $className = 'eZStep'.$step['class'];