function execute($process, $event)
 {
     // get object being published
     $parameters = $process->attribute('parameter_list');
     $objectID = $parameters['object_id'];
     eZDebug::writeDebug('Update object state for object: ' . $objectID);
     $object = eZContentObject::fetch($objectID);
     $state_before = $event->attribute('state_before');
     $state_after = $event->attribute('state_after');
     if ($object == null) {
         eZDebug::writeError('Update object state failed for inexisting object: ' . $objectID, __METHOD__);
         return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
     }
     if ($state_before == null || $state_after == null) {
         eZDebug::writeError('Update object state failed: badly configured states', __METHOD__);
         return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
     }
     $currentStateIDArray = $object->attribute('state_id_array');
     if (in_array($state_before->attribute('id'), $currentStateIDArray)) {
         $canAssignStateIDList = $object->attribute('allowed_assign_state_id_list');
         if (!in_array($state_after->attribute('id'), $canAssignStateIDList)) {
             eZDebug::writeWarning("Not enough rights to assign state to object {$objectID}: " . $state_after->attribute('id'), __METHOD__);
         } else {
             eZDebug::writeDebug('Changing object state from ' . $state_before->attribute('name') . ' to ' . $state_after->attribute('name'), __METHOD__);
             if (eZOperationHandler::operationIsAvailable('content_updateobjectstate')) {
                 $operationResult = eZOperationHandler::execute('content', 'updateobjectstate', array('object_id' => $objectID, 'state_id_list' => array($state_after->attribute('id'))));
             } else {
                 eZContentOperationCollection::updateObjectState($objectID, array($state_after->attribute('id')));
             }
         }
     }
     return eZWorkflowType::STATUS_ACCEPTED;
 }
 function connect($server, $db, $user, $password, $socketPath, $charset = null, $port = false)
 {
     $connection = false;
     if ($socketPath !== false) {
         ini_set("mysqli.default_socket", $socketPath);
     }
     if ($this->UsePersistentConnection == true) {
         // Only supported on PHP 5.3 (mysqlnd)
         if (version_compare(PHP_VERSION, '5.3') > 0) {
             $this->Server = 'p:' . $this->Server;
         } else {
             eZDebug::writeWarning('mysqli only supports persistent connections when using php 5.3 and higher', 'eZMySQLiDB::connect');
         }
     }
     eZPerfLogger::accumulatorStart('mysqli_connection', 'mysqli_total', 'Database connection');
     $connection = mysqli_connect($server, $user, $password, null, (int) $port, $socketPath);
     $dbErrorText = mysqli_connect_error();
     eZPerfLogger::accumulatorStop('mysqli_connection');
     $maxAttempts = $this->connectRetryCount();
     $waitTime = $this->connectRetryWaitTime();
     $numAttempts = 1;
     while (!$connection && $numAttempts <= $maxAttempts) {
         sleep($waitTime);
         eZPerfLogger::accumulatorStart('mysqli_connection', 'mysqli_total', 'Database connection');
         $connection = mysqli_connect($this->Server, $this->User, $this->Password, null, (int) $this->Port, $this->SocketPath);
         eZPerfLogger::accumulatorStop('mysqli_connection');
         $numAttempts++;
     }
     $this->setError();
     $this->IsConnected = true;
     if (!$connection) {
         eZDebug::writeError("Connection error: Couldn't connect to database. Please try again later or inform the system administrator.\n{$dbErrorText}", __CLASS__);
         $this->IsConnected = false;
         throw new eZDBNoConnectionException($server);
     }
     if ($this->IsConnected && $db != null) {
         eZPerfLogger::accumulatorStart('mysqli_connection', 'mysqli_total', 'Database connection');
         $ret = mysqli_select_db($connection, $db);
         eZPerfLogger::accumulatorStop('mysqli_connection');
         if (!$ret) {
             //$this->setError();
             eZDebug::writeError("Connection error: " . mysqli_errno($connection) . ": " . mysqli_error($connection), "eZMySQLiDB");
             $this->IsConnected = false;
         }
     }
     if ($charset !== null) {
         $originalCharset = $charset;
         $charset = eZCharsetInfo::realCharsetCode($charset);
     }
     if ($this->IsConnected and $charset !== null) {
         eZPerfLogger::accumulatorStart('mysqli_connection', 'mysqli_total', 'Database connection');
         $status = mysqli_set_charset($connection, eZMySQLCharset::mapTo($charset));
         eZPerfLogger::accumulatorStop('mysqli_connection');
         if (!$status) {
             $this->setError();
             eZDebug::writeWarning("Connection warning: " . mysqli_errno($connection) . ": " . mysqli_error($connection), "eZMySQLiDB");
         }
     }
     return $connection;
 }
 function __construct($id, $createIfNotExists = false, $options = array(), $remoteUrl = null)
 {
     $this->notifications = array(self::ERROR => array(), self::WARNING => array(), self::NOTICE => array());
     if ($remoteUrl !== NULL) {
         self::setRemoteUrl($remoteUrl);
     }
     $class = eZContentClass::fetch(intval($id));
     $this->options = $options;
     $this->data = new stdClass();
     if (!$class instanceof eZContentClass) {
         $class = eZContentClass::fetchByIdentifier($id);
     }
     if (!$class instanceof eZContentClass) {
         if (!$createIfNotExists) {
             throw new Exception("Classe {$id} non trovata");
         } else {
             if (!is_numeric($id)) {
                 eZDebug::writeWarning("Creazione della classe {$id}");
                 $class = $this->createNew($id);
                 if (!$class instanceof eZContentClass) {
                     throw new Exception("Fallita la creazionde della classe {$id}");
                 }
             } else {
                 throw new Exception("Per creare automaticamente una nuova classe è necessario fornire l'identificativo e non l'id numerico");
             }
         }
     }
     $this->currentClass = $class;
     $this->id = $this->currentClass->attribute('id');
     $this->identifier = $this->currentClass->attribute('identifier');
 }
 function execute($process, $event)
 {
     $parameters = $process->attribute('parameter_list');
     $http = eZHTTPTool::instance();
     eZDebug::writeNotice($parameters, "parameters");
     $orderID = $parameters['order_id'];
     $order = eZOrder::fetch($orderID);
     if (empty($orderID) || get_class($order) != 'ezorder') {
         eZDebug::writeWarning("Can't proceed without a Order ID.", "SimpleStockCheck");
         return eZWorkflowEventType::STATUS_FETCH_TEMPLATE_REPEAT;
     }
     // Decrement the quantitity field
     $order = eZOrder::fetch($orderID);
     $productCollection = $order->productCollection();
     $ordereditems = $productCollection->itemList();
     foreach ($ordereditems as $item) {
         $contentObject = $item->contentObject();
         $contentObjectVersion = $contentObject->version($contentObject->attribute('current_version'));
         $contentObjectAttributes = $contentObjectVersion->contentObjectAttributes();
         foreach (array_keys($contentObjectAttributes) as $key) {
             $contentObjectAttribute = $contentObjectAttributes[$key];
             $contentClassAttribute = $contentObjectAttribute->contentClassAttribute();
             // Each attribute has an attribute identifier called 'quantity' that identifies it.
             if ($contentClassAttribute->attribute("identifier") == "quantity") {
                 $contentObjectAttribute->setAttribute("data_int", $contentObjectAttribute->attribute("value") - $item->ItemCount);
                 $contentObjectAttribute->store();
             }
         }
     }
     return eZWorkflowEventType::STATUS_ACCEPTED;
 }
 /**
  * @todo add support for SVN
  * @return array each element is an array with information
  */
 public static function getScmInfo()
 {
     $dirs = self::getScmDir();
     if (!$dirs) {
         return array();
     }
     if (is_string($dirs)) {
         $dirs = array($dirs);
     }
     $out = array();
     foreach ($dirs as $name => $dir) {
         if (!is_dir($dir)) {
             eZDebug::writeWarning("'{$dir}' is not a directory, can not get SCM info", __METHOD__);
             continue;
         }
         $revisionInfo = array();
         exec("cd {$dir} && git log -1", $revisionInfo, $retcode);
         $statusInfo = array();
         exec("cd {$dir} && git status", $statusInfo, $retcode);
         $tagInfo = array();
         exec("cd {$dir} && git describe", $tagInfo, $retcode);
         $out[$name] = array('revision_info' => $revisionInfo, 'status_info' => $statusInfo, 'tag_info' => $tagInfo);
     }
     return $out;
 }
 /**
  * Get singleton instance for filter
  * @param string $filterID
  * @return eZFindExtendedAttributeFilterInterface|false
  */
 public static function getInstance($filterID)
 {
     if (!isset(self::$instances[$filterID])) {
         try {
             if (!self::$filtersList) {
                 $ini = eZINI::instance('ezfind.ini');
                 self::$filtersList = $ini->variable('ExtendedAttributeFilters', 'FiltersList');
             }
             if (!isset(self::$filtersList[$filterID])) {
                 throw new Exception($filterID . ' extended attribute filter is not defined');
             }
             $className = self::$filtersList[$filterID];
             if (!class_exists($className)) {
                 throw new Exception('Could not find class ' . $className);
             }
             $instance = new $className();
             if (!$instance instanceof eZFindExtendedAttributeFilterInterface) {
                 throw new Exception($className . ' is not a valid eZFindExtendedAttributeFilterInterface');
             }
             self::$instances[$filterID] = $instance;
         } catch (Exception $e) {
             eZDebug::writeWarning($e->getMessage(), __METHOD__);
             self::$instances[$filterID] = false;
         }
     }
     return self::$instances[$filterID];
 }
 /**
  * Modifies SolR query params according to filter parameters
  * @param array $queryParams
  * @param array $filterParams
  * @return array $queryParams
  */
 public function filterQueryParams(array $queryParams, array $filterParams)
 {
     try {
         if (!isset($filterParams['field'])) {
             throw new Exception('Missing filter parameter "field"');
         }
         if (!isset($filterParams['latitude'])) {
             throw new Exception('Missing filter parameter "latitude"');
         }
         if (!isset($filterParams['longitude'])) {
             throw new Exception('Missing filter parameter "longitude"');
         }
         $fieldName = eZSolr::getFieldName($filterParams['field']);
         //geodist custom parameters
         $queryParams['sfield'] = $fieldName;
         $queryParams['pt'] = $filterParams['latitude'] . ',' . $filterParams['longitude'];
         //sort by geodist
         $queryParams['sort'] = 'geodist() asc,' . $queryParams['sort'];
         //exclude unlocated documents
         $queryParams['fq'][] = $fieldName . ':[-90,-90 TO 90,90]';
     } catch (Exception $e) {
         eZDebug::writeWarning($e->getMessage(), __CLASS__);
     }
     return $queryParams;
 }
