コード例 #1
1
ファイル: class-bootstrap.php プロジェクト: arter97/h5ai
 public static function run()
 {
     spl_autoload_register(['Bootstrap', 'autoload']);
     putenv('LANG=en_US.UTF-8');
     setlocale(LC_CTYPE, 'en_US.UTF-8');
     date_default_timezone_set(@date_default_timezone_get());
     session_start();
     $session = new Session($_SESSION);
     $request = new Request($_REQUEST);
     $setup = new Setup($request->query_boolean('refresh', false));
     $context = new Context($session, $request, $setup);
     if ($context->is_api_request()) {
         (new Api($context))->apply();
     } else {
         if ($context->is_info_request()) {
             $public_href = $setup->get('PUBLIC_HREF');
             $x_head_tags = $context->get_x_head_html();
             require __DIR__ . '/pages/info.php';
         } else {
             $public_href = $setup->get('PUBLIC_HREF');
             $x_head_tags = $context->get_x_head_html();
             $fallback_html = (new Fallback($context))->get_html();
             require __DIR__ . '/pages/index.php';
         }
     }
 }
コード例 #2
0
 /**
  * Constructor
  *
  * @return  void
  */
 public function __construct($caller)
 {
     setlocale(LC_MONETARY, 'en_US.UTF-8');
     $logPath = Config::get('log_path', PATH_APP . DS . 'logs');
     $this->logFile = $logPath . DS . 'cart.log';
     $this->caller = $caller;
 }
コード例 #3
0
function translate($lang, $test = 0)
{
    global $LOCALE_PATH;
    putenv("LANGUAGE={$lang}");
    bindtextdomain("zarafa", "{$LOCALE_PATH}");
    if (STORE_SUPPORTS_UNICODE == false) {
        bind_textdomain_codeset('zarafa', "windows-1252");
    } else {
        bind_textdomain_codeset('zarafa', "utf-8");
    }
    textdomain('zarafa');
    setlocale(LC_ALL, $lang);
    $trans_array["Sent Items"] = _("Sent Items");
    $trans_array["Outbox"] = _("Outbox");
    $trans_array["Deleted Items"] = _("Deleted Items");
    $trans_array["Inbox"] = _("Inbox");
    $trans_array["Calendar"] = _("Calendar");
    $trans_array["Contacts"] = _("Contacts");
    $trans_array["Drafts"] = _("Drafts");
    $trans_array["Journal"] = _("Journal");
    $trans_array["Notes"] = _("Notes");
    $trans_array["Tasks"] = _("Tasks");
    $trans_array["Junk E-mail"] = _("Junk E-mail");
    return $trans_array;
}
コード例 #4
0
ファイル: fireeagle.php プロジェクト: nemein/openpsa
 private function _fetch_fireeagle_positions($fireeagle_access_key, $fireeagle_access_secret)
 {
     $position = array();
     require_once MIDCOM_ROOT . '/external/fireeagle.php';
     $fireeagle = new FireEagle($this->_config->get('fireeagle_consumer_key'), $this->_config->get('fireeagle_consumer_secret'), $fireeagle_access_key, $fireeagle_access_secret);
     // Note: this must be C so we get floats correctly from JSON. See http://bugs.php.net/bug.php?id=41403
     setlocale(LC_NUMERIC, 'C');
     $user_data = $fireeagle->user();
     if (!$user_data || !$user_data->user || empty($user_data->user->location_hierarchy)) {
         return $position;
     }
     $best_position = $user_data->user->location_hierarchy[0];
     switch ($best_position->level_name) {
         case 'exact':
             $position['accuracy'] = 10;
             break;
         case 'postal':
             $position['accuracy'] = 20;
             break;
         case 'city':
             $position['accuracy'] = 30;
             break;
         default:
             $position['accuracy'] = 60;
             break;
     }
     $position['latitude'] = $best_position->latitude;
     $position['longitude'] = $best_position->longitude;
     $position['date'] = strtotime($best_position->located_at);
     return $position;
 }
