Пример #1
0
<?php

/**
 * Global Configuration Override
 *
 * You can use this file for overriding configuration values from modules, etc.
 * You would place values in here that are agnostic to the environment and not * sensitive to security.
 * * @NOTE: In practice, this file will typically be INCLUDED in your source
 * control, so do not include passwords or other sensitive information in this
 * file.
 */
return array('db' => array('driver' => 'Pdo', 'username' => 'root', 'password' => 'root', 'dsn' => 'mysql:dbname=lsproduccion;host=127.0.0.1', 'driver_options' => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'')), 'solr' => array('host' => '127.0.0.1', 'port' => '8983', 'folder' => '/solr'), 'facebook' => array('appId' => '750432834973806', 'secret' => '2e07ad7ea83185f20da1ca546fee0720'), 'host' => array('base' => 'http://acomer.com:81', 'static' => 'http://acomer.com:81', 'images' => 'http://acomer.com:81/imagenes', 'img' => 'http://acomer.com:81/img', 'ruta' => 'http://acomer.com:81', 'version' => 1), 'upload' => array('images' => APPLICATION_PATH . '/public/imagenes'), 'data' => array('busqueda' => APPLICATION_PATH . '/data/busqueda'), 'verifica' => array('img' => APPLICATION_PATH . '/public/img'), 'mail' => array('transport' => array('options' => array('host' => 'smtp.innovationssystems.com', 'connection_class' => 'login', 'connection_config' => array('username' => '*****@*****.**', 'password' => 'L1st@d3ls@b0r')))), 'service_manager' => array('factories' => array('Zend\\Db\\TableGateway\\TableGateway' => 'Zend\\Db\\Adapter\\AdapterServiceFactory', 'Zend\\Cache\\Storage\\Filesystem' => function ($sm) {
    $cache = Zend\Cache\StorageFactory::factory(array('adapter' => 'filesystem', 'plugins' => array('exception_handler' => array('throw_exceptions' => false), 'serializer')));
    $cache->setOptions(array('cache_dir' => './data/cache', 'ttl' => 5 * 60));
    return $cache;
})), 'module_layouts' => array('Application' => array('default' => 'layout/layout-portada2', 'index' => 'layout/layout-portada2', 'terminos' => 'layout/layout-portada2', 'contactenos' => 'layout/layout-portada2', 'nosotros' => 'layout/layout-portada2', 'solicita' => 'layout/layout-portada2', 'ver' => 'layout/layout-portada2', 'detalleubicacion' => 'layout/layout-portada2'), 'Local' => array('index' => 'layout/layout-administrador'), 'Platos' => array('index' => 'layout/layout-administrador', 'verplatos' => 'layout/layout-portada2'), 'Usuario' => array('index' => 'layout/layout-administrador', 'comentarios' => 'layout/layout-administrador'), 'Restaurante' => array('default' => 'layout/layout-administrador', 'index' => 'layout/layout-administrador')));
Пример #2
0
 /**
  * Include the good language dict.
  *
  * Get the default language from current user in $_SESSION["glpilanguage"].
  * And load the dict that correspond.
  *
  * @param $forcelang Force to load a specific lang (default '')
  *
  * @return nothing (make an include)
  **/
 static function loadLanguage($forcelang = '')
 {
     global $LANG, $CFG_GLPI, $TRANSLATE;
     $file = "";
     if (!isset($_SESSION["glpilanguage"])) {
         if (isset($CFG_GLPI["language"])) {
             // Default config in GLPI >= 0.72
             $_SESSION["glpilanguage"] = $CFG_GLPI["language"];
         } else {
             if (isset($CFG_GLPI["default_language"])) {
                 // Default config in GLPI < 0.72 : keep it for upgrade process
                 $_SESSION["glpilanguage"] = $CFG_GLPI["default_language"];
             } else {
                 $_SESSION["glpilanguage"] = "en_GB";
             }
         }
     }
     $trytoload = $_SESSION["glpilanguage"];
     // Force to load a specific lang
     if (!empty($forcelang)) {
         $trytoload = $forcelang;
     }
     // If not set try default lang file
     if (empty($trytoload)) {
         $trytoload = $CFG_GLPI["language"];
     }
     if (isset($CFG_GLPI["languages"][$trytoload])) {
         $newfile = "/locales/" . $CFG_GLPI["languages"][$trytoload][1];
     }
     if (empty($newfile) || !is_file(GLPI_ROOT . $newfile)) {
         $newfile = "/locales/en_GB.mo";
     }
     $TRANSLATE = new Zend\I18n\Translator\Translator();
     try {
         $cache = Zend\Cache\StorageFactory::factory(array('adapter' => 'apc'));
         $TRANSLATE->setCache($cache);
     } catch (Zend\Cache\Exception\ExtensionNotLoadedException $e) {
         // ignore when APC not available
         // toolbox::logDebug($e->getMessage());
     }
     $TRANSLATE->addTranslationFile('gettext', GLPI_ROOT . $newfile, 'glpi', $trytoload);
     // Test APC version, if is enable with special check for cli
     //      if (version_compare(phpversion('apc'), '3.1.6') >= 0
     //          && ini_get('apc.enabled')
     //          && (!isCommandLine() || ini_get('apc.enable_cli'))) { // Try from APC cache
     ////          $key       = "glpi".sha1_file(GLPI_ROOT.$newfile); // Use content to detect changes
     //         $cache = Zend\Cache\StorageFactory::factory(array('adapter' => 'apc',
     //                                                           'plugins' => array('exception_handler'
     //                                                                               => array('throw_exceptions'
     //                                                                                         => false))));
     //         $TRANSLATE->setCache($cache);
     //         $TRANSLATE->addTranslationFile('gettext', GLPI_ROOT.$newfile, 'glpi', $trytoload);
     //
     //      } else if (function_exists('xcache_get') && !isCommandLine()) { // Try from XCache
     //         // TODO : use xcache adapter of Zend when available (2.1)
     //         // see http://framework.zend.com/issues/browse/ZF2-543
     //         $key = "glpi".sha1_file(GLPI_ROOT.$newfile); // Use content to detect changes
     //         if (@xcache_isset($key)) {
     //            $TRANSLATE = unserialize(xcache_get($key));
     //         }
     //         if (!$TRANSLATE) {
     //            $TRANSLATE = new Zend\I18n\Translator\Translator;
     //            $TRANSLATE->addTranslationFile('gettext', GLPI_ROOT.$newfile, 'glpi', $trytoload);
     //         }
     //         $tmp = xcache_set($key, serialize($TRANSLATE));
     //      } else {
     //         $TRANSLATE = new Zend\I18n\Translator\Translator;
     //         $TRANSLATE->addTranslationFile('gettext', GLPI_ROOT.$newfile, 'glpi', $trytoload);
     //      }
     // Load plugin dicts
     if (isset($_SESSION['glpi_plugins']) && is_array($_SESSION['glpi_plugins'])) {
         if (count($_SESSION['glpi_plugins'])) {
             foreach ($_SESSION['glpi_plugins'] as $plug) {
                 Plugin::loadLang($plug, $forcelang, $trytoload);
             }
         }
     }
     // TRANSLATION_MODE deleted : maybe find another solution ?
     // Debug display lang element with item
     //       if ($_SESSION['glpi_use_mode'] == Session::TRANSLATION_MODE && $CFG_GLPI["debug_lang"]) {
     //          foreach ($LANG as $module => $tab) {
     //             foreach ($tab as $num => $val) {
     //                $LANG[$module][$num] = "".$LANG[$module][$num].
     //                                       "/<span style='font-size:12px; color:red;'>$module/$num</span>";
     //             }
     //          }
     //       }
     $TRANSLATE->setLocale($trytoload);
     return $trytoload;
 }