function updateAutoload($tpl = null)
{
    $autoloadGenerator = new eZAutoloadGenerator();
    try {
        $autoloadGenerator->buildAutoloadArrays();
        $messages = $autoloadGenerator->getMessages();
        foreach ($messages as $message) {
            eZDebug::writeNotice($message, 'eZAutoloadGenerator');
        }
        $warnings = $autoloadGenerator->getWarnings();
        foreach ($warnings as &$warning) {
            eZDebug::writeWarning($warning, "eZAutoloadGenerator");
            // For web output we want to mark some of the important parts of
            // the message
            $pattern = '@^Class\\s+(\\w+)\\s+.* file\\s(.+\\.php).*\\n(.+\\.php)\\s@';
            preg_match($pattern, $warning, $m);
            $warning = str_replace($m[1], '<strong>' . $m[1] . '</strong>', $warning);
            $warning = str_replace($m[2], '<em>' . $m[2] . '</em>', $warning);
            $warning = str_replace($m[3], '<em>' . $m[3] . '</em>', $warning);
        }
        if ($tpl !== null) {
            $tpl->setVariable('warning_messages', $warnings);
        }
    } catch (Exception $e) {
        eZDebug::writeError($e->getMessage());
    }
}
    function run( &$benchmark, $display = false )
    {
        $this->Results = array();
        $this->CurrentResult = false;
        if ( is_subclass_of( $benchmark, 'ezbenchmarkunit' ) )
        {
            $markList = $benchmark->markList();
            foreach ( $markList as $mark )
            {
                $type = $this->markEntryType( $benchmark, $mark );
                if ( $type )
                {
                    $mark['type'] = $type;
                    $this->prepareMarkEntry( $benchmark, $mark );

                    $this->runMarkEntry( $benchmark, $mark );

                    $this->finalizeMarkEntry( $benchmark, $mark, $display );
                }
                else
                    $this->addToCurrentResult( $mark,
                                               "Unknown mark type for mark " . $benchmark->name() . '::' . $mark['name'] );
            }
        }
        else
        {
            eZDebug::writeWarning( "Tried to run test on an object which is not subclassed from eZBenchmarkCase", __METHOD__ );
        }
    }
