/**
     * @param eZINI $importINI
     * @return void
     */
    public static function init(eZINI $importINI)
    {
        $extDir = eZSys::rootDir() . '/extension/';

        //Get generated mapping config file
        $jsonFile     = $extDir . $importINI->variable('XMLImportSettings', 'MappingConfigGeneratedFile');
        $jsonString   = file_get_contents($jsonFile);
        $mapGenerated = json_decode($jsonString, true);

        //Get fixed mapping config file
        $jsonFile   = $extDir . $importINI->variable('XMLImportSettings', 'MappingConfigFixedFile');
        $jsonString = file_get_contents($jsonFile);
        $mapFixed   = json_decode($jsonString, true);

        //Merge both file
        self::$mapping = $mapGenerated + $mapFixed;
    }
Example #2
0
function eZSetupTestDirectoryPermissions($type)
{
    $dirList = eZSetupConfigVariableArray($type, 'CheckList');
    $ini = eZINI::instance();
    $dirPermission = $ini->variable('FileSettings', 'StorageDirPermissions');
    $result = true;
    $resultElements = array();
    $resultElementsByErrorCode = array();
    $rootDir = eZSys::rootDir();
    $dirPermOctal = octdec($dirPermission);
    foreach ($dirList as $dir) {
        if (empty($dir)) {
            continue;
        }
        $resultElement = array();
        $resultElement['file'] = $dir;
        $resultElement['result'] = 1;
        // ok by default
        $resultElement['permission'] = false;
        $dir = eZDir::cleanPath($dir);
        if (!file_exists($dir)) {
            // if directory does not exist then try to create it
            if (empty($rootDir)) {
                $dirPath = './' . $dir;
            } else {
                $dirPath = $rootDir . '/' . $dir;
            }
            $res = eZDir::mkdir($dirPath, $dirPermOctal);
            if ($res) {
                $resultElement['permission'] = $dirPermission;
                $resultElement['result'] = 1;
            } else {
                $result = false;
                $resultElement['result'] = 2;
                // unable to create unexistent dir
            }
        } else {
            if (is_dir($dir)) {
                $resultElement['permission'] = $dirPermission;
                if (!eZSetupPrvtAreDirAndFilesWritable($dir)) {
                    $result = false;
                    $resultElement['result'] = 3;
                    // dir has wrong permissions
                }
            } else {
                if (is_file($dir)) {
                    $result = false;
                    $resultElement['result'] = 4;
                    // dir exists but it is a file
                }
            }
        }
        $resultElements[] = $resultElement;
        $resultElementsByErrorCode[$resultElement['result']][] = $resultElement;
    }
    $safeMode = ini_get('safe_mode') != 0;
    $userInfo = eZSetupPrvPosixExtension();
    return array('result' => $result, 'safe_mode' => $safeMode, 'user_info' => $userInfo, 'persistent_data' => array('result' => array('value' => $result)), 'current_path' => realpath('.'), 'result_elements' => $resultElements, 'result_elements_by_error_code' => $resultElementsByErrorCode);
}
 /**
  * Absolute path to the current image editor work folder
  *
  * @return string
  */
 public function getAbsoluteWorkingFolder()
 {
     return eZSys::rootDir() . "/" . $this->working_folder;
 }