コード例 #5
0
ファイル: TextHandler.php プロジェクト: nuffer/bolt
 /**
  * Returns the date time in a particular format. Takes the locale into
  * account.
  *
  * @param string|\DateTime $dateTime
  * @param string           $format
  *
  * @return string Formatted date and time
  */
 public function localeDateTime($dateTime, $format = '%B %e, %Y %H:%M')
 {
     if (!$dateTime instanceof \DateTime) {
         $dateTime = new \DateTime($dateTime);
     }
     // Check for Windows to find and replace the %e modifier correctly
     // @see: http://php.net/strftime
     if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
         $format = preg_replace('#(?<!%)((?:%%)*)%e#', '\\1%#d', $format);
     }
     // According to http://php.net/manual/en/function.setlocale.php manual
     // if the second parameter is "0", the locale setting is not affected,
     // only the current setting is returned.
     $result = setlocale(LC_ALL, 0);
     if ($result === false) {
         // This shouldn't occur, but.. Dude!
         // You ain't even got locale or English on your platform??
         // Various things we could do. We could fail miserably, but a more
         // graceful approach is to use the datetime to display a default
         // format
         $this->app['logger.system']->error('No valid locale detected. Fallback on DateTime active.', ['event' => 'system']);
         return $dateTime->format('Y-m-d H:i:s');
     } else {
         $timestamp = $dateTime->getTimestamp();
         return strftime($format, $timestamp);
     }
 }
コード例 #6
0
 /**
  * Constructor. Perform some checks about the OS and setserial
  *
  * @return phpSerial
  */
 function Serial()
 {
     setlocale(LC_ALL, "en_US");
     $sysname = php_uname();
     if (substr($sysname, 0, 5) === "Linux") {
         $this->_os = "linux";
         if ($this->_exec("stty --version") === 0) {
             register_shutdown_function(array($this, "deviceClose"));
         } else {
             trigger_error("No stty availible, unable to run.", E_USER_ERROR);
         }
     } elseif (substr($sysname, 0, 6) === "Darwin") {
         $this->_os = "osx";
         // We know stty is available in Darwin.
         // stty returns 1 when run from php, because "stty: stdin isn't a
         // terminal"
         // skip this check
         //                      if($this->_exec("stty") === 0)
         //                      {
         register_shutdown_function(array($this, "deviceClose"));
         //                      }
         //                      else
         //                      {
         //                              trigger_error("No stty availible, unable to run.", E_USER_ERROR);
         //                      }
     } elseif (substr($sysname, 0, 7) === "Windows") {
         $this->_os = "windows";
         register_shutdown_function(array($this, "deviceClose"));
     } else {
         trigger_error("Host OS is neither osx, linux nor windows, unable tu run.", E_USER_ERROR);
         exit;
     }
 }
コード例 #7
0
ファイル: xp.php プロジェクト: BackupTheBerlios/babylon
function zeichne_beitrag($param)
{
    $Erster = $param['Erster'];
    $ForumId = $param['ForumId'];
    $BeitragId = $param['BeitragId'];
    $Autor = $param['Autor'];
    $AutorURL = rawurlencode($Autor);
    $StempelLetzter = $param['StempelLetzter'];
    $Thema = $param['Thema'];
    $Inhalt = $param['Inhalt'];
    $Egl = $param['Egl'];
    $Atavar = $param['Atavar'];
    setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
    $datum = strftime("%d.%b.%Y", $StempelLetzter);
    $zeit = date("H.i:s", $StempelLetzter);
    if ($Erster) {
        echo "      <tr>\n        <th class=\"ueber\" align=\"center\" width=\"100%\" colspan=\"2\">{$Thema}</th>\n      </tr>\n";
    }
    echo "      <tr>\n        <td colspan=\"2\">\n          <table class=\"beitrag\">\n            <tr>\n              <th class=\"ueber\" align=\"left\" colspan=\"2\"><a href=\"mitglieder-profil.php?alias={$AutorURL}\">{$Autor}</a></th>\n              <th class=\"ueber\" align=\"right\">{$datum} {$zeit}</th>\n            </tr>\n            <tr>\n";
    if ($Atavar > -1) {
        echo "              <td class=\"col-dunkel\" valign=\"top\">\n                <div class=\"atavar\">\n                  <img src=\"atavar-ausgeben.php?atavar={$Atavar}\">\n                </div>\n              </td>\n              <td class=\"col-hell\" valign=\"top\" colspan=\"2\" width=\"100%\">{$Inhalt}</td>\n";
    } else {
        echo "              <td class=\"col-hell\" valign=\"top\" colspan=\"3\" width=\"100%\">{$Inhalt}</td>\n";
    }
    echo "            </tr>\n          </table>\n        </td>\n      </tr>\n";
    // Die Antwort Zeile
    if ($Egl) {
        echo "      <tr>\n        <td><font size=\"-1\"><input type=\"radio\" name=\"eltern\" value=\"{$BeitragId}\"";
        if ($Erster) {
            echo ' checked';
        }
        echo ">Antworten auf diesen Beitrag</font></td>\n        <td align=\"right\"><font size=\"-1\"><button type=\"submit\" name=\"zid\" value=\"{$BeitragId}\">zitieren</button></font></td>\n      </tr>\n";
    }
}
コード例 #8
0
ファイル: CApp.php プロジェクト: amanai/next24
 public function init($configFile)
 {
     if (!file_exists($configFile) || !is_file($configFile)) {
         die("Missing main configuration file");
     }
     //$x = setlocale(LC_TIME, 'ru_RU.CP1251', 'ru_RU.cp1251', 'Russian_Russia.1251');
     $x = setlocale(LC_ALL, 'rus_RUS.65001', 'rus_RUS.65001', 'Russian_Russia.65001');
     $xml = simplexml_load_file($configFile);
     foreach ($xml->module as $module) {
         $configuration = new ConfigParameter($module->asXML());
         $class = $configuration->get('class');
         if (!$class) {
             die("Module has no class");
         }
         $module_id = $configuration->get('id');
         if (!$module_id) {
             die("Module has no ID");
         }
         if (Project::exists($module_id)) {
             // TODO:: write to log file
             //die("Module id already busy:".$module_id);
         }
         $module = new $class();
         $module->initialize($configuration);
         if ($module->setToRegistry() === true) {
             Project::set($module_id, $module);
         }
         unset($module);
     }
 }
