function eZMail()
    {
        $this->Mail = new ezpMail();

        $this->ReceiverElements = array();
        $this->From = false;
        $this->CcElements = array();
        $this->BccElements = array();
        $this->ReplyTo = false;
        $this->Subject = false;
        $this->BodyText = false;
        $this->ExtraHeaders = array();
        $this->TextCodec = false;
        $this->MessageID = false;

        // Sets some default values
        $version = eZPublishSDK::version();

        $this->MIMEVersion = '1.0';
        $this->ContentType = array( 'type' => 'text/plain',
                                    'charset' => $this->usedCharset(),
                                    'transfer-encoding' => '8bit',
                                    'disposition' => 'inline',
                                    'boundary' => false );
        $this->UserAgent = "eZ Publish, Version $version";

        $ini = eZINI::instance();

        if ( $ini->hasVariable( 'MailSettings', 'ContentType' ) )
            $this->setContentType( $ini->variable( 'MailSettings', 'ContentType' ) );
    }
     /**
     * 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;
        }
    }
Beispiel #3
0
 protected static function initialize($force = false)
 {
     if (self::$initialized && !$force) {
         return;
     }
     // starting with version 4.1, this is available in the Setup|System Info page
     if (version_compare('4.1', eZPublishSDK::version()) <= 0) {
         self::$view_groups['PHP']['php']['hidden'] = true;
     }
     $ini = eZINI::instance('file.ini');
     $h = $ini->variable('ClusteringSettings', 'FileHandler');
     if (in_array($h, array('ezfs', 'eZFSFileHandler', 'eZFS2FileHandler'))) {
         self::$view_groups['eZPublish']['cachestats']['disabled'] = false;
         self::$view_groups['eZPublish']['cachesearch']['disabled'] = false;
         self::$view_groups['eZPublish']['storagestats']['disabled'] = false;
     }
     if (in_array($h, array('eZDFSFileHandler'))) {
         self::$view_groups['eZPublish']['cachestats']['disabled'] = false;
         self::$view_groups['eZPublish']['storagestats']['disabled'] = false;
     }
     /*if ( isset( $GLOBALS['_PHPA'] ) )
       {
          self::$view_groups['PHP']['phpaccelerator'];
       }
       else if ( extension_loaded( 'Turck MMCache' ) )
       {
           $operatorValue = 'mmcache';
       }*/
     if (extension_loaded('eAccelerator')) {
         self::$view_groups['PHP']['eaccelerator']['disabled'] = false;
     }
     if (extension_loaded('apc')) {
         self::$view_groups['PHP']['apc']['disabled'] = false;
     }
     if (function_exists('accelerator_get_status') || function_exists('opcache_get_status')) {
         self::$view_groups['PHP']['acceleratorplus']['disabled'] = false;
     }
     /*else if ( extension_loaded( 'Zend Performance Suite' ) )
       {
           $operatorValue = 'performancesuite';
       }*/
     if (extension_loaded('xcache')) {
         self::$view_groups['PHP']['xcache']['disabled'] = false;
     }
     if (extension_loaded('wincache')) {
         self::$view_groups['PHP']['wincache']['disabled'] = false;
     }
     $db = eZDB::instance();
     if ($db->databaseName() == 'mysql') {
         self::$view_groups['QA']['databaseqa']['disabled'] = false;
         /// @todo is this the correct way to check?
         if (function_exists('mysqli_get_client_stats')) {
             self::$view_groups['PHP']['mysqli']['disabled'] = false;
         }
     }
     self::$initialized = true;
 }
 /**
  * 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;
 }
Beispiel #5
0
 function get($oid)
 {
     $internaloid = preg_replace('/\\.0$/', '', $oid);
     switch ($internaloid) {
         case '3.1':
             return array('oid' => $oid, 'type' => eZSNMPd::TYPE_STRING, 'value' => eZPublishSDK::version());
         case '3.2':
             return array('oid' => $oid, 'type' => eZSNMPd::TYPE_STRING, 'value' => eZSNMPd::VERSION);
         case '3.3':
             return array('oid' => $oid, 'type' => eZSNMPd::TYPE_STRING, 'value' => $GLOBALS['eZCurrentAccess']['name']);
     }
     return self::NO_SUCH_OID;
     // oid not managed
 }
 function setParameters( $parameters = array() )
 {
     $timestamp = time();
     if ( isset( $_SERVER['HOSTNAME'] ) )
         $host = $_SERVER['HOSTNAME'];
     else if ( isset( $_SERVER['HTTP_HOST'] ) )
         $host = $_SERVER['HTTP_HOST'];
     else
         $host = 'localhost';
     $packaging = array( 'timestamp' => $timestamp,
                         'host' => $host,
                         'packager' => false );
     $ezpublishVersion = eZPublishSDK::version( true );
     $ezpublishNamedVersion = eZPublishSDK::version( false, false, true );
     $ezpublish = array( 'version' => $ezpublishVersion,
                         'named-version' => $ezpublishNamedVersion );
     $defaults = array( 'name' => false,
                        'development' => eZPackage::DEVELOPMENT,
                        'summary' => false,
                        'description' => false,
                        'vendor' => false,
                        'vendor-dir' => false,
                        'priority' => false,
                        'type' => false,
                        'extension' => false,
                        'install_type' => 'install',
                        'ezpublish' => $ezpublish,
                        'maintainers' => array(),
                        'packaging' => $packaging,
                        'source' => false,
                        'documents' => array(),
                        'groups' => array(),
                        'changelog' => array(),
                        'file-list' => array(),
                        'simple-file-list' => array(),
                        'version-number' => false,
                        'release-number' => false,
                        'release-timestamp' => false,
                        'licence' => false,
                        'state' => false,
                        'dependencies' => array( 'provides' => array(),
                                                 'requires' => array(),
                                                 'obsoletes' => array(),
                                                 'conflicts' => array() ),
                        'install' => array(),
                        'uninstall' => array() );
     $this->PolicyCache = array();
     $this->InstallData = array();
     $this->Parameters = array_merge( $defaults, $parameters );
 }
 protected static function initialize()
 {
     // starting with version 4.1, this is available in the Setup|System Info page
     if (version_compare('4.1', eZPublishSDK::version()) <= 0 && !count(ezSysinfoClusterManager::clusterNodes())) {
         self::$view_groups['php']['hidden'] = true;
     }
     /*if ( isset( $GLOBALS['_PHPA'] ) )
       {
          self::$view_groups['PHP']['phpaccelerator'];
       }
       else if ( extension_loaded( 'Turck MMCache' ) )
       {
           $operatorValue = 'mmcache';
       }*/
     if (extension_loaded('eAccelerator')) {
         self::$view_groups['eaccelerator']['disabled'] = false;
     }
     if (extension_loaded('apc')) {
         self::$view_groups['apc']['disabled'] = false;
     }
     if (function_exists('accelerator_get_status') || function_exists('opcache_get_status')) {
         self::$view_groups['acceleratorplus']['disabled'] = false;
     }
     /*else if ( extension_loaded( 'Zend Performance Suite' ) )
       {
           $operatorValue = 'performancesuite';
       }*/
     if (extension_loaded('xcache')) {
         self::$view_groups['xcache']['disabled'] = false;
     }
     if (extension_loaded('wincache')) {
         self::$view_groups['wincache']['disabled'] = false;
     }
     $db = eZDB::instance();
     if ($db->databaseName() == 'mysql') {
         /// @todo is this the correct way to check?
         if (function_exists('mysqli_get_client_stats')) {
             self::$view_groups['mysqli']['disabled'] = false;
         }
     }
     // a bit hackish
     if (count(ezSysinfoClusterManager::clusterNodes()) && !ezSysinfoClusterManager::isClusterSlaveRequest()) {
         foreach (self::$view_groups as &$viewDefinition) {
             if (@$viewDefinition['cluster_mode'] != '') {
                 $viewDefinition['script'] = $viewDefinition['cluster_mode'];
             }
         }
     }
 }
 function eZStepSiteTypes($tpl, $http, $ini, &$persistenceList)
 {
     $ini = eZINI::instance('package.ini');
     $indexURL = trim($ini->variable('RepositorySettings', 'RemotePackagesIndexURL'));
     if ($indexURL === '') {
         $indexURL = trim($ini->variable('RepositorySettings', 'RemotePackagesIndexURLBase'));
         if (substr($indexURL, -1, 1) !== '/') {
             $indexURL .= '/';
         }
         $indexURL .= eZPublishSDK::version(false, false, false) . '/' . eZPublishSDK::version() . '/';
     }
     $this->IndexURL = $indexURL;
     if (substr($this->IndexURL, -1, 1) == '/') {
         $this->XMLIndexURL = $this->IndexURL . 'index.xml';
     } else {
         $this->XMLIndexURL = $this->IndexURL . '/index.xml';
     }
     $this->eZStepInstaller($tpl, $http, $ini, $persistenceList, 'site_types', 'Site types');
 }
 function __construct()
 {
     $this->ReceiverElements = array();
     $this->MobileElements = array();
     $this->From = false;
     $this->CcElements = array();
     $this->BccElements = array();
     $this->ReplyTo = false;
     $this->Subject = false;
     $this->BodyText = false;
     $this->ExtraHeaders = array();
     $this->TextCodec = false;
     $this->MessageID = false;
     $this->Date = false;
     // Sets some default values
     $version = eZPublishSDK::version();
     $this->MIMEVersion = '1.0';
     $this->ContentType = array('type' => 'text/plain', 'charset' => eZTextCodec::internalCharset(), 'transfer-encoding' => '8bit', 'disposition' => 'inline', 'boundary' => false);
     $this->UserAgent = "eZ publish, Version {$version}";
     $ini = eZINI::instance();
     // HACK! Ignore system content type
     //if ( $ini->hasVariable( 'MailSettings', 'ContentType' ) )
     //    $this->setContentType( $ini->variable( 'MailSettings', 'ContentType' ) );
     if (!defined('EZ_MAIL_LINE_SEPARATOR')) {
         $ini = eZINI::instance('site.ini');
         $ending = $ini->variable('MailSettings', 'HeaderLineEnding');
         if ($ending == 'auto') {
             $sys = eZSys::instance();
             // For windows we use \r\n which is the endline defined in RFC 2045
             if ($sys->osType() == 'win32') {
                 $separator = "\r\n";
             } else {
                 $separator = "\n";
             }
         } else {
             $separator = urldecode($ending);
         }
         define('EZ_MAIL_LINE_SEPARATOR', $separator);
     }
 }