Beispiel #10
0
    function runFile( $Params, $file, $params_as_var )
    {
        $Result = null;
        if ( $params_as_var )
        {
            foreach ( $Params as $key => $dummy )
            {
                if ( $key != "Params" and
                     $key != "this" and
                     $key != "file" and
                     !is_numeric( $key ) )
                {
                    ${$key} = $Params[$key];
                }
            }
        }

        if ( file_exists( $file ) )
        {
            $includeResult = include( $file );
            if ( empty( $Result ) &&
                 $includeResult != 1 )
            {
                $Result = $includeResult;
            }
        }
        else
            eZDebug::writeWarning( "PHP script $file does not exist, cannot run.",
                                   "eZProcess" );
        return $Result;
    }
 function _exclusiveLock($fname = false)
 {
     $mutex =& $this->_mutex();
     while (true) {
         $timestamp = $mutex->lockTS();
         // Note: This does not lock, only checks what the timestamp is.
         if ($timestamp === false) {
             if (!$mutex->lock()) {
                 eZDebug::writeWarning("Failed to acquire lock for file " . $this->filePath);
                 return false;
             }
             $mutex->setMeta('pid', getmypid());
             return true;
         }
         if ($timestamp >= time() - $this->lifetime) {
             usleep(500000);
             // Sleep 0.5 second
             continue;
         }
         $oldPid = $mutex->meta('pid');
         if (is_numeric($oldPid) && $oldPid != 0 && function_exists('posix_kill')) {
             posix_kill($oldPid, 9);
         }
         if (!$mutex->steal()) {
             eZDebug::writeWarning("Failed to steal lock for file " . $this->filePath . " from PID {$oldPid}");
             return false;
         }
         $mutex->setMeta('pid', getmypid());
         return true;
     }
 }
    /**
     * Get percentage of VAT type corresponding to the given product and country the user is from.
     *
     * \return Percentage, or null on error.
     * \public
     * \static
     */
    static function getVAT( $object, $country )
    {
        // Load VAT handler.
        if ( !is_object( $handler = eZVATManager::loadVATHandler() ) )
        {
            if ( $handler === true )
            {
                eZDebug::writeWarning( "No VAT handler specified but dynamic VAT charging is used." );
            }

            return null;
        }

        // Check if user country must be specified.
        $requireUserCountry = eZVATManager::isUserCountryRequired();

        // Determine user country if it's not specified
        if ( $country === false )
            $country = eZVATManager::getUserCountry();

        if ( !$country && $requireUserCountry )
        {
            eZDebug::writeNotice( "User country is not specified." );
        }

        return $handler->getVatPercent( $object, $country );
    }
Beispiel #13
0
 function attribute($name)
 {
     switch ($name) {
         case 'input_xml':
             return $this->inputXML();
             break;
         case 'edit_template_name':
             return $this->editTemplateName();
             break;
         case 'information_template_name':
             return $this->informationTemplateName();
             break;
         case 'aliased_type':
             eZDebug::writeWarning("'aliased_type' is deprecated as of 4.1 and not in use anymore, meaning it will always return false.", __METHOD__);
             return $this->AliasedType;
             break;
         case 'aliased_handler':
             if ($this->AliasedHandler === null) {
                 $this->AliasedHandler = eZXMLText::inputHandler($this->XMLData, $this->AliasedType, false, $this->ContentObjectAttribute);
             }
             return $this->AliasedHandler;
             break;
         default:
             eZDebug::writeError("Attribute '{$name}' does not exist", __METHOD__);
             return null;
             break;
     }
 }
 function sendMail(eZMail $mail)
 {
     $ini = eZINI::instance();
     $sendmailOptions = '';
     $emailFrom = $mail->sender();
     $emailSender = isset($emailFrom['email']) ? $emailFrom['email'] : false;
     if (!$emailSender || count($emailSender) <= 0) {
         $emailSender = $ini->variable('MailSettings', 'EmailSender');
     }
     if (!$emailSender) {
         $emailSender = $ini->variable('MailSettings', 'AdminEmail');
     }
     if (!eZMail::validate($emailSender)) {
         $emailSender = false;
     }
     $isSafeMode = ini_get('safe_mode') != 0;
     $sendmailOptionsArray = $ini->variable('MailSettings', 'SendmailOptions');
     if (is_array($sendmailOptionsArray)) {
         $sendmailOptions = implode(' ', $sendmailOptionsArray);
     } elseif (!is_string($sendmailOptionsArray)) {
         $sendmailOptions = $sendmailOptionsArray;
     }
     if (!$isSafeMode and $emailSender) {
         $sendmailOptions .= ' -f' . $emailSender;
     }
     if ($isSafeMode and $emailSender and $mail->sender() == false) {
         $mail->setSenderText($emailSender);
     }
     if (function_exists('mail')) {
         $message = $mail->body();
         $sys = eZSys::instance();
         $excludeHeaders = array('Subject');
         // If not Windows PHP mail() implementation, we can not specify a To: header in the $additional_headers parameter,
         // because then there will be 2 To: headers in the resulting e-mail.
         // However, we can use "undisclosed-recipients:;" in $to.
         if ($sys->osType() != 'win32') {
             $excludeHeaders[] = 'To';
             $receiverEmailText = count($mail->ReceiverElements) > 0 ? $mail->receiverEmailText() : 'undisclosed-recipients:;';
         } else {
             $receiverEmailText = $mail->receiverEmailText();
         }
         // If in debug mode, send to debug email address and nothing else
         if ($ini->variable('MailSettings', 'DebugSending') == 'enabled') {
             $receiverEmailText = $ini->variable('MailSettings', 'DebugReceiverEmail');
             $excludeHeaders[] = 'To';
             $excludeHeaders[] = 'Cc';
             $excludeHeaders[] = 'Bcc';
         }
         $extraHeaders = $mail->headerText(array('exclude-headers' => $excludeHeaders));
         $returnedValue = mail($receiverEmailText, $mail->subject(), $message, $extraHeaders, $sendmailOptions);
         if ($returnedValue === false) {
             eZDebug::writeError('An error occurred while sending e-mail. Check the Sendmail error message for further information (usually in /var/log/messages)', __METHOD__);
         }
         return $returnedValue;
     } else {
         eZDebug::writeWarning("Unable to send mail: 'mail' function is not compiled into PHP.", __METHOD__);
     }
     return false;
 }