コード例 #9
0
ファイル: ProgramacionW.php プロジェクト: Telemedellin/tm
 public static function getSelect($menu)
 {
     date_default_timezone_set('America/Bogota');
     setlocale(LC_ALL, 'es_ES.UTF-8');
     $base = bu('programacion');
     $hoy = mktime(0, 0, 0, date('m'), date('j'), date('Y'));
     $html = '';
     $manana = $hoy + 86400;
     $ya = false;
     $ruri = Yii::app()->request->requestUri;
     $html .= '<select name="dia_programacion" id="dia_programacion">';
     foreach ($menu as $item) {
         $selected = '';
         $url = $base . '?dia=' . date('j', $item) . '&mes=' . date('m', $item) . '&anio=' . date('Y', $item);
         if (!$ya) {
             if ($url == $ruri) {
                 $selected = " selected='selected'";
                 $ya = true;
             } elseif ($item >= $hoy && $item < $manana) {
                 $selected = " selected='selected'";
             } else {
                 $selected = '';
             }
         }
         $html .= '<option value="' . $url . '"' . $selected . '>';
         $html .= ucfirst(strftime("%A", $item)) . ' ' . strftime("%e", $item);
         $html .= '</option>';
     }
     $html .= '</select>';
     return $html;
 }
コード例 #10
0
ファイル: DefaultController.php プロジェクト: andrelotto/zcpe
 /**
  * @Route("/admin/parser")
  * @Method("GET")
  * @Template()
  */
 public function parserAction()
 {
     set_time_limit(0);
     $rootDir = $this->get('kernel')->getRootDir();
     $content = file_get_contents(realpath($rootDir . '/../docs/google-groups-posts.bkp.html'));
     $crawler = new Crawler($content);
     $subjectFilterPrefix = 'pergunta';
     $em = $this->get('doctrine')->getManager();
     $crawler->filter('body > table > tbody > tr > td > div > div > div:first-child')->each(function (Crawler $node, $i) use(&$subjectFilterPrefix, $em) {
         $subject = $node->filter('a')->first();
         $author = $node->filter('div:first-child > div')->attr('data-name');
         $time = $node->filter('div')->last()->children()->attr('title');
         setlocale(LC_ALL, NULL);
         setlocale(LC_ALL, 'pt_BR');
         if (substr(strtolower(utf8_decode($subject->text())), 0, strlen($subjectFilterPrefix)) == $subjectFilterPrefix) {
             $timeParts = explode(',', utf8_decode($time));
             $timeParsed = strptime(end($timeParts), '%d de %B de %Y %Hh%Mmin%Ss');
             $createdAt = new \DateTime(date('Y-m-d h:i:s', mktime($timeParsed['tm_hour'], $timeParsed['tm_min'], $timeParsed['tm_sec'], 1, $timeParsed['tm_yday'] + 1, $timeParsed['tm_year'] + 1900)));
             $entity = $em->getRepository('CekurteZCPEBundle:Parser')->findOneBy(array('subject' => utf8_decode($subject->text())));
             if (!$entity instanceof Parser) {
                 $parser = new Parser();
                 $parser->setSubject(utf8_decode($subject->text()))->setUrl($subject->attr('href'))->setAuthor(utf8_decode($author))->setCreatedAt($createdAt);
                 $em->persist($parser);
                 $em->flush();
             }
         }
     });
     return array();
 }