Beispiel #10
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();
             }
         }
     }
 }
Beispiel #11
0
 $meta = $ini->variable('SiteSettings', 'MetaDataArray');
 if (!isset($meta['description'])) {
     $metaDescription = "";
     if (isset($moduleResult['path']) and is_array($moduleResult['path'])) {
         foreach ($moduleResult['path'] as $pathPart) {
             if (isset($pathPart['text'])) {
                 $metaDescription .= $pathPart['text'] . " ";
             }
         }
     }
     $meta['description'] = $metaDescription;
 }
 $site['uri'] = $oldURI;
 $site['redirect'] = false;
 $site['meta'] = $meta;
 $site['version'] = eZPublishSDK::version();
 $site['page_title'] = $module->title();
 $tpl->setVariable("site", $site);
 if ($ini->variable('DebugSettings', 'DisplayDebugWarnings') == 'enabled') {
     // Make sure any errors or warnings are reported
     if (isset($GLOBALS['eZDebugError']) and $GLOBALS['eZDebugError']) {
         eZAppendWarningItem(array('error' => array('type' => 'error', 'number' => 1, 'count' => $GLOBALS['eZDebugErrorCount']), 'identifier' => 'ezdebug-first-error', 'text' => ezpI18n::tr('index.php', 'Some errors occurred, see debug for more information.')));
     }
     if (isset($GLOBALS['eZDebugWarning']) and $GLOBALS['eZDebugWarning']) {
         eZAppendWarningItem(array('error' => array('type' => 'warning', 'number' => 1, 'count' => $GLOBALS['eZDebugWarningCount']), 'identifier' => 'ezdebug-first-warning', 'text' => ezpI18n::tr('index.php', 'Some general warnings occured, see debug for more information.')));
     }
 }
 if ($userObjectRequired) {
     $currentUser = eZUser::currentUser();
     $tpl->setVariable("current_user", $currentUser);
     $tpl->setVariable("anonymous_user_id", $ini->variable('UserSettings', 'AnonymousUserID'));
Beispiel #12
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);
 /**
  * Note: this list will be "untrue" when some other php code has called eZPerfLogger::recordVale(),
  * as there will be more variables available. Shall we add 'custom' or '*' here?
  */
 public static function supportedVariables()
 {
     $out = array('execution_time' => 'float (seconds, rounded to 1msec)', 'mem_usage' => 'int (bytes, rounded to 1000)', 'output_size' => 'int (bytes)');
     /// @todo fix to run from eZ5 context
     if (eZPerfLoggerDebug::isDebugEnabled()) {
         $out['db_queries'] = 'int';
         $out['accumulators/*'] = 'float (seconds, rounded to 1msec)';
         $out['accumulators/*/count'] = 'int (number of times operation executed)';
     }
     if (extension_loaded('xhprof')) {
         $out['xhkprof_runs'] = 'string (csv list of identifiers)';
     }
     if (isset($_SERVER['UNIQUE_ID'])) {
         $out['unique_id'] = 'string (unique per-request identifier)';
     }
     /// @todo also take into account CP version numbers
     if (version_compare('4.7.0', eZPublishSDK::version()) >= 0) {
         $out['content/nodeid'] = 'int';
     }
     $out['_server/*'] = 'string (depending on the specific variable)';
     return $out;
 }
 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');
 }
 static function databaseVersion( $withRelease = true )
 {
     $db = eZDB::instance();
     $rows = $db->arrayQuery( "SELECT value as version FROM ezsite_data WHERE name='ezpublish-version'" );
     $version = false;
     if ( count( $rows ) > 0 )
     {
         $version = $rows[0]['version'];
         if ( $withRelease )
         {
             $release = eZPublishSDK::databaseRelease();
             $version .= '-' . $release;
         }
     }
     return $version;
 }