Example #4
0
$attributeID = (int) $Params['attribute_id'];
$version = (int) $Params['version'];
// Check for permissions
$contentObject = eZContentObject::fetch($objectId);
if (!$contentObject instanceof eZContentObject || !$contentObject->canEdit(false, false, false, $editLanguage)) {
    die('// @todo fixme :)');
}
// retrieve the original image path
$img = eZContentObjectAttribute::fetch($attributeID, $version)->attribute('content');
$image_path = $img->attributeFromOriginal('url');
$absolute_image_path = eZSys::rootDir() . "/{$image_path}";
// Creation of the editing arborescence
// /{cache folder}/public/ezie/user_id/image_id-version_id
$user = eZUser::instance();
$working_folder_path = eZSys::cacheDirectory() . '/public/ezie/' . $user->id() . "/{$attributeID}-{$version}";
$working_folder_absolute_path = eZSys::rootDir() . "/{$working_folder_path}";
$handler = eZClusterFileHandler::instance();
if (!$handler->fileExists($working_folder_absolute_path)) {
    // @todo DB Based handlers have no knowledge of folders !
    $res = eZDir::mkdir($working_folder_absolute_path, false, true);
}
// Copy the original file in the temp directory
// $work_folder/{history_id}-{file_name}
// (thumb: $working_folder/thumb_{history_id}-{file_name}
$file = "0-" . basename($image_path);
$thumb = "thumb-{$file}";
// @todo Manage possible errors
$handler->fileCopy($image_path, "{$working_folder_path}/{$file}");
// Creation of a thumbnail
eZIEImageToolResize::doThumb("{$working_folder_path}/{$file}", "{$working_folder_path}/{$thumb}");
// retrieve image dimensions
Example #5
0
    /**
     * Removes a directory and all it's contents, recursively.
     *
     * @param string $dir Directory to remove
     * @param bool $rootCheck Check whether $dir is supposed to be contained in
     *                        eZ Publish root directory
     * @return bool True if the operation succeeded, false otherwise
     */
    static function recursiveDelete( $dir, $rootCheck = true )
    {
        // RecursiveDelete fails if ...
        // $dir is not a directory
        if ( !is_dir( $dir ) )
            return false;

        // rootCheck is enabled and $dir is not part of the root directory
        if ( $rootCheck && strpos( dirname( realpath( $dir ) ) . DIRECTORY_SEPARATOR, realpath( eZSys::rootDir() ) . DIRECTORY_SEPARATOR ) === false )
            return false;

        // the directory cannot be opened
        if ( ! ( $handle = @opendir( $dir ) ) )
            return false;

        while ( ( $file = readdir( $handle ) ) !== false )
        {
            if ( ( $file == "." ) || ( $file == ".." ) )
            {
                continue;
            }
            if ( is_dir( $dir . '/' . $file ) )
            {
                eZDir::recursiveDelete( $dir . '/' . $file, false );
            }
            else
            {
                unlink( $dir . '/' . $file );
            }
        }
        @closedir( $handle );
        return rmdir( $dir );
    }
    /**
     * Main method to process current row returned by getNextRow() method.
     * You may throw an exception if something goes wrong. It will be logged but won't break the import process
     * @param array $row Depending on your data format, can be DOMNode, SimpleXMLIterator, SimpleXMLElement, CSV row...
     * @throws Exception
     * @return void
     */
    public function process( $row )
    {
        $rootImport     = $this->importINI->variable( 'XMLImportSettings', 'RootImport' );
        $publisherInfos = $this->fileHandler->getPublisherInfosFromFolderName( $row['publisher'] );
        if ( empty( $publisherInfos['default_language'] ) ) {
            $publisherInfos['default_language'] = 'eng-GB';
        }
        $filePath       = eZSys::rootDir() . "/$rootImport/{$this->fileHandler->rootImportFolder}/{$publisherInfos['path']}/{$row['file']}";

        XMLImportMonitor::initFile( $row['file'], $publisherInfos['path'], $publisherInfos['id'], md5_file($filePath) );

        try
        {
            if ( empty( $row['file'] ) || empty( $publisherInfos['path'] ) )
                return;

            try
            {
                $xmlOptions = new SQLIXMLOptions( array(
                    'xml_path'   => $filePath,
                    'xml_parser' => 'dom'
                ) );

                $sqliXmlParser   = new SQLIXMLParser( $xmlOptions );
                $this->xmlParser = $sqliXmlParser->parse();
            }
            catch ( SQLIXMLException $e )
            {
                $this->triggerException( $row['file'], $publisherInfos['path'], $e, 4 );
            }

            $xslProcess = XMLImportMapping::getByFieldName('xsl_process', $publisherInfos['path']);

            if ( $xslProcess !== false )
            {
                if ( !isset($this->xmlTransformers[$publisherInfos['path']]) )
                {
                    try
                    {
                        $xslFolder   = $this->importINI->variable('XMLImportSettings', 'XSLTFolder');
                        $xmslOptions = new SQLIXMLOptions( array(
                            'xml_path'   => eZSys::rootDir() . '/extension/' . $xslFolder . '/' . $xslProcess,
                            'xml_parser' => 'dom'
                        ) );

                        $sqliXmlTransformer           = new SQLIXMLParser( $xmslOptions );
                        $path                         = $publisherInfos['path'];
                        $this->xmlTransformers[$path] = $sqliXmlTransformer->parse();
                    }
                    catch ( SQLIXMLException $e )
                    {
                        $this->triggerException( $row['file'], $publisherInfos['path'], $e, 4 );
                    }
                }

                // Configure the transformer
                $proc = new XSLTProcessor;
                $proc->importStyleSheet($this->xmlTransformers[$publisherInfos['path']]);
                $this->xmlParser = $proc->transformToDoc($this->xmlParser);
            }

            try
            {
                $xmlFieldBuilder = new XMLFieldBuilder( $this->xmlParser, $this->importINI );
            }
            catch ( RootNodeException $e )
            {
                $this->triggerException( $row['file'], $publisherInfos['path'], $e, 4 );
            }

            try
            {
                $xmlFieldMixer = new XMLFieldMixer( $xmlFieldBuilder, $this->xmlParser, $this->importINI, $publisherInfos, $this->rootImportFolder );
                $fieldArray    = $xmlFieldMixer->process();
            }
            catch ( MandatoryException $e )
            {
                $this->triggerException( $row['file'], $publisherInfos['path'], $e, 3 );
            }
            try
            {
                XMLImportDataHandler::updateMdd( $fieldArray );
            }
            catch ( XMLImportDBException $e )
            {
                XMLImportDB::rollbackQuery();

                $e = new Exception( $e->getMessage() . "\n" . 'SQL action failed - Transaction will be rollbacked - Error Message : ' . XMLImportDB::getErrorMessage() );

                $this->triggerException( $row['file'], $publisherInfos['path'], $e, 5 );
            }

            //Archive XML and blobed files
            $this->fileHandler->archiveFiles( $publisherInfos['path'], $row['file'], $xmlFieldMixer->blobedFiles );

        }
        catch ( Exception $e )
        {
            XMLImportMonitor::commitFile();
            throw $e;
        }

        $this->fileHandler->dataSourcesCompleted++;

        XMLImportMonitor::commitFile();
    }
