Ejemplo n.º 1
0
 public function put_category_autofill_to_db($db, $cat)
 {
     mb_internal_encoding('UTF-8');
     mb_http_output('UTF-8');
     mb_http_input('UTF-8');
     echo '<pre>';
     //        $old_categorys = $db->get_categorys_from_db();
     //
     //        echo '<h2>vanhat</h2>';
     //
     //        var_dump($old_categorys);
     //
     //        echo '<h2>settareissa</h2>';
     //
     //        var_dump($xml_categorys);
     //
     //        $new_categorys = array_diff($xml_categorys, $old_categorys);
     echo '<h2>lisätään</h2>';
     $xml_categorys = $cat->autofillCategorys();
     var_dump($xml_categorys);
     foreach ($xml_categorys as $category) {
         $db->put_category_to_db($category);
         echo "\n";
     }
     echo '</pre>';
 }
Ejemplo n.º 2
0
 static function initMbstring()
 {
     if (extension_loaded('mbstring')) {
         if (((int) ini_get('mbstring.encoding_translation') || in_array(strtolower(ini_get('mbstring.encoding_translation')), array('on', 'yes', 'true'))) && !in_array(strtolower(ini_get('mbstring.http_input')), array('pass', '8bit', 'utf-8'))) {
             user_error('php.ini settings: Please disable mbstring.encoding_translation or set mbstring.http_input to "pass"', E_USER_WARNING);
         }
         if (MB_OVERLOAD_STRING & (int) ini_get('mbstring.func_overload')) {
             user_error('php.ini settings: Please disable mbstring.func_overload', E_USER_WARNING);
         }
         mb_regex_encoding('UTF-8');
         ini_set('mbstring.script_encoding', 'pass');
         if ('utf-8' !== strtolower(mb_internal_encoding())) {
             mb_internal_encoding('UTF-8');
             ini_set('mbstring.internal_encoding', 'UTF-8');
         }
         if ('none' !== strtolower(mb_substitute_character())) {
             mb_substitute_character('none');
             ini_set('mbstring.substitute_character', 'none');
         }
         if (!in_array(strtolower(mb_http_output()), array('pass', '8bit'))) {
             mb_http_output('pass');
             ini_set('mbstring.http_output', 'pass');
         }
         if (!in_array(strtolower(mb_language()), array('uni', 'neutral'))) {
             mb_language('uni');
             ini_set('mbstring.language', 'uni');
         }
     } else {
         if (!defined('MB_OVERLOAD_MAIL')) {
             extension_loaded('iconv') or static::initIconv();
             require __DIR__ . '/Bootup/mbstring.php';
         }
     }
 }
Ejemplo n.º 3
0
 public function __construct()
 {
     $this->mysql = new mysql();
     mb_internal_encoding('UTF-8');
     mb_http_output('UTF-8');
     mb_http_input('UTF-8');
 }
Ejemplo n.º 4
0
 /**
  * Configures mbstring settings
  */
 function configureMBSettings($charset)
 {
     $charset = _ml_strtolower($charset);
     $this->_charset = $charset;
     $this->_internal_charset = $charset;
     if (!$this->_mb_enabled) {
         // setting the codepage for mysql connection
         $this->_codepage = $this->getSQLCharacterSet();
         return;
     }
     // getting the encoding for post/get data
     if (_ml_strtolower(ini_get('mbstring.http_input')) == 'pass' || !ini_get('mbstring.encoding_translation')) {
         $data_charset = $charset;
     } else {
         $data_charset = ini_get('mbstring.internal_encoding');
     }
     $this->_internal_charset = 'UTF-8';
     mb_internal_encoding('UTF-8');
     mb_http_output($charset);
     if (!$this->_mb_output) {
         ob_start("mb_output_handler", 8096);
     }
     // setting the codepage for mysql connection
     $this->_codepage = $this->getSQLCharacterSet();
     // checking if get/post data is properly encoded
     if ($data_charset != $this->_internal_charset) {
         convertInputData($this->_internal_charset, $data_charset);
     }
 }