Beispiel #16
0
 static function checkFileNames()
 {
     self::initialize();
     $ini = eZINI::instance('site.ini');
     $activesiteaccesses = $ini->variable('SiteAccessSettings', 'AvailableSiteAccessList');
     // $i => $name
     // checks:
     $warnings = array();
     // look for files named .ini.append, .ini.php
     foreach (self::$userinis as $file) {
         if (preg_match('/\\.ini(\\.append|\\.php)$/', $file)) {
             $warnings[] = array("File has deprecated filename extension", $file, null, '');
         }
     }
     // look for extension/xxx/siteaccess/yyy/zzz files, with yyy siteaccess not existing
     foreach (self::$userinis as $file) {
         if (preg_match('#/siteaccess/([^/]+)/.+#', $file, $matches)) {
             if ($matches[1] != 'setup' && $matches[1] != 'admin' && !in_array($matches[1], $activesiteaccesses)) {
                 $warnings[] = array("File is for an inactive siteaccess {$matches[1]}", $file, null, '');
             }
         }
     }
     // starting with version 4.4, it is not necessary to have exactly one .ini
     // file (and optionally many .ini.append.php)
     if (version_compare('4.4', eZPublishSDK::version()) <= 0) {
         // .ini files in extensions that have same name as std files, no .ini (master) file for new ones
         $newinis = array();
         $changedinis = array();
         foreach (self::$userinis as $file) {
             $ini = preg_replace('/\\.append$/', '', preg_replace('/\\.php/', '', basename($file)));
             if (in_array($ini, self::$originalinis)) {
                 $changedinis[$ini][] = $file;
             } else {
                 $newinis[$ini][] = $file;
             }
         }
         foreach ($changedinis as $ini) {
             foreach ($ini as $file) {
                 if (preg_match('#\\.ini$#', $file)) {
                     $warnings[] = array("File should be renamed to .ini.append.php", $file, null, '');
                 }
             }
         }
         foreach ($newinis as $ininame => $inis) {
             $orig = 0;
             foreach ($inis as $file) {
                 if (preg_match('#\\.ini$#', $file)) {
                     $orig++;
                 }
             }
             if ($orig != 1) {
                 if ($orig == 0) {
                     $warnings[] = array("There should be one {$ininame} file with a .ini extension. Found: " . implode($inis, ', '), '', null, '');
                 } else {
                     $warnings[] = array("There should be only one {$ininame} file with a .ini extension. Found: " . implode($inis, ', '), '', null, '');
                 }
             }
         }
     }
     return $warnings;
 }