Example #7
0
 /**
  * Removes a directory and all it's contents, recursively.
  *
  * @param string $dir Directory to remove
  * @param bool $rootCheck Check whether $dir is supposed to be contained in
  *                        eZ Publish root directory
  * @return bool True if the operation succeeded, false otherwise
  */
 static function recursiveDelete($dir, $rootCheck = true)
 {
     // RecursiveDelete fails if ...
     // $dir is not a directory
     if (!is_dir($dir)) {
         eZDebug::writeError("The path: {$dir} is not a folder", __METHOD__);
         return false;
     }
     if ($rootCheck) {
         // rootCheck is enabled, check if $dir is part of authorized directories
         $allowedDirs = eZINI::instance()->variable('FileSettings', 'AllowedDeletionDirs');
         // Also adding eZ Publish root dir.
         $rootDir = eZSys::rootDir() . DIRECTORY_SEPARATOR;
         array_unshift($allowedDirs, $rootDir);
         $dirRealPath = dirname(realpath($dir)) . DIRECTORY_SEPARATOR;
         $canDelete = false;
         foreach ($allowedDirs as $allowedDir) {
             if (strpos($dirRealPath, realpath($allowedDir)) === 0) {
                 $canDelete = true;
                 break;
             }
         }
         if (!$canDelete) {
             eZDebug::writeError("Recursive delete denied for '{$dir}' as its realpath '{$dirRealPath}' is outside eZ Publish root and not registered in AllowedDeletionDirs.");
             return false;
         }
     }
     // the directory cannot be opened
     if (!($handle = @opendir($dir))) {
         eZDebug::writeError("Cannot access folder:" . dirname($dir), __METHOD__);
         return false;
     }
     while (($file = readdir($handle)) !== false) {
         if ($file == "." || $file == "..") {
             continue;
         }
         if (is_dir($dir . '/' . $file)) {
             eZDir::recursiveDelete($dir . '/' . $file, false);
         } else {
             unlink($dir . '/' . $file);
         }
     }
     @closedir($handle);
     return rmdir($dir);
 }
