/**
  * This part has had to be outsourced from the Constructor,
  * because the called Classes access the core and by
  * that the Core::instance() method. Thus an endless recursion
  * occured. because the instance is not already instantiated
  */
 private function postConstruct()
 {
     $this->db = Grootdb::instance();
     I18N::instance()->addFolder('i18n');
     UserHandler::instance();
     $this->controller = Controller::instance();
 }
Example #2
0
/**
 * This file is part of the PWAK (PHP Web Application Kit) framework.
 *
 * PWAK is a php framework initially developed for the
 * {@link http://onlogistics.googlecode.com Onlogistics} ERP/Supply Chain
 * management web application.
 * It provides components and tools for developers to build complex web
 * applications faster and in a more reliable way.
 *
 * PHP version 5.1.0+
 * 
 * LICENSE: This source file is subject to the MIT license that is available
 * through the world-wide-web at the following URI:
 * http://opensource.org/licenses/mit-license.php
 *
 * @package   PWAK
 * @author    ATEOR dev team <*****@*****.**>
 * @copyright 2003-2008 ATEOR <*****@*****.**> 
 * @license   http://opensource.org/licenses/mit-license.php MIT License 
 * @version   SVN: $Id$
 * @link      http://pwak.googlecode.com
 * @since     File available since release 0.1.0
 * @filesource
 */
function grid_filter_formatdate($date, $fmt = 'DATETIME_SHORT')
{
    if (defined('I18N::' . $fmt)) {
        $fmt = constant('I18N::' . $fmt);
    }
    return I18N::formatDate($date, $fmt);
}
 /**
  * Constructs Calendar_Decorator_Textual_Lang
  * @param object subclass of Calendar
  * @access public
  * @return void
  */
 public function __construct($calendar)
 {
     parent::Calendar_Decorator_Textual($calendar);
     $this->longMonthArray = I18N::getMonthesArray();
     $this->shortMonthArray = I18N::getMonthesArray(true);
     $this->longWeekDayNames = I18N::getDaysArray();
     $this->shortWeekDayNames = I18N::getDaysArray(true);
 }
Example #4
0
 public static function instance($lang = 'en_EN', $domain = 'default')
 {
     if (!isset(self::$_instance)) {
         $c = __CLASS__;
         self::$_instance = new $c($lang, $domain);
     }
     return self::$_instance;
 }
 public function register($user_name, $password, $first_name, $last_name)
 {
     if (!is_null(UserModel::findFirst(array('user_name' => $user_name)))) {
         return UserHandler::ERROR_EXISTS;
     }
     $user = UserModel::create(array('user_name' => $user_name, 'password' => Utilities::hash($password, static::$salt), 'first_name' => $first_name, 'last_name' => $last_name, 'lang' => I18N::lang()));
     $this->_login($user);
     return $user;
 }
Example #6
0
 /**
  * Returns the translation of a string
  *
  * @param string $subject
  * @param string $var_1
  * @param string $var2
  * @param string $var_n
  * @return string
  */
 public function translate($subject, $var_1 = '', $var2 = '', $var_n = '')
 {
     $args = func_get_args();
     $variables = array();
     if (1 < count($args)) {
         foreach ($args as $key => $value) {
             $variables['%' . $key] = $value;
         }
     }
     unset($variables['%0']);
     return I18N::getInstance('messages', Domains::getInstance()->getLanguage())->getTranslation($subject, $variables);
 }
 private static function getImpl() {
   if(is_null(self::$impl)) {
     $pkg = Package::getPackageByName('i18n');
     $implName = $pkg->getProperty('provider');
     try {
       $rc = new ReflectionClass($implName);
       self::$impl = $rc->newInstance();
     } catch(ReflectionException $re) {
       throw new ConfigurationException('i18n', 'provider', ($implName ? 'Cannot instantiate i18n provider ' . $$implName : 'i18n provider not set (provider option empty in i18n/.config)'));
     }
   }
   return self::$impl;
 }
 public function handleRequest()
 {
     $requestPath = Request::getRequestPath();
     $requestPath = ltrim($requestPath, '/');
     if (!$requestPath) {
         $requestPath = 'Index';
     }
     Filter::preRoute($requestPath);
     $this->findController($requestPath);
     if (!$this->foundController) {
         throw new Error(I18N::parse('Error.Messages.PageNotExists', 'The request URL is not exists'), 404);
     }
 }
Example #9
0
File: output.php Project: pihizi/qf
 static function &T($str, $args = NULL, $options = NULL)
 {
     if (is_array($str)) {
         foreach ($str as &$s) {
             $s = T($s, $args, $options);
         }
         return $str;
     }
     //如果有I18N模块反调用I18N
     if (class_exists('I18N', false)) {
         $str = I18N::convert($str, $options);
     }
     if ($args) {
         return stripcslashes(strtr($str, $args));
     } else {
         return stripcslashes($str);
     }
 }