コード例 #11
0
ファイル: TippsController.php プロジェクト: sewede/footipp
 public function index()
 {
     Carbon::setLocale('de');
     setlocale(LC_TIME, 'de_DE.utf8');
     $myTipps = Tipp::join('matches', 'tipps.match_id', '=', 'matches.id')->join('clubs as homeclub', 'matches.home_id', '=', 'homeclub.id')->join('clubs as awayclub', 'matches.away_id', '=', 'awayclub.id')->select('matches.home_goals as erg1', 'matches.away_goals as erg2', 'matches.date', 'tipps.*', 'homeclub.club as home', 'awayclub.club as away')->where('tipps.user_id', '=', Auth::id())->orderBy('date')->get();
     return view('pages.tipps', compact('myTipps'));
 }
コード例 #12
0
ファイル: TestBase.php プロジェクト: jubinpatel/horde
 /**
  * Tests ability to extract EXIF data without errors. Does not test data
  * for validity.
  */
 public function testExtract()
 {
     $fixture = __DIR__ . '/../Fixtures/img_exif.jpg';
     setlocale(LC_ALL, 'de_DE');
     self::$_data = self::$_exif->getData($fixture);
     $this->assertInternalType('array', self::$_data);
 }
コード例 #13
0
ファイル: view.functions.php プロジェクト: umjinsun12/dngshin
function set_language()
{
    global $amp_conf, $db;
    $nt = notifications::create($db);
    if (extension_loaded('gettext')) {
        $nt->delete('core', 'GETTEXT');
        if (php_sapi_name() !== 'cli') {
            if (empty($_COOKIE['lang']) || !preg_match('/^[\\w\\._@-]+$/', $_COOKIE['lang'], $matches)) {
                $lang = $amp_conf['UIDEFAULTLANG'] ? $amp_conf['UIDEFAULTLANG'] : 'en_US';
                if (empty($_COOKIE['lang'])) {
                    setcookie("lang", $lang);
                }
            } else {
                preg_match('/^([\\w\\._@-]+)$/', $_COOKIE['lang'], $matches);
                $lang = !empty($matches[1]) ? $matches[1] : 'en_US';
            }
            $_COOKIE['lang'] = $lang;
        } else {
            $lang = $amp_conf['UIDEFAULTLANG'] ? $amp_conf['UIDEFAULTLANG'] : 'en_US';
        }
        putenv('LC_ALL=' . $lang);
        putenv('LANG=' . $lang);
        putenv('LANGUAGE=' . $lang);
        setlocale(LC_ALL, $lang);
        bindtextdomain('amp', $amp_conf['AMPWEBROOT'] . '/admin/i18n');
        bind_textdomain_codeset('amp', 'utf8');
        textdomain('amp');
        return $lang;
    }
    $nt->add_warning('core', 'GETTEXT', _("Gettext is not installed"), _("Please install gettext so that the PBX can properly translate itself"), 'https://www.gnu.org/software/gettext/');
    return 'en_US';
}
コード例 #14
0
ファイル: GenerateIntl.php プロジェクト: dorelljames/piwik
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $piwikLanguages = \Piwik\Plugins\LanguagesManager\API::getInstance()->getAvailableLanguages();
     $aliasesUrl = 'https://raw.githubusercontent.com/unicode-cldr/cldr-core/master/supplemental/aliases.json';
     $aliasesData = Http::fetchRemoteFile($aliasesUrl);
     $aliasesData = json_decode($aliasesData, true);
     $aliasesData = $aliasesData['supplemental']['metadata']['alias']['languageAlias'];
     $writePath = Filesystem::getPathToPiwikRoot() . '/plugins/Intl/lang/%s.json';
     foreach ($piwikLanguages as $langCode) {
         if ($langCode == 'dev') {
             continue;
         }
         $requestLangCode = $transformedLangCode = $this->transformLangCode($langCode);
         if (array_key_exists($requestLangCode, $aliasesData)) {
             $requestLangCode = $aliasesData[$requestLangCode]['_replacement'];
         }
         // fix some locales
         $localFixes = array('pt' => 'pt-PT', 'pt-br' => 'pt', 'zh-cn' => 'zh-Hans', 'zh-tw' => 'zh-Hant');
         if (array_key_exists($langCode, $localFixes)) {
             $requestLangCode = $localFixes[$langCode];
         }
         setlocale(LC_ALL, $langCode);
         $translations = array();
         $this->fetchLanguageData($output, $transformedLangCode, $requestLangCode, $translations);
         $this->fetchTerritoryData($output, $transformedLangCode, $requestLangCode, $translations);
         $this->fetchCalendarData($output, $transformedLangCode, $requestLangCode, $translations);
         $this->fetchLayoutDirection($output, $transformedLangCode, $requestLangCode, $translations);
         $this->fetchUnitData($output, $transformedLangCode, $requestLangCode, $translations);
         $this->fetchNumberFormattingData($output, $transformedLangCode, $requestLangCode, $translations);
         ksort($translations['Intl']);
         file_put_contents(sprintf($writePath, $langCode), json_encode($translations, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
     }
 }
コード例 #15
0
function smarty_modifier_locale($stream, $locale)
{
    setlocale("LC_ALL", $locale);
    setlocale("LC_TIME", $locale);
    setlocale("LC_LANG", $locale);
    return $stream;
}
コード例 #16
0
ファイル: localizer.php プロジェクト: roitiger/sonosmusix
 public function __construct($dataDirectory)
 {
     //
     // Default to English for lack of anything better
     //
     $this->clientLang = 'en-us';
     //
     // See if we can find anything better
     //
     $matches = array();
     if (array_key_exists('HTTP_ACCEPT_LANGUAGE', $_SERVER)) {
         setlocale(LC_ALL, 'en-US');
         if (preg_match('/(en-US|fr-FR|de-DE|it-IT|es-ES|sv-SV|sv-SE|nl-NL)/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $matches)) {
             $this->clientLang = strtolower($matches[1]);
         }
     }
     //
     // Pull in all of the strings we need
     //
     $lang2file = array("es-es" => "es-ES.xml", "en-us" => "en-US.xml", "de-de" => "de-DE.xml", "fr-fr" => "fr-FR.xml", "it-it" => "it-IT.xml", "nl-nl" => "nl-NL.xml", "sv-sv" => "sv-SE.xml", "sv-se" => "sv-SE.xml");
     $xml_parser = xml_parser_create();
     $l10nValues = array();
     $l10nIndexes = array();
     $l10nContents = file_get_contents("{$dataDirectory}/" . $lang2file[$this->getClientLang()]);
     if (!xml_parse_into_struct($xml_parser, $l10nContents, $l10nValues, $l10nIndexes)) {
         die(sprintf("l10n: XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser)));
     } else {
         foreach ($l10nIndexes["STRING"] as $l10nStringIndex) {
             $this->l10n[$l10nValues[$l10nStringIndex]["attributes"]["ID"]] = $l10nValues[$l10nStringIndex]["value"];
         }
     }
     xml_parser_free($xml_parser);
 }
コード例 #17
0
ファイル: qa-base.php プロジェクト: netham91/question2answer
function qa_initialize_php()
{
    if (qa_php_version_below('4.3')) {
        qa_fatal_error('This requires PHP 4.3 or later');
    }
    error_reporting(E_ALL);
    // be ultra-strict about error checking
    @ini_set('magic_quotes_runtime', 0);
    @setlocale(LC_CTYPE, 'C');
    // prevent strtolower() et al affecting non-ASCII characters (appears important for IIS)
    if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
        @date_default_timezone_set(@date_default_timezone_get());
    }
    // prevent PHP notices where default timezone not set
    if (ini_get('register_globals')) {
        $checkarrays = array('_ENV', '_GET', '_POST', '_COOKIE', '_SERVER', '_FILES', '_REQUEST', '_SESSION');
        // unregister globals if they're registered
        $keyprotect = array_flip(array_merge($checkarrays, array('GLOBALS')));
        foreach ($checkarrays as $checkarray) {
            if (isset(${$checkarray}) && is_array(${$checkarray})) {
                foreach (${$checkarray} as $checkkey => $checkvalue) {
                    if (isset($keyprotect[$checkkey])) {
                        qa_fatal_error('My superglobals are not for overriding');
                    } else {
                        unset($GLOBALS[$checkkey]);
                    }
                }
            }
        }
    }
}
コード例 #18
0
function tgl($date)
{
    setlocale(LC_TIME, 'INDONESIAN');
    $st = strftime("%d/%m/%Y", strtotime($date));
    //return strtoupper($st);
    return $st;
}
コード例 #19
0
ファイル: csv.php プロジェクト: 453111208/bbc
 function __construct()
 {
     if (!setlocale(LC_ALL, 'zh_CN.gbk')) {
         setlocale(LC_ALL, "chs");
     }
     $this->charset = kernel::single('base_charset');
 }
コード例 #20
0
function processData($data)
{
    global $db, $drop;
    $data = $data->toArray();
    foreach ($data as $collection => $entities) {
        if ($drop) {
            $db->{$collection}->drop();
        }
        foreach ($entities as $entity) {
            echo "Generating {$collection} " . (@$entity['_id'] ?: "new") . PHP_EOL;
            if (!isset($entity['_id'])) {
                $entity['_id'] = (string) new \MongoId();
            }
            if ($collection === 'user') {
                setlocale(LC_CTYPE, 'en_US.utf8');
                if (isset($entity['firstName'])) {
                    $fistNameSorting = utf8_encode(iconv("UTF-8", 'ASCII//TRANSLIT', $entity['firstName']));
                    $fistNameSorting = strtolower($fistNameSorting);
                    $entity['firstName_sorting'] = $fistNameSorting;
                }
                if (isset($entity['lastName'])) {
                    $lastNameSorting = utf8_encode(iconv("UTF-8", 'ASCII//TRANSLIT', $entity['lastName']));
                    $lastNameSorting = strtolower($lastNameSorting);
                    $entity['lastName_sorting'] = $lastNameSorting;
                }
            }
            $db->{$collection}->save($entity);
        }
    }
    //$db->user->ensureIndex(array('userName' => 1), array('unique'=>1));
    $db->org_mock->ensureIndex(array('name' => 1), array('unique' => 1));
}
コード例 #21
0
ファイル: index.php プロジェクト: themiddleearth/RPG.SU
function addm($char, $mes, $priv)
{
    setlocale(LC_ALL, "ru_RU.CP1251");
    if (!isset($char['sex']) || $char['sex'] == "male") {
        $mes = preg_replace("/\\{([\\d\\w\\s]*?)\\|([\\d\\w\\s]*?)\\}/i", "\\1", $mes);
    } else {
        $mes = preg_replace("/\\{([\\d\\w\\s]*?)\\|([\\d\\w\\s]*?)\\}/i", "\\2", $mes);
    }
    $mes = '<span style="color:#FF2828;font-size:12px;">' . iconv("Windows-1251", "UTF-8//IGNORE", $mes) . '</style>';
    $message = $mes;
    $message = mysql_real_escape_string($message);
    $sel = myquery("SELECT `count` FROM `game_bot_chat_resp` WHERE `id` = '" . $char['name'] . "';");
    $n = mysql_fetch_array($sel);
    if ($n['count'] <= 4) {
        myquery("INSERT INTO `game_bot_chat_resp` (`id`,`count`) VALUES ('" . $char['name'] . "','1') ON DUPLICATE KEY UPDATE `count` = `count` + 1;");
        $update_chat = myquery("insert into game_log (town,fromm,too,message,date,ptype) values (0,'-1','" . $char['user_id'] . "','" . $message . "','" . time() . "'," . $priv . ")");
    } else {
        $sel = myquery("SELECT `text` FROM `game_bot_chat_annoy` ORDER BY RAND() ASC LIMIT 1");
        $mes = mysql_fetch_array($sel);
        if (!isset($char['sex']) || $char['sex'] == "male") {
            $mes = preg_replace("/\\{([\\d\\w\\s]*?)\\|([\\d\\w\\s]*?)\\}/i", "\\1", $mes);
        } else {
            $mes = preg_replace("/\\{([\\d\\w\\s]*?)\\|([\\d\\w\\s]*?)\\}/i", "\\2", $mes);
        }
        $message = mysql_real_escape_string('<span style="color:#FF2828;font-size:12px;">' . iconv("Windows-1251", "UTF-8//IGNORE", $mes['text']) . '</style>');
        $update_chat = myquery("insert into game_log (town,fromm,too,message,date,ptype) values (0,'-1','" . $char['user_id'] . "','" . $message . "','" . time() . "'," . $priv . ")");
    }
}
コード例 #22
0
ファイル: Gettext.php プロジェクト: rpsimao/laravel-gettext
 /**
  * Sets the current locale code
  */
 public function setLocale($locale)
 {
     //Remove from master until I figure this out
     /*if (!$this->isLocaleSupported($locale)) {
           throw new Exceptions\LocaleNotSupportedException(
               sprintf('Locale %s is not supported', $locale)
           );
       }*/
     try {
         $gettextLocale = $locale . "." . $this->encoding;
         // All locale functions are updated: LC_COLLATE, LC_CTYPE,
         // LC_MONETARY, LC_NUMERIC, LC_TIME and LC_MESSAGES
         putenv("LC_ALL={$gettextLocale}");
         putenv("LANGUAGE={$gettextLocale}");
         setlocale(LC_ALL, $gettextLocale);
         // Domain
         $this->setDomain($this->domain);
         $this->locale = $locale;
         $this->session->set($locale);
         // Laravel built-in locale
         if ($this->configuration->isSyncLaravel()) {
             $this->adapter->setLocale($locale);
         }
         return $this->getLocale();
     } catch (\Exception $e) {
         $this->locale = $this->configuration->getFallbackLocale();
         $exceptionPosition = $e->getFile() . ":" . $e->getLine();
         throw new \Exception($exceptionPosition . $e->getMessage());
     }
 }
コード例 #23
0
ファイル: Format.php プロジェクト: abada/webshop
 public static function formatDate($date)
 {
     $instance = Carbon::createFromFormat('Y-m-d', $date);
     setlocale(LC_TIME, 'fr_FR');
     $formatDate = $instance->formatLocalized('%d %B %Y');
     return $formatDate;
 }
コード例 #24
0
 /**
  * Initialize the Titanium core framework and autoloader
  *
  * @access public
  * @return void
  */
 public static function init()
 {
     // Register the framework autoloader
     spl_autoload_register(array('Titanium', 'auto_loader'));
     // Set the timezone for the date() functions
     date_default_timezone_set('America/Chicago');
     // Set internal locale
     setlocale(LC_ALL, 'en_US.utf-8');
     // Set internet encoding to utf8
     ini_set('default_charset', 'UTF-8');
     // Register the script shurdown handler
     register_shutdown_function(array('Titanium', 'handle_shutdown'));
     /*
     set_exception_handler(
     	array('Titanium', 'exception_handler')
     );
     
     set_error_handler(
     	array('Titanium', 'error_handler')
     );
     */
     if (function_exists('mb_internal_encoding')) {
         mb_internal_encoding('UTF-8');
     }
     self::$is_cli = PHP_SAPI === 'cli';
     self::$is_windows = DIRECTORY_SEPARATOR === '\\';
     self::load_functions();
 }
コード例 #25
0
function before($route)
{
    $lang_mapping = array('fr' => 'fr_FR');
    if (!isset($_SESSION['locale'])) {
        $locale = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
        $_SESSION['locale'] = strtolower(substr(chop($locale[0]), 0, 2));
    }
    $lang = $_SESSION['locale'];
    // Convert simple language code into full language code
    if (array_key_exists($lang, $lang_mapping)) {
        $lang = $lang_mapping[$lang];
    }
    $lang = "{$lang}.utf8";
    $textdomain = "localization";
    putenv("LANGUAGE={$lang}");
    putenv("LANG={$lang}");
    putenv("LC_ALL={$lang}");
    putenv("LC_MESSAGES={$lang}");
    setlocale(LC_ALL, $lang);
    setlocale(LC_CTYPE, $lang);
    $locales_dir = dirname(__FILE__) . '/i18n';
    bindtextdomain($textdomain, $locales_dir);
    bind_textdomain_codeset($textdomain, 'UTF-8');
    textdomain($textdomain);
    set('locale', $lang);
}
コード例 #26
0
ファイル: date.class.php プロジェクト: Esleelkartea/arotz
 function parse()
 {
     setlocale(LC_TIME, $this->locale);
     if ($this->day && $this->month && $this->year) {
         $this->timestamp = mktime($this->hour, $this->minutes, $this->seconds, $this->month, $this->day, $this->year);
     }
     for ($i = 0; $i < 7; $i++) {
         $this->__weekdays[$i] = ucfirst(strftime("%a", $i * 86400 + 3 * 86400));
     }
     for ($i = 1; $i < 13; $i++) {
         $this->__months[$i] = ucfirst(strftime("%B", mktime(0, 0, 0, $i, 1, $this->year)));
     }
     list($this->weekday, $this->day, $this->month, $this->year, $this->hour, $this->minutes, $this->seconds) = explode(" ", date("w j n Y G i s", $this->timestamp));
     $this->strmonth = $this->__months[$this->month];
     $this->strweekday = $this->__weekdays[$this->weekday];
     //$this->string = $this->__weekdays[$this->weekday]." ".$this->day." ".$this->__months[$this->month]." ".$this->year." ".$this->hour.":".$this->minutes;
     $this->string = $this->day . "/" . $this->month . "/" . $this->year . " " . $this->hour . ":" . $this->minutes;
     $this->short_string = substr($this->__weekdays[$this->weekday], 0, 4) . " " . $this->day . " " . substr($this->__months[$this->month], 0, 3) . " " . $this->year;
     debug($this, "<font color=\"magenta\"> Parsed Date, timestamp = " . $this->timestamp . " , string = " . $this->string);
     if ($this->timestamp == 0 || $this->timestamp == -1) {
         $this->timestamp = 0;
         $this->day = 0;
         $this->month = 0;
         $this->year = 0;
         $this->hour = 0;
         $this->minutes = 0;
         $this->seconds = 0;
         $this->string = " N/A ";
         $this->short_string = " N/A ";
     }
 }
コード例 #27
0
 public static function start()
 {
     $OSCOM_Language = Registry::get('Language');
     $OSCOM_MessageStack = Registry::get('MessageStack');
     if (SERVICE_DEBUG_CHECK_LOCALE == '1') {
         $setlocale = setlocale(LC_TIME, explode(',', $OSCOM_Language->getLocale()));
         if ($setlocale === false || $setlocale === null) {
             $OSCOM_MessageStack->add('debug', 'Error: Locale does not exist: ' . $OSCOM_Language->getLocale(), 'error');
         }
     }
     if (SERVICE_DEBUG_CHECK_INSTALLATION_MODULE == '1' && file_exists(OSCOM::BASE_DIRECTORY . 'Core/Site/Setup')) {
         $OSCOM_MessageStack->add('debug', sprintf(OSCOM::getDef('warning_install_directory_exists'), OSCOM::BASE_DIRECTORY . 'Core/Site/Setup'), 'warning');
     }
     if (SERVICE_DEBUG_CHECK_CONFIGURATION == '1' && is_writeable(OSCOM::BASE_DIRECTORY . 'Config/settings.ini')) {
         $OSCOM_MessageStack->add('debug', sprintf(OSCOM::getDef('warning_config_file_writeable'), OSCOM::BASE_DIRECTORY . 'Config//settings.ini'), 'warning');
     }
     if (SERVICE_DEBUG_CHECK_SESSION_DIRECTORY == '1' && OSCOM::getConfig('store_sessions') == '') {
         if (!is_dir(OSCOM_Registry::get('Session')->getSavePath())) {
             $OSCOM_MessageStack->add('debug', sprintf(OSCOM::getDef('warning_session_directory_non_existent'), OSCOM_Registry::get('Session')->getSavePath()), 'warning');
         } elseif (!is_writeable(OSCOM_Registry::get('Session')->getSavePath())) {
             $OSCOM_MessageStack->add('debug', sprintf(OSCOM::getDef('warning_session_directory_not_writeable'), OSCOM_Registry::get('Session')->getSavePath()), 'warning');
         }
     }
     if (SERVICE_DEBUG_CHECK_SESSION_AUTOSTART == '1' && (bool) ini_get('session.auto_start')) {
         $OSCOM_MessageStack->add('debug', OSCOM::getDef('warning_session_auto_start'), 'warning');
     }
     if (SERVICE_DEBUG_CHECK_DOWNLOAD_DIRECTORY == '1' && DOWNLOAD_ENABLED == '1') {
         if (!is_dir(DIR_FS_DOWNLOAD)) {
             $OSCOM_MessageStack->add('debug', sprintf(OSCOM::getDef('warning_download_directory_non_existent'), DIR_FS_DOWNLOAD), 'warning');
         }
     }
     return true;
 }
コード例 #28
0
 public function defineLanguage()
 {
     setlocale(LC_MESSAGES, $this->locales[$this->language]);
     bindtextdomain($this->route['view'], 'language');
     textdomain($this->route['view']);
     bind_textdomain_codeset($this->route['view'], 'UTF-8');
 }
コード例 #29
0
 function __construct(NoticeRepository $noticeRepo)
 {
     $this->noticeRepository = $noticeRepo;
     $this->middleware('auth');
     $this->middleware('nouser');
     setlocale(LC_TIME, "es_ES");
 }
コード例 #30
0
ファイル: Translate.php プロジェクト: soundake/pd
 public function setLocale($lang)
 {
     switch ($lang) {
         case 'en':
             setlocale(LC_ALL, 'en_EN.UTF8', 'en_EN.UTF-8', 'en_EN	');
             break;
         case 'cs':
         default:
             setlocale(LC_ALL, 'cs_CZ.UTF8', 'cs_CZ.UTF-8', 'cs_CZ');
     }
     $this->lang = $lang;
     $cache = Environment::getCache();
     $cacheName = 'getText-' . $this->lang;
     if (isset($cache[$cacheName])) {
         $this->dictionary = unserialize($cache[$cacheName]);
     } else {
         $dict = new Model\Dictionary('utils/translate');
         try {
             $this->dictionary = $dict->getPairs($this->lang);
             $cache->save($cacheName, serialize((array) $this->dictionary), array('expire' => time() + 60 * 30, 'refresh' => TRUE, 'tags' => array('dictionary')));
         } catch (DibiException $e) {
             echo $e;
         }
     }
 }