Beispiel #17
0
  Returns array with replacements
*/
function strReplaceByArray($searches = array(), $subjects = array())
{
    $retArray = array();
    foreach ($subjects as $key => $subject) {
        if (is_array($subject)) {
            $retArray[$key] = strReplaceByArray($searches, $subject);
        } else {
            $retArray[$key] = str_replace(array_keys($searches), $searches, $subject);
        }
    }
    return $retArray;
}
$ezinfo = eZPublishSDK::version(true);
$whatIsEzPublish = 'eZ Publish is a professional PHP application framework with advanced
CMS (content management system) functionality. As a CMS its most notable
featureis its revolutionary, fully customizable and extendable content
model. Thisis also what makes eZ Publish suitable as a platform for
general PHP  development,allowing you to rapidly create professional
web-based applications.

Standard CMS functionality (such as news publishing, e-commerce and
forums) are already implemented and ready to use. Standalone libraries
can be used for cross-platform database-independent browser-neutral
PHP projects. Because eZ Publish is a web-based application, it can
be accessed from anywhere you have an internet connection.';
$license = 'This copy of eZ Publish is distributed under the terms and conditions of
the GNU General Public License (GPL). Briefly summarized, the GPL gives
you the right to use, modify and share this copy of eZ Publish. If you
Beispiel #18
0
    }
}
$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);
        }
 function fetchDatabaseRelease()
 {
     return array('result' => eZPublishSDK::databaseRelease());
 }
    /**
     * @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' );
    }
Beispiel #21
0
        $script->shutdown(1);
    }
    $params = array('use_defaults' => false, 'server' => $dbHost, 'user' => $dbUser, 'socket' => $dbSocket, 'password' => $dbPassword, 'database' => $dbName);
    $db = eZDB::instance($dbType, $params, true);
    if (!$db->isConnected()) {
        $str = "Failed to connect to database: {$dbType}://{$dbUser}@{$dbHost}";
        $cli->error($str);
        $script->shutdown(1);
    }
    eZDB::setInstance($db);
    // Only continue if the database is using the same version as the PHP code
    $rows = $db->arrayQuery("SELECT * FROM ezsite_data WHERE name = 'ezpublish-version'");
    if (count($rows) > 0) {
        $version = $rows[0]['value'];
        if (version_compare($version, eZPublishSDK::version()) != 0) {
            $cli->error("Version '{$version}' in database '{$dbName}' is different from the running version " . eZPublishSDK::version());
            $script->shutdown(1);
        }
    }
}
$script->setUser($userLogin, $userPassword);
$script->initialize();
$alreadyCreated = false;
$createdPackages = array();
foreach ($commandList as $commandItem) {
    $command = $commandItem['command'];
    if ($command == 'list') {
        $fetchParameters = array();
        if ($repositoryID) {
            $fetchParameters['repository_id'] = $repositoryID;
            $cli->output("The list of packages in the repository " . $cli->stylize('dir', $fetchParameters['repository_id']) . ":");
function templateOperatorDownload($tpl, &$persistentData, $stepData)
{
    $singleOperator = $persistentData['single-operator'];
    $useInput = $persistentData['use-input'];
    $useOutput = $persistentData['use-output'];
    $parameterCheck = $persistentData['parameter-check'];
    $useInput = true;
    $useOutput = false;
    $parameterCheck = 2;
    $operatorName = $persistentData['name'];
    $className = $persistentData['class-name'];
    if (!$className) {
        $fullClassName = 'Template' . strtoupper($operatorName[0]) . substr($operatorName, 1) . 'Operator';
    } else {
        $fullClassName = $className;
    }
    $filename = strtolower($fullClassName) . '.php';
    $description = $persistentData['description'];
    $creator = $persistentData['creator-name'];
    $example = $persistentData['example-code'];
    $brief = '';
    $full = '';
    $lines = explode("\n", $description);
    if (count($lines) > 0) {
        $brief = $lines[0];
        $full = implode("\n", array_slice($lines, 1));
    }
    $tpl->setVariable('full_class_name', $fullClassName);
    $tpl->setVariable('class_name', $className);
    $tpl->setVariable('file_name', $filename);
    $tpl->setVariable('operator_name', $operatorName);
    $tpl->setVariable('example_code', $example);
    $tpl->setVariable('creator_name', $creator);
    $tpl->setVariable('description_brief', $brief);
    $tpl->setVariable('description_full', $full);
    $tpl->setVariable('single_operator', $singleOperator);
    $tpl->setVariable('use_input', $useInput);
    $tpl->setVariable('use_output', $useOutput);
    $tpl->setVariable('parameter_check', $parameterCheck);
    $content = $tpl->fetch('design:setup/templateoperator_code.tpl');
    $contentLength = strlen($content);
    $mimeType = 'application/octet-stream';
    $version = eZPublishSDK::version();
    header("Pragma: ");
    header("Cache-Control: ");
    header("Content-Length: {$contentLength}");
    header("Content-Type: {$mimeType}");
    header("X-Powered-By: eZ Publish {$version}");
    header("Content-Disposition: attachment; filename={$filename}");
    header("Content-Transfer-Encoding: binary");
    ob_end_clean();
    print $content;
    fflush();
    eZExecution::cleanExit();
}
Beispiel #23
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();
     }
 }
Beispiel #24
0
                                    $view = array_merge( array( 'params' => array(), 'functions' => array(), 'unordered_params' => array(), 'single_post_actions' => array(), 'post_actions' => array(), 'post_action_parameters' => array() ), $view );
                                    $operationList[$viewname . '_' . $modulename] = $view;
                                    $operationList[$viewname . '_' . $modulename]['name'] = $viewname;
                                    $operationList[$viewname . '_' . $modulename]['module'] = $modulename;
                                    $operationList[$viewname . '_' . $modulename]['extension'] = $extension;
                                    // merge all post parameters stuff
                                    $post_params = array_merge( $view['post_actions'], array_keys( $view['single_post_actions'] ) );
                                    foreach( $view['post_action_parameters'] as $key => $params )
                                    {
                                        $post_params = array_merge( $post_params, array_keys( $params ) );
                                    }
                                    sort( $post_params );
                                    $operationList[$viewname . '_' . $modulename]['post_params'] = array_unique( $post_params );
                                }*/
            }
        }
    }
    ksort($operationList);
}
$title = 'List of available operations';
if ($Params['modulename'] != '') {
    $title .= ' in module "' . $Params['modulename'] . '"';
    $extra_path = $Params['modulename'];
}
$ezgeshi_available = sysInfoTools::ezgeshiAvailable();
$tpl->setVariable('title', $title);
$tpl->setVariable('operationlist', $operationList);
$tpl->setVariable('sdkversion', eZPublishSDK::version());
$tpl->setVariable('ezgeshi_available', $ezgeshi_available);
$tpl->setVariable('source_available', sysInfoTools::sourceCodeAvailable(eZPublishSDK::version()));
 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;
 }
 /**
  * Execution point for controller actions
  */
 public function run()
 {
     ob_start();
     $this->requestInit();
     // send header information
     foreach (eZHTTPHeader::headerOverrideArray($this->uri) + array('Expires' => 'Mon, 26 Jul 1997 05:00:00 GMT', 'Last-Modified' => gmdate('D, d M Y H:i:s') . ' GMT', 'Cache-Control' => 'no-cache, must-revalidate', 'Pragma' => 'no-cache', 'X-Powered-By' => 'eZ Publish', 'Content-Type' => 'text/html; charset=' . $this->httpCharset, 'Served-by' => $_SERVER["SERVER_NAME"], 'Content-language' => $this->languageCode) as $key => $value) {
         header($key . ': ' . $value);
     }
     try {
         $moduleResult = $this->dispatchLoop();
     } catch (Exception $e) {
         $this->shutdown();
         throw $e;
     }
     $ini = eZINI::instance();
     /**
      * Ouput an is_logged_in cookie when users are logged in for use by http cache solutions.
      *
      * @deprecated As of 4.5, since 4.4 added lazy session support (init on use)
      */
     if ($ini->variable("SiteAccessSettings", "CheckValidity") !== 'true') {
         $currentUser = eZUser::currentUser();
         $wwwDir = eZSys::wwwDir();
         // On host based site accesses this can be empty, causing the cookie to be set for the current dir,
         // but we want it to be set for the whole eZ publish site
         $cookiePath = $wwwDir != '' ? $wwwDir : '/';
         if ($currentUser->isLoggedIn()) {
             // Only set the cookie if it doesnt exist. This way we are not constantly sending the set request in the headers.
             if (!isset($_COOKIE['is_logged_in']) || $_COOKIE['is_logged_in'] !== 'true') {
                 setcookie('is_logged_in', 'true', 0, $cookiePath);
             }
         } else {
             if (isset($_COOKIE['is_logged_in'])) {
                 setcookie('is_logged_in', false, 0, $cookiePath);
             }
         }
     }
     if ($this->module->exitStatus() == eZModule::STATUS_REDIRECT) {
         $this->redirect();
     }
     // Store the last URI for access history for login redirection
     // Only if user has session and only if there was no error or no redirects happen
     if (eZSession::hasStarted() && $this->module->exitStatus() == eZModule::STATUS_OK) {
         $currentURI = $this->completeRequestedURI;
         if (strlen($currentURI) > 0 && $currentURI[0] !== '/') {
             $currentURI = '/' . $currentURI;
         }
         $lastAccessedURI = "";
         $lastAccessedViewURI = "";
         $http = eZHTTPTool::instance();
         // Fetched stored session variables
         if ($http->hasSessionVariable("LastAccessesURI")) {
             $lastAccessedViewURI = $http->sessionVariable("LastAccessesURI");
         }
         if ($http->hasSessionVariable("LastAccessedModifyingURI")) {
             $lastAccessedURI = $http->sessionVariable("LastAccessedModifyingURI");
         }
         // Update last accessed view page
         if ($currentURI != $lastAccessedViewURI && !in_array($this->module->uiContextName(), array('edit', 'administration', 'browse', 'authentication'))) {
             $http->setSessionVariable("LastAccessesURI", $currentURI);
         }
         // Update last accessed non-view page
         if ($currentURI != $lastAccessedURI) {
             $http->setSessionVariable("LastAccessedModifyingURI", $currentURI);
         }
     }
     eZDebug::addTimingPoint("Module end '" . $this->module->attribute('name') . "'");
     if (!is_array($moduleResult)) {
         eZDebug::writeError('Module did not return proper result: ' . $this->module->attribute('name'), 'index.php');
         $moduleResult = array();
         $moduleResult['content'] = false;
     }
     if (!isset($moduleResult['ui_context'])) {
         $moduleResult['ui_context'] = $this->module->uiContextName();
     }
     $moduleResult['ui_component'] = $this->module->uiComponentName();
     $moduleResult['is_mobile_device'] = $this->mobileDeviceDetect->isMobileDevice();
     $moduleResult['mobile_device_alias'] = $this->mobileDeviceDetect->getUserAgentAlias();
     $templateResult = null;
     eZDebug::setUseExternalCSS($this->siteBasics['external-css']);
     if ($this->siteBasics['show-page-layout']) {
         $tpl = eZTemplate::factory();
         if ($tpl->hasVariable('node')) {
             $tpl->unsetVariable('node');
         }
         if (!isset($moduleResult['path'])) {
             $moduleResult['path'] = false;
         }
         $moduleResult['uri'] = eZSys::requestURI();
         $tpl->setVariable("module_result", $moduleResult);
         $meta = $ini->variable('SiteSettings', 'MetaDataArray');
         if (!isset($meta['description'])) {
             $metaDescription = "";
             if (isset($moduleResult['path']) && is_array($moduleResult['path'])) {
                 foreach ($moduleResult['path'] as $pathPart) {
                     if (isset($pathPart['text'])) {
                         $metaDescription .= $pathPart['text'] . " ";
                     }
                 }
             }
             $meta['description'] = $metaDescription;
         }
         $this->site['uri'] = $this->oldURI;
         $this->site['redirect'] = false;
         $this->site['meta'] = $meta;
         $this->site['version'] = eZPublishSDK::version();
         $this->site['page_title'] = $this->module->title();
         $tpl->setVariable("site", $this->site);
         if ($ini->variable('DebugSettings', 'DisplayDebugWarnings') === 'enabled') {
             // Make sure any errors or warnings are reported
             if (isset($GLOBALS['eZDebugError']) && $GLOBALS['eZDebugError']) {
                 eZAppendWarningItem(array('error' => array('type' => 'error', 'number' => 1, 'count' => $GLOBALS['eZDebugErrorCount']), 'identifier' => 'ezdebug-first-error', 'text' => ezpI18n::tr('index.php', 'Some errors occurred, see debug for more information.')));
             }
             if (isset($GLOBALS['eZDebugWarning']) && $GLOBALS['eZDebugWarning']) {
                 eZAppendWarningItem(array('error' => array('type' => 'warning', 'number' => 1, 'count' => $GLOBALS['eZDebugWarningCount']), 'identifier' => 'ezdebug-first-warning', 'text' => ezpI18n::tr('index.php', 'Some general warnings occured, see debug for more information.')));
             }
         }
         if ($this->siteBasics['user-object-required']) {
             $currentUser = eZUser::currentUser();
             $tpl->setVariable("current_user", $currentUser);
             $tpl->setVariable("anonymous_user_id", $ini->variable('UserSettings', 'AnonymousUserID'));
         } else {
             $tpl->setVariable("current_user", false);
             $tpl->setVariable("anonymous_user_id", false);
         }
         $tpl->setVariable("access_type", $this->access);
         $tpl->setVariable('warning_list', !empty($this->warningList) ? $this->warningList : false);
         $resource = "design:";
         if (is_string($this->siteBasics['show-page-layout'])) {
             if (strpos($this->siteBasics['show-page-layout'], ":") !== false) {
                 $resource = "";
             }
         } else {
             $this->siteBasics['show-page-layout'] = "pagelayout.tpl";
         }
         // Set the navigation part
         // Check for navigation part settings
         $navigationPartString = 'ezcontentnavigationpart';
         if (isset($moduleResult['navigation_part'])) {
             $navigationPartString = $moduleResult['navigation_part'];
             // Fetch the navigation part
         }
         $navigationPart = eZNavigationPart::fetchPartByIdentifier($navigationPartString);
         $tpl->setVariable('navigation_part', $navigationPart);
         $tpl->setVariable('uri_string', $this->uri->uriString());
         if (isset($moduleResult['requested_uri_string'])) {
             $tpl->setVariable('requested_uri_string', $moduleResult['requested_uri_string']);
         } else {
             $tpl->setVariable('requested_uri_string', $this->actualRequestedURI);
         }
         // Set UI context and component
         $tpl->setVariable('ui_context', $moduleResult['ui_context']);
         $tpl->setVariable('ui_component', $moduleResult['ui_component']);
         $templateResult = $tpl->fetch($resource . $this->siteBasics['show-page-layout']);
     } else {
         $templateResult = $moduleResult['content'];
     }
     eZDebug::addTimingPoint("Script end");
     $content = trim(ob_get_clean());
     ob_start();
     eZDB::checkTransactionCounter();
     eZDisplayResult($templateResult);
     $content .= ob_get_clean();
     $this->shutdown();
     return new ezpKernelResult($content);
 }
