protected function setUp() { $reader = new Zend\Config\Reader\Ini(); $config = $reader->fromFile(__DIR__ . '/HotelApiClient.ini'); $cfgApi = $config["apiclient"]; $this->apiClient = new HotelApiClient($cfgApi["url"], $cfgApi["apikey"], $cfgApi["sharedsecret"], new ApiVersion(ApiVersions::V1_0), $cfgApi["timeout"]); }
public function indexAction() { $reader = new \Zend\Config\Reader\Ini(); $reader->setNestSeparator('.'); /** default: '.' */ $configArray = $reader->fromFile(__DIR__ . '/config/ini/module.config.ini'); $configArray['view_manager']['template_path_stack'][] = __DIR__ . '/../view'; return $configArray; }
/** * @internal */ public function __invoke(\Interop\Container\ContainerInterface $container, $requestedName, array $options = null) { $applicationConfig = $container->get('ApplicationConfig'); if (isset($applicationConfig['Library\\UserConfig'])) { return $applicationConfig['Library\\UserConfig']; } else { $reader = new \Zend\Config\Reader\Ini(); return $reader->fromFile(getenv('BRAINTACLE_CONFIG') ?: \Library\Application::getPath('user_config/braintacle.ini')); } }
/** * @return array * * @throws ParsingException */ public function parse() { try { $parser = new \Zend\Config\Reader\Ini(); $config = $parser->fromFile($this->getFile()); } catch (RuntimeException $e) { throw new ParsingException("Cannot parse this file: " . $e->getMessage(), 0, $e); } return $config; }
/** * Initialize targets proxy * * @param String $configFile ConfigFile * * @return void */ public function initialize($configFile) { if (!$this->targetsProxy) { $_SERVER['REMOTE_ADDR'] = '1.1.1.1'; $iniReader = new \Zend\Config\Reader\Ini(); $config = new Config($iniReader->fromFile($configFile)); $serviceLocator = new ServiceManager(); $serviceLocator->setService('VuFind\\Config', $config); $this->targetsProxy = new TargetsProxy($config, new Logger(), new Request()); $this->targetsProxy->setSearchClass('Summon'); $this->targetsProxy->setServiceLocator($serviceLocator); } }
/** * Get the test application. * * @return Application */ public static function getApplication() { // Return the application immediately if already set. if (self::$application instanceof Application) { return self::$application; } $config = (require OMEKA_PATH . '/config/application.config.php'); $reader = new \Zend\Config\Reader\Ini(); $testConfig = ['connection' => $reader->fromFile(OMEKA_PATH . '/application/test/config/database.ini')]; $config = array_merge($config, $testConfig); self::$application = Application::init($config); return self::$application; }
/** * @see \TranslatorTools\I18n\Translator\Writer\FileWriterInterface::write() * @param array $aMessages * @param string $sFilename * @throws \InvalidArgumentException * @return \TranslatorTools\I18n\Translator\Writer\Ini */ public function write(array $aMessages, $sFilename) { $aTempMessages = array(); foreach ($aMessages as $sMessage => $sTranslation) { $aTempMessages[str_replace('"', '\'', $sMessage)] = str_replace('"', '\'', $sTranslation); } $aMessages = $aTempMessages; if (is_file($sFilename)) { if (!is_readable($sFilename)) { throw new \InvalidArgumentException(sprintf('Could not open file "%s" for writing', $sFilename)); } $oIniReader = new \Zend\Config\Reader\Ini(); $aMessagesNamespaced = $oIniReader->fromFile($sFilename); $aListMessages = isset($aMessagesNamespaced['translation']) ? $aMessagesNamespaced['translation'] : $aMessagesNamespaced; foreach ($aListMessages as $aMessage) { if (!is_array($aMessage) || count($aMessage) < 2) { /* TODO remove */ error_log('$aMessage : ' . print_r($aMessage, true)); throw new \InvalidArgumentException('Each INI row must be an array with message and translation'); } if (isset($aMessage['message']) && isset($aMessage['translation'])) { //Add message only if not given if (!isset($aMessages[$aMessage['message']])) { $aMessages[$aMessage['message']] = $aMessage['translation']; } continue; } //Add message only if not given $sMessage = array_shift($aMessage); if (!isset($aMessages[$sMessage])) { $aMessages[$sMessage] = array_shift($aMessage); } } } else { $aMessagesNamespaced = null; } //Sort messages ksort($aMessages); $aMessagesKeys = array_keys($aMessages); $aMessages = array_combine($aMessagesKeys, array_map(function ($sTranslation, $sMessage) { return array('message' => $sMessage, 'translation' => $sTranslation); }, $aMessages, $aMessagesKeys)); if (isset($aMessagesNamespaced['translation'])) { $aMessagesNamespaced['translation'] = $aMessages; } else { $aMessagesNamespaced = $aMessages; } $oIniWriter = new \Zend\Config\Writer\Ini(); $oIniWriter->toFile($sFilename, $aMessagesNamespaced); return $this; }
public function authenticate($username = null, $password = null) { if (self::$configFile === null) { throw SlimAuthException::configFileIsNotSet(); } //TODO check what Zend Exceptions may occour, if any, and enclose in SlimAuthException messages $configReader = new \Zend\Config\Reader\Ini(); $configData = $configReader->fromFile(self::$configFile); $config = new \Zend\Config\Config($configData, false); $options = $config->ldapauth->ldap->toArray(); $this->setOptions($options); $this->setUsername($username); $this->setPassword($password); return parent::authenticate(); }
public function test_Provider_Data_getConfig() { $_environment = "development"; if (isset($_ENV['APPLICATION_ENV']) and !empty($_ENV['APPLICATION_ENV'])) { $_environment = $_ENV['APPLICATION_ENV']; } $_zendConfigReader = new \Zend\Config\Reader\Ini(); $_configFileLocation = dirname(__FILE__) . "/config.ini"; try { $_configInformationFromIniFile = $_zendConfigReader->fromFile($_configFileLocation); } catch (\Zend\Config\Exception\RuntimeException $e) { throw new \Audith\Providers\Nexway\Exception\ConfigFileNotReadableException("Error reading INI file at location " . $_configFileLocation); } $config = $_configInformationFromIniFile[$_environment]; $this->assertNotEmpty($config['service']); self::$config = $config; }
public function index2Action() { $reader = new \Zend\Config\Reader\Ini(); // Cau hinh $reader->setNestSeparator('-'); $data = $reader->fromFile(__DIR__ . '/../../../config/ini/module.config.ini', true); $config = new \Zend\Config\Config(array(), true); $config->production = array(); $config->production->website = 'www.zend.vn'; $config->production->account = array(); $config->production->account->email = '*****@*****.**'; $config->production->account->port = 465; $writer = new \Zend\Config\Writer\Ini(); $writer->setNestSeparator('-'); $writer->toFile(__DIR__ . '/../../../config/ini/config.ini', $config); //return false; }
/** * Process data from the parsed ini file. * * @param array $data * @return array */ protected function process(array $data) { $data = $this->preProcessSectionInheritance($data); $config = parent::process($data); $config = $this->posProcessSectionInheritance($config); if (!is_null($this->filterSection)) { if (array_key_exists($this->filterSection, $config)) { return $config[$this->filterSection]; } else { return array(); } } return $config; }
public function index2Action() { echo __FILE__ . __METHOD__ . '<br/>'; $reader = new \Zend\Config\Reader\Ini(); $reader->setNestSeparator('.'); /** default: '.' */ $data = $reader->fromFile(__DIR__ . '/../../../config/ini/module.config.ini'); echo '<pre class="container">'; print_r($data); echo '</pre>'; /** Viết xuống file cấu hình */ // $config = new \Zend\Config\Config(array(), true); // $config->production = array(); // $config->production->website = '*****@*****.**'; // $config->production->account = array(); // $config->production->account->email = '*****@*****.**'; // $config->production->account->password = '******'; // // $writer = new \Zend\Config\Writer\Ini(); // $writer->setNestSeparator('-'); // $writer->toFile(__DIR__.'/../../../config/ini/config.ini', $config); return false; }
public function SendMail($sender, $emailDestino, $emailCC, $emailCCO, $emailTitulo, $emailCuerpo, $emailReplyTo = null, $files = null) { $reader = new \Zend\Config\Reader\Ini(); $config = $reader->fromFile('ini/config.ini'); $emailDestinatario_Defecto = ''; if (!empty($config['email']['destinatario_defecto'])) { $emailDestinatario_Defecto = $config['email']['destinatario_defecto']; } //end if $ini_email = $config['email'][$sender]; /** * This example shows making an SMTP connection with authentication. */ //SMTP needs accurate times, and the PHP time zone MUST be set //This should be done in your php.ini, but this is how to do it if you don't have access to that //date_default_timezone_set('Etc/UTC'); $PHPMailerApp = new PHPMailerApp(); //Create a new PHPMailer instance $mail = new \PHPMailer(); //Tell PHPMailer to use SMTP $mail->isSMTP(); //Enable SMTP debugging // 0 = off (for production use) // 1 = client messages // 2 = client and server messages $mail->SMTPDebug = $ini_email['SMTPDebug']; //Ask for HTML-friendly debug output $mail->Debugoutput = $ini_email['Debugoutput']; //Set the hostname of the mail server $mail->Host = $ini_email['Host']; //Set the SMTP port number - likely to be 25, 465 or 587 $mail->Port = $ini_email['Port']; //Whether to use SMTP authentication $mail->SMTPAuth = $ini_email['SMTPAuth']; $mail->SMTPSecure = $ini_email['SMTPSecure']; //Username to use for SMTP authentication $mail->Username = $ini_email['Username']; //Password to use for SMTP authentication $mail->Password = $ini_email['Password']; //Set who the message is to be sent from $mail->setFrom($ini_email['From']['email'], $ini_email['From']['name']); //Set an alternative reply-to address if (!empty($emailCC)) { if (is_array($emailCC)) { foreach ($emailCC as $email) { $mail->addCC($email, $email); } //end foreach } else { $mail->addCC($emailCC, $emailCC); } //end if } //end if if (!empty($emailCCO)) { if (is_array($emailCCO)) { foreach ($emailCCO as $email) { $mail->addBCC($email, $email); } //end foreach } else { $mail->addBCC($emailCCO, $emailCCO); } //end if } //end if if (!empty($emailReplyTo)) { $mail->addReplyTo($emailReplyTo, $emailReplyTo); } //end if //Set who the message is to be sent to if (!empty($emailDestinatario_Defecto)) { $mail->addAddress($emailDestinatario_Defecto, $emailDestinatario_Defecto); //die('paso01 *'.$emailDestinatario_Defecto); } else { if (is_array($emailDestino)) { foreach ($emailDestino as $email) { $mail->addAddress($email, $email); } //end foreach } else { $mail->addAddress($emailDestino, $emailDestino); } //end if //die('paso02 *'); } //end if //Set the subject line $mail->Subject = $emailTitulo; //Read an HTML message body from an external file, convert referenced images to embedded, //convert HTML into a basic plain-text alternative body //$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__)); $mail->msgHTML($emailCuerpo); //Replace the plain text body with one created manually $mail->AltBody = $emailCuerpo; //Attach an image file if (!empty($files)) { if (is_array($files)) { foreach ($files as $file) { $mail->addAttachment($file); } //end foreach } else { $mail->addAttachment($files); } //end if } //end if $mail->SMTPOptions = array('ssl' => array('verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true)); //send the message, check for errors if (!$mail->send()) { return "Mailer Error: " . $mail->ErrorInfo; } else { return "OK"; } //end if }
$modules[] = array_shift($moduleFiltered); } else { print "Invalid module name: {$module}\n"; exit(1); } } $modules = array_unique($modules); } else { // No module requested, test all modules $modules = $modulesAvailable; } // Compose list of database configurations to test $databases = array(); if ($opts->database) { // Get available sections $reader = new \Zend\Config\Reader\Ini(); $config = $reader->fromFile(__DIR__ . '/../user_config/braintacle.ini'); // Remove reserved sections unset($config['database']); // Production database cannot be used unset($config['debug']); if (is_string($opts->database)) { // Comma-separated list: validate and add each requested section foreach (explode(',', $opts->database) as $section) { if (!isset($section, $config)) { print "Invalid config section: {$section}\n"; exit(1); } $databases[$section] = $config[$section]; } } else {
function enviarEmailAdjuntoPDF($pedido_cab_id) { $reader = new \Zend\Config\Reader\Ini(); $config = $reader->fromFile('ini/config.ini'); /* var_Dump($config); die(); */ $PedidoCabDAO = new PedidoCabDAO(); $ClienteDAO = new ClienteDAO(); $PedidoCabDAO->setEntityManager($this->getEntityManager()); $ClienteDAO->setEntityManager($this->getEntityManager()); //Consulta el registro de la cabecera del Pedido $PedidoCabData = $PedidoCabDAO->consultar($pedido_cab_id); //Consultar Registro Cliente $reg_cliente = $ClienteDAO->consultar($PedidoCabData->getClienteId(), \Application\Constants\ResultType::MATRIZ); //Generar PDF $salida_archivo_pdf = $config['ruta_archivos']['tmp'] . 'order' . $pedido_cab_id . ".pdf"; $this->generarPDF($pedido_cab_id, $salida_archivo_pdf); //Envia Email $CorreoElectronico = new CorreoElectronico(); $destinatario = $reg_cliente['email']; $cc = $reg_cliente['usuario_vendedor_email']; $titulo = 'Agrinag Order #' . \Application\Classes\Mascara::getNroPedidoFormateado($pedido_cab_id, $config['pedido']['mascara']) . ' - ' . ucwords($reg_cliente['nombre']); $html = 'Processed by: Web'; $resultadoEnvio = $CorreoElectronico->SendMail('order', $destinatario, $cc, null, $titulo, $html, $cc, $salida_archivo_pdf); //elimina el archivo unlink($salida_archivo_pdf); }
<?php $ini = new Zend\Config\Reader\Ini(); $iniConfiguration = $ini->setNestSeparator('::')->fromFile(__DIR__ . '/' . 'm.ini'); return $iniConfiguration;
<?php /** * Created by IntelliJ IDEA. * User: Armando Reyna * Date: 16/04/2015 * Time: 09:13 AM */ $reader = new Zend\Config\Reader\Ini(); $config = $reader->fromFile('config/autoload/config.ini'); $environment = $config['environment']; $config = $config[$environment]; return array('db' => array('driver' => 'pdo', 'dsn' => 'sqlsrv:database=' . $config['pronoi']['db'] . ';Server=' . $config['pronoi']['server'], 'username' => $config['pronoi']['user'], 'password' => $config['pronoi']['pass'], 'driver_options' => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'')), 'service_manager' => array('factories' => array('Zend\\Db\\Adapter\\Adapter' => 'Zend\\Db\\Adapter\\AdapterServiceFactory')));
public function verArchivoSkypeCajasAction() { $ArchivoPlugin = $this->ArchivoPlugin(); $reader = new \Zend\Config\Reader\Ini(); $config = $reader->fromFile('ini/config.ini'); $request = $this->getRequest(); $file_name = $request->getQuery('file_name', ""); $directorio = $config['ruta_archivos']['public']['descarga']; $nombre_archivo = $directorio . $file_name; $ArchivoPlugin->downloadForce($nombre_archivo); exit; }
<?php $configFile = __DIR__ . '/../../module/Zf2f/config/labs_and_classes.ini'; $configReader = new Zend\Config\Reader\Ini(); $config = $configReader->fromFile($configFile); return ['service_manager' => ['services' => $config]]; /* return [ 'service_manager' => [ 'services' => [ 'zf2f-config' => [ 'class' => [ '20130722' => '20130722', ], 'notes' => [ 'mod_02' => 'Module 2 (Project) LAB SETUP NOTES', 'mod_03' => 'Module 3 (Events) LAB SETUP NOTES', 'mod_04' => 'Module 4 (Services) LAB SETUP NOTES', ], 'solutions' => [ 'mod_03' => 'Module 3 (Events) LAB SOLUTIONS', 'mod_04' => 'Module 4 (Services) LAB SOLUTIONS', ], ], ], ], ]; */
*****************************************/ $sImporterPath = dirname(__FILE__); chdir($sImporterPath); $sScriptPath = substr($sImporterPath, 0, strrpos($sImporterPath, DIRECTORY_SEPARATOR)); $sIncludePath = $sImporterPath . PATH_SEPARATOR . $sScriptPath . PATH_SEPARATOR; set_include_path(get_include_path() . PATH_SEPARATOR . $sIncludePath); require 'Zend/Loader/StandardAutoloader.php'; $autoloader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true)); $sImporterClassNameSpacePath = $sImporterPath . DIRECTORY_SEPARATOR . 'Classes'; $sInstallerNameSpacePath = $sScriptPath . DIRECTORY_SEPARATOR . 'installer' . DIRECTORY_SEPARATOR . 'Reports' . DIRECTORY_SEPARATOR; $autoloader->registerNamespace('Classes', $sImporterClassNameSpacePath, $sInstallerNameSpacePath); $autoloader->register(); /***************************************** * LOAD CONFIGURATION *****************************************/ $oConfig = new Zend\Config\Reader\Ini(); $oConfig->setNestSeparator(' : '); $aConfig = $oConfig->fromFile('config.ini.php'); // First attempt to load relevant section based on host name if (isset($_SERVER['HTTP_HOST'])) { $sServerHost = $_SERVER['HTTP_HOST']; foreach ($aConfig as $sSection => $aConfigSection) { if (isset($aConfigSection['common']) and isset($aConfigSection['common']['host'])) { $sHost = $aConfigSection['common']['host']; if ($sHost != '' and $sHost === $sServerHost) { $sConfigSection = $sSection; break; } } } }
<?php $reader = new Zend\Config\Reader\Ini(); $config = $reader->fromFile(OMEKA_PATH . '/config/database.ini'); return ['modules' => ['Omeka'], 'module_listener_options' => ['module_paths' => ['Omeka' => OMEKA_PATH . '/application', OMEKA_PATH . '/modules'], 'config_glob_paths' => [OMEKA_PATH . '/config/local.config.php']], 'service_manager' => ['factories' => ['Omeka\\Connection' => 'Omeka\\Service\\ConnectionFactory', 'Omeka\\ModuleManager' => 'Omeka\\Service\\ModuleManagerFactory'], 'invokables' => ['Omeka\\Status' => 'Omeka\\Mvc\\Status']], 'connection' => $config];
public function generarTextoCajasXFincasOld($condiciones, $usuario_id, $separar_archivo = 'S') { set_time_limit(0); ini_set('memory_limit', '-1'); $GrupoDispoCabDAO = new GrupoDispoCabDAO(); $reader = new \Zend\Config\Reader\Ini(); $config = $reader->fromFile('ini/config.ini'); $GrupoDispoCabDAO->setEntityManager($this->getEntityManager()); $inventario_id = $condiciones['inventario_id']; //Consulta la lista de registros $result_dispo = $this->listadoDisponibilidadPorProveedor($condiciones, true); $tipo_caja = 'HB'; $result_HB = $this->transformarDispoEnCajas($inventario_id, $tipo_caja, $result_dispo); $tipo_caja = 'QB'; $result_QB = $this->transformarDispoEnCajas($inventario_id, $tipo_caja, $result_dispo); if ($result_HB) { ksort($result_HB); } if ($result_QB) { ksort($result_QB); } $nro_archivos = 2; $files_zip = null; //$files = null; $archivo_texto_HB = ''; $archivo_texto_QB = ''; for ($cont_file = 0; $cont_file < $nro_archivos; $cont_file++) { if ($cont_file == 0) { $result_cajas = $result_HB; } else { $result_cajas = $result_QB; } //end if $arr_grados = array('40', '50', '60', '70', '80', '90', '100', '110'); $arr_archivo_texto_proveedor['AGR'] = null; $arr_archivo_texto_proveedor['LMA'] = null; $arr_archivo_texto_proveedor['HTC'] = null; //$arr_archivo_texto = null; foreach ($result_cajas as $reg) { foreach ($arr_grados as $grado_id) { foreach ($reg[$grado_id]['cajas']['fincas'] as $key_finca => $reg_finca) { //$total_cajas = $reg_finca; $total_cajas = $reg_finca['total']; if ($total_cajas > 0) { $tipo_caja_id = $reg['tipo_caja_id']; $tallos_x_bunch = $reg['tallos_x_bunch']; $key = $reg['producto_id'] . '-' . $reg['variedad'] . '-' . $reg['variedad_id'] . '-' . $reg['tallos_x_bunch'] . '-' . $grado_id . '-' . $reg['tipo_caja_id']; if ($reg['tallos_x_bunch'] == 25) { $arr_archivo_texto_proveedor[$key_finca][$key] = $total_cajas . $tipo_caja_id . ' ' . $reg['variedad'] . ' ' . $grado_id . 'cm'; } else { $arr_archivo_texto_proveedor[$key_finca][$key] = $total_cajas . $tipo_caja_id . ' ' . $reg['variedad'] . ' ' . $grado_id . 'cm (x' . $reg['tallos_x_bunch'] . ')'; } //end if } //end if } //end foreach } //end foreach } // end foreach //Ordena Array ksort($arr_archivo_texto_proveedor['AGR']); ksort($arr_archivo_texto_proveedor['LMA']); ksort($arr_archivo_texto_proveedor['HTC']); $ruta = $config['ruta_archivos']['tmp']; //$ruta = $config['ruta_archivos']['public']['descarga']; if ($cont_file == 0) { foreach ($arr_archivo_texto_proveedor as $key_archivo_texto_proveedor => $reg_archivo_texto_proveedor) { $archivo_texto = $ruta . 'skype_' . $key_archivo_texto_proveedor . '_HB_' . $usuario_id . '.txt'; $archivo_texto_HB = basename($archivo_texto); \Application\Classes\ArchivoTexto::creaArchivoConArray($archivo_texto, $reg_archivo_texto_proveedor); $files_zip[] = $archivo_texto; } //end foreach } else { foreach ($arr_archivo_texto_proveedor as $key_archivo_texto_proveedor => $reg_archivo_texto_proveedor) { $archivo_texto = $ruta . 'skype_' . $key_archivo_texto_proveedor . '_QB_' . $usuario_id . '.txt'; $archivo_texto_QB = basename($archivo_texto); \Application\Classes\ArchivoTexto::creaArchivoConArray($archivo_texto, $reg_archivo_texto_proveedor); $files_zip[] = $archivo_texto; } //end foreach } //end if //$files['file'] = basename($archivo_texto); } //end for $zipname = $ruta . 'skype_fincas_' . $usuario_id . '.zip'; if (file_exists($zipname)) { $respuesta = unlink($zipname); } //end if \Application\Classes\Compress::comprimir($files_zip, $zipname); \Application\Classes\Compress::downloadFile($zipname); //BORRA ARCHIVO //return array($archivo_texto_HB, $archivo_texto_QB); }
/** * Expects ini file's schema: * <pre> * [ldapauth] * ldap.[options]... * ldap.[options]... * ldap.[options]... * ... * </pre> */ private function authenticateLdap() { $configReader = new \Zend\Config\Reader\Ini(); $configData = $configReader->fromFile(self::$configFile); $config = new \Zend\Config\Config($configData, false); $options = $config->ldapauth->ldap->toArray(); $adapter = new \Zend\Authentication\Adapter\Ldap($options); $adapter->setIdentity($this->getIdentity()); $adapter->setCredential($this->getCredential()); return $adapter->authenticate(); }