Пример #3
0
 /**
  * Include the good language dict.
  *
  * Get the default language from current user in $_SESSION["glpilanguage"].
  * And load the dict that correspond.
  *
  * @param $forcelang Force to load a specific lang (default '')
  *
  * @return nothing (make an include)
  **/
 static function loadLanguage($forcelang = '')
 {
     global $LANG, $CFG_GLPI, $TRANSLATE;
     $file = "";
     if (!isset($_SESSION["glpilanguage"])) {
         if (isset($CFG_GLPI["language"])) {
             // Default config in GLPI >= 0.72
             $_SESSION["glpilanguage"] = $CFG_GLPI["language"];
         } else {
             if (isset($CFG_GLPI["default_language"])) {
                 // Default config in GLPI < 0.72 : keep it for upgrade process
                 $_SESSION["glpilanguage"] = $CFG_GLPI["default_language"];
             } else {
                 $_SESSION["glpilanguage"] = "en_GB";
             }
         }
     }
     $trytoload = $_SESSION["glpilanguage"];
     // Force to load a specific lang
     if (!empty($forcelang)) {
         $trytoload = $forcelang;
     }
     // If not set try default lang file
     if (empty($trytoload)) {
         $trytoload = $CFG_GLPI["language"];
     }
     if (isset($CFG_GLPI["languages"][$trytoload])) {
         $newfile = "/locales/" . $CFG_GLPI["languages"][$trytoload][1];
     }
     if (empty($newfile) || !is_file(GLPI_ROOT . $newfile)) {
         $newfile = "/locales/en_GB.mo";
     }
     if (isset($CFG_GLPI["languages"][$trytoload][5])) {
         $_SESSION['glpipluralnumber'] = $CFG_GLPI["languages"][$trytoload][5];
     }
     $TRANSLATE = new Zend\I18n\Translator\Translator();
     try {
         $cache = Zend\Cache\StorageFactory::factory(array('adapter' => 'apc'));
         $TRANSLATE->setCache($cache);
     } catch (Zend\Cache\Exception\ExtensionNotLoadedException $e) {
         // ignore when APC not available
         // toolbox::logDebug($e->getMessage());
     }
     $TRANSLATE->addTranslationFile('gettext', GLPI_ROOT . $newfile, 'glpi', $trytoload);
     // Load plugin dicts
     if (isset($_SESSION['glpi_plugins']) && is_array($_SESSION['glpi_plugins'])) {
         if (count($_SESSION['glpi_plugins'])) {
             foreach ($_SESSION['glpi_plugins'] as $plug) {
                 Plugin::loadLang($plug, $forcelang, $trytoload);
             }
         }
     }
     // TRANSLATION_MODE deleted : maybe find another solution ?
     // Debug display lang element with item
     //       if ($_SESSION['glpi_use_mode'] == Session::TRANSLATION_MODE && $CFG_GLPI["debug_lang"]) {
     //          foreach ($LANG as $module => $tab) {
     //             foreach ($tab as $num => $val) {
     //                $LANG[$module][$num] = "".$LANG[$module][$num].
     //                                       "/<span style='font-size:12px; color:red;'>$module/$num</span>";
     //             }
     //          }
     //       }
     $TRANSLATE->setLocale($trytoload);
     return $trytoload;
 }