Ejemplo n.º 5
0
 function execute()
 {
     $context =& $this->getContext();
     $controller = $context->getController();
     $user = $context->getUser();
     $request = $context->getRequest();
     $pagefile = ACS_PAGES_DIR . "index.html." . ACSMsg::get_lang();
     $lockfile = $pagefile . ".locked";
     // 静的ファイル書き換え中の場合(0.5秒待つ)
     if (is_readable($lockfile)) {
         usleep(500000);
     }
     // 書き換え中でなく、静的ファイルが存在する場合
     if (!is_readable($lockfile) && is_readable($pagefile)) {
         // 静的ファイル作成時間が有効時間範囲内の場合
         if (time() - filemtime($pagefile) <= ACS_PAGES_EFFECTIVE_SEC) {
             // 静的トップを標準出力
             mb_http_output('pass');
             readfile($pagefile);
             return;
         }
     }
     $request->setAttribute('force_realtime', 1);
     $controller->forward("Public", "Index");
 }
Ejemplo n.º 6
0
function show_rss_content()
{
    global $xoopsConfig;
    include_once $GLOBALS['xoops']->path('class/template.php');
    $tpl = new XoopsTpl();
    $module = rmc_server_var($_GET, 'mod', '');
    if ($module == '') {
        redirect_header('backend.php', 1, __('Choose an option to see its feed', 'rmcommon'));
        die;
    }
    if (!file_exists(XOOPS_ROOT_PATH . '/modules/' . $module . '/rss.php')) {
        redirect_header('backend.php', 1, __('This module does not support rss feeds', 'rmcommon'));
        die;
    }
    $GLOBALS['xoopsLogger']->activated = false;
    if (function_exists('mb_http_output')) {
        mb_http_output('pass');
    }
    header('Content-Type:text/xml; charset=utf-8');
    include XOOPS_ROOT_PATH . '/modules/' . $module . '/rss.php';
    if (!isset($rss_channel['image'])) {
        $rmc_config = RMFunctions::configs();
        $rss_channel['image']['url'] = $rmc_config['rssimage'];
        $dimention = getimagesize(XOOPS_ROOT_PATH . '/images/logo.png');
        $rss_channel['image']['width'] = $dimention[0] > 144 ? 144 : $dimention[0];
        $rss_channel['image']['height'] = $dimention[1] > 400 ? 400 : $dimention[1];
    }
    include RMTemplate::get()->get_template('rmc_rss.php', 'module', 'rmcommon');
}
Ejemplo n.º 7
0
 /**
  * Run an application
  */
 public static function run()
 {
     // Error reporting
     error_reporting(ENV === 'production' ? E_ERROR | E_WARNING | E_PARSE : -1);
     ini_set('display_errors', ENV === 'production' ? 0 : 1);
     // Services
     $services = Services::getInstance();
     // Global configuration
     $config = $services->config()->get('config');
     // UTF-8 support
     if (isset($config['utf8']) && $config['utf8']) {
         mb_internal_encoding('UTF-8');
         mb_http_output('UTF-8');
         mb_http_input('UTF-8');
         mb_language('uni');
         mb_regex_encoding('UTF-8');
         ob_start('mb_output_handler');
     } else {
         ob_start();
     }
     // Set Locales
     if (isset($config['locale']) && $config['locale']) {
         setlocale(LC_ALL, $config['locale']);
         setlocale(LC_NUMERIC, 'C');
     }
     // Call controller
     if ($route = $services->route()) {
         list($class, $method, $params) = $route;
         $controller = new $class();
         $controller->{$method}(...$params);
     }
     $services->output()->display(!$services->input()->isClient());
     ob_end_flush();
 }