Beispiel #27
0
        $phpAcceleratorInfo = array('name' => $info->phpAccelerator->name, 'url' => $info->phpAccelerator->url, 'enabled' => $info->phpAccelerator->isEnabled, 'version_integer' => $info->phpAccelerator->versionInt, 'version_string' => $info->phpAccelerator->versionString);
    } else {
        $phpAcceleratorInfo = array();
    }
} else {
    $systemInfo = array('cpu_type' => '', 'cpu_speed' => '', 'cpu_count' => '', 'memory_size' => '');
    $phpAcceleratorInfo = array();
}
$webserverInfo = false;
if (function_exists('apache_get_version')) {
    $webserverInfo = array('name' => 'Apache', 'modules' => false, 'version' => apache_get_version());
    if (function_exists('apache_get_modules')) {
        $webserverInfo['modules'] = apache_get_modules();
    }
}
$tpl->setVariable('ezpublish_version', eZPublishSDK::version() . " (" . eZPublishSDK::alias() . ")");
$tpl->setVariable('ezpublish_extensions', eZExtension::activeExtensions());
$tpl->setVariable('php_version', phpversion());
$tpl->setVariable('php_accelerator', $phpAcceleratorInfo);
$tpl->setVariable('webserver_info', $webserverInfo);
$tpl->setVariable('database_info', $db->databaseName());
$tpl->setVariable('database_charset', $db->charset());
$tpl->setVariable('database_object', $db);
$tpl->setVariable('php_loaded_extensions', get_loaded_extensions());
$tpl->setVariable('autoload_functions', spl_autoload_functions());
// Workaround until ezcTemplate
// The new system info class uses properties instead of attributes, so the
// values are not immediately available in the old template engine.
$tpl->setVariable('system_info', $systemInfo);
$phpINI = array();
foreach (array('safe_mode', 'register_globals', 'file_uploads') as $iniName) {
    $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 ) // if processing post data of current step failed, use same class object.
        {
Beispiel #29
0
function datatypeDownload($tpl, &$persistentData, $stepData)
{
    $datatypeName = $persistentData['name'];
    $classInput = $persistentData['class-input'];
    $descName = $persistentData['desc-name'];
    $className = $persistentData['class-name'];
    $constantName = $persistentData['constant-name'];
    $creator = $persistentData['creator-name'];
    $description = $persistentData['description'];
    $datatypeName = $persistentData['datatype-name'];
    $filename = strtolower($className) . '.php';
    $brief = '';
    $full = '';
    $lines = explode("\n", $description);
    if (count($lines) > 0) {
        $brief = $lines[0];
        $full = implode("\n", array_slice($lines, 1));
    }
    $tpl->setVariable('full_class_name', $className);
    $tpl->setVariable('constant_name', $constantName);
    $tpl->setVariable('datatype_name', $datatypeName);
    $tpl->setVariable('desc_name', $descName);
    $tpl->setVariable('file_name', $filename);
    $tpl->setVariable('creator_name', $creator);
    $tpl->setVariable('description_brief', $brief);
    $tpl->setVariable('description_full', $full);
    $tpl->setVariable('class_input', $classInput);
    $content = $tpl->fetch('design:setup/datatype_code.tpl');
    $contentLength = strlen($content);
    $mimeType = 'application/octet-stream';
    $version = eZPublishSDK::version();
    header("Pragma: ");
    header("Cache-Control: ");
    header("Content-Length: {$contentLength}");
    header("Content-Type: {$mimeType}");
    header("X-Powered-By: eZ Publish {$version}");
    header("Content-Disposition: attachment; filename={$filename}");
    header("Content-Transfer-Encoding: binary");
    ob_end_clean();
    print $content;
    flush();
    eZExecution::cleanExit();
}
Beispiel #30
0
 function validateVersion()
 {
     $versionValidated = false;
     $ezversion = eZPublishSDK::version();
     if ($this->MinVersion !== false) {
         if ($this->MaxVersion !== false) {
             if (version_compare($this->MinVersion, $ezversion, 'le') && version_compare($this->MaxVersion, $ezversion, 'ge')) {
                 return true;
             }
             return false;
         }
         if (version_compare($this->MinVersion, $ezversion, 'le')) {
             return true;
         }
         return false;
     } else {
         if (version_compare($this->MaxVersion, $ezversion, 'ge')) {
             return true;
         }
         return false;
     }
 }