Example #10
0
 /**
  * This method initialize the current language and the current step
  *
  */
 private function init()
 {
     //get the current post-request and check if the language was given by POST
     $s_post = \Globals::get('_POST');
     if (!is_null($s_post['game_language'])) {
         \Session::get_session()->set_value('language', $s_post['game_language']);
     }
     //Initialize the I18N-Class for templates-usage
     \I18N::init();
     //if we have no language-value in the session, set the default install-language to ENGLISH
     if (is_null(\Session::get_session()->get_value('language'))) {
         \I18N::set_language('en_EN');
     } else {
         \I18N::set_language(\Session::get_session()->get_value('language'));
     }
     \Replacer::set_language(\I18N::get_language());
     //set the current step by POST
     $this->i_step = $s_post['install_step'];
 }
Example #11
0
</div>
</div>
<div id="footer"></div>
</div>
<?php 
echo showInfoBox($showInfoBox);
/* Meldungen ausgeben */
?>
<div><span id="rfooter" style="color:#666; width:820px; margin-left:auto; margin-right:auto; height:55px; text-align:center; font-size:80%; text-decoration:none">
    <span title="<?php 
echo I18N::getBrowserLanguage();
?>
"><?php 
echo _('Sprache:');
?>
</span> <a rel="nofollow" href="/?setLocale=de_DE">Deutsch</a> &middot; <a rel="nofollow" href="/?setLocale=en_US">English</a> &middot; <a rel="nofollow" href="/?setLocale=es_ES">Español</a><br />
	<a href="/regeln.php#regeln" rel="nofollow"><?php 
echo _('Regeln');
?>
</a> &middot;
    <?php 
if (!is_null(CONFIG_ANDROID_APP_URL)) {
    echo '<a href="' . htmlspecialchars(CONFIG_ANDROID_APP_URL) . '">' . _('Android-App') . '</a> &middot;';
}
?>
	<a href="/impressum.php" rel="nofollow"><?php 
echo _('Impressum');
?>
</a> &middot;
	<a href="/regeln.php#datenschutz" rel="nofollow"><?php 
echo _('Datenschutz');
Example #12
0
 * mode d'upload des fichiers et images
 * [db|path/to/writable/dir]
 */
if (!defined('UPLOAD_STORAGE')) {
    define('UPLOAD_STORAGE', 'db');
}
// on ajoute les chemins nécessaires au include_path de php
$pathes = ini_get('include_path') . PATH_SEPARATOR . PROJECT_ROOT . DIRECTORY_SEPARATOR . WWW_DIR . PATH_SEPARATOR . PROJECT_ROOT . DIRECTORY_SEPARATOR . LIB_DIR . PATH_SEPARATOR . FRAMEWORK_ROOT . PATH_SEPARATOR . FRAMEWORK_ROOT . DIRECTORY_SEPARATOR . 'vendor';
ini_set('include_path', $pathes);
// classe de base
require_once 'lib/Object.php';
// inclus le système de chargement auto des fichiers requis
require_once 'autoload.inc.php';
// i18n
if (!function_exists('_')) {
    // gettext n'est pas disponible
    function _($msg)
    {
        return $msg;
    }
} else {
    if (I18N_ENABLED) {
        I18N::setLocale();
    }
}
// inclusion des messages d'erreur/info génériques
require_once 'lib/GenericMessages.php';
// point d'arret marquant la fin de l'initialisation du framework pour le timer
if (DEV_VERSION) {
    Timer::stop('Framework initialization');
}
Example #13
0
 /**
  * Generate a private version of this record
  *
  * @param int $access_level
  *
  * @return string
  */
 protected function createPrivateGedcomRecord($access_level)
 {
     return '0 @' . $this->xref . "@ REPO\n1 NAME " . I18N::translate('Private');
 }