<?php

require '../vendor/autoload.php';
$converter = new CurrencyConverter\CurrencyConverter();
// Via factory:
$zendCache = Zend\Cache\StorageFactory::factory(array('adapter' => array('name' => 'Filesystem', 'options' => array('ttl' => 10, 'cache_dir' => __DIR__ . '/cache'))));
$cacheAdapter = new CurrencyConverter\Cache\Adapter\ZendAdapter($zendCache);
$converter->setCacheAdapter($cacheAdapter);
echo $converter->convert('USD', 'NPR');
Пример #5
0
<?php

return array('factories' => array('GeonamesServer\\Service\\Installer' => function ($sm) {
    $config = $sm->get('config');
    return new GeonamesServer\Service\Installer($config['geonames_server']['installer'], $sm);
}, 'GeonamesServer\\Service\\Elasticsearch' => function ($sm) {
    $config = $sm->get('config');
    return new GeonamesServer\Service\Elasticsearch($config['geonames_server']['elasticsearch']);
}, 'geonamesCache' => function ($sm) {
    return Zend\Cache\StorageFactory::factory(array('adapter' => array('name' => 'filesystem', 'options' => array('cache_dir' => $sm->get('GeonamesServer\\Service\\Installer')->getDataLocalPath() . DS . 'cache')), 'plugins' => array('exception_handler' => array('throw_exceptions' => false), 'Serializer')));
}));
Пример #6
0
    throw new Exception('Config file is wrong', 1512250909);
}
$config = new Zend\Config\Config($configArray);
$db = new Zend\Db\Adapter\Adapter($config->database->toArray());
$baktrace = debug_backtrace();
if (sizeof($baktrace) < 1) {
    throw new Exception('No backtrace available to create base path', 0710141057);
}
$db->baseDir = dirname($baktrace[0]['file']) . DIRECTORY_SEPARATOR;
$db->baseDir = str_replace('/shell/', '/', $db->baseDir);
try {
    $db->cache = Zend\Cache\StorageFactory::factory($config->cache->toArray());
} catch (\Exception $e) {
    if (preg_match('/Cache directory \'(.*)\' not found or not a directory/', $e->getMessage(), $catches)) {
        mkdir($catches[1]);
        $db->cache = Zend\Cache\StorageFactory::factory($config->cache->toArray());
    } else {
        throw $e;
    }
}
$db->config = $config;
require __DIR__ . '/../lib/crm/Autoload.php';
crm\Autoload::getInstance();
$template = new Template(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR, $config->template);
$template->setBlock('head', 'general/head.phtml');
$template->setBlock('header', 'general/header.phtml');
$template->setBlock('breadcrumbs', 'general/breadcrumbs.phtml');
$template->setBlock('navigation', 'general/navigation.phtml');
$template->setBlock('footer', 'general/footer.phtml');
$control = $template->createControl();
$control->setBaseDir(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'control');
<?php