Beispiel #15
0
 /**
  * Return a list of all cache items in the system.
  *
  * @return array The list of cache items
  */
 static function fetchList()
 {
     static $cacheList = null;
     if ($cacheList === null) {
         $ini = eZINI::instance();
         $textToImageIni = eZINI::instance('texttoimage.ini');
         $cacheList = array(array('name' => ezpI18n::tr('kernel/cache', 'Content view cache'), 'id' => 'content', 'is-clustered' => true, 'tag' => array('content'), 'expiry-key' => 'content-view-cache', 'enabled' => $ini->variable('ContentSettings', 'ViewCaching') == 'enabled', 'path' => $ini->variable('ContentSettings', 'CacheDir'), 'function' => array('eZCache', 'clearContentCache')), array('name' => ezpI18n::tr('kernel/cache', 'Global INI cache'), 'id' => 'global_ini', 'tag' => array('ini'), 'enabled' => true, 'path' => 'var/cache/ini', 'function' => array('eZCache', 'clearGlobalINICache'), 'purge-function' => array('eZCache', 'clearGlobalINICache')), array('name' => ezpI18n::tr('kernel/cache', 'INI cache'), 'id' => 'ini', 'tag' => array('ini'), 'enabled' => true, 'path' => 'ini'), array('name' => ezpI18n::tr('kernel/cache', 'Codepage cache'), 'id' => 'codepage', 'tag' => array('codepage'), 'enabled' => true, 'path' => 'codepages'), array('name' => ezpI18n::tr('kernel/cache', 'Class identifier cache'), 'id' => 'classid', 'tag' => array('content'), 'expiry-key' => 'class-identifier-cache', 'enabled' => true, 'path' => false, 'is-clustered' => true, 'function' => array('eZCache', 'clearClassID'), 'purge-function' => array('eZCache', 'clearClassID')), array('name' => ezpI18n::tr('kernel/cache', 'Sort key cache'), 'id' => 'sortkey', 'tag' => array('content'), 'expiry-key' => 'sort-key-cache', 'enabled' => true, 'path' => false, 'function' => array('eZCache', 'clearSortKey'), 'purge-function' => array('eZCache', 'clearSortKey'), 'is-clustered' => true), array('name' => ezpI18n::tr('kernel/cache', 'URL alias cache'), 'id' => 'urlalias', 'is-clustered' => true, 'tag' => array('content'), 'enabled' => true, 'path' => 'wildcard'), array('name' => ezpI18n::tr('kernel/cache', 'Character transformation cache'), 'id' => 'chartrans', 'tag' => array('i18n'), 'enabled' => true, 'path' => 'trans'), array('name' => ezpI18n::tr('kernel/cache', 'Image alias'), 'id' => 'imagealias', 'tag' => array('image'), 'path' => false, 'enabled' => true, 'function' => array('eZCache', 'clearImageAlias'), 'purge-function' => array('eZCache', 'purgeImageAlias'), 'is-clustered' => true), array('name' => ezpI18n::tr('kernel/cache', 'Template cache'), 'id' => 'template', 'tag' => array('template'), 'enabled' => $ini->variable('TemplateSettings', 'TemplateCompile') == 'enabled', 'path' => 'template'), array('name' => ezpI18n::tr('kernel/cache', 'Template block cache'), 'id' => 'template-block', 'is-clustered' => true, 'tag' => array('template', 'content'), 'expiry-key' => 'global-template-block-cache', 'enabled' => $ini->variable('TemplateSettings', 'TemplateCache') == 'enabled', 'path' => 'template-block', 'function' => array('eZCache', 'clearTemplateBlockCache')), array('name' => ezpI18n::tr('kernel/cache', 'Template override cache'), 'id' => 'template-override', 'tag' => array('template'), 'enabled' => true, 'path' => 'override', 'function' => array('eZCache', 'clearTemplateOverrideCache')), array('name' => ezpI18n::tr('kernel/cache', 'Text to image cache'), 'id' => 'texttoimage', 'tag' => array('template'), 'enabled' => $textToImageIni->variable('ImageSettings', 'UseCache') == 'enabled', 'path' => $textToImageIni->variable('PathSettings', 'CacheDir'), 'function' => array('eZCache', 'clearTextToImageCache'), 'purge-function' => array('eZCache', 'purgeTextToImageCache'), 'is-clustered' => true), array('name' => ezpI18n::tr('kernel/cache', 'RSS cache'), 'id' => 'rss_cache', 'is-clustered' => true, 'tag' => array('content'), 'enabled' => true, 'path' => 'rss'), array('name' => ezpI18n::tr('kernel/cache', 'User info cache'), 'id' => 'user_info_cache', 'is-clustered' => true, 'tag' => array('user'), 'expiry-key' => 'user-info-cache', 'enabled' => true, 'path' => 'user-info', 'function' => array('eZCache', 'clearUserInfoCache')), array('name' => ezpI18n::tr('kernel/cache', 'Content tree menu (browser cache)'), 'id' => 'content_tree_menu', 'tag' => array('content'), 'path' => false, 'enabled' => true, 'function' => array('eZCache', 'clearContentTreeMenu'), 'purge-function' => array('eZCache', 'clearContentTreeMenu')), array('name' => ezpI18n::tr('kernel/cache', 'State limitations cache'), 'is-clustered' => true, 'id' => 'state_limitations', 'tag' => array('content'), 'expiry-key' => 'state-limitations', 'enabled' => true, 'path' => false, 'function' => array('eZCache', 'clearStateLimitations'), 'purge-function' => array('eZCache', 'clearStateLimitations')), array('name' => ezpI18n::tr('kernel/cache', 'Design base cache'), 'id' => 'design_base', 'tag' => array('template'), 'enabled' => $ini->variable('DesignSettings', 'DesignLocationCache') == 'enabled', 'path' => false, 'function' => array('eZCache', 'clearDesignBaseCache'), 'purge-function' => array('eZCache', 'clearDesignBaseCache')), array('name' => ezpI18n::tr('kernel/cache', 'Active extensions cache'), 'id' => 'active_extensions', 'tag' => array('ini'), 'expiry-key' => 'active-extensions-cache', 'enabled' => true, 'path' => false, 'function' => array('eZCache', 'clearActiveExtensions'), 'purge-function' => array('eZCache', 'clearActiveExtensions')), array('name' => ezpI18n::tr('kernel/cache', 'TS Translation cache'), 'id' => 'translation', 'tag' => array('i18n'), 'enabled' => true, 'expiry-key' => 'ts-translation-cache', 'path' => 'translation', 'function' => array('eZCache', 'clearTSTranslationCache')), array('name' => ezpI18n::tr('kernel/cache', 'SSL Zones cache'), 'id' => 'sslzones', 'tag' => array('ini'), 'enabled' => eZSSLZone::enabled(), 'path' => false, 'function' => array('eZSSLZone', 'clearCache'), 'purge-function' => array('eZSSLZone', 'clearCache')));
         // Append cache items defined (in ini) by extensions, see site.ini[Cache] for details
         foreach ($ini->variable('Cache', 'CacheItems') as $cacheItemKey) {
             $name = 'Cache_' . $cacheItemKey;
             if (!$ini->hasSection($name)) {
                 eZDebug::writeWarning("Missing site.ini section: '{$name}', skipping!", __METHOD__);
                 continue;
             }
             $cacheItem = array();
             if ($ini->hasVariable($name, 'name')) {
                 $cacheItem['name'] = $ini->variable($name, 'name');
             } else {
                 $cacheItem['name'] = ucwords($cacheItemKey);
             }
             if ($ini->hasVariable($name, 'id')) {
                 $cacheItem['id'] = $ini->variable($name, 'id');
             } else {
                 $cacheItem['id'] = $cacheItemKey;
             }
             if ($ini->hasVariable($name, 'isClustered')) {
                 $cacheItem['is-clustered'] = $ini->variable($name, 'isClustered');
             } else {
                 $cacheItem['is-clustered'] = false;
             }
             if ($ini->hasVariable($name, 'tags')) {
                 $cacheItem['tag'] = $ini->variable($name, 'tags');
             } else {
                 $cacheItem['tag'] = array();
             }
             if ($ini->hasVariable($name, 'expiryKey')) {
                 $cacheItem['expiry-key'] = $ini->variable($name, 'expiryKey');
             }
             if ($ini->hasVariable($name, 'enabled')) {
                 $cacheItem['enabled'] = $ini->variable($name, 'enabled');
             } else {
                 $cacheItem['enabled'] = true;
             }
             if ($ini->hasVariable($name, 'path')) {
                 $cacheItem['path'] = $ini->variable($name, 'path');
             } else {
                 $cacheItem['path'] = false;
             }
             if ($ini->hasVariable($name, 'class')) {
                 $cacheItem['function'] = array($ini->variable($name, 'class'), 'clearCache');
             }
             if ($ini->hasVariable($name, 'purgeClass')) {
                 $cacheItem['purge-function'] = array($ini->variable($name, 'purgeClass'), 'purgeCache');
             }
             $cacheList[] = $cacheItem;
         }
     }
     return $cacheList;
 }