Example #14
0
 /**
  * Calculate the Daitch-Mokotoff soundex for a word.
  *
  * @param string $name
  *
  * @return string[] List of possible DM codes for the word.
  */
 private static function daitchMokotoffWord($name)
 {
     // Apply special transformation rules to the input string
     $name = I18N::strtoupper($name);
     foreach (self::$transformNameTable as $transformRule) {
         $name = str_replace($transformRule[0], $transformRule[1], $name);
     }
     // Initialize
     $name_script = I18N::textScript($name);
     $noVowels = $name_script == 'Hebr' || $name_script == 'Arab';
     $lastPos = strlen($name) - 1;
     $currPos = 0;
     $state = 1;
     // 1: start of input string, 2: before vowel, 3: other
     $result = array();
     // accumulate complete 6-digit D-M codes here
     $partialResult = array();
     // accumulate incomplete D-M codes here
     $partialResult[] = array('!');
     // initialize 1st partial result  ('!' stops "duplicate sound" check)
     // Loop through the input string.
     // Stop when the string is exhausted or when no more partial results remain
     while (count($partialResult) !== 0 && $currPos <= $lastPos) {
         // Find the DM coding table entry for the chunk at the current position
         $thisEntry = substr($name, $currPos, self::MAXCHAR);
         // Get maximum length chunk
         while ($thisEntry != '') {
             if (isset(self::$dmsounds[$thisEntry])) {
                 break;
             }
             $thisEntry = substr($thisEntry, 0, -1);
             // Not in table: try a shorter chunk
         }
         if ($thisEntry === '') {
             $currPos++;
             // Not in table: advance pointer to next byte
             continue;
             // and try again
         }
         $soundTableEntry = self::$dmsounds[$thisEntry];
         $workingResult = $partialResult;
         $partialResult = array();
         $currPos += strlen($thisEntry);
         // Not at beginning of input string
         if ($state != 1) {
             if ($currPos <= $lastPos) {
                 // Determine whether the next chunk is a vowel
                 $nextEntry = substr($name, $currPos, self::MAXCHAR);
                 // Get maximum length chunk
                 while ($nextEntry != '') {
                     if (isset(self::$dmsounds[$nextEntry])) {
                         break;
                     }
                     $nextEntry = substr($nextEntry, 0, -1);
                     // Not in table: try a shorter chunk
                 }
             } else {
                 $nextEntry = '';
             }
             if ($nextEntry != '' && self::$dmsounds[$nextEntry][0] != '0') {
                 $state = 2;
             } else {
                 // Next chunk is a vowel
                 $state = 3;
             }
         }
         while ($state < count($soundTableEntry)) {
             // empty means 'ignore this sound in this state'
             if ($soundTableEntry[$state] == '') {
                 foreach ($workingResult as $workingEntry) {
                     $tempEntry = $workingEntry;
                     $tempEntry[count($tempEntry) - 1] .= '!';
                     // Prevent false 'doubles'
                     $partialResult[] = $tempEntry;
                 }
             } else {
                 foreach ($workingResult as $workingEntry) {
                     if ($soundTableEntry[$state] !== $workingEntry[count($workingEntry) - 1]) {
                         // Incoming sound isn't a duplicate of the previous sound
                         $workingEntry[] = $soundTableEntry[$state];
                     } else {
                         // Incoming sound is a duplicate of the previous sound
                         // For Hebrew and Arabic, we need to create a pair of D-M sound codes,
                         // one of the pair with only a single occurrence of the duplicate sound,
                         // the other with both occurrences
                         if ($noVowels) {
                             $workingEntry[] = $soundTableEntry[$state];
                         }
                     }
                     if (count($workingEntry) < 7) {
                         $partialResult[] = $workingEntry;
                     } else {
                         // This is the 6th code in the sequence
                         // We're looking for 7 entries because the first is '!' and doesn't count
                         $tempResult = str_replace('!', '', implode('', $workingEntry));
                         // Only return codes from recognisable sounds
                         if ($tempResult) {
                             $result[] = substr($tempResult . '000000', 0, 6);
                         }
                     }
                 }
             }
             $state = $state + 3;
             // Advance to next triplet while keeping the same basic state
         }
     }
     // Zero-fill and copy all remaining partial results
     foreach ($partialResult as $workingEntry) {
         $tempResult = str_replace('!', '', implode('', $workingEntry));
         // Only return codes from recognisable sounds
         if ($tempResult) {
             $result[] = substr($tempResult . '000000', 0, 6);
         }
     }
     return $result;
 }
Example #15
0
 /**
  * Derived classes should redefine this function, otherwise the object will have no name
  *
  * @return string[][]
  */
 public function getAllNames()
 {
     if (is_null($this->_getAllNames)) {
         // Check the script used by each name, so we can match cyrillic with cyrillic, greek with greek, etc.
         if ($this->husb) {
             $husb_names = $this->husb->getAllNames();
         } else {
             $husb_names = array(0 => array('type' => 'BIRT', 'sort' => '@N.N.', 'full' => I18N::translateContext('Unknown given name', '…') . ' ' . I18N::translateContext('Unknown surname', '…')));
         }
         foreach ($husb_names as $n => $husb_name) {
             $husb_names[$n]['script'] = I18N::textScript($husb_name['full']);
         }
         if ($this->wife) {
             $wife_names = $this->wife->getAllNames();
         } else {
             $wife_names = array(0 => array('type' => 'BIRT', 'sort' => '@N.N.', 'full' => I18N::translateContext('Unknown given name', '…') . ' ' . I18N::translateContext('Unknown surname', '…')));
         }
         foreach ($wife_names as $n => $wife_name) {
             $wife_names[$n]['script'] = I18N::textScript($wife_name['full']);
         }
         // Add the matched names first
         foreach ($husb_names as $husb_name) {
             foreach ($wife_names as $wife_name) {
                 if ($husb_name['type'] != '_MARNM' && $wife_name['type'] != '_MARNM' && $husb_name['script'] == $wife_name['script']) {
                     $this->_getAllNames[] = array('type' => $husb_name['type'], 'sort' => $husb_name['sort'] . ' + ' . $wife_name['sort'], 'full' => $husb_name['full'] . ' + ' . $wife_name['full']);
                 }
             }
         }
         // Add the unmatched names second (there may be no matched names)
         foreach ($husb_names as $husb_name) {
             foreach ($wife_names as $wife_name) {
                 if ($husb_name['type'] != '_MARNM' && $wife_name['type'] != '_MARNM' && $husb_name['script'] != $wife_name['script']) {
                     $this->_getAllNames[] = array('type' => $husb_name['type'], 'sort' => $husb_name['sort'] . ' + ' . $wife_name['sort'], 'full' => $husb_name['full'] . ' + ' . $wife_name['full']);
                 }
             }
         }
     }
     return $this->_getAllNames;
 }