Example #8
0
 private function internalClear($purge, $cacheEntries, $name, $purgeSleep = null, $purgeMax = null, $purgeExpiry = null)
 {
     $this->cli->output(($purge ? 'Purging ' : 'Clearing ') . $this->cli->stylize('emphasize', $name ? $name : 'All cache') . ': ');
     $warnPaths = array();
     foreach ($cacheEntries as $cacheEntry) {
         $absPath = realpath(eZSys::cacheDirectory() . DIRECTORY_SEPARATOR . $cacheEntry['path']);
         $absPathElementCount = count(explode(DIRECTORY_SEPARATOR, rtrim($absPath, DIRECTORY_SEPARATOR)));
         // Refuse to delete root directory ('/' or 'C:\')
         // 2 => since one path element ('/foo') produces two exploded elements
         if ($absPath && $absPathElementCount < 2) {
             $this->cli->error('Refusing to delete root directory! Please check your cache settings. Path: ' . $absPath);
             $this->script->shutdown(1);
             exit;
         }
         // Warn if the cache entry is not function based, and the path is outside ezp root, and the path has less than 2 elements
         if ($absPath && (!$purge || !isset($cacheEntry['purge-function'])) && !isset($cacheEntry['function']) && $absPathElementCount < 3 && strpos(dirname($absPath) . DIRECTORY_SEPARATOR, realpath(eZSys::rootDir()) . DIRECTORY_SEPARATOR) === false) {
             $warnPaths[] = $absPath;
         }
     }
     if (!empty($warnPaths)) {
         $this->cli->warning('The following cache paths are outside of the eZ Publish root directory, and have less than 2 path elements. ' . 'Are you sure you want to ' . ($purge ? 'purge' : 'clear') . ' them?');
         foreach ($warnPaths as $warnPath) {
             $this->cli->output($warnPath);
         }
         if (function_exists("getUserInput")) {
             $input = getUserInput(($purge ? 'Purge' : 'Clear') . '? yes/no:', array('yes', 'no'));
         } else {
             $validInput = false;
             $readlineExists = function_exists("readline");
             while (!$validInput) {
                 if ($readlineExists) {
                     $input = readline($query);
                 } else {
                     echo $prompt . ' ';
                     $input = trim(fgets(STDIN));
                 }
                 if ($acceptValues === false || in_array($input, $acceptValues)) {
                     $validInput = true;
                 }
             }
         }
         if ($input === 'no') {
             $this->script->shutdown();
             exit;
         }
     }
     $firstItem = true;
     foreach ($cacheEntries as $cacheEntry) {
         if ($firstItem) {
             $firstItem = false;
         } else {
             $this->cli->output(', ', false);
         }
         $this->cli->output($this->cli->stylize('emphasize', $cacheEntry['name']), false);
         if ($purge) {
             eZCache::clearItem($cacheEntry, true, array($this, 'reportProgress'), $purgeSleep, $purgeMax, $purgeExpiry);
         } else {
             eZCache::clearItem($cacheEntry);
         }
     }
     $this->cli->output();
 }
    /**
     * Called by PHPUnit before each test.
     */
    public function setUp()
    {
        // Call the setUp() in ezpDatabaseTestCase
        parent::setUp();

        // Set these to your own values
        // @todo get these values automatically from somewhere (how to get the password?)
        $GLOBALS['ezc_webdav_username'] = '******';
        $GLOBALS['ezc_webdav_password'] = '******';
        $GLOBALS['ezc_webdav_host'] = 'webdav.ezp';

        // A compound value from the above
        $GLOBALS['ezc_webdav_url'] = 'http://' . $GLOBALS['ezc_webdav_host'] . '/';

        // Set some server variables (not all of them are needed)
        $_SERVER['HTTP_USER_AGENT'] = 'cadaver/0.22.5 neon/0.26.3';
        $_SERVER['SERVER_NAME'] = $GLOBALS['ezc_webdav_host'];
        $_SERVER['SERVER_PORT'] = '80';

        // Set to null various variables used in the tests
        $GLOBALS['ezc_response_body'] = null;
        $GLOBALS['ezc_post_body'] = null;
        $GLOBALS['ezc_webdav_testfolder'] = null;
        $GLOBALS['ezc_webdav_testfolderobject'] = null;
        $GLOBALS['ezc_webdav_testfolderid'] = null;

        // Not sure if these 2 values are needed
        $_SERVER['SCRIPT_FILENAME'] = eZSys::rootDir() . DIRECTORY_SEPARATOR . 'index.php';
        $_SERVER['DOCUMENT_ROOT'] = eZSys::rootDir();

        $GLOBALS['ezc_siteaccess'] = strtolower( __CLASS__ );
    }