Ejemplo n.º 8
0
 /**
  * Boots the configuration module.
  *
  * @throws ModuleException If config file doesn't exist.
  * @param Application $application Calling application.
  * @return self
  */
 public function boot(Application $application = null) : Module
 {
     // calling the config module without any application makes no sense
     if (isset($application) === false) {
         throw new ModuleException('The configuration module is expected to run within an application.');
     }
     // check for available configuration files
     // $configs = new GenericDirectory($application->getConfigsPath());
     // try to locate configuration file for current running application
     $file = new GenericFile([$application->getConfigsPath(), 'config.json']);
     // try to read config file
     $config = FileConfig::create($file);
     // different internal character encoding given by config
     if ($config->has('charset')) {
         $charset = $config->get('charset');
         function_exists('mb_internal_encoding') && mb_internal_encoding($charset);
         function_exists('mb_http_output') && mb_http_output($charset);
     }
     // different timezone given by config
     if ($config->has('timezone')) {
         date_default_timezone_set($config->get('timezone'));
     }
     // keep instance
     $this->config = $config;
     return $this;
 }
Ejemplo n.º 9
0
 function myalbum_callback_after_stripslashes_local($text)
 {
     if (function_exists('mb_convert_encoding') && mb_internal_encoding() != mb_http_output()) {
         return mb_convert_encoding($text, mb_internal_encoding(), mb_detect_order());
     } else {
         return $text;
     }
 }
Ejemplo n.º 10
0
 function output($html)
 {
     //HTMLに出力
     mb_internal_encoding("UTF-8");
     mb_http_output("UTF-8");
     ob_start("mb_output_handler");
     //	echo mb_convert_encoding($html, "SJIS", "UTF-8");
     echo $html;
 }
Ejemplo n.º 11
0
 /**
  * Sets the default charset to be used for everything
  */
 public function setCharset($charset = '')
 {
     if (!empty($charset) && is_string($charset)) {
         $charset = trim($charset);
         @mb_internal_encoding($charset);
         @mb_http_output($charset);
         @mb_http_input($charset);
         @mb_regex_encoding($charset);
     }
 }
Ejemplo n.º 12
0
 /**
  * Fired on instantiate the module
  * At this point nothing from the module is loaded
  */
 public function onInit()
 {
     mb_detect_order(self::$encoding . ", UTF-8, UTF-7, ISO-8859-1, ASCII, EUC-JP, SJIS, eucJP-win, SJIS-win, JIS, ISO-2022-JP, Windows-1251, Windows-1252");
     mb_internal_encoding(self::$encoding);
     mb_http_input(self::$encoding);
     mb_http_output(self::$encoding);
     mb_language("uni");
     header("Content-Type: text/html; charset=" . self::$encoding);
     return $this;
 }
Ejemplo n.º 13
0
 function mobile_display($tempfile, $context = '')
 {
     if (is_array($context)) {
         extract($context);
     }
     mb_http_output("SJIS");
     ob_start("mb_output_handler");
     $tf = $_SERVER['DOCUMENT_ROOT'] . '/' . $this->template_dir;
     include $tf . $tempfile;
     ob_end_flush();
 }
Ejemplo n.º 14
0
 public function initialize()
 {
     mb_internal_encoding('UTF-8');
     mb_http_output('UTF-8');
     mb_http_input('UTF-8');
     \common\classes\Error::initialize();
     \System\handler\ExceptionHandler::initialize();
     /**
      * @var $session Session
      */
     $session = \common\classes\Application::get_class(Session::class);
     $session->start();
 }