Example #16
0
 /**
  * Search for a place name.
  *
  * @param string  $filter
  * @param Tree    $tree
  *
  * @return Place[]
  */
 public static function findPlaces($filter, Tree $tree)
 {
     $places = array();
     $rows = Database::prepare("SELECT SQL_CACHE CONCAT_WS(', ', p1.p_place, p2.p_place, p3.p_place, p4.p_place, p5.p_place, p6.p_place, p7.p_place, p8.p_place, p9.p_place)" . " FROM      `##places` AS p1" . " LEFT JOIN `##places` AS p2 ON (p1.p_parent_id = p2.p_id)" . " LEFT JOIN `##places` AS p3 ON (p2.p_parent_id = p3.p_id)" . " LEFT JOIN `##places` AS p4 ON (p3.p_parent_id = p4.p_id)" . " LEFT JOIN `##places` AS p5 ON (p4.p_parent_id = p5.p_id)" . " LEFT JOIN `##places` AS p6 ON (p5.p_parent_id = p6.p_id)" . " LEFT JOIN `##places` AS p7 ON (p6.p_parent_id = p7.p_id)" . " LEFT JOIN `##places` AS p8 ON (p7.p_parent_id = p8.p_id)" . " LEFT JOIN `##places` AS p9 ON (p8.p_parent_id = p9.p_id)" . " WHERE CONCAT_WS(', ', p1.p_place, p2.p_place, p3.p_place, p4.p_place, p5.p_place, p6.p_place, p7.p_place, p8.p_place, p9.p_place) LIKE CONCAT('%', :filter_1, '%') AND CONCAT_WS(', ', p1.p_place, p2.p_place, p3.p_place, p4.p_place, p5.p_place, p6.p_place, p7.p_place, p8.p_place, p9.p_place) NOT LIKE CONCAT('%,%', :filter_2, '%') AND p1.p_file = :tree_id" . " ORDER BY  CONCAT_WS(', ', p1.p_place, p2.p_place, p3.p_place, p4.p_place, p5.p_place, p6.p_place, p7.p_place, p8.p_place, p9.p_place) COLLATE :collation")->execute(array('filter_1' => preg_quote($filter), 'filter_2' => preg_quote($filter), 'tree_id' => $tree->getTreeId(), 'collation' => I18N::collation()))->fetchOneColumn();
     foreach ($rows as $row) {
         $places[] = new self($row, $tree);
     }
     return $places;
 }
Example #17
0
 /**
 	Get custom (html/text) module translations
 		@private
 	**/
 private static function __translate(&$item, $section = 'custom', $skip_enable_checking = false)
 {
     if (empty($item)) {
         return false;
     }
     $params = json_decode($item->params);
     $serialized = $params !== null;
     if (!$serialized) {
         $params = new Parameter(@$item->params);
     }
     // get active lang
     $active_lang = I18N::getCurrentLanguage();
     if (!$skip_enable_checking) {
         $translation_opt = $serialized ? @$params->translation : @json_decode($params->get('translation'));
         // check enabled
         $lang_enabled = isset($translation_opt->{"{$active_lang}"}) ? $translation_opt->{$active_lang}->enabled : false;
         if ($lang_enabled && isset($translation_opt->{$active_lang})) {
             foreach (get_object_vars($translation_opt->{$active_lang}) as $k => $v) {
                 if (strpos($k, 'params__') !== false && isset($item->params)) {
                     $k = str_replace('params__', '', $k);
                     if ($serialized) {
                         $params->{$k} = $v;
                     } else {
                         $params->set($k, $v);
                     }
                 } else {
                     $item->{$k} = $v;
                 }
             }
             /**/
             $item->params = $serialized ? json_encode($params) : $params->toString();
         }
     } else {
         $lang_enabled = true;
     }
     if ($lang_enabled) {
         $lang_map = array();
         $active_lang = empty($active_lang) ? I18N::getDefaultLanguage() : $active_lang;
         // get translation map
         $map_data = I18N::getTranslationMapKeyValuePair(array('section' => 'default.modules.' . $section, 'id' => $item->id), 'lang_code');
         if (isset($map_data[$active_lang])) {
             $lang_map = $map_data[$active_lang];
         }
         if ($lang_map) {
             // translate
             foreach ($lang_map as $k => $v) {
                 if (isset($item->{$k}) && !empty($v)) {
                     $item->{$k} = $v;
                 }
             }
         }
     }
 }