Beispiel #16
0
 function addFunctionMark($function, $name, $parameter = false)
 {
     if (!function_exists($function)) {
         eZDebug::writeWarning("Mark function {$method} does not exist, cannot add to mark " . $this->Name, __METHOD__);
     }
     if (!$name) {
         $name = $function;
     }
     $this->addEntry(array('name' => $name, 'function' => $function, 'parameter' => $parameter));
 }
Beispiel #17
0
 public static function checkCommentPermission($contentObject, $languageCode, $foundCommentAttribute)
 {
     //check permission
     $canAddComment = ezcomPermission::hasAccessToFunction('add', $contentObject, $languageCode, null, null, $contentObject->mainNode());
     if (!$canAddComment['result']) {
         eZDebug::writeWarning('No access to adding comments.', 'ezcomments');
         return $module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
     }
     // Check to see if commenting is turned on, on the object level
     $commentContent = $foundCommentAttribute->content();
     return $commentContent;
 }
 /**
  * Cluster shutdown handler. Terminates generation for unterminated files.
  * This situation doesn't happen by default, but may with custom code that doesn't follow recommendations.
  */
 static function cleanupGeneratingFiles()
 {
     if (count(self::$generatingFiles) === 0) {
         return false;
     } else {
         eZDebug::writeWarning("Execution was stopped while one or more files were generating. This should not happen.", __METHOD__);
         foreach (self::$generatingFiles as $generatingFile) {
             $generatingFile->abortCacheGeneration();
             self::removeGeneratingFile($generatingFile);
         }
     }
 }
Beispiel #19
0
 function addMark(&$mark)
 {
     if (is_subclass_of($mark, 'ezbenchmarkunit')) {
         $markList = $mark->markList();
         foreach ($markList as $entry) {
             $entry['name'] = $mark->name() . '::' . $entry['name'];
             $this->addEntry($entry);
         }
     } else {
         eZDebug::writeWarning("Tried to add mark unit for an object which is not subclassed from eZBenchmarkUnit", 'eZBenchmark::addMark');
     }
 }
Beispiel #20
0
 /**
  * Call preUpload or postUpload user definied functions.
  *
  * @static
  * @param string $method
  * @param array $result
  * @return bool
  */
 static function exec($method, &$result)
 {
     $ini = eZINI::instance('ezmultiupload.ini');
     $handlers = $ini->variable('MultiUploadSettings', 'MultiuploadHandlers');
     if (!$handlers) {
         return false;
     }
     foreach ($handlers as $hanlder) {
         if (!call_user_func(array($hanlder, $method), $result)) {
             eZDebug::writeWarning('Multiupload handler implementation not found');
         }
     }
     return true;
 }
 /**
  * Identifies, based on the existing object relations, the type of the subattribute.
  *
  * @param eZContentClassAttribute $classAttribute
  * @param $subAttribute
  * @param $context
  *
  * @return bool|string
  */
 protected static function getTypeForSubattribute(eZContentClassAttribute $classAttribute, $subAttribute, $context)
 {
     $q = "SELECT DISTINCT( ezcoa.data_type_string )\n                FROM   ezcontentobject_link AS ezcol,\n                       ezcontentobject_attribute AS ezcoa,\n                       ezcontentclass_attribute AS ezcca,\n                       ezcontentclass_attribute AS ezcca_target\n                WHERE  ezcol.contentclassattribute_id={$classAttribute->attribute('id')}\n                  AND  ezcca_target.identifier='{$subAttribute}'\n                  AND  ezcca.data_type_string='{$classAttribute->attribute('data_type_string')}'\n                  AND  ezcca.id=ezcol.contentclassattribute_id\n                  AND  ezcol.to_contentobject_id = ezcoa.contentobject_id\n                  AND  ezcoa.contentclassattribute_id = ezcca_target.id;\n        ";
     $rows = eZDB::instance()->arrayQuery($q);
     if (count($rows) == 0) {
         return self::DEFAULT_SUBATTRIBUTE_TYPE;
     }
     if ($rows and count($rows) > 0) {
         if (count($rows) > 1) {
             $msg = "Multiple types were found for subattribute '{$subAttribute}' of class attribute #{$classAttribute->attribute('id')} [{$classAttribute->attribute('data_type_string')}]. This means that objects of different content classes were related through class attribute #{$classAttribute->attribute('id')} and had attributes named '{$subAttribute}' of different datatypes : \n" . print_r($rows, true) . " Picking the first one here : {$rows[0]['data_type_string']}";
             eZDebug::writeWarning($msg, __METHOD__);
         }
         return ezfSolrDocumentFieldBase::getClassAttributeType(new eZContentClassAttribute($rows[0]), null, $context);
     }
     return false;
 }