Example #10
0
function checkPaths( $cacheEntries, $purge )
{
    global $cli, $script;

    $warnPaths = array();
    foreach ( $cacheEntries as $cacheEntry )
    {
        $absPath = realpath( eZSys::cacheDirectory() . DIRECTORY_SEPARATOR . $cacheEntry['path'] );
        $absPathElementCount = count( explode( DIRECTORY_SEPARATOR, rtrim( $absPath, DIRECTORY_SEPARATOR ) ) );
        // Refuse to delete root directory ('/' or 'C:\')
        if ( $absPath &&
             $absPathElementCount < 2 ) // 2, since one path element ('/foo') produces two exploded elements
        {
            $cli->error( 'Refusing to delete root directory! Please check your cache settings. Path: ' . $absPath );
            $script->shutdown( 1 );
            exit();
        }

        // Warn if the cache entry is not function based, and the path is outside ezp root, and the path has less than 2 elements
        if ( $absPath &&
             ( !$purge || !isset( $cacheEntry['purge-function'] ) ) &&
             !isset( $cacheEntry['function'] ) &&
             $absPathElementCount < 3 && /* 3, since two path elements ('/foo/bar') produce three exploded elements */
             strpos( dirname( $absPath ) . DIRECTORY_SEPARATOR, realpath( eZSys::rootDir() ) . DIRECTORY_SEPARATOR ) === false )
        {
            $warnPaths[] = $absPath;
        }
    }

    if ( count( $warnPaths ) > 0 )
    {
        $cli->warning( 'The following cache paths are outside of the eZ Publish root directory, and have less than 2 path elements. ' .
                       'Are you sure you want to ' . ( $purge ? 'purge' : 'clear' ) . ' them?' );
        foreach ( $warnPaths as $warnPath )
        {
            $cli->output( $warnPath );
        }
        $input = getUserInput( ( $purge ? 'Purge' : 'Clear' ) . '? yes/no:', array( 'yes', 'no' ) );

        if ( $input == 'no' )
        {
            $script->shutdown();
            exit();
        }
    }
}
Example #11
0
 public function generatePng($url, $density, $keys)
 {
     $data = $this->getPDF($url);
     // check if error occurred during pdf generation
     if ($data === false) {
         return false;
     }
     // save pdf, generate png, return url
     $cacheName = hash("md5", $url . '-' . $density . '-' . implode($keys, '-'));
     $cacheDir = self::getCacheDir();
     eZFile::create($cacheName . '.pdf', $cacheDir, $data);
     $pdfUrl = $cacheDir . $cacheName . '.pdf';
     $pngUrl = $cacheDir . $cacheName . '.png';
     $command = "gs -dNOPAUSE -dBATCH -sDEVICE=pngalpha -r{$density} -dEPSCrop -sOutputFile=" . eZSys::rootDir() . "/" . $pngUrl . " " . eZSys::rootDir() . "/" . $pdfUrl;
     exec($command, $output, $returnCode);
     //eZDebug::writeError($command, 'sPdf2png::exportPng');
     //eZDebug::writeError("pngUrl=".$pngUrl, 'sPdf2png::exportPng');
     //eZFileHandler::unlink($pdfUrl);
     return $this->getPngData($pngUrl);
     /*return array('url' => ,
     	 'width' => '100',
     	 'height' => '100' );*/
 }
 function generateNewsletter($contentObject)
 {
     // 1. Set resource keys
     $res = eZTemplateDesignResource::instance();
     $res->setKeys(array(array('newslettertype_id', $this->attribute('newslettertype_id')), array('newsletter_id', $this->attribute('id')), array('class_identifier', ''), array('newsletter_type', 'mail')));
     // 2. Set general mail and template properties
     $ini = eZINI::instance();
     $hostname = eZSys::hostname();
     $newsletterType = $this->attribute('newsletter_type');
     // 3. get skin for newsletter
     if ($this->attribute('design_to_use')) {
         $skin_prefix = $this->attribute('design_to_use');
     } else {
         $skin_prefix = 'eznewsletter';
     }
     $mail = new ezpMailComposer();
     $mail->charset = 'utf-8';
     $tpl = eZTemplate::factory();
     $tpl->setVariable('hostname', $hostname);
     $tpl->setVariable('contentobject', $contentObject);
     $tpl->setVariable('newsletter', $this);
     $tpl->setVariable('SkipMIMEPart', false);
     $mail->plainText = $tpl->fetch('design:' . $skin_prefix . '/sendout/text.tpl');
     $mail->plainText = rtrim(preg_replace('/(\\r\\n|\\r|\\n)/', "\r\n", $mail->plainText));
     if ($tpl->hasVariable('SkipMIMEPart') && $tpl->variable('SkipMIMEPart') === true) {
         $mail->plainText = null;
     }
     $tpl->setVariable('SkipMIMEPart', false);
     $mail->htmlText = $tpl->fetch('design:' . $skin_prefix . '/sendout/html.tpl');
     $mail->htmlText = rtrim(preg_replace('/(\\r\\n|\\r|\\n)/', "\r\n", $mail->htmlText));
     if ($tpl->hasVariable('SkipMIMEPart') && $tpl->variable('SkipMIMEPart') === true) {
         $mail->htmlText = null;
     }
     if ($tpl->hasVariable('attachments')) {
         foreach ($tpl->hasVariable('attachments') as $attachment) {
             $mail->addFileAttachment($attachment);
         }
     }
     $emailSender = $newsletterType->attribute('sender_address') ? $newsletterType->attribute('sender_address') : $ini->variable('MailSettings', 'EmailSender');
     if ($tpl->hasVariable('emailSenderName')) {
         $mail->from = new ezcMailAddress($emailSender, $tpl->variable('emailSenderName'), 'utf-8');
     } else {
         $mail->from = new ezcMailAddress($emailSender, null, 'utf-8');
     }
     $subject = $this->attribute('name');
     if ($tpl->hasVariable('subject')) {
         $subject = $tpl->variable('subject');
     }
     $mail->subject = $subject;
     $mail->subjectCharset = 'utf-8';
     if (preg_match_all('/(<img)\\s (src="\\/([a-zA-Z0-9-\\.;:!\\/\\?&=_|\\r|\\n]{1,})")/isxmU', $mail->htmlText, $patterns)) {
         foreach ($patterns[3] as $key => $file) {
             if (file_exists($file) and !is_dir($file)) {
                 $mail->htmlText = preg_replace("/" . preg_quote($patterns[0][$key], '/') . "/", $patterns[1][$key] . ' src="file://' . str_replace("\\", "/", eZSys::rootDir()) . '/' . $file . "\"", $mail->htmlText);
             }
         }
     }
     //setting the reply-to head from site.ini
     if ($ini->variable('MailSettings', 'EmailReplyTo') != "") {
         $mail->setHeader('Reply-To', $ini->variable('MailSettings', 'EmailReplyTo'));
     }
     return $mail;
 }
 /**
  * Called by PHPUnit before each test.
  */
 public function setUp()
 {
     // Call the setUp() in ezpDatabaseTestCase
     parent::setUp();
     // Set these to your own values
     // @todo get these values automatically from somewhere (how to get the password?)
     $GLOBALS['ezc_webdav_username'] = '******';
     $GLOBALS['ezc_webdav_password'] = '******';
     $GLOBALS['ezc_webdav_host'] = 'webdav.ezp';
     // A compound value from the above
     $GLOBALS['ezc_webdav_url'] = 'http://' . $GLOBALS['ezc_webdav_host'] . '/';
     // Set some server variables (not all of them are needed)
     $_SERVER['HTTP_USER_AGENT'] = 'cadaver/0.22.5 neon/0.26.3';
     $_SERVER['SERVER_NAME'] = 'webdav';
     $_SERVER['SERVER_PORT'] = '80';
     // Set to null various variables used in the tests
     $GLOBALS['ezc_response_body'] = null;
     $GLOBALS['ezc_post_body'] = null;
     $GLOBALS['ezc_webdav_testfolder'] = null;
     $GLOBALS['ezc_webdav_testfolderobject'] = null;
     $GLOBALS['ezc_webdav_testfolderid'] = null;
     // Not sure if these 2 values are needed
     $_SERVER['SCRIPT_FILENAME'] = eZSys::rootDir() . DIRECTORY_SEPARATOR . 'index.php';
     $_SERVER['DOCUMENT_ROOT'] = eZSys::rootDir();
     $GLOBALS['ezc_siteaccess'] = strtolower(__CLASS__);
     // Remove the siteaccess from settings/override/site.ini.append.php
     // in case it already exists
     try {
         ezpSiteAccessCreator::disableSiteAccess($GLOBALS['ezc_siteaccess']);
     } catch (ezsahINIVariableNotSetException $e) {
         // eZSiteAccessHelper::disableSiteAccess throws an exception
         // if the siteaccess does not exist already in
         // settings/override/site.ini.append.php
     }
     // Add the siteaccess to settings/override/site.ini.append.php
     ezpSiteAccessCreator::enableSiteAccess($GLOBALS['ezc_siteaccess']);
 }