Changeset 24916
- Timestamp:
- 11/29/08 08:59:08 (6 weeks ago)
- Location:
- development/main
- Files:
-
- 7 added
- 2 removed
- 6 modified
-
includes/BlockUtil.class.php (modified) (3 diffs)
-
includes/DBConnectionStack.class.php (modified) (1 diff)
-
includes/LanguageUtil.class.php (modified) (7 diffs)
-
includes/Renderer.class.php (modified) (1 diff)
-
includes/Theme.class.php (modified) (6 diffs)
-
includes/Zikula.class.php (modified) (1 diff)
-
locale/en (added)
-
locale/eng (deleted)
-
locale/en/zikula.po (added)
-
locale/ja (added)
-
locale/ja/LC_MESSAGES (added)
-
locale/ja/LC_MESSAGES/zikula.mo (added)
-
locale/ja/zikula.mo (added)
-
locale/ja/zikula.po (added)
-
locale/postnuke.po (deleted)
Legend:
- Unmodified
- Added
- Removed
-
development/main/includes/BlockUtil.class.php
r24768 r24916 74 74 $blockinfo = self::getInfo($blockplacement['bid']); 75 75 // block filtering 76 //bp 2008-02-12 - if session variable 'area' is set retrieve it 77 $area = SessionUtil::getVar('area',null); 78 76 79 if (!empty($blockinfo['filter']['modules']) || 77 80 !empty($blockinfo['filter']['type']) || … … 92 95 if (!empty($blockinfo['filter']['customargs'])) { 93 96 $blockinfo['filter']['customargs'] = explode(',', $blockinfo['filter']['customargs']); 94 $customargs = array(); 95 static $filtervars = array('module', 'name', 'type', 'func', 'theme', 'authid'); 96 foreach ($_GET as $var => $value) { 97 $customargs = array(); 98 static $filtervars = array('module', 'name', 'type', 'func', 'theme', 'authid'); 99 100 // bp foreach ($_GET as $var => $value) { 101 $_get = $_GET; 102 if (isset($area)) { 103 $_get['area'] = $area; 104 } 105 foreach ($_get as $var => $value) { 106 // end bp 107 97 108 if (!in_array($var, $filtervars)) { 98 109 $customargs[] = DataUtil::formatForOS(strip_tags($var)) . '=' . DataUtil::formatForOS(strip_tags($value)); … … 102 113 } 103 114 } 115 //bp area set but empty customargs -> we hide the block 116 if (!empty($area) && empty($blockinfo['filter']['customargs'])) continue; 117 104 118 // dont display the block if it's not active or not in matching langauge 105 119 if (!$blockinfo['active'] || (!empty($blockinfo['language']) && $blockinfo['language'] != $currentlang)) continue; -
development/main/includes/DBConnectionStack.class.php
r24728 r24916 119 119 } 120 120 */ 121 122 // ensure mysql handles utf-8 ok. 123 // bplagge - 2008/11/18 124 if (!defined('_PNINSTALLVER') && ($dbdriver == 'mysql' || $dbdriver == 'mysqli')) { 125 if (isset($dbcharset)) { 126 $cs = str_replace('-','', strtolower($dbcharset)); 127 $conn->Execute("set names $cs"); 128 } 129 } 121 130 122 131 $GLOBALS['PNRuntime']['DB'][$count] = $GLOBALS['PNConfig']['DBInfo'][$name]; -
development/main/includes/LanguageUtil.class.php
r24768 r24916 141 141 static function setLocale($category, $locale) 142 142 { 143 $winos = stristr(getenv('OS'),'windows'); 144 !isset($category) ? $category = "LC_ALL" : ""; 145 is_array($locale) ? implode(',', $locale) : ''; 146 $result = setlocale($category, $locale); 147 148 $p = strpos($result, '.'); 149 if ($p > 0) { 150 $encoding = substr($result, $p + 1); 151 if ($winos) { 152 $encoding = 'CP' . $encoding; 153 } 154 } 155 # ensure that we always return the valid character set 156 empty($encoding) ? $encoding = _CHARSET : ''; 157 # session variable is used in DateUtil 158 SessionUtil::setVar('encoding', $encoding); 143 $winos = stristr(getenv('OS'),'windows'); 144 !isset($category) ? $category = "LC_ALL" : ""; 145 146 $envlanguage = Zikula::getConfigVar('syslocale'); 147 148 // set the LANGUAGE environment variable 149 # NOTE: if the locale to set is not included in LANGUAGE environment variable translations won't work! 150 $re = putenv("LANGUAGE=$envlanguage"); 151 /* 152 $lv = getenv('LANGUAGE'); 153 echo "putenv returned: $re language environment var set to: $lv<br>"; 154 */ 155 156 /* debug 157 if (is_Array($locale)) { 158 print_r($locale); echo "<br>"; 159 } else { 160 echo "locale: $locale<br>"; 161 } 162 */ 163 164 $encoding = setlocale($category, $locale); 165 166 /* 167 echo "encoding: $encoding<br>"; 168 */ 169 170 if ($winos) { 171 $enc = 'CP' . $encoding; 172 } else { 173 $p = strpos($encoding, '.'); 174 $enc = ($p > 0) ? substr($encoding, $p+1) : $encoding; 175 } 176 # setlocale return value but: 177 # Linux: without charset, Windows: CP. prefix 178 SessionUtil::setVar('encoding', $enc); 179 159 180 return $encoding; 160 181 } 182 161 183 162 184 /** … … 178 200 179 201 /** 180 * This file sets textdomain and locale for gettext error messages 181 * It is included in the ../modules/MailingList/pntables.php file 202 * This function sets textdomain and locale for gettext error messages 182 203 * @param $modname module name - lowercase only 183 204 * @param $bindtextdom defaults to the module name - lowercase only … … 207 228 static function initGettext($modname = '') { 208 229 209 $winos = stristr(getenv('OS'), 'windows'); 210 $syscharset = _CHARSET; 211 $syslocale = $winos ? _LOCALEWIN : _LOCALE; 212 $locarray = array(_LOCALE, _LOCALEWIN); 213 $sysdomain = "zikula"; 230 $winos = stristr(getenv('OS'),'windows'); 231 $syscharset = Zikula::getConfigVar('syscharset'); 232 $syslocale = Zikula::getConfigVar('syslocale'); 233 $sysdom = Zikula::getConfigVar('sysdom'); 214 234 215 235 $currentlang = LanguageUtil::getUserLang(); … … 219 239 } 220 240 221 if (isset($modname)) {241 if (!empty($modname)) { 222 242 $modinfo = ModuleUtil::getInfo(ModuleUtil::getIDFromName($modname)); 223 243 if (!$modinfo) { … … 232 252 $usmoddir = "config/locale/$directory"; 233 253 } else { 234 // use $sysdom ain235 $dom = strtolower($sysdom ain);254 // use $sysdom 255 $dom = strtolower($sysdom); 236 256 $locdir = "locale"; 237 257 } … … 252 272 $locdir = $b . '/' . $locdir; 253 273 254 $enc = LanguageUtil::setLocale(LC_ALL, $locarray); 255 if (!$enc) { 256 ($winos) ? $loc = _LOCALEWIN : $loc = _LOCALE; 257 LogUtil::registerError(__fGT(_('Could not set locale to %s'), array(array($loc, true)))); 258 } 274 $extlocale = $syslocale.'.'.$syscharset; 275 $locarray = array($extlocale, $syslocale); 276 $enc = LanguageUtil::setLocale(LC_ALL, $locarray); 277 278 if (!$enc) { 279 LogUtil::registerError (__fGT( _('Could not set locale to %s'), array( array($syslocale, true)))); 280 } 259 281 260 282 $rt = bindtextdomain($dom, $locdir); … … 263 285 // this is important for languages like Japanese which can be encoded using different character sets 264 286 $rc = bind_textdomain_codeset($dom, $syscharset); 265 $rd = textdomain($dom); 287 288 // we only set the textdomain for a module 289 if (isset($modname)) { 290 $rd=textdomain($dom); 291 } 266 292 267 293 return array($enc, $syscharset); -
development/main/includes/Renderer.class.php
r24885 r24916 254 254 // lastly the theme paths 255 255 $this->assign('themepath', $this->baseurl . 'themes/' . $theme); 256 $this->assign('stylepath', $this->baseurl . 'themes/' . $theme . '/style'); 256 //bp 2008-11-17 add $themedom variable 257 $this->assign('themedom', $this->themeinfo['name']); 258 // end bp 259 $this->assign('stylepath', $this->baseurl . 'themes/' . $theme . '/style'); 257 260 $this->assign('scriptpath', $this->baseurl . 'themes/' . $theme . '/javascript'); 258 261 $this->assign('imagepath', $this->baseurl . 'themes/' . $theme . '/images'); -
development/main/includes/Theme.class.php
r24768 r24916 59 59 protected $isloggedin; 60 60 61 //bp 2008-02-11 62 // area, logical subset of the website (similar to category 63 protected $area; 64 61 65 /** 62 66 * Initialize our class … … 143 147 } 144 148 149 //bp 2008-11-17 - bindtextdomain 150 //the name of the theme's textdomain must correspond to the name defined in pnversion.php! 151 //e.g. $themeversion['name'] = sql_ledger; 152 $syscharset = Zikula::getConfigVar('syscharset'); 153 154 // we need the absolute path! 155 $ldir = dirname(__FILE__); 156 $p = strpos($ldir, '/includes'); 157 $b = substr($ldir, 0, $p); 158 159 $themelocpath = $b."/".$this->themepath.'/locale'; 160 161 $rt = bindtextdomain($this->name, $themelocpath); 162 $rc = bind_textdomain_codeset($this->name, $syscharset); 163 164 //debug 165 /* 166 $loc = setlocale(LC_ALL,0); 167 echo "syscharset: $syscharset, locale: $loc, themelocpath: $themelocpath, themedom: $this->name<br/> 168 bindtextdomain: $rt, bind_textdomain_codeset: $rc<br/>"; 169 echo dgettext($this->name, 'Home'); 170 171 echo "<br/>set textdomain<br/>"; 172 $rd=textdomain($this->name); 173 echo _('Home'); 174 */ 175 //end bp 176 145 177 // Start the output buffering to capture module output 146 178 ob_start(); … … 277 309 // 1. Master template path 278 310 $masterpath = "themes/$os_theme/templates"; 311 312 //bp 2008-02-11 area template path -> so we can specify area-specific templates 313 $areapath = "themes/$os_theme/templates/category"; 314 //bp end 315 279 316 // 2. The module template path 280 317 $modulepath = "themes/$os_theme/templates/modules"; … … 284 321 $ostemplate = DataUtil::formatForOS($template); 285 322 323 //bp 2008-02-11 - add $areapath and subdir for module to the search path 286 324 $search_path = array($masterpath, 325 $areapath, 326 $areapath.'/'.$modulepath, 287 327 $modulepath, 288 328 $blockpath); … … 434 474 } 435 475 476 //bp 2008-02-11 - extract and save area id 477 foreach ($queryparts as $querypart) { 478 if (stristr($querypart, 'area=')) { 479 $n = strpos($querypart, '='); 480 $this->area = substr($querypart, $n+1); 481 $this->assign('area', $this->area); 482 SessionUtil::setVar('area', $this->area); 483 } 484 } 485 $this->area = SessionUtil::getVar('area',null); 486 //bp 487 488 436 489 // identify and load the correct module configuration 437 490 $this->cachepage = true; … … 443 496 $this->cachepage = false; 444 497 $file = $pageconfigurations['*admin']['file']; 498 //bp 2008-02-11 499 } else if (isset($this->area) && isset($pageconfigurations[$this->area])) { 500 $file = $pageconfigurations[$this->area]['file']; 501 //bp 445 502 } else { 446 503 $customargs = $this->module.'/'.$this->type.'/'.$this->func.$customargs; -
development/main/includes/Zikula.class.php
r24778 r24916 254 254 // Load our language files 255 255 pnLangLoad(); 256 257 //bp 2008-11-17 258 // set config variable $sysdom, $syscharset 259 $sysdom = $GLOBALS['PNConfig']['System']['dom']; 260 !$sysdom ? $sysdom = 'zikula' : ''; 261 Zikula::setConfigVar('sysdom', $sysdom); 262 $syscharset = $GLOBALS['PNConfig']['DBInfo']['default']['dbcharset']; 263 !$syscharset ? $syscharset = 'UTF-8' : ''; 264 Zikula::setConfigVar('syscharset', $syscharset); 265 // locale is currently only set in the old language files 266 $winos = stristr(getenv('OS'),'windows'); 267 $syslocale = $winos ? _LOCALEWIN : _LOCALE; 268 Zikula::setConfigVar('syslocale', $syslocale); 269 270 // bp 2008-11-17 initialize Gettext 271 list($lc, $cs) = LanguageUtil::initGettext(); 272 273 /* debug 274 echo "syscharset: $syscharset<br/>"; 275 echo "sysdom: $sysdom, lc: $lc, cs: $cs<br/>"; 276 echo dgettext('zikula', 'Home'); 277 echo "<br/>set textdomain<br/>"; 278 $rd=textdomain($sysdom); 279 echo _('Home'); 280 */ 256 281 } 257 282