return array('modules' => array('Admin', 'User', 'Home', 'RtHeadtitle', 'AcMailer'), 'module_listener_options' => array('module_paths' => array('./ad562ed675cf746e886308b57144220f8e_module', './ad562ed675cf746e886308b57144220f8e_vendor'), 'config_glob_paths' => array('ad562ed675cf746e886308b57144220f8e_config/autoload/{,*.}{global,local}.php')), 'service_manager' => array('factories' => array('ZendCacheStorageFactory' => function () {
    return Zend\Cache\StorageFactory::factory(array('adapter' => array('name' => 'filesystem', 'options' => array('dirLevel' => 2, 'cacheDir' => 'data/cache', 'dirPermission' => 0755, 'filePermission' => 0666, 'namespaceSeparator' => '-db-')), 'plugins' => array('serializer')));
}), 'aliases' => array('cache' => 'ZendCacheStorageFactory')));
Пример #8
0
<?php

return array('doctrine' => array('driver' => array('application_entities' => array('class' => 'Doctrine\\ORM\\Mapping\\Driver\\AnnotationDriver', 'cache' => 'array', 'paths' => array(__DIR__ . '/../src/Core/Entity')), 'orm_default' => array('drivers' => array('Core\\Entity' => 'application_entities')), 'cache' => 'Doctrine\\Common\\Cache\\ArrayCache'), 'paths' => array(__DIR__ . '/../src/Core/Entity')), 'view_helpers' => array('invokables' => array('session' => 'Core\\View\\Helper\\Session', 'AlertMessage' => 'Core\\View\\Helper\\Messages')), 'translator' => array('locale' => 'pt_BR', 'translation_file_patterns' => array(array('type' => 'phparray', 'base_dir' => __DIR__ . '/../language', 'pattern' => '%s.php'))), 'service_manager' => array('factories' => array('translator' => 'Zend\\I18n\\Translator\\TranslatorServiceFactory', 'Session' => function ($sm) {
    return new Zend\Session\Container('SysSession');
}, 'Core\\Service\\Auth\\System' => function ($sm) {
    return new Core\Service\Auth\System();
}, 'Cache' => function ($sm) {
    // incluindo o arquivo config para pegar o cache adapter
    $config = (include __DIR__ . '/../../../config/application.config.php');
    $cache = Zend\Cache\StorageFactory::factory(array('adapter' => array('name' => $config['cache']['adapter'], 'options' => array('ttl' => 1800, 'cacheDir' => __DIR__ . '/../../../data/cache')), 'plugins' => array('exception_handler' => array('throw_exceptions' => false), 'Serializer')));
    $cache->clearExpired();
    return $cache;
}, 'Zend\\Log' => function ($sm) {
    $today = date('Y-m-d');
    $log = new Zend\Log\Logger();
    $writer = new Zend\Log\Writer\Stream(__DIR__ . '/../../../data/logs/' . $today . '.log');
    $log->addWriter($writer);
    return $log;
}, 'Core\\Acl\\Builder' => function ($sm) {
    $builder = new Core\Acl\Builder();
    return $builder;
})));