Beispiel #22
0
 function warning($text, $position = false)
 {
     if ($position) {
         $str = $position['file'] . ':' . $position['from'][0] . ' C' . $position['from'][1];
         if (isset($position['to'])) {
             $str .= ' -> L' . $position['to'][0] . ' C' . $position['to'][1];
         }
         $str .= ':';
     }
     $str .= $text;
     if (class_exists('ezcli')) {
         $cli = eZCLI::instance();
         $cli->warning($str);
     } else {
         eZDebug::writeWarning($str, __METHOD__);
     }
 }
Beispiel #23
0
 function eZImageAliasHandler($contentObjectAttribute)
 {
     $this->ContentObjectAttributeData = array();
     if (is_object($contentObjectAttribute)) {
         $this->ContentObjectAttributeData['id'] = $contentObjectAttribute->attribute('id');
         $this->ContentObjectAttributeData['contentobject_id'] = $contentObjectAttribute->attribute('contentobject_id');
         $this->ContentObjectAttributeData['version'] = $contentObjectAttribute->attribute('version');
         $this->ContentObjectAttributeData['language_code'] = $contentObjectAttribute->attribute('language_code');
         $this->ContentObjectAttributeData['can_translate'] = $contentObjectAttribute->attribute('can_translate');
         $this->ContentObjectAttributeData['data_text'] = $contentObjectAttribute->attribute('data_text');
         $this->ContentObjectAttributeData['DataTypeCustom'] = $contentObjectAttribute->DataTypeCustom;
         if (!is_array($this->ContentObjectAttributeData['DataTypeCustom'])) {
             $this->ContentObjectAttributeData['DataTypeCustom'] = array();
         }
     } else {
         eZDebug::writeWarning('Invalid eZContentObjectAttribute', __METHOD__);
     }
 }
Beispiel #24
0
 /** Get the text content to make the edge include the given method call.
  * @param array $methodInfo Information on the method call to be included.
  * This includes the keys 'class', 'method' and 'static'.
  * @param array $keys The cache keys for the included method call.
  * These will be provided to the method call as a parameter.
  * @return string|null The text content to put in the output to make the
  * edge processor include the given method call with the given keys,
  * or null on error.
  */
 public static function getIncludeForMethodCall($methodInfo, $keys)
 {
     if (!self::isMethodAllowed($methodInfo['class'], $methodInfo['method'])) {
         eZDebug::writeWarning('Tried to include a method call that is not allowed.', __METHOD__);
         return null;
     }
     $handler = self::getESITypeHandler();
     $call = array($handler, 'getIncludeForMethodCall');
     if (!is_callable($call)) {
         eZDebug::writeError('The ESI type handler cannot handle method call includes.', __METHOD__);
         return null;
     }
     $content = call_user_func($call, $methodInfo, $keys);
     if (!is_string($content) && $content !== null) {
         eZDebug::writeError('The ESI type handler returned an invalid value.', __METHOD__);
         return null;
     }
     return $content;
 }
 /**
  * Logs the string $logString to the logfile webservices.log
  * in the current log directory (usually var/log).
  * If logging is disabled, nothing is done.
  *
  * In dev mode, also writes to the eZP logs to ease debugging (this happens
  * regardless of the logging level set for the extension itself)
  */
 static function appendLogEntry($logString, $debuglevel)
 {
     $ini = eZINI::instance('site.ini');
     if ($ini->variable('DebugSettings', 'DebugOutput') == 'enabled' && $ini->variable('TemplateSettings', 'DevelopmentMode') == 'enabled') {
         switch ($debuglevel) {
             case 'info':
             case 'notice':
                 eZDebug::writeNotice($logString, 'ggwebservices');
                 break;
             case 'debug':
                 eZDebug::writeDebug($logString, 'ggwebservices');
                 break;
             case 'warning':
                 eZDebug::writeWarning($logString, 'ggwebservices');
                 break;
             case 'error':
             case 'critical':
                 eZDebug::writeError($logString, 'ggwebservices');
                 break;
         }
     }
     if (!self::isLoggingEnabled($debuglevel)) {
         return false;
     }
     $varDir = eZSys::varDirectory();
     $logDir = 'log';
     $logName = 'webservices.log';
     $fileName = $varDir . '/' . $logDir . '/' . $logName;
     if (!file_exists($varDir . '/' . $logDir)) {
         //include_once( 'lib/ezfile/classes/ezdir.php' );
         eZDir::mkdir($varDir . '/' . $logDir, 0775, true);
     }
     if ($logFile = fopen($fileName, 'a')) {
         $nowTime = date("Y-m-d H:i:s : ");
         $text = $nowTime . $logString;
         /*if ( $label )
           $text .= ' [' . $label . ']';*/
         fwrite($logFile, $text . "\n");
         fclose($logFile);
     }
 }
 /**
  Executes the needed operator(s).
  Checks operator names, and calls the appropriate functions.
 */
 function modify(&$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
 {
     switch ($operatorName) {
         case 'washxml':
             $operatorValue = str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $operatorValue);
             break;
         case 'washxmlcomment':
             // in xml comments the -- string is not permitted
             $operatorValue = str_replace('--', '_-', $operatorValue);
             break;
         case 'washxmlcdata':
             /// @todo
             eZDebug::writeWarning('Template operator washxmlcdata not yet implemented, it should not be used!', __METHOD__);
             break;
         case 'xsdtype':
             $operatorValue = ggWSDLParser::phpType2xsdType($operatorValue, $namedParameters['targetprefix'], $namedParameters['xsdprefix'], $namedParameters['soapencprefix']);
             break;
         case 'classInspect':
             $operatorValue = ggeZWebservices::classInspect($operatorValue);
             break;
     }
 }
Beispiel #27
0
 /**
  * @param string $filename
  * @return ezdbiSchemaChecks
  *
  * @todo manage better ini reading to allow inis outside of standard locations
  */
 public function parseFile($filename)
 {
     $ini = eZINI::instance($filename);
     $checks = new ezdbiSchemaChecks();
     foreach ($ini->group('ForeignKeys') as $table => $value) {
         if (!is_array($value)) {
             eZDebug::writeWarning("Error in ini file {$filename}, var. {$table} is not an array", __METHOD__);
             continue;
         }
         foreach ($value as $def) {
             $def = explode($this->token, $def);
             if (count($def) >= 3) {
                 $checks->addForeignKey($table, $def[0], $def[1], $def[2], isset($def[3]) ? $def[3] : null);
             } else {
                 eZDebug::writeWarning("Error in ini file {$filename}, line in var. {$table} is not correct", __METHOD__);
             }
         }
     }
     foreach ($ini->group('CustomQueries') as $name => $def) {
         $checks->addQuery($def['sql'], str_replace('_', ' ', $name), @$def['description']);
     }
     return $checks;
 }
Beispiel #28
0
 /**
  * Provides suggestion results when adding tags to object
  *
  * @static
  *
  * @param array $args
  *
  * @return array
  */
 public static function suggest($args)
 {
     $http = eZHTTPTool::instance();
     $searchEngine = eZINI::instance()->variable('SearchSettings', 'SearchEngine');
     if (!class_exists('eZSolr') || $searchEngine != 'ezsolr') {
         return array('status' => 'success', 'message' => '', 'tags' => array());
     }
     $tagIDs = $http->postVariable('tag_ids', '');
     if (empty($tagIDs)) {
         return array('status' => 'success', 'message' => '', 'tags' => array());
     }
     $tagIDs = array_values(array_unique(explode('|#', $tagIDs)));
     $solrSearch = new eZSolr();
     $params = array('SearchOffset' => 0, 'SearchLimit' => 0, 'Facet' => array(array('field' => 'ezf_df_tag_ids', 'limit' => 5 + count($tagIDs), 'mincount' => 1)), 'Filter' => array('ezf_df_tag_ids' => implode(' OR ', $tagIDs)), 'QueryHandler' => 'ezpublish', 'AsObjects' => false);
     $searchResult = $solrSearch->search('', $params);
     if (!isset($searchResult['SearchExtras']) || !$searchResult['SearchExtras'] instanceof ezfSearchResultInfo) {
         eZDebug::writeWarning('There was an error fetching tag suggestions from Solr. Maybe server is not running or using unpatched schema?', __METHOD__);
         return array('status' => 'success', 'message' => '', 'tags' => array());
     }
     $facetResult = $searchResult['SearchExtras']->attribute('facet_fields');
     if (!is_array($facetResult) || !is_array($facetResult[0]['nameList'])) {
         eZDebug::writeWarning('There was an error fetching tag suggestions from Solr. Maybe server is not running or using unpatched schema?', __METHOD__);
         return array('status' => 'success', 'message' => '', 'tags' => array());
     }
     $facetResult = array_values($facetResult[0]['nameList']);
     $tagsToSuggest = array();
     foreach ($facetResult as $result) {
         if (!in_array($result, $tagIDs)) {
             $tagsToSuggest[] = $result;
         }
     }
     if (empty($tagsToSuggest)) {
         return array('status' => 'success', 'message' => '', 'tags' => array());
     }
     return self::generateOutput(array('id' => array($tagsToSuggest)), 0, false, $http->postVariable('locale', ''));
 }
 }
 $fe_array_keys_614401abe4850022cf155f1d2dde8ff4_4 = is_array($fe_array_614401abe4850022cf155f1d2dde8ff4_4) ? array_keys($fe_array_614401abe4850022cf155f1d2dde8ff4_4) : array();
 $fe_n_items_614401abe4850022cf155f1d2dde8ff4_4 = count($fe_array_keys_614401abe4850022cf155f1d2dde8ff4_4);
 $fe_n_items_processed_614401abe4850022cf155f1d2dde8ff4_4 = 0;
 $fe_offset_614401abe4850022cf155f1d2dde8ff4_4 = 0;
 $fe_max_614401abe4850022cf155f1d2dde8ff4_4 = $fe_n_items_614401abe4850022cf155f1d2dde8ff4_4 - $fe_offset_614401abe4850022cf155f1d2dde8ff4_4;
 $fe_reverse_614401abe4850022cf155f1d2dde8ff4_4 = false;
 if ($fe_offset_614401abe4850022cf155f1d2dde8ff4_4 < 0 || $fe_offset_614401abe4850022cf155f1d2dde8ff4_4 >= $fe_n_items_614401abe4850022cf155f1d2dde8ff4_4) {
     $fe_offset_614401abe4850022cf155f1d2dde8ff4_4 = $fe_offset_614401abe4850022cf155f1d2dde8ff4_4 < 0 ? 0 : $fe_n_items_614401abe4850022cf155f1d2dde8ff4_4;
     if ($fe_n_items_614401abe4850022cf155f1d2dde8ff4_4 || $fe_offset_614401abe4850022cf155f1d2dde8ff4_4 < 0) {
         eZDebug::writeWarning("Invalid 'offset' parameter specified: '{$fe_offset_614401abe4850022cf155f1d2dde8ff4_4}'. Array count: {$fe_n_items_614401abe4850022cf155f1d2dde8ff4_4}");
     }
 }
 if ($fe_max_614401abe4850022cf155f1d2dde8ff4_4 < 0 || $fe_offset_614401abe4850022cf155f1d2dde8ff4_4 + $fe_max_614401abe4850022cf155f1d2dde8ff4_4 > $fe_n_items_614401abe4850022cf155f1d2dde8ff4_4) {
     if ($fe_max_614401abe4850022cf155f1d2dde8ff4_4 < 0) {
         eZDebug::writeWarning("Invalid 'max' parameter specified: {$fe_max_614401abe4850022cf155f1d2dde8ff4_4}");
     }
     $fe_max_614401abe4850022cf155f1d2dde8ff4_4 = $fe_n_items_614401abe4850022cf155f1d2dde8ff4_4 - $fe_offset_614401abe4850022cf155f1d2dde8ff4_4;
 }
 if ($fe_reverse_614401abe4850022cf155f1d2dde8ff4_4) {
     $fe_first_val_614401abe4850022cf155f1d2dde8ff4_4 = $fe_n_items_614401abe4850022cf155f1d2dde8ff4_4 - 1 - $fe_offset_614401abe4850022cf155f1d2dde8ff4_4;
     $fe_last_val_614401abe4850022cf155f1d2dde8ff4_4 = 0;
 } else {
     $fe_first_val_614401abe4850022cf155f1d2dde8ff4_4 = $fe_offset_614401abe4850022cf155f1d2dde8ff4_4;
     $fe_last_val_614401abe4850022cf155f1d2dde8ff4_4 = $fe_n_items_614401abe4850022cf155f1d2dde8ff4_4 - 1;
 }
 // foreach
 for ($fe_i_614401abe4850022cf155f1d2dde8ff4_4 = $fe_first_val_614401abe4850022cf155f1d2dde8ff4_4; $fe_n_items_processed_614401abe4850022cf155f1d2dde8ff4_4 < $fe_max_614401abe4850022cf155f1d2dde8ff4_4 && ($fe_reverse_614401abe4850022cf155f1d2dde8ff4_4 ? $fe_i_614401abe4850022cf155f1d2dde8ff4_4 >= $fe_last_val_614401abe4850022cf155f1d2dde8ff4_4 : $fe_i_614401abe4850022cf155f1d2dde8ff4_4 <= $fe_last_val_614401abe4850022cf155f1d2dde8ff4_4); $fe_reverse_614401abe4850022cf155f1d2dde8ff4_4 ? $fe_i_614401abe4850022cf155f1d2dde8ff4_4-- : $fe_i_614401abe4850022cf155f1d2dde8ff4_4++) {
     $fe_key_614401abe4850022cf155f1d2dde8ff4_4 = $fe_array_keys_614401abe4850022cf155f1d2dde8ff4_4[$fe_i_614401abe4850022cf155f1d2dde8ff4_4];
     $fe_val_614401abe4850022cf155f1d2dde8ff4_4 = $fe_array_614401abe4850022cf155f1d2dde8ff4_4[$fe_key_614401abe4850022cf155f1d2dde8ff4_4];
     $vars[$rootNamespace]['latest_node'] = $fe_val_614401abe4850022cf155f1d2dde8ff4_4;
 }
 $fe_array_keys_f7d54e3bf684e011bf56b2b03b8f70fb_15 = is_array($fe_array_f7d54e3bf684e011bf56b2b03b8f70fb_15) ? array_keys($fe_array_f7d54e3bf684e011bf56b2b03b8f70fb_15) : array();
 $fe_n_items_f7d54e3bf684e011bf56b2b03b8f70fb_15 = count($fe_array_keys_f7d54e3bf684e011bf56b2b03b8f70fb_15);
 $fe_n_items_processed_f7d54e3bf684e011bf56b2b03b8f70fb_15 = 0;
 $fe_offset_f7d54e3bf684e011bf56b2b03b8f70fb_15 = 0;
 $fe_max_f7d54e3bf684e011bf56b2b03b8f70fb_15 = $fe_n_items_f7d54e3bf684e011bf56b2b03b8f70fb_15 - $fe_offset_f7d54e3bf684e011bf56b2b03b8f70fb_15;
 $fe_reverse_f7d54e3bf684e011bf56b2b03b8f70fb_15 = false;
 if ($fe_offset_f7d54e3bf684e011bf56b2b03b8f70fb_15 < 0 || $fe_offset_f7d54e3bf684e011bf56b2b03b8f70fb_15 >= $fe_n_items_f7d54e3bf684e011bf56b2b03b8f70fb_15) {
     $fe_offset_f7d54e3bf684e011bf56b2b03b8f70fb_15 = $fe_offset_f7d54e3bf684e011bf56b2b03b8f70fb_15 < 0 ? 0 : $fe_n_items_f7d54e3bf684e011bf56b2b03b8f70fb_15;
     if ($fe_n_items_f7d54e3bf684e011bf56b2b03b8f70fb_15 || $fe_offset_f7d54e3bf684e011bf56b2b03b8f70fb_15 < 0) {
         eZDebug::writeWarning("Invalid 'offset' parameter specified: '{$fe_offset_f7d54e3bf684e011bf56b2b03b8f70fb_15}'. Array count: {$fe_n_items_f7d54e3bf684e011bf56b2b03b8f70fb_15}");
     }
 }
 if ($fe_max_f7d54e3bf684e011bf56b2b03b8f70fb_15 < 0 || $fe_offset_f7d54e3bf684e011bf56b2b03b8f70fb_15 + $fe_max_f7d54e3bf684e011bf56b2b03b8f70fb_15 > $fe_n_items_f7d54e3bf684e011bf56b2b03b8f70fb_15) {
     if ($fe_max_f7d54e3bf684e011bf56b2b03b8f70fb_15 < 0) {
         eZDebug::writeWarning("Invalid 'max' parameter specified: {$fe_max_f7d54e3bf684e011bf56b2b03b8f70fb_15}");
     }
     $fe_max_f7d54e3bf684e011bf56b2b03b8f70fb_15 = $fe_n_items_f7d54e3bf684e011bf56b2b03b8f70fb_15 - $fe_offset_f7d54e3bf684e011bf56b2b03b8f70fb_15;
 }
 if ($fe_reverse_f7d54e3bf684e011bf56b2b03b8f70fb_15) {
     $fe_first_val_f7d54e3bf684e011bf56b2b03b8f70fb_15 = $fe_n_items_f7d54e3bf684e011bf56b2b03b8f70fb_15 - 1 - $fe_offset_f7d54e3bf684e011bf56b2b03b8f70fb_15;
     $fe_last_val_f7d54e3bf684e011bf56b2b03b8f70fb_15 = 0;
 } else {
     $fe_first_val_f7d54e3bf684e011bf56b2b03b8f70fb_15 = $fe_offset_f7d54e3bf684e011bf56b2b03b8f70fb_15;
     $fe_last_val_f7d54e3bf684e011bf56b2b03b8f70fb_15 = $fe_n_items_f7d54e3bf684e011bf56b2b03b8f70fb_15 - 1;
 }
 // foreach
 for ($fe_i_f7d54e3bf684e011bf56b2b03b8f70fb_15 = $fe_first_val_f7d54e3bf684e011bf56b2b03b8f70fb_15; $fe_n_items_processed_f7d54e3bf684e011bf56b2b03b8f70fb_15 < $fe_max_f7d54e3bf684e011bf56b2b03b8f70fb_15 && ($fe_reverse_f7d54e3bf684e011bf56b2b03b8f70fb_15 ? $fe_i_f7d54e3bf684e011bf56b2b03b8f70fb_15 >= $fe_last_val_f7d54e3bf684e011bf56b2b03b8f70fb_15 : $fe_i_f7d54e3bf684e011bf56b2b03b8f70fb_15 <= $fe_last_val_f7d54e3bf684e011bf56b2b03b8f70fb_15); $fe_reverse_f7d54e3bf684e011bf56b2b03b8f70fb_15 ? $fe_i_f7d54e3bf684e011bf56b2b03b8f70fb_15-- : $fe_i_f7d54e3bf684e011bf56b2b03b8f70fb_15++) {
     $fe_key_f7d54e3bf684e011bf56b2b03b8f70fb_15 = $fe_array_keys_f7d54e3bf684e011bf56b2b03b8f70fb_15[$fe_i_f7d54e3bf684e011bf56b2b03b8f70fb_15];
     $fe_val_f7d54e3bf684e011bf56b2b03b8f70fb_15 = $fe_array_f7d54e3bf684e011bf56b2b03b8f70fb_15[$fe_key_f7d54e3bf684e011bf56b2b03b8f70fb_15];
     $vars[$rootNamespace]['relation_id_array'] = $fe_val_f7d54e3bf684e011bf56b2b03b8f70fb_15;