コード例 #1
0
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhchat/listchatconfig.tpl.php');
if ($currentUser->hasAccessTo('lhchat', 'administrateconfig')) {
    if (isset($_POST['UpdateConfig'])) {
        foreach (erLhcoreClassModelChatConfig::getItems() as $item) {
            $ConfigData = erLhcoreClassModelChatConfig::fetch($item->identifier);
            switch ($ConfigData->type) {
                case erLhcoreClassModelChatConfig::SITE_ACCESS_PARAM_ON:
                    $data = array();
                    foreach (erConfigClassLhConfig::getInstance()->getSetting('site', 'available_site_access') as $siteaccess) {
                        $data[$siteaccess] = $_POST[$item->identifier . 'Value' . $siteaccess];
                    }
                    $ConfigData->value = serialize($data);
                    break;
                case erLhcoreClassModelChatConfig::SITE_ACCESS_PARAM_OFF:
                    $ConfigData->value = isset($_POST[$item->identifier . 'ValueParam']) ? $_POST[$item->identifier . 'ValueParam'] : 0;
                    break;
                default:
                    break;
            }
            $ConfigData->saveThis();
        }
        // Cleanup cache to recompile templates etc.
        $CacheManager = erConfigClassLhCacheConfig::getInstance();
        $CacheManager->expireCache();
        $tpl->set('updated', 'done');
    }
}
$tpl->set('currentUser', $currentUser);
$Result['content'] = $tpl->fetch();
コード例 #2
0
<?php

// php cron.php -s site_admin -c cron/util/generate_translation_file
$arrayTranslationsProcess = array();
$items = erLhcoreClassModelChatConfig::getItems(array('limit' => 500, 'filter' => array('hidden' => 0)));
foreach ($items as $item) {
    $arrayTranslationsProcess['listchatconfig'][] = $item->explain;
}
$filesToCheck = ezcBaseFile::findRecursive('.', array('@\\.php$@'), array('@/./albums|./ezcomponents|./doc|./translations|./var|./extension|./cache|./bin|./Zend|./setttings|./pos/@'));
$locale = 'en_EN';
foreach ($filesToCheck as $filePath) {
    $contentFile = file_get_contents($filePath);
    $Matches = array();
    preg_match_all('/<\\?php echo erTranslationClassLhTranslation::getInstance\\(\\)->getTranslation\\(\'(.*?)\',\'(.*?)\'\\)(.*?)\\?\\>/i', $contentFile, $Matches);
    foreach ($Matches[1] as $key => $section) {
        if (!isset($arrayTranslationsProcess[$section])) {
            $arrayTranslationsProcess[$section] = array();
        }
        if (!in_array($Matches[2][$key], $arrayTranslationsProcess[$section])) {
            $arrayTranslationsProcess[$section][] = $Matches[2][$key];
        }
        $contentFile = str_replace($Matches[0][$key], '', $contentFile);
    }
    $Matches = array();
    preg_match_all('/erTranslationClassLhTranslation::getInstance\\(\\)->getTranslation\\(\'(.*?)\',\'(.*?)\'\\)/i', $contentFile, $Matches);
    foreach ($Matches[1] as $key => $section) {
        if (!isset($arrayTranslationsProcess[$section])) {
            $arrayTranslationsProcess[$section] = array();
        }
        if (!in_array($Matches[2][$key], $arrayTranslationsProcess[$section])) {
            $arrayTranslationsProcess[$section][] = $Matches[2][$key];