Example #18
0
/**
 * Find source records from the database.
 *
 * @param Tree   $tree
 * @param string $term
 *
 * @return \stdClass[]
 */
function get_SOUR_rows(Tree $tree, $term)
{
    return Database::prepare("SELECT s_id AS xref, s_gedcom AS gedcom" . " FROM `##sources`" . " WHERE s_name LIKE CONCAT('%', REPLACE(:term, ' ', '%'), '%') AND s_file = :tree_id" . " ORDER BY s_name COLLATE :collation")->execute(array('term' => $term, 'tree_id' => $tree->getTreeId(), 'collation' => I18N::collation()))->fetchAll();
}
Example #19
0
<?php

/**
 * webtrees: online genealogy
 * Copyright (C) 2016 webtrees development team
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
namespace Fisharebest\Webtrees;

define('WT_SCRIPT_NAME', 'logout.php');
require './includes/session.php';
if (Auth::id()) {
    Log::addAuthenticationLog('Logout: ' . Auth::user()->getUserName() . '/' . Auth::user()->getRealName());
    Auth::logout();
    FlashMessages::addMessage(I18N::translate('You are logged out.'), 'info');
}
header('Location: ' . WT_BASE_URL);
Example #20
0
File: Server.php Project: arhe/pwak
 /** Retourne les locales supportées
  *
  */
 protected function getSupportedLocales($method)
 {
     $this->auth();
     $this->log('XmlRpcServer::getSupportedLocales called');
     return I18N::getSupportedLocales();
 }
Example #21
0
    Registry::set('pronto:db:main', $db);
} else {
    require_once DIR_FS_APP . DS . 'config' . DS . 'databases.php';
    foreach ($DATABASES as $key => $dbcfg) {
        $db =& Factory::db($dbcfg);
        Registry::set('pronto:db:' . $key, $db);
    }
    // we leave $db set for scripts that expect it
    unset($key, $dbcfg);
}
// TODO: this should be unset, left for back-compat for now...
//unset($db);
/************************************************************************
 * INTERNATIONALIZATION
 ************************************************************************/
$i18n = new I18N();
$i18n->autoset_language('en');
define('LANG', $i18n->get_language());
Registry::set('pronto:i18n', $i18n);
unset($i18n);
/************************************************************************
 * PRELOAD PLUGINS
 ************************************************************************/