Ejemplo n.º 15
0
function set_mbstring($lang)
{
    // Internal content encoding = Output content charset (for skin)
    define('CONTENT_CHARSET', get_content_charset($lang));
    // 'UTF-8', 'iso-8859-1', 'EUC-JP' or ...
    // Internal content encoding (for mbstring extension)
    define('SOURCE_ENCODING', get_source_encoding($lang));
    // 'UTF-8', 'ASCII', or 'EUC-JP'
    mb_language(get_mb_language($lang));
    mb_internal_encoding(SOURCE_ENCODING);
    ini_set('mbstring.http_input', 'pass');
    mb_http_output('pass');
    mb_detect_order('auto');
}
Ejemplo n.º 16
0
 public function apply()
 {
     if (function_exists('headers_sent') && headers_sent()) {
         throw new \RuntimeException("Failed to apply response: The headers have already " . "been sent out. You made some kind of output " . "before apply() has been called on the HTTP response");
     }
     if (function_exists('mb_http_output')) {
         $encoding = $this->getBody()->getContentEncoding();
         mb_http_output(strtoupper($encoding ? $encoding : 'UTF-8'));
         ob_start('mb_output_handler');
     }
     $this->applyHeadLine();
     $this->applyHeaders();
     $this->applyBody();
     return $this;
 }
Ejemplo n.º 17
0
 /**
  * @param null $config
  *
  * @return TestApplication
  */
 public function __construct($config = null)
 {
     Craft::setApplication(null);
     clearstatcache();
     // SHOW EVERYTHING
     error_reporting(E_ALL & ~E_STRICT);
     ini_set('display_errors', 1);
     mb_internal_encoding('UTF-8');
     mb_http_input('UTF-8');
     mb_http_output('UTF-8');
     mb_detect_order('auto');
     // No matter how much you want to delete this line... DO NOT DO IT.
     Craft::$enableIncludePath = false;
     parent::__construct($config);
 }
Ejemplo n.º 18
0
 /**
  * Let's boot up the requested application!
  *
  * @param string $application Name of the application.
  */
 public static function boot(string $application)
 {
     // already booted?
     if (self::getBootTime()) {
         return;
     }
     // start stopping time
     self::$bootedAt = microtime(true);
     // set internal character encoding
     function_exists('mb_internal_encoding') && mb_internal_encoding('utf-8');
     function_exists('mb_http_output') && mb_http_output('utf-8');
     // sets the default timezone used by all date/time functions
     date_default_timezone_set('Europe/Berlin');
     // booted application
     self::$bootedApplication = ApplicationHandler::boot($application);
 }
Ejemplo n.º 19
0
function clean($string)
{
    mb_internal_encoding('UTF-8');
    mb_http_output('UTF-8');
    mb_http_input('UTF-8');
    if (is_array($string)) {
        foreach ($string as $key => $value) {
            $string[$key] = clean($value);
        }
        return $string;
    } else {
        if (strpos($string = htmlentities($string, ENT_QUOTES, 'UTF-8'), '&') !== false) {
            $string = html_entity_decode(preg_replace('~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|tilde|uml);~i', '$1', $string), ENT_QUOTES, 'UTF-8');
        }
        return $string;
    }
}
Ejemplo n.º 20
0
 /**
  * Send the HTTP header
  *
  * @param	string  $filename
  *
  */
 protected function _header($filename)
 {
     if (function_exists('mb_http_output')) {
         mb_http_output('pass');
     }
     header('Content-Type: ' . $this->mimetype);
     if (preg_match("/MSIE ([0-9]\\.[0-9]{1,2})/", $_SERVER['HTTP_USER_AGENT'])) {
         header('Content-Disposition: attachment; filename="' . $filename . '"');
         header('Expires: 0');
         header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
         header('Pragma: public');
     } else {
         header('Content-Disposition: attachment; filename="' . $filename . '"');
         header('Expires: 0');
         header('Pragma: no-cache');
     }
 }
Ejemplo n.º 21
0
function wpfa_apply_filters()
{
    ini_set('default_charset', 'UTF-8');
    ini_set('date.timezone', 'UTC');
    if (extension_loaded('mbstring')) {
        mb_internal_encoding('UTF-8');
        mb_language('neutral');
        mb_http_output('UTF-8');
    }
    foreach (array('date_i18n', 'get_post_time', 'get_comment_date', 'get_comment_time', 'get_the_date', 'the_date', 'get_the_time', 'the_time', 'get_the_modified_date', 'the_modified_date', 'get_the_modified_time', 'the_modified_time', 'get_post_modified_time', 'number_format_i18n') as $i) {
        remove_all_filters($i);
    }
    add_filter('date_i18n', 'wpfa_date_i18n', 10, 3);
    if (WPFA_NUMS === "on") {
        add_filter('number_format_i18n', 'numbers_fa');
    }
}
 public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
 {
     $front = Zend_Controller_Front::getInstance();
     $currentModule = $front->getRequest()->getModuleName();
     $registry = Zend_Registry::getInstance();
     $registry->session = Base_Helper_Session::getInstance();
     $appConfig = $front->getParam("bootstrap")->getOptions();
     $registry->appConfig = $appConfig;
     $registry->currentModule = $currentModule;
     $modulePaths = array();
     foreach ($front->getControllerDirectory() as $moduleName => $controllerPath) {
         $modulePaths[$moduleName] = dirname($controllerPath);
     }
     $registry->modulePaths = $modulePaths;
     $registry->controllerPaths = $front->getControllerDirectory();
     $logName = date('Y-m-d') . '.log';
     !is_dir(LOG_PATH) ? mkdir(LOG_PATH, 0777, TRUE) : NULL;
     $registry->logging = new Base_Php_Overloader();
     $registry->logging->logDir = LOG_PATH;
     $registry->logging->logName = $logName;
     Base_Helper_Log::getInstance()->setLogName($logName);
     if (PHP_VERSION_ID < 50600) {
         mb_http_input('UTF-8');
         mb_http_output('UTF-8');
         mb_internal_encoding('UTF-8');
         iconv_set_encoding('input_encoding', 'UTF-8');
         iconv_set_encoding('output_encoding', 'UTF-8');
         iconv_set_encoding('internal_encoding', 'UTF-8');
         iconv_set_encoding('internal_encoding', 'UTF-8');
     } else {
         ini_set('input_encoding', 'UTF-8');
         ini_set('output_encoding', 'UTF-8');
         ini_set('default_charset', 'UTF-8');
         ini_set('default_charset', 'UTF-8');
         //ini_set('mbstring.http_input', 'UTF-8');
         //ini_set('mbstring.http_output', 'UTF-8');
         //ini_set('mbstring.internal_encoding', 'UTF-8');
     }
     if ('base' != strtolower($currentModule)) {
         Base_Plugin_Module::init();
     }
     $class = ucfirst($currentModule) . '_Plugin_Module';
     call_user_func($class . '::init');
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 public function process()
 {
     // ページのデータを取得
     // FIXME PCサイトのみに限定している。ある程度妥当だとは思うが、よりベターな方法はないだろうか。
     $this->arrPageList = $this->getPageData('device_type_id = ?', DEVICE_TYPE_PC);
     // キャッシュしない(念のため)
     header('Paragrama: no-cache');
     // XMLテキスト
     header('Content-type: application/xml; charset=utf-8');
     // 必ず UTF-8 として出力
     mb_http_output('UTF-8');
     ob_start('mb_output_handler');
     echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
     echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
     // TOPページを処理
     $arrTopPagesList = $this->getTopPage($this->arrPageList);
     $this->createSitemap($arrTopPagesList[0]['url'], $this->date2W3CDatetime($arrTopPagesList[0]['update_date']), 'daily', 1.0);
     // 静的なページを処理
     foreach ($this->staticURL as $url) {
         $this->createSitemap($url, '', 'daily', 1.0);
     }
     // 編集可能ページを処理
     $arrEditablePagesList = $this->getEditablePage($this->arrPageList);
     foreach ($arrEditablePagesList as $arrEditablePage) {
         $this->createSitemap($arrEditablePage['url'], $this->date2W3CDatetime($arrEditablePage['update_date']));
     }
     // 商品一覧ページを処理
     $arrProductPagesList = $this->getAllProducts();
     foreach ($arrProductPagesList as $arrProductPage) {
         $this->createSitemap($arrProductPage['url'], '', 'daily');
     }
     // 商品詳細ページを処理
     $arrDetailPagesList = $this->getAllDetail();
     foreach ($arrDetailPagesList as $arrDetailPage) {
         $this->createSitemap($arrDetailPage['url'], $this->date2W3CDatetime($arrDetailPage['update_date']));
     }
     // 追加分
     $arrPageListAdd = $this->arrPageListAdd;
     foreach ($arrPageListAdd as $arrPageAdd) {
         $this->createSitemap($arrPageAdd['url'], $this->date2W3CDatetime($arrDetailPage['update_date']));
     }
     echo '</urlset>' . "\n";
 }
Ejemplo n.º 24
0
 public static function setEncoding($encoding = 'UTF-8', $language = null)
 {
     if ($language === null || !in_array($language, ['uni', 'Japanese', 'ja', 'English', 'en'], true)) {
         $language = 'uni';
     }
     switch (strtoupper($encoding)) {
         case 'UTF-8':
             if (extension_loaded("mbstring")) {
                 mb_internal_encoding($encoding);
                 mb_http_output($encoding);
                 mb_http_input($encoding);
                 mb_language($language);
                 mb_regex_encoding($encoding);
             } else {
                 throw new phpFastCacheCoreException("MB String need to be installed for Unicode Encoding");
             }
             break;
     }
 }
Ejemplo n.º 25
0
 /**
  * @param $locale_head
  * @return string
  */
 static function setLocale($language, $region, $encoding)
 {
     if (self::$language != $language) {
         foreach (self::$domains as $domain) {
             self::resetDomain($domain);
         }
     }
     self::$language = $language;
     self::$region = $region;
     self::$encoding = $encoding;
     $locale = self::makeLocale($language, $region, $encoding);
     setlocale(LC_ALL, $locale);
     // set init encoding
     mb_language($language);
     mb_internal_encoding($encoding);
     mb_http_input($encoding);
     mb_http_output($encoding);
     return $locale;
 }
Ejemplo n.º 26
0
 public function __construct()
 {
     $this->dbhost = get_dbhost();
     $this->dbuser = get_dbuser();
     $this->dbpw = get_dbpw();
     $this->dbname = get_dbname();
     $this->dbsocket = get_dbsocket();
     $this->dbport = get_dbport();
     $this->etuliite = get_etuliite();
     mb_internal_encoding('UTF-8');
     mb_http_output('UTF-8');
     mb_http_input('UTF-8');
     if (empty($this->dbsocket)) {
         $this->local_db = mysqli_connect($this->dbhost, $this->dbuser, $this->dbpw) or die;
         mysqli_select_db($this->local_db, $this->dbname) or die;
     } else {
         $this->local_db = mysqli_connect($this->dbhost, $this->dbuser, $this->dbpw, $this->dbname, $this->dbport, $this->dbsocket) or die;
     }
 }
Ejemplo n.º 27
0
function add_file_counter($files_sn = "")
{
    global $xoopsDB;
    $file = upfile::get_one_file($files_sn);
    $file_type = $file['file_type'];
    $file_size = $file['file_size'];
    $real_filename = $file['description'];
    $sql = "update " . $xoopsDB->prefix("tad_web_files_center") . " set `counter`=`counter`+1 where `files_sn`='{$files_sn}'";
    $xoopsDB->queryF($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error());
    if ($file['kind'] == "img") {
        //header("location:"._FILES_CENTER_IMAGE_URL."/{$file['file_name']}");
        $file_saved = _FILES_CENTER_IMAGE_URL . "/{$file['file_name']}";
    } else {
        //header("location:"._FILES_CENTER_URL."/{$file['file_name']}");
        $file_saved = _FILES_CENTER_URL . "/{$file['file_name']}";
    }
    $file_display = mb_convert_encoding($real_filename, "BIG-5", "UTF-8");
    $mimetype = $file_type;
    if (function_exists('mb_http_output')) {
        mb_http_output('pass');
    }
    header('Expires: 0');
    header('Content-Type: ' . $mimetype);
    if (preg_match("/MSIE ([0-9]\\.[0-9]{1,2})/", $HTTP_USER_AGENT)) {
        header('Content-Disposition: inline; filename="' . $file_display . '"');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Pragma: public');
    } else {
        header('Content-Disposition: attachment; filename="' . $file_display . '"');
        header('Pragma: no-cache');
    }
    header("Content-Type: application/force-download");
    header("Content-Transfer-Encoding: binary");
    $handle = fopen($file_saved, "rb");
    while (!feof($handle)) {
        $buffer = fread($handle, 4096);
        echo $buffer;
    }
    fclose($handle);
}
Ejemplo n.º 28
0
 function init($blog_id = null, $cfg_file = null)
 {
     if (isset($blog_id)) {
         $this->blog_id = $blog_id;
     }
     if (!file_exists($cfg_file)) {
         $mtdir = dirname(dirname(__FILE__));
         $cfg_file = $mtdir . DIRECTORY_SEPARATOR . "config.cgi";
     }
     $this->configure($cfg_file);
     $this->init_addons();
     $this->configure_from_db();
     $lang = substr(strtolower($this->config('DefaultLanguage')), 0, 2);
     if (!@(include_once "l10n_{$lang}.php")) {
         include_once "l10n_en.php";
     }
     if (extension_loaded('mbstring')) {
         $charset = $this->config('PublishCharset');
         mb_internal_encoding($charset);
         mb_http_output($charset);
     }
 }
Ejemplo n.º 29
0
 public function __construct(ErrorRunner $errorRunner, FullLogInterface $logger)
 {
     // This is used to compress output, but it can cause errors during debugging
     // if output is sent before compression.
     ini_set("zlib.output_compression", "On");
     ob_start();
     date_default_timezone_set('America/Chicago');
     mb_internal_encoding('UTF-8');
     mb_http_output('UTF-8');
     // These are better to set as defaults in php.ini, but here for inclusion.
     // They help make the session hash stronger and introduce more bits into data.
     ini_set('default_charset', 'utf-8');
     register_shutdown_function(array($this, 'shutdownNotify'));
     // Sending headers in the command line will cause problems.
     // This converts all errors to Exceptions automatically.
     set_error_handler([$this, 'errorHandler']);
     if (PHP_SAPI !== 'cli') {
         $this->sendHeaders();
     }
     $this->errorRunner = $errorRunner;
     $this->logger = $logger;
 }
Ejemplo n.º 30
-1
 public function run()
 {
     ignore_user_abort(false);
     ob_implicit_flush(1);
     ini_set('implicit_flush', true);
     cachemgr::init(false);
     if (strpos(strtolower(PHP_OS), 'win') === 0) {
         if (function_exists('mb_internal_encoding')) {
             mb_internal_encoding('UTF-8');
             mb_http_output('GBK');
             ob_start('mb_output_handler', 2);
         } elseif (function_exists('iconv_set_encoding')) {
             iconv_set_encoding('internal_encoding', 'UTF-8');
             iconv_set_encoding('output_encoding', 'GBK');
             ob_start('ob_iconv_handler', 2);
         }
     }
     if (isset($_SERVER['argv'][1])) {
         $args = array_shift($_SERVER['argv']);
         $rst = $this->exec_command(implode(' ', $_SERVER['argv']));
         if ($rst === false) {
             exit(-1);
         }
     } else {
         $this->interactive();
     }
 }