Пример #1
0
 /**
  * @return \ArrayObject
  *
  * @throws ParsingException
  */
 public function parse()
 {
     $this->setTemporaryErrorHandler();
     $parser = new \IniParser($this->getFile());
     /** @var \ArrayObject $parsed */
     $parsed = $parser->parse();
     $this->restoreErrorHandler();
     $parsed = $this->transformToArray($parsed);
     return $parsed;
 }
Пример #2
0
/**
 * A crude, but simple way to query the DB.  Returns the resource obtained from
 * the given MySQL statement.
 * 
 * @param string $sql
 *                    a string of sql
 * 
 * @return the resource obtained from the given MySQL statement
 */
function QueryDB($sql)
{
    $iniParser = new IniParser();
    $settings = $iniParser->getSettings();
    $schema = $settings['database']['schema'];
    $host = $settings['database']['host'];
    $password = $settings['database']['password'];
    $username = $settings['database']['username'];
    $link = mysqli_connect($host, $username, $password, $schema);
    $sql = mysqli_real_escape_string($link, $sql);
    $result = mysqli_query($link, $sql);
    return $result;
}
Пример #3
0
 /**
  * @param String $iniPath path of the ini file
  *
  * @return IniFetcher
  * @throws InvalidArgumentException
  *
  * Namespace based factory. One factory for each ini file. This is particularly useful
  * when we have multiple ini file to be decoded in single php process.
  */
 public static function getInstance($iniPath)
 {
     if (!is_null($iniPath)) {
         if (is_null(self::$self[$iniPath])) {
             self::$self[$iniPath] = new self();
             $iniParser = new IniParser($iniPath);
             self::setParams($iniParser->parse());
         } else {
             return self::$self[$iniPath];
         }
     } else {
         throw new InvalidArgumentException('Variable iniPath can not be null');
     }
     return self::$self[$iniPath];
 }
Пример #4
0
 public static function getInstance()
 {
     if (self::$_instance === NULL) {
         self::$_instance = new self(IniParser::getInstance()->getSection('error'));
     }
     return self::$_instance;
 }
Пример #5
0
 protected function init($file)
 {
     $this->items = array();
     $ini = IniParser::parseMerged(array($file));
     foreach ($ini as $key => $value) {
         $this->items[$key] = array();
         // TODO refactor ... XD
         $tmp = array();
         $composite = false;
         foreach ($value as $k => $v) {
             if (is_array($v)) {
                 $tmp[$k] = $v;
             } else {
                 if ($k == 'type' && $v == 'Composite') {
                     $composite = true;
                 }
                 $this->items[$key][$k] = $v;
             }
         }
         if ($composite) {
             $this->items[$key]['dropdown'] = array();
             $this->items[$key]['composite'] = $tmp;
         } else {
             $this->items[$key]['dropdown'] = $tmp;
             $this->items[$key]['composite'] = array();
         }
     }
     return $this->items;
 }
Пример #6
0
 public function __construct($pageId = NULL)
 {
     if ($access = IniParser::getInstance()->getSection('access')) {
         if (isset($access['ip'])) {
             $ips = explode(',', $access['ip']);
             if (in_array(self::getIp(), $ips)) {
                 if (!defined('WWW2')) {
                     define('WWW2', true);
                 }
             }
         }
     }
     $this->isCacher = FALSE;
     if (isset($pageId)) {
         $this->pageId = $pageId;
         $this->isCacher = TRUE;
     } else {
         @($this->requestURI = '/' . $_GET['request']);
     }
     if (!VBox::isExist('ConstData')) {
         $this->constData = VBox::get('ConstData');
     } else {
         $this->constData = new ConstData();
         VBox::set('ConstData', $this->constData);
     }
     /* italiano, 14.01.2015
        if(!VBox::isExist('Event')) { 
            VBox::set('Event', new Event());
        }
        /* end */
 }
Пример #7
0
 public function get_pages_text($num_page, $page_count, $url_mask, $link_class = 'nav_page', $current_page_class = 'nav_current_page')
 {
     $limit = IniParser::getInstance()->getSettring('count', 'records_on_page');
     $pages_text = "";
     //	$pages_text = "<span class='$link_class'>Îòîáðàæàòü ïî</span> <input type=text name='records_on_page' value=$limit style='width:50px'>";
     $from = $num_page - (int) $limit;
     if ($from < 0) {
         $from = 0;
     }
     $to = $num_page + (int) $limit;
     if ($to > $page_count - 1) {
         $to = $page_count - 1;
     }
     if ($num_page > 0) {
         $pages_text .= "<a href='" . $url_mask[start] . ($num_page - 1) . $url_mask[end] . "' title='<<' class='prev_{$link_class}'></a>&nbsp;&nbsp;&nbsp;";
     }
     if ($page_count > 1) {
         for ($i = $from; $i <= $to; $i++) {
             if ($i != $num_page) {
                 $pages_text .= "<a href='{$url_mask['start']}{$i}{$url_mask['end']}' title='" . ($i + 1) . "' class='{$link_class}'>" . ($i + 1) . "</a>";
             } else {
                 $pages_text .= "<span class='" . $current_page_class . "'>" . ($i + 1) . "</span>";
             }
             if ($i <= $to - 1) {
                 $pages_text .= "&nbsp;&nbsp;&nbsp;";
             }
         }
     }
     if ($num_page < $page_count - 1) {
         $pages_text .= "&nbsp;&nbsp;&nbsp;<a href='" . $url_mask[start] . ($num_page + 1) . $url_mask[end] . "' title=' >>' class='next_{$link_class}' style='text-decoration:none;'></a>";
     }
     return $pages_text;
 }
Пример #8
0
 public function __construct($siteId)
 {
     $this->siteId = $siteId;
     $this->dbAdapter = Zend_Registry::get('dbAdapter');
     $dbAdapter = Zend_Registry::get('dbAdapter');
     $config = Zend_Registry::get('config');
     $params = $config->db->config->toArray();
     //        	$params['dbname'] 	= 'venginse_all';
     $params['dbname'] = $config->db->config->dballname;
     $this->alldbAdapter = Zend_Db::factory($config->db->adapter, $params);
     $select = $dbAdapter->select();
     $select->from('sites', array('s_dbname', 's_path'));
     $select->where('s_id = ?', $siteId);
     $config = $dbAdapter->fetchRow($select->__toString());
     $this->siteDbName = $config['s_dbname'];
     $this->sitePath = $config['s_path'];
     include_once $this->sitePath . 'application/includes.inc.php';
     IniParser::getInstance()->setIni($this->sitePath . 'application/config.ini', TRUE);
     $config = Zend_Registry::get('config');
     $params = $config->db->config->toArray();
     $params['dbname'] = $this->siteDbName;
     $this->siteDbAdapter = Zend_Db::factory($config->db->adapter, $params);
     Zend_Registry::set('siteDbAdapter', $this->siteDbAdapter);
     $this->siteDbAdapter->query('SET NAMES utf8');
     $this->alldbAdapter->query('SET NAMES utf8');
     $this->loadLangs();
     $this->recCount = $this->countStrings();
     $this->recPerPage = 20;
 }
Пример #9
0
 public function init()
 {
     // create logger
     self::$_logger = LoggerFactory::getInstance(ucfirst($this->{FrameworkConstants::ENTITY_NAME}) . 'ActiveRecord');
     // load database configs
     $file = $this->{FrameworkConstants::DATABASE_CONFIG_FILE};
     $configSection = $this->{FrameworkConstants::DATABASE_CONFIG_SECTION};
     if (!is_file($file)) {
         throw new Exception("Can't find database config file (" . $file . ")...");
     }
     self::$_logger->debug('Looking for db section -> ' . $configSection);
     $configData = IniParser::parse($file, $configSection);
     $data = $configData[$configSection];
     $this->{FrameworkConstants::DATABASE_TYPE} = $data[FrameworkConstants::DATABASE_TYPE];
     $this->{FrameworkConstants::DATABASE_HOST} = $data[FrameworkConstants::DATABASE_HOST];
     $this->{FrameworkConstants::DATABASE_NAME} = $data[FrameworkConstants::DATABASE_NAME];
     $this->{FrameworkConstants::DATABASE_USERNAME} = $data[FrameworkConstants::DATABASE_USERNAME];
     $this->{FrameworkConstants::DATABASE_PASSWORD} = $data[FrameworkConstants::DATABASE_PASSWORD];
     $this->{FrameworkConstants::MYSQL_COMMAND} = $data[FrameworkConstants::MYSQL_COMMAND];
     $this->{FrameworkConstants::MYSQL_COMMAND_CONTINUE_ON_ERROR} = $data[FrameworkConstants::MYSQL_COMMAND_CONTINUE_ON_ERROR];
     $this->_currentDataSourceName = $this->{FrameworkConstants::DATABASE_CONFIG_SECTION};
     $this->_returnErrors = $this->{FrameworkConstants::RETURN_ERRORS};
     // Load table info
     $this->getTableInfo();
 }
Пример #10
0
 /**
  * Parse config files.
  */
 private function _parse()
 {
     //Parse default config file
     $config_default = rtrim(self::$_config['dir'], '/') . '/' . self::$_config['file_default'] . '.ini';
     self::$_items = IniParser::getInstance()->get($config_default);
     //Parse local config file and update/add keys of default config
     $config_local = rtrim(self::$_config['dir'], '/') . '/' . self::$_config['file_local'] . '.ini';
     self::$_items = array_merge(self::$_items, IniParser::getInstance()->get($config_local));
 }
Пример #11
0
 /**
  * Parse language files.
  *
  * @param string $language
  */
 private function _parse($language)
 {
     //Parse default language file
     $language_default = rtrim(self::$_config['dir'], '/') . '/' . self::$_config['file_default'] . '.ini';
     self::$_items[$language] = IniParser::getInstance()->get($language_default);
     //Parse additional language file and update/add keys of default language
     if ($language != self::$_config['file_default']) {
         $language_additional = rtrim(self::$_config['dir'], '/') . '/' . $language . '.ini';
         self::$_items[$language] = array_merge(self::$_items[$language], IniParser::getInstance()->get($language_additional));
     }
 }
Пример #12
0
 public function add_data()
 {
     $id = 0;
     $error = '';
     $message = array();
     if ($id = DB::_add_data()) {
         /*--if gifts > 0*/
         if (isset($_POST['link']) && $_POST['link'] > 0 && $id > 0) {
             $q = 'INSERT INTO case_studies_links(csl_cs_id, csl_url, csl_comment) ';
             $firstIteration = true;
             foreach ($_POST['link'] as $key => $val) {
                 $q .= (!$firstIteration ? ',' : 'VALUES') . '(' . $id . ', ' . DB::_quote($val) . ',' . DB::_quote($_POST['comment_link'][$key]) . ')';
                 $firstIteration = false;
             }
             DB::executeAlter($q, 'update_case_studies_links');
         }
         /*--if images_and_files > 0*/
         $countfiles = count($_FILES['images_and_files']['name']);
         if ($countfiles > 0) {
             if (!file_exists(LOCAL_PATH . IniParser::getInstance()->getSettring('path', 'localupload') . $id)) {
                 mkdir(LOCAL_PATH . IniParser::getInstance()->getSettring('path', 'localupload') . $id);
             }
             for ($i = 0; $i < $countfiles; $i++) {
                 $resupload = true;
                 // test FILE is IMAGE
                 if (!getimagesize($_FILES['images_and_files']['tmp_name'][$i])) {
                     array_push($message, 'File is not image type - ' . $_FILES['images_and_files']['name'][$i]);
                     $resupload = false;
                 }
                 // test FILESIZE
                 if ($_FILES['images_and_files']['size'][$i] > IniParser::getInstance()->getSettring('path', 'maxfilesize')) {
                     array_push($message, 'Limit filesize  - ' . $_FILES['images_and_files']['name'][$i]);
                     $resupload = false;
                 }
                 if ($_FILES['images_and_files']['size'][$i] == 0) {
                     array_push($message, 'Filesize is null  - ' . $_FILES['images_and_files']['name'][$i]);
                     $resupload = false;
                 }
                 if ($resupload) {
                     if (move_uploaded_file($_FILES['images_and_files']['tmp_name'][$i], LOCAL_PATH . IniParser::getInstance()->getSettring('path', 'localupload') . $id . '/' . $_FILES['images_and_files']['name'][$i])) {
                         $q = 'INSERT INTO case_studies_files(csf_cs_id, csf_name, csf_comment) values(' . $id . ',' . DB::_quote($_FILES['images_and_files']['name'][$i]) . ',' . DB::_quote($_POST['comment_is_obligatory'][$i]) . ')';
                         DB::executeAlter($q, 'images_and_files');
                     } else {
                         array_push($message, 'File not upload  - ' . $_FILES['images_and_files']['name'][$i]);
                     }
                 }
             }
         }
     } else {
         $error = 'Run time error';
     }
     return array('id' => $id, 'message' => $message, 'error' => $error);
 }
Пример #13
0
 private static function _loadDataFromFile($moduleName, $locale, $resourceFileName)
 {
     $resourceFile = APPLICATION_MODULE_DIR . $moduleName . '/' . self::RESOURCES_DIR_NAME . '/' . $locale . '/' . $resourceFileName . '.ini';
     if (is_file($resourceFile)) {
         // load the resource bundle
         $data = IniParser::parse($resourceFile);
     }
     if ($data) {
         self::$_data[self::$_resourceBundleKey] = $data;
     }
     return $data;
 }
Пример #14
0
 /**
  * Parse platform files.
  *
  * @param string $platform
  */
 private function _parse($platform)
 {
     //Parse default platform file
     $platform_default = rtrim(self::$_config['dir'], '/') . '/' . self::$_config['file_default'] . '.ini';
     self::$_items[$platform] = IniParser::getInstance()->get($platform_default);
     //Parse local platform file and update/add keys of default platform
     $platform_local = rtrim(self::$_config['dir'], '/') . '/' . self::$_config['file_local'] . '.ini';
     self::$_items[$platform] = array_merge(self::$_items[$platform], IniParser::getInstance()->get($platform_local));
     //Parse additional platform file and update/add keys of default platform
     if ($platform != self::$_config['file_default']) {
         $platform_additional = rtrim(self::$_config['dir'], '/') . '/' . $platform . '.ini';
         self::$_items[$platform] = array_merge(self::$_items[$platform], IniParser::getInstance()->get($platform_additional));
     }
 }
Пример #15
0
 public function __construct($siteId)
 {
     $dbAdapter = Zend_Registry::get('dbAdapter');
     $select = $dbAdapter->select();
     $select->from('sites', array('s_dbname', 's_path'));
     $select->where('s_id = ?', $siteId);
     $res = $dbAdapter->fetchRow($select->__toString());
     $this->siteDbName = $res['s_dbname'];
     $config = Zend_Registry::get('config');
     $params = $config->db->config->toArray();
     $params['dbname'] = $this->siteDbName;
     $this->siteDbAdapter = Zend_Db::factory($config->db->adapter, $params);
     $this->siteDbAdapter->query('SET NAMES utf8');
     @IniParser::setIni($res['s_path'] . 'application/config.ini', TRUE);
     $this->constData = new ConstData($params['dbname']);
     $this->headerShort = array('1' => '301 Moved Permanently', '2' => '302 Moved Temporary', '3' => '404 Not Found', '4' => '410 Never exist', '5' => 'No headers');
     $this->headerFull = array('1' => 'HTTP/1.1 301 Moved Permanently', '2' => 'HTTP/1.1 302 Found', '3' => 'HTTP/1.1 404 Not Found', '4' => 'HTTP/1.1 410 Gone', '5' => '');
     $this->id404 = '3';
 }
Пример #16
0
 public static function getNextFromIni($moduleName, $statusCode, $flowFileName = false)
 {
     if (!self::$_registry[$moduleName]) {
         if ($flowFileName) {
             $file = APPLICATION_MODULE_DIR . $moduleName . '/flows/' . $flowFileName . '.flw';
             if (!is_file($file)) {
                 $file = APPLICATION_MODULE_DIR . $moduleName . '/flows/default.flw';
             }
         } else {
             $file = APPLICATION_MODULE_DIR . $moduleName . '/flows/default.flw';
         }
         $data = IniParser::parse($file);
         $_registry[$moduleName] = $data;
         return self::_buildArray($data[$statusCode]);
     } elseif (self::$_registry[$moduleName]) {
         $data = self::$_registry[$moduleName];
         return self::_buildArray($data[$statusCode]);
     }
     return null;
 }
Пример #17
0
 public static function getInfo($data)
 {
     $file = APPLICATION_CONFIG_DIR . 'url_mapper.ini';
     if (is_file($file) && is_array($data)) {
         // check modification date of url_mapper file
         $mapperFileInfo = stat($file);
         $mapperLastModified = $mapperFileInfo['mtime'];
         $cacheLastModified = 0;
         if (is_file(APPLICATION_CACHE_DIR . 'url_mapper')) {
             $cacheFileInfo = stat(APPLICATION_CACHE_DIR . 'url_mapper');
             $cacheLastModified = $cacheFileInfo['mtime'];
         }
         // let's check the cache first
         if ($mapperLastModified < $cacheLastModified) {
             $iniData = ConfigCacheHelper::getCache(APPLICATION_CACHE_DIR, 'url_mapper');
         } else {
             $iniData = IniParser::parse($file, true);
             ConfigCacheHelper::saveCache(APPLICATION_CACHE_DIR, 'url_mapper', $iniData);
         }
         if ($iniData) {
             $shortcuts = $iniData['shortcuts'];
         }
         if (is_array($shortcuts)) {
             foreach ($data as $k => $v) {
                 if (isset($k) && empty($v)) {
                     if ($shortcuts[$k]) {
                         // found a matching map, parse it and update the request
                         parse_str($shortcuts[$k], $output);
                         $request = Request::getInstance();
                         foreach ($output as $k => $v) {
                             $request->setParameter($k, $v);
                         }
                     }
                 }
             }
         }
     }
 }
Пример #18
0
 public static function parseMerged(array $files)
 {
     $ini = array();
     if (!empty($files)) {
         $parser = new IniParser();
         $parser->use_array_object = false;
         $ini = $parser->parse($files[0]);
         unset($files[0]);
         foreach ($files as $f) {
             $out = (array) $parser->parse($f);
             $ini = $parser->array_merge_recursive_distinct($ini, $out);
         }
     }
     return $ini;
 }
Пример #19
0
<?php

/*	Plugin Name: Form MercadoLibre
	Plugin URI: https://cuado.co/
	Description: Plugin que permite manejar las ventas realizadas por MercadoLibre con varios estatus
	Version: 1.0
	Author: Pedro Caicedo
	Author URI: http://pcaicedo.com/	
*/
//Cargamos las librerias
require_once "libs/class.iniparser.php";
require_once "libs/class.gump.php";
//Cargamos los archivos INI
$parser = new IniParser(dirname(__FILE__) . '/conf/general.ini');
$parser->use_array_object = false;
//Variales globales
global $wpdb;
//acceso a BD
$config = $parser->parse();
//Conf. Generales
$validator = new GUMP();
//Validador de Datos en el server
//Tablas BD
$config['tables']['forms'] = $wpdb->prefix . "forms_ml";
$config['tables']['forms_histories'] = $wpdb->prefix . "forms_ml_histories";
function install_form_ml()
{
    global $config, $wpdb;
    $config['tables']['forms'] = $wpdb->prefix . "forms_ml";
    $config['tables']['forms_histories'] = $wpdb->prefix . "forms_ml_histories";
    $sql = "CREATE TABLE IF NOT EXISTS `{$config['tables']['forms']}` (\n\t`id_form_ml` int(10) NOT NULL AUTO_INCREMENT,\n\t`user_vat` varchar(255) COLLATE utf8_bin NOT NULL,\n\t`user_names` varchar(255) COLLATE utf8_bin NOT NULL,\n\t`user_username` varchar(50) COLLATE utf8_bin NOT NULL,\n\t`user_phone` varchar(32) COLLATE utf8_bin DEFAULT NULL,\t\n\t`user_email` varchar(100) COLLATE utf8_bin NOT NULL,\n\t`user_address` text COLLATE utf8_bin NOT NULL,\n\t`user_products` text COLLATE utf8_bin NOT NULL,\n\t`bank_date` datetime NOT NULL,\n\t`bank_type_payment` enum('DEPOSITO','TRANSFERENCIA_BS','TRANSFERENCIA_USD','MERCADOPAGO') COLLATE utf8_bin NOT NULL DEFAULT 'DEPOSITO',\n\t`bank_name` varchar(50) COLLATE utf8_bin NOT NULL,\n\t`bank_reference` varchar(20) COLLATE utf8_bin NOT NULL,\n\t`bank_mount_payment` double(10,2) DEFAULT NULL,\n\t`ship_vat` varchar(255) COLLATE utf8_bin NOT NULL,\n\t`ship_names` varchar(255) COLLATE utf8_bin NOT NULL,\n\t`ship_type` enum('ZOOM','TEALCA','PERSONAL') COLLATE utf8_bin NOT NULL DEFAULT 'ZOOM',\n\t`ship_address` text COLLATE utf8_bin NOT NULL,\n\t`ship_zp` varchar(10) COLLATE utf8_bin NOT NULL,\n\t`ship_parish` varchar(50) COLLATE utf8_bin NOT NULL,\n\t`ship_municipality` varchar(50) COLLATE utf8_bin NOT NULL,\n\t`ship_city` varchar(50) COLLATE utf8_bin NOT NULL,\n\t`ship_state` varchar(50) COLLATE utf8_bin NOT NULL,\n\t`ship_comments` text COLLATE utf8_bin NOT NULL,\n\t`ship_status_now` enum('POR_VERIFICAR','VERIFICADO','NEGADO','ENVIADO','ENTREGADO') COLLATE utf8_bin NOT NULL DEFAULT 'POR_VERIFICAR',\n\tPRIMARY KEY ( `id_form_ml` )\n\t) ;";
Пример #20
0
 /**
  * Create a config array (from the given fixture).
  *
  * @param $file
  *
  * @return array
  */
 protected function getConfig($file, $options = array())
 {
     $parser = new IniParser(BASE_DIR . '/tests/fixtures/' . $file);
     foreach ($options as $key => $value) {
         $parser->{$key} = $value;
     }
     $config = $parser->parse();
     return $config;
 }
Пример #21
0
 public function get_page_count_date($where_str = '')
 {
     $where_str = $this->_get_where($where_str);
     $count = $this->get_count_data($where_str);
     //var_dump($count, IniParser::getInstance()->getSettring('count', 'in_page'));
     $page_count = ceil($count / (int) IniParser::getInstance()->getSettring('count', 'in_page'));
     return $page_count;
 }
Пример #22
0
 protected function _getLayouts($moduleName = false, $layoutFileName = false)
 {
     try {
         if (!$moduleName) {
             $moduleName = $this->_currentModuleName;
         }
         $configDir = APPLICATION_MODULE_DIR . $moduleName . '/conf/';
         if (!$layoutFileName) {
             $layoutFileName = DEFAULT_LAYOUT_FILE_NAME . '.ini';
         } else {
             $layoutFileName = $layoutFileName . '.ini';
         }
         $layoutFileName = $configDir . $layoutFileName;
         if (is_file($layoutFileName)) {
             // get data from layouts ini file
             $data = IniParser::parse($layoutFileName, true);
         }
     } catch (Exception $ex) {
         throw new Exception($ex->getMessage());
     }
     return $data;
 }
Пример #23
0
 public static function unsetInstance()
 {
     self::getInstance()->_parsed = NULL;
     self::getInstance()->_settings = NULL;
     self::$_instance = NULL;
 }
Пример #24
0
<?php

/*
unset($_GObjects);
*/
DB::unsetInstance();
print Error::showErrorMessages();
Error::unsetInstance();
IniParser::unsetInstance();
Пример #25
0
function oa($a)
{
    echo '<pre>';
    var_dump($a);
    echo '</pre>';
}
if (isset($_GET['pass']) && md5($_GET['pass']) == md5('DbJ4BO1WTJp1kgFSk7dU')) {
    //if ($_SERVER['HTTP_HOST'] == NULL){
    include_once dirname(__FILE__) . '/application/includes.inc.php';
    include_once ENGINE_PATH . 'class/classPage.php';
    include_once ENGINE_PATH . 'class/classCase.php';
    error_reporting(E_ALL);
    ini_set('display_errors', 1);
    VBox::set('ConstData', new ConstData());
    //Count case on each page
    $count_case_on_page = IniParser::getSettring('case', 'step') ? IniParser::getSettring('case', 'step') : 3;
    if ((int) $count_case_on_page > 0) {
        //	Очистим таблицу case2page
        $q = "TRUNCATE TABLE case2page";
        DB::executeAlter($q);
        // Выбираем все уникальные значения языков страниц
        $q = "select distinct pg_lang  from pages where pg_hidden = ?";
        DB::executeQuery($q, 'langs_data', array(0));
        $langs_data = DB::fetchResults('langs_data');
        //Запрос для выборки активных страниц для данного языка
        $q_page = "select pg_id from pages where pg_hidden = ? and pg_lang = ? and pg_id <>?";
        //Запрос для выборки активных case для данного языка
        $q_case = "select cs_id from " . VBox::get('ConstData')->getConst('langsDb') . ".case_study where cs_hidden = ? and cs_lang_id = ?";
        $q_res = "";
        // Делаем цикл по языкам
        foreach ($langs_data as $lang) {
Пример #26
0
<?php 
set_time_limit(360);
if ($_SERVER['HTTP_HOST'] == NULL) {
    ini_set('magic_quotes_runtime', 'Off');
    ini_set('display_errors', 'off');
    include_once 'application/includes.inc.php';
    VBox::set('ConstData', new ConstData());
    $isCacheable = VBox::get('ConstData')->getConst('isCacheable');
    // get isCacheable
    if ((bool) $isCacheable) {
        $localPath = LOCAL_PATH;
        //local path to site
        $cachePath = IniParser::getSettring('cache', 'cache_path');
        //path to cache dir
        $cachecount = IniParser::getSettring('cache', 'cachecount');
        //count copy of cache
        include_once ENGINE_PATH . 'class/classReCacher.php';
        $cacher = new ReCacher($localPath, $cachePath, $cachecount);
        $cacher->setLogMode(2);
        $cacher->_rebuildAllCache();
        unset($cacher);
    }
    include_once LOCAL_PATH . 'application/final.inc.php';
}
Пример #27
0
<?php

require_once 'IniFetcher.php';
/**
 * This example demonstrates how you can use IniParser and IniFetcher classes. Below examples are only
 * for the testing purpose, please use it your own way.
 */
$fileGlobal = '../tests/ini_files/global.ini';
$fileSimple = '../tests/ini_files/simple.ini';
$fileComments = '../tests/ini_files/comments.ini';
$fileArray = '../tests/ini_files/array.ini';
$fileBad = '../tests/ini_files/bad.ini';
$fileEscape = '../tests/ini_files/escape.ini';
$fileJson = '../tests/ini_files/json.ini';
// IniParser way
$parser = new IniParser($fileJson);
$parser->setFormat($parser::OUTPUT_FORMAT_ARRAY);
// default
$data = $parser->parse();
echo "Using IniParser: " . $data['json']['list']['creditcards']['amex']['prefix'] . '<br/>';
// IniFetcher way (preferable)
$fetcher = IniFetcher::getInstance($fileJson);
echo "Using IniFetcher: " . $fetcher::get('json.list.creditcards.amex.prefix');
Пример #28
0
 public function SendMail($email_subject, $email_message, $fromName = '', $email_from = NULL, $fileatt = NULL, $fileatt_name = NULL)
 {
     $email_to = '';
     $email_from = $email_from ? $email_from : 'norepeat@' . $_SERVER['HTTP_HOST'];
     foreach ($this->mSettings as $key => $val) {
         if (1 == substr_count($key, 'mail')) {
             $email_to .= $val . ',';
         }
     }
     if (!empty($email_to)) {
         $email_to = trim($email_to, ',');
     } else {
         return FALSE;
     }
     $headers = "From: " . $email_from;
     $semi_rand = md5(time());
     $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
     $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"";
     $email_message .= "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type:text/html; charset=\"utf-8\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . str_replace("\n", "<br>", $email_message) . "\n\n";
     /*
      FILE
     */
     $ok = false;
     if ($fileatt != '') {
         $fileatt_type = "application/octet-stream";
         // File Type
         $file = fopen($fileatt, 'rb');
         $data = fread($file, filesize($fileatt));
         $data = chunk_split(base64_encode($data));
         fclose($file);
         $email_message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}\n";
         $ok = @mail($email_to, $email_subject, $email_message, $headers);
         if ($ok == true) {
             unlink($fileatt);
         }
         unset($data, $file, $fileatt, $fileatt_type, $fileatt_name);
     }
     if ($ok == false) {
         @mail($email_to, $email_subject, $email_message, $headers);
         if ((bool) IniParser::getInstance()->getSettring('mail', 'toMail')) {
             $adminMail = IniParser::getInstance()->getSettring('mail', 'adminMail');
             $subjectMail = IniParser::getInstance()->getSettring('mail', 'subjectMail');
             @mail($adminMail, $email_subject . ($subjectMail ? $subjectMail : ''), $email_message, $headers);
         }
         /* Äîáîâëÿåì ïèñüìî â àðõèâ */
         $q = 'INSERT INTO ' . VBox::get('ConstData')->getConst('langsDb') . '.email_archive
 	              SET ea_email_to = ?,
     	              ea_email_from = ?,
         	          ea_subject = ?,
             	      ea_message = ?';
         DB::executeAlter($q, array($email_to, $email_from, $email_subject, $email_message));
     }
     return TRUE;
 }
Пример #29
0
<?php

date_default_timezone_set('UTC');
ini_set('display_errors', 1);
if (!defined('LOCAL_PATH')) {
    define('LOCAL_PATH', $_SERVER['DOCUMENT_ROOT'] . '/');
}
if (!defined('ENGINE_PATH')) {
    define('ENGINE_PATH', LOCAL_PATH . 'libs/');
}
if (!defined('LIB_PATH')) {
    define('LIB_PATH', LOCAL_PATH . 'libs/');
}
include_once ENGINE_PATH . 'class/classError.php';
include_once ENGINE_PATH . 'class/classVException.php';
include_once ENGINE_PATH . 'class/classIniParser.php';
include_once ENGINE_PATH . 'class/classDB.php';
include_once ENGINE_PATH . 'class/classConstData.php';
include_once ENGINE_PATH . 'class/classVBox.php';
include_once ENGINE_PATH . 'class/classAgregator.php';
IniParser::getInstance()->setIni(LOCAL_PATH . 'application/config.ini', true);
Пример #30
0
<?php

header('Content-Type: text/html; charset=UTF-8');
header('Cache-Control: no cache');
//no cache
function __autoload($className)
{
    $filename = $className . ".php";
    if (is_readable($filename)) {
        require_once $filename;
    }
}
$dir = $_SERVER['DOCUMENT_ROOT'] . '/app/';
include_once $dir . 'models/IniParser.php';
$file = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'configuration.ini';
$parser = new \IniParser();
$config = $parser->parse($file);
$apps = $config->app;
$wss = $config->webservice;
$configs = $config->config;
$dh = opendir($dir);
$dir_list = array($dir);
while (false !== ($filename = readdir($dh))) {
    if ($filename != "." && $filename != ".." && is_dir($dir . $filename)) {
        array_push($dir_list, $dir . $filename . "/");
    }
}
foreach ($dir_list as $dir) {
    foreach (glob($dir . "*.php") as $filename) {
        include_once $filename;
    }