foreach (explode(' ', PLUGINS) as $p) {
    if ($p) {
        Factory::plugin($p, 'page');
    }
}
unset($p);
// left in the symbol table for the cmdline script
$plugins =& Registry::get('pronto:plugins');
 private static function loadFolders()
 {
     foreach (static::$folders as $folder) {
         if (!in_array(static::$lang, $folder['langs'])) {
             I18N::instance(static::$lang)->loadLanguageFiles($folder);
         }
     }
 }
 public function ajax_updatenext()
 {
     $time_start = microtime(true);
     $response["error"] = "none";
     $response["file"] = "none";
     $response["nextId"] = null;
     if (!empty($_POST["id"])) {
         $id = intval($_POST["id"]);
         if ($id < 1) {
             $i = 1;
         }
         $history = new History();
         $themeInfo = $history->getFewInfo($id);
         if (!empty($themeInfo)) {
             $unzippath = TC_VAULTDIR . '/unzip/' . $themeInfo["hash"] . "/";
             if (file_exists($unzippath)) {
                 $nextId = $history->getNextId($themeInfo["id"]);
                 $response["nextId"] = $nextId;
                 $themeInfo = $history->loadThemeFromHash($themeInfo["hash"]);
                 // need an objet and not an array
                 $r = $themeInfo->initFromUnzippedArchive($unzippath, $themeInfo->zipfilename, $themeInfo->zipmimetype, $themeInfo->zipfilesize);
                 // merchant...
                 $this->fileValidator = new FileValidator($themeInfo);
                 $this->fileValidator->validate();
                 if (UserMessage::getCount(ERRORLEVEL_FATAL) > 0) {
                     $response["error"] = "fatal error:\n";
                     foreach (UserMessage::getMessages(ERRORLEVEL_FATAL) as $m) {
                         $response["error"] .= "\n" . $m;
                     }
                 } else {
                     if ($this->fileValidator->serialize(true)) {
                         if (UserMessage::getCount(ERRORLEVEL_FATAL) > 0) {
                             // at least one error occured while serializing (no thumbnail...)
                             $response["error"] = "fatal error, could not serialize validation results:\n";
                             foreach (UserMessage::getMessages(ERRORLEVEL_FATAL) as $m) {
                                 $response["error"] .= "\n" . $m;
                             }
                             foreach (UserMessage::getMessages(ERRORLEVEL_CRITICAL) as $m) {
                                 $response["error"] .= "\n" . $m;
                             }
                         } else {
                             $this->validationResults = $this->fileValidator->getValidationResults(I18N::getCurLang());
                             $themeInfo = $this->fileValidator->themeInfo;
                             $response["name"] = $themeInfo->name;
                         }
                     } else {
                         // at least one error occured while serializing (no thumbnail...)
                         if (UserMessage::getCount(ERRORLEVEL_CRITICAL) > 0) {
                             $response["error"] = "could not serialize validation results";
                         }
                         foreach (UserMessage::getMessages(ERRORLEVEL_CRITICAL) as $m) {
                             $response["error"] .= "\n" . $m;
                         }
                     }
                 }
             } else {
                 $response["error"] .= "No zip file " . $unzippath;
             }
         } else {
             if (UserMessage::getCount(ERRORLEVEL_FATAL) > 0) {
                 // at least one error occured while serializing (no thumbnail...)
                 $response["error"] = "could not execute validation:\n";
                 foreach (UserMessage::getMessages(ERRORLEVEL_FATAL) as $m) {
                     $response["error"] .= "\n" . $m;
                 }
                 foreach (UserMessage::getMessages(ERRORLEVEL_CRITICAL) as $m) {
                     $response["error"] .= "\n" . $m;
                 }
             } else {
                 $response["error"] = "could not execute validation (unknown error).";
             }
         }
     }
     $time_end = microtime(true);
     $time = $time_end - $time_start;
     $response["duration"] = $time;
     //ob_clean();
     header('Content-Type: application/json');
     echo json_encode($response);
 }
Example #24
0
        $title = I18N::translate('Year input box');
        $text = I18N::translate('This input box lets you change that year of the calendar. Type a year into the box and press <b>Enter</b> to change the calendar to that year.<br><br><b>Advanced features</b> for <b>View the year</b><dl><dt><b>More than one year</b></dt><dd>You can search for dates in a range of years.<br><br>Year ranges are <u>inclusive</u>. This means that the date range extends from 1 January of the first year of the range to 31 December of the last year mentioned. Here are a few examples of year ranges:<br><br><b>1992-5</b> for all events from 1992 to 1995.<br><b>1972-89</b> for all events from 1972 to 1989.<br><b>1610-759</b> for all events from 1610 to 1759.<br><b>1880-1905</b> for all events from 1880 to 1905.<br><b>880-1105</b> for all events from 880 to 1105.<br><br>To see all the events in a given decade or century, you can use <b>?</b> in place of the final digits. For example, <b>197?</b> for all events from 1970 to 1979 or <b>16??</b> for all events from 1600 to 1699.<br><br>Selecting a range of years will change the calendar to the year view.</dd></dl>');
        break;
    case 'edit_edit_raw':
        $title = I18N::translate('Edit the raw GEDCOM');
        $text = I18N::translate('This page allows you to bypass the usual forms, and edit the underlying data directly. It is an advanced option, and you should not use it unless you understand the GEDCOM format. If you make a mistake here, it can be difficult to fix.') . '<br><br>' . I18N::translate('You can download a copy of the GEDCOM specification from %s.', '<a href="https://wiki.webtrees.net/w/images-en/Ged551-5.pdf">https://wiki.webtrees.net/w/images-en/Ged551-5.pdf</a>');
        break;
    case 'edit_SOUR_EVEN':
        $title = I18N::translate('Associate events with this source');
        $text = I18N::translate('Each source records specific events, generally for a given date range and for a place jurisdiction. For example a Census records census events and church records record birth, marriage, and death events.<br><br>Select the events that are recorded by this source from the list of events provided. The date should be specified in a range format such as <i>FROM 1900 TO 1910</i>. The place jurisdiction is the name of the lowest jurisdiction that encompasses all lower-level places named in this source. For example, “Oneida, Idaho, USA” would be used as a source jurisdiction place for events occurring in the various towns within Oneida County. “Idaho, USA” would be the source jurisdiction place if the events recorded took place not only in Oneida County but also in other counties in Idaho.');
        break;
    case 'google_chart_surname':
        $title = I18N::translate('Surname');
        $text = I18N::translate('The number of occurrences of the specified name will be shown on the map. If you leave this field empty, the most common surname will be used.');
        break;
    case 'pending_changes':
        $title = I18N::translate('Pending changes');
        $text = '<p>' . I18N::translate('When you add, edit, or delete information, the changes are not saved immediately. Instead, they are kept in a “pending” area. These pending changes need to be reviewed by a moderator before they are accepted.') . '</p><p>' . I18N::translate('This process allows the site’s owner to ensure that the new information follows the site’s standards and conventions, has proper source attributions, etc.') . '</p><p>' . I18N::translate('Pending changes are only shown when your account has permission to edit. When you sign out, you will no longer be able to see them. Also, pending changes are only shown on certain pages. For example, they are not shown in lists, reports, or search results.') . '</p>';
        if (Auth::isAdmin()) {
            $text .= '<p>' . I18N::translate('Each user account has an option to “automatically accept changes”. When this is enabled, any changes made by that user are saved immediately. Many administrators enable this for their own user account.') . '</p>';
        }
        break;
    default:
        $title = I18N::translate('Help');
        $text = I18N::translate('The help text has not been written for this item.');
        break;
}
// This file is called by a getJSON call so return the data
// in correct format
header('Content-Type: application/json');
echo json_encode(array('title' => $title, 'content' => $text));
Example #25
0
echo I18N::translate('Search');
?>
							</a>
						</td>
					</tr>
					<tr>
						<td align="center">
							<table width="100%" class="fact_table" cellspacing="0" border="0">
								<tr>
									<td align="center" colspan=3 class="descriptionbox wrap">
										<?php 
echo I18N::translate('Click %s to choose individual as head of family.', '<i class="headimg vmiddle icon-button_head"></i>');
?>
										<br><br>
										<?php 
echo I18N::translate('Click name to add individual to add links list.');
?>
									</td>
								</tr>
								<?php 
foreach ($person->getChildFamilies() as $family) {
    echo '<tr><th colspan="2">', $family->getFullName(), '</td></tr>';
    print_navigator_family($family, $person);
}
foreach ($person->getChildStepFamilies() as $family) {
    echo '<tr><th colspan="2">', $family->getFullName(), '</td></tr>';
    print_navigator_family($family, $person);
}
foreach ($person->getSpouseFamilies() as $family) {
    echo '<tr><th colspan="2">', $family->getFullName(), '</td></tr>';
    print_navigator_family($family, $person);
Example #26
0
define('WT_MODULES_DIR', 'modules_v3/');
Session::start();
define('WT_LOCALE', I18N::init());
if (file_exists(WT_DATA_DIR . 'offline.txt')) {
    $offline_txt = file_get_contents(WT_DATA_DIR . 'offline.txt');
} else {
    // offline.txt has gone - we're back online!
    header('Location: index.php');
    return;
}
http_response_code(503);
header('Content-Type: text/html; charset=UTF-8');
echo '<!DOCTYPE html>', '<html ', I18N::htmlAttributes(), '>', '<head>', '<meta charset="UTF-8">', '<title>', WT_WEBTREES, '</title>', '<meta name="robots" content="noindex,follow">', '<style type="text/css">
		body {color: gray; background-color: white; font: 14px tahoma, arial, helvetica, sans-serif; padding:10px; }
		a {color: #81A9CB; font-weight: bold; text-decoration: none;}
		a:hover {text-decoration: underline;}
		h1 {color: #81A9CB; font-weight:normal; text-align:center;}
		li {line-height:2;}
		blockquote {color:red;}
		.content { /*margin:auto; width:800px;*/ border:1px solid gray; padding:15px; border-radius:15px;}
		.good {color: green;}
	</style>', '</head><body>', '<h1>', I18N::translate('This website is temporarily unavailable'), '</h1>', '<div class="content"><p>';
if ($offline_txt) {
    echo $offline_txt;
} else {
    echo I18N::translate('This website is down for maintenance.  You should <a href="index.php">try again</a> in a few minutes.');
}
echo '</p>';
echo '</div>';
echo '</body>';
echo '</html>';
Example #27
0
 public static function load($lang = null)
 {
     if (!is_null($lang)) {
         $langfile = "./apps/" . PROJECT . "/models/locale/" . $lang . "/lang.php";
         $altlangfile = "./models/locale/" . $lang . "/lang.php";
     } else {
         $langfile = "./apps/" . PROJECT . "/models/locale/" . LANG . "/lang.php";
         $altlangfile = "./models/locale/" . LANG . "/lang.php";
     }
     if (file_exists($langfile)) {
         include $langfile;
         return true;
     } else {
         if (file_exists($altlangfile)) {
             include $altlangfile;
             return true;
         } else {
             // Se não houver o arquivo PHP de idiomas, e gerado um atraves de um arquivo CSV
             if (!is_null($lang)) {
                 $csvlangfile = "./apps/" . PROJECT . "/models/locale/" . $lang . "/lang.csv";
                 $altcsvlangfile = "./models/locale/" . $lang . "/lang.csv";
             } else {
                 $csvlangfile = "./apps/" . PROJECT . "/models/locale/" . LANG . "/lang.csv";
                 $altcsvlangfile = "./models/locale/" . LANG . "/lang.csv";
             }
             if (file_exists($csvlangfile)) {
                 $handle = fopen($csvlangfile, "r");
             } else {
                 if (file_exists($altcsvlangfile)) {
                     $handle = fopen($altcsvlangfile, "r");
                 }
             }
             if (isset($handle)) {
                 $phplangfile = "<?php\n";
                 while (($linhas = fgetcsv($handle, 1000, ",")) !== FALSE) {
                     $num = count($linhas);
                     // Número de campos
                     if ($num > 1) {
                         for ($c = 1; $c < $num; $c++) {
                             $linhas[$c] = str_replace("\"", "", $linhas[$c]);
                             $linhas[$c] = str_replace("\\'", "", $linhas[$c]);
                             if ($linhas[$c] != "") {
                                 $phplangfile .= "  define(\"LANG_" . strtoupper($linhas[$c]) . "\", \"";
                                 $phplangfile .= strtolower(htmlentities(utf8_decode($linhas[0]))) . "\");\n";
                             }
                         }
                     }
                 }
                 fclose($handle);
                 if (is_writable($langfile) || !file_exists($langfile)) {
                     if ($file = fopen($langfile, 'w')) {
                         fwrite($file, $phplangfile);
                         I18N::load();
                         // Tenta recarregar o arquivo de Idioma (php) novamente
                         fclose($file);
                         if (DEBUG) {
                             alert("Arquivo de idioma gerado atraves de um arquivo CSV<br /><u>" . $langfile . "</u>");
                         }
                     } else {
                         if (DEBUG) {
                             alert("N&atilde;o foi poss&iacute;vel gerar o arquivo de idioma atrav&eacute;s do arquivo CSV<br /><u>" . $langfile . "</u>");
                         }
                     }
                     return true;
                 } else {
                     if (DEBUG) {
                         alert("Sem permissao para gerar arquivo de idioma<br /><u>" . $langfile . "</u>");
                     }
                     return false;
                 }
             } else {
                 if (DEBUG) {
                     alert("Arquivo referente ao idioma <u>" . LANG . "</u> nao encontrado!");
                 }
                 return false;
             }
         }
     }
 }
Example #28
0
 public function validate()
 {
     return Params::Validate($this, array('firstName' => I18N::String('Please enter a first name'), 'lastName' => I18N::String('Please enter a last name'), 'creditCardType' => I18N::String('Please select your credit card type'), 'creditCardNumber' => I18N::String('Please enter your credit card number'), 'expirationMonth' => I18N::String('Please select the month this credit card expires'), 'expirationYear' => I18N::String('Please select the year this credit card expires'), 'cvv2Number' => I18N::String('Please enter your security code'), 'address1' => I18N::String('Please enter your billing address'), 'city' => I18N::String('Please enter your billing city'), 'state' => I18N::String('Please enter your billing state'), 'zip' => I18N::String('Please enter your billing zipcode'), 'amount' => array(array(Params::VALIDATE_EMPTY, I18N::String('The amount of your purchase could not be found')), array(Params::VALIDATE_NUMERIC, I18N::String('The amount of the service should be numeric')))));
 }
Example #29
0
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
namespace Fisharebest\Webtrees;

/** @global Controller\SimpleController $controller */
global $controller;
/** @global Tree $WT_TREE */
global $WT_TREE;
if (!Filter::checkCsrf()) {
    require WT_ROOT . WT_MODULES_DIR . 'GEDFact_assistant/census/census-edit.php';
    return;
}
// We are creating a CENS/NOTE record linked to these individuals
$pid_array = Filter::post('pid_array');
if (empty($pid_array)) {
    $xref = '';
} else {
    $NOTE = Filter::post('NOTE');
    $gedcom = '0 @XREF@ NOTE ' . preg_replace('/\\r?\\n/', "\n1 CONT ", trim($NOTE));
    $xref = $WT_TREE->createRecord($gedcom)->getXref();
}
$controller->addInlineJavascript('window.opener.set_pid_array("' . $pid_array . '");')->addInlineJavascript('openerpasteid("' . $xref . '");')->setPageTitle(I18N::translate('Create a shared note using the census assistant'))->pageHeader();
?>

<div id="edit_interface-page">
	<h4><?php 
echo $controller->getPageTitle();
?>
</h4>
</div>
<?php 
Example #30
0
<?php

require dirname(__FILE__) . '/I18N.php';
I18N::instance('pt_PT');
?>
<!doctype html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>translate test...</title>
	</head>
	<body>
	<?php 
echo I18N::translate("I hope it's useful for someone");
?>
	</body>
</html>