Changeset 15664
- Timestamp:
- 11/08/11 02:19:15 (7 months ago)
- Location:
- trunk
- Files:
-
- 109 added
- 6 deleted
- 22 edited
- 3 moved
-
inc/classes/BxDolFile.php (modified) (1 diff)
-
inc/classes/BxDolFtp.php (modified) (1 diff)
-
inc/classes/BxDolLanguagesQuery.php (modified) (10 diffs)
-
inc/classes/BxDolModuleQuery.php (modified) (1 diff)
-
inc/classes/BxDolXmlParser.php (added)
-
inc/languages.inc.php (modified) (10 diffs)
-
install/index.php (modified) (1 diff)
-
install/langs (deleted)
-
install/sql/v70.sql (modified) (5 diffs)
-
langs/.htaccess (modified) (1 diff)
-
modules/boonex/articles/install/langs/en.php (deleted)
-
modules/boonex/articles/install/langs/en.xml (added)
-
modules/boonex/basic/install/config.php (modified) (4 diffs)
-
modules/boonex/basic/install/data/templates (added)
-
modules/boonex/basic/install/data/templates/tmpl_basic (added)
-
modules/boonex/basic/install/data/templates/tmpl_basic/css (added)
-
modules/boonex/basic/install/data/templates/tmpl_basic/images (added)
-
modules/boonex/basic/install/data/templates/tmpl_basic/images/icons (added)
-
modules/boonex/basic/install/data/templates/tmpl_basic/scripts (added)
-
modules/boonex/basic/install/data/templates/tmpl_basic/scripts/BxTemplCategories.php (added)
-
modules/boonex/basic/install/data/templates/tmpl_basic/scripts/BxTemplConfig.php (added)
-
modules/boonex/basic/install/data/templates/tmpl_basic/scripts/BxTemplDesign.php (added)
-
modules/boonex/basic/install/data/templates/tmpl_basic/scripts/BxTemplFormView.php (added)
-
modules/boonex/basic/install/data/templates/tmpl_basic/scripts/BxTemplFunctions.php (added)
-
modules/boonex/basic/install/data/templates/tmpl_basic/scripts/BxTemplIndexPageView.php (added)
-
modules/boonex/basic/install/data/templates/tmpl_basic/scripts/BxTemplMenu.php (added)
-
modules/boonex/basic/install/data/templates/tmpl_basic/scripts/BxTemplName.php (added)
-
modules/boonex/basic/install/data/templates/tmpl_basic/scripts/BxTemplPaginate.php (added)
-
modules/boonex/basic/install/data/templates/tmpl_basic/scripts/BxTemplTags.php (added)
-
modules/boonex/basic/install/data/tmpl_basic (deleted)
-
modules/boonex/basic/install/langs/en.xml (moved) (moved from trunk/modules/boonex/basic/install/langs/en.php) (1 diff)
-
modules/boonex/basic/install/sql/install.sql (modified) (2 diffs)
-
modules/boonex/english (added)
-
modules/boonex/english/install (added)
-
modules/boonex/english/install/config.php (added)
-
modules/boonex/english/install/data (added)
-
modules/boonex/english/install/data/langs (added)
-
modules/boonex/english/install/data/langs/en.xml (added)
-
modules/boonex/english/install/info (added)
-
modules/boonex/english/install/info/inst_concl.html (added)
-
modules/boonex/english/install/info/inst_intro.html (added)
-
modules/boonex/english/install/info/uninst_concl.html (added)
-
modules/boonex/english/install/info/uninst_intro.html (added)
-
modules/boonex/english/install/installer.php (added)
-
modules/boonex/english/install/langs (added)
-
modules/boonex/english/install/langs/en.xml (added)
-
modules/boonex/english/install/sql (added)
-
modules/boonex/english/install/sql/disable.sql (added)
-
modules/boonex/english/install/sql/enable.sql (added)
-
modules/boonex/english/install/sql/install.sql (added)
-
modules/boonex/english/install/sql/uninstall.sql (added)
-
modules/boonex/english/templates (added)
-
modules/boonex/english/templates/base (added)
-
modules/boonex/english/templates/base/images (added)
-
modules/boonex/english/templates/base/images/icons (added)
-
modules/boonex/english/templates/base/images/icons/std-pi.png (added)
-
modules/boonex/english/templates/base/images/icons/std-wi.png (added)
-
modules/boonex/english/updates (added)
-
modules/boonex/russian (added)
-
modules/boonex/russian/install (added)
-
modules/boonex/russian/install/config.php (added)
-
modules/boonex/russian/install/data (added)
-
modules/boonex/russian/install/data/langs (added)
-
modules/boonex/russian/install/data/langs/ru.xml (added)
-
modules/boonex/russian/install/data/modules (added)
-
modules/boonex/russian/install/data/modules/boonex (added)
-
modules/boonex/russian/install/data/modules/boonex/articles (added)
-
modules/boonex/russian/install/data/modules/boonex/articles/install (added)
-
modules/boonex/russian/install/data/modules/boonex/articles/install/langs (added)
-
modules/boonex/russian/install/data/modules/boonex/articles/install/langs/ru.xml (added)
-
modules/boonex/russian/install/data/modules/boonex/basic (added)
-
modules/boonex/russian/install/data/modules/boonex/basic/install (added)
-
modules/boonex/russian/install/data/modules/boonex/basic/install/langs (added)
-
modules/boonex/russian/install/data/modules/boonex/basic/install/langs/ru.xml (added)
-
modules/boonex/russian/install/data/modules/boonex/english (added)
-
modules/boonex/russian/install/data/modules/boonex/english/install (added)
-
modules/boonex/russian/install/data/modules/boonex/english/install/langs (added)
-
modules/boonex/russian/install/data/modules/boonex/english/install/langs/ru.xml (added)
-
modules/boonex/russian/install/data/modules/boonex/sundance (added)
-
modules/boonex/russian/install/data/modules/boonex/sundance/install (added)
-
modules/boonex/russian/install/data/modules/boonex/sundance/install/langs (added)
-
modules/boonex/russian/install/data/modules/boonex/sundance/install/langs/ru.xml (added)
-
modules/boonex/russian/install/info (added)
-
modules/boonex/russian/install/info/inst_concl.html (added)
-
modules/boonex/russian/install/info/inst_intro.html (added)
-
modules/boonex/russian/install/info/uninst_concl.html (added)
-
modules/boonex/russian/install/info/uninst_intro.html (added)
-
modules/boonex/russian/install/installer.php (added)
-
modules/boonex/russian/install/langs (added)
-
modules/boonex/russian/install/langs/en.xml (added)
-
modules/boonex/russian/install/langs/ru.xml (added)
-
modules/boonex/russian/install/sql (added)
-
modules/boonex/russian/install/sql/disable.sql (added)
-
modules/boonex/russian/install/sql/enable.sql (added)
-
modules/boonex/russian/install/sql/install.sql (added)
-
modules/boonex/russian/install/sql/uninstall.sql (added)
-
modules/boonex/russian/templates (added)
-
modules/boonex/russian/templates/base (added)
-
modules/boonex/russian/templates/base/images (added)
-
modules/boonex/russian/templates/base/images/icons (added)
-
modules/boonex/russian/templates/base/images/icons/std-pi.png (added)
-
modules/boonex/russian/templates/base/images/icons/std-wi.png (added)
-
modules/boonex/russian/updates (added)
-
modules/boonex/sundance/install/config.php (modified) (4 diffs)
-
modules/boonex/sundance/install/data/templates (added)
-
modules/boonex/sundance/install/data/templates/tmpl_sundance (added)
-
modules/boonex/sundance/install/data/templates/tmpl_sundance/css (added)
-
modules/boonex/sundance/install/data/templates/tmpl_sundance/images (added)
-
modules/boonex/sundance/install/data/templates/tmpl_sundance/images/icons (added)
-
modules/boonex/sundance/install/data/templates/tmpl_sundance/scripts (added)
-
modules/boonex/sundance/install/data/templates/tmpl_sundance/scripts/BxTemplCategories.php (added)
-
modules/boonex/sundance/install/data/templates/tmpl_sundance/scripts/BxTemplConfig.php (added)
-
modules/boonex/sundance/install/data/templates/tmpl_sundance/scripts/BxTemplDesign.php (added)
-
modules/boonex/sundance/install/data/templates/tmpl_sundance/scripts/BxTemplFormView.php (added)
-
modules/boonex/sundance/install/data/templates/tmpl_sundance/scripts/BxTemplFunctions.php (added)
-
modules/boonex/sundance/install/data/templates/tmpl_sundance/scripts/BxTemplIndexPageView.php (added)
-
modules/boonex/sundance/install/data/templates/tmpl_sundance/scripts/BxTemplMenu.php (added)
-
modules/boonex/sundance/install/data/templates/tmpl_sundance/scripts/BxTemplName.php (added)
-
modules/boonex/sundance/install/data/templates/tmpl_sundance/scripts/BxTemplPaginate.php (added)
-
modules/boonex/sundance/install/data/templates/tmpl_sundance/scripts/BxTemplTags.php (added)
-
modules/boonex/sundance/install/data/tmpl_sundance (deleted)
-
modules/boonex/sundance/install/langs/en.xml (moved) (moved from trunk/modules/boonex/sundance/install/langs/en.php) (1 diff)
-
modules/boonex/sundance/install/sql/install.sql (modified) (2 diffs)
-
studio/classes/BxDolStudioInstaller.php (modified) (6 diffs)
-
studio/classes/BxDolStudioInstallerQuery.php (modified) (4 diffs)
-
studio/classes/BxDolStudioLanguage.php (modified) (2 diffs)
-
studio/classes/BxDolStudioLanguageQuery.php (modified) (1 diff)
-
studio/classes/BxDolStudioModulesQuery.php (modified) (1 diff)
-
studio/design.php (modified) (1 diff)
-
studio/js/language.js (added)
-
studio/language.php (moved) (moved from trunk/studio/languages.php) (2 diffs)
-
studio/templates/base/images/icons/mi-lang-general.png (added)
-
studio/templates/base/images/icons/pi-lang-en.png (deleted)
-
studio/templates/base/images/icons/wi-lang-english.png (deleted)
-
studio/templates/base/language.html (added)
-
studio/templates/base/lng_page_caption.html (added)
-
studio/templates/base/scripts/BxBaseStudioDesign.php (modified) (2 diffs)
-
studio/templates/base/scripts/BxBaseStudioLanguage.php (modified) (2 diffs)
-
studio/templates/tmpl_uni/scripts/BxTemplStudioLanguage.php (modified) (1 diff)
-
templates/base/scripts/BxBaseCmtsView.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/inc/classes/BxDolFile.php
r15654 r15664 48 48 49 49 protected function _copyFile($sFilePathFrom, $sFilePathTo) { 50 if(file_exists($sFilePathTo)) 51 return true; 52 50 53 if(substr($sFilePathFrom, -1) == '*') 51 54 $sFilePathFrom = substr($sFilePathFrom, 0, -1); 52 55 53 $bResult = false;56 $bResult = true; 54 57 if(is_file($sFilePathFrom)) { 55 58 if($this->_isFile($sFilePathTo)) { -
trunk/inc/classes/BxDolFtp.php
r15654 r15664 30 30 $sFilePathFrom = substr($sFilePathFrom, 0, -1); 31 31 32 $bResult = false;32 $bResult = true; 33 33 if(is_file($sFilePathFrom)) { 34 34 if($this->_isFile($sFilePathTo)) { -
trunk/inc/classes/BxDolLanguagesQuery.php
r15547 r15664 38 38 39 39 function getLanguageId($sName, $bFromCache = true) { 40 $sSql = $this->prepare("SELECT `ID` FROM `sys_localization_languages` WHERE `Name`=? LIMIT 1", $sName);40 $sSql = $this->prepare("SELECT `ID` FROM `sys_localization_languages` WHERE `Name`=? AND `Enabled`='1' LIMIT 1", $sName); 41 41 42 42 if($bFromCache) … … 45 45 return (int)$this->getOne($sSql); 46 46 } 47 function getLanguages($bIdAsKey = false ) {48 $sSql = "SELECT * FROM `sys_localization_languages` WHERE 1 ORDER BY `Title` ASC";47 function getLanguages($bIdAsKey = false, $bActiveOnly = false) { 48 $sSql = "SELECT * FROM `sys_localization_languages` WHERE 1 " . ($bActiveOnly ? " AND `Enabled`='1'" : "") . " ORDER BY `Title` ASC"; 49 49 return $this->getPairs($sSql, $bIdAsKey ? 'ID' : 'Name', 'Title'); 50 50 } … … 66 66 $sWhereClause .= $this->prepare(" AND `tl`.`Name`=?", $aParams['value']); 67 67 break; 68 case 'active': 69 $sWhereClause = " AND `tl`.`Enabled`='1'"; 70 break; 68 71 case 'all': 69 72 $sOrderClause = " `tl`.`Name` ASC "; … … 86 89 `tl`.`Name` AS `name`, 87 90 `tl`.`Flag` AS `flag`, 88 `tl`.`Title` AS `title`" . $sSelectClause . " 91 `tl`.`Title` AS `title`, 92 `tl`.`Enabled` AS `enabled`" . $sSelectClause . " 89 93 FROM `sys_localization_languages` AS `tl`" . $sJoinClause . " 90 94 WHERE 1" . $sWhereClause . " … … 209 213 } 210 214 215 function addKeys($iLanguageId, $iCategoryId, &$aKeys) { 216 foreach($aKeys as $sKey => $sValue) { 217 $sQuery = $this->prepare("SELECT `ID` FROM `sys_localization_keys` WHERE `IDCategory`=? AND `Key`=? LIMIT 1", $iCategoryId, $sKey); 218 $iKeyId = (int)$this->getOne($sQuery); 219 220 if($iKeyId == 0) { 221 $sQuery = $this->prepare("INSERT INTO `sys_localization_keys`(`IDCategory`, `Key`) VALUES(?, ?)", $iCategoryId, $sKey); 222 if((int)$this->query($sQuery) <= 0) 223 continue; 224 225 $iKeyId = (int)$this->lastId(); 226 } 227 228 $sQuery = $this->prepare("INSERT IGNORE INTO `sys_localization_strings`(`IDKey`, `IDLanguage`, `String`) VALUES(?, ?, ?)", $iKeyId, $iLanguageId, $sValue); 229 $this->query($sQuery); 230 } 231 } 232 233 /** 234 * Remove language key ONLY. Language strings should be already removed. 235 * @param integer $iKeyId language key ID 236 */ 211 237 function deleteKey($iKeyId) { 212 $sSql = $this->prepare("DELETE FROM `sys_localization_keys` WHERE `ID`=? LIMIT 1", $iKeyId); 213 return (int)$this->query($sSql) > 0; 238 $sQuery = $this->prepare("DELETE FROM `sys_localization_keys` WHERE `ID`=? LIMIT 1", $iKeyId); 239 return (int)$this->query($sQuery) > 0; 240 } 241 242 function deleteKeys($aKeys) { 243 foreach($aKeys as $sKey => $sValue) { 244 $sQuery = $this->prepare("DELETE FROM `sys_localization_keys`, `sys_localization_strings` USING `sys_localization_keys`, `sys_localization_strings` WHERE `sys_localization_keys`.`ID`=`sys_localization_strings`.`IDKey` AND `sys_localization_keys`.`Key`=?", $sKey); 245 $this->query($sQuery); 246 } 214 247 } 215 248 … … 221 254 $sWhereClause = $this->prepare(" AND `tk`.`ID`=?", $aParams['value']); 222 255 break; 223 case 'by_cat_and_lang': 224 if((int)$aParams['category_id'] != 0) 225 $sWhereClause .= $this->prepare(" AND `tc`.`ID`=?", $aParams['category_id']); 226 if(!empty($aParams['language_id'])) 227 $sWhereClause .= $this->prepare(" AND `tl`.`ID`=?", $aParams['language_id']); 256 case 'by_cat_id': 257 $sWhereClause .= $this->prepare(" AND `tc`.`ID`=?", $aParams['value']); 228 258 break; 229 259 } … … 233 263 `sys_localization_categories` AS `tc`, 234 264 `sys_localization_keys` AS `tk`, 235 `sys_localization_languages` AS `tl`, 265 `sys_localization_strings` AS `ts` 266 WHERE `tk`.`ID`=`ts`.`IDKey` AND `tk`.`IDCategory`=`tc`.`ID`" . $sWhereClause; 267 return (int)$this->query($sSql); 268 } 269 270 function addString($iKeyId, $iLanguageId, $sString) { 271 $sSql = $this->prepare("INSERT INTO `sys_localization_strings` SET `IDKey`=?, `IDLanguage`=?, `String`=?", $iKeyId, $iLanguageId, $sString); 272 return (int)$this->query($sSql) > 0; 273 } 274 275 function updateString($iKeyId, $iLanguageId, $sString) { 276 $sSql = $this->prepare("UPDATE `sys_localization_strings` SET `String`=? WHERE `IDKey`=? AND `IDLanguage`=?", $sString, $iKeyId, $iLanguageId); 277 return (int)$this->query($sSql) > 0; 278 } 279 280 function deleteString($iKeyId, $iLanguageId) { 281 $sSql = $this->prepare("DELETE FROM `sys_localization_strings` WHERE `IDKey`=? AND `IDLanguage`=?", $iKeyId, $iLanguageId); 282 return (int)$this->query($sSql) > 0; 283 } 284 285 function deleteStringsBy($aParams = array()) { 286 $sWhereClause = ""; 287 288 switch($aParams['type']) { 289 case 'by_cat_and_lang': 290 $sWhereClause .= $this->prepare(" AND `tc`.`ID`=? AND `tl`.`ID`=?", $aParams['category_id'], $aParams['language_id']); 291 break; 292 } 293 294 $sSql = "DELETE FROM `ts` 295 USING 296 `sys_localization_categories` AS `tc`, 297 `sys_localization_keys` AS `tk`, 298 `sys_localization_languages` AS `tl`, 236 299 `sys_localization_strings` AS `ts` 237 300 WHERE `tk`.`ID`=`ts`.`IDKey` AND `tk`.`IDCategory`=`tc`.`ID` AND `ts`.`IDLanguage`=`tl`.`ID`" . $sWhereClause; … … 239 302 } 240 303 241 function addString($iKeyId, $iLanguageId, $sString) {242 $sSql = $this->prepare("INSERT INTO `sys_localization_strings` SET `IDKey`=?, `IDLanguage`=?, `String`=?", $iKeyId, $iLanguageId, $sString);243 return (int)$this->query($sSql) > 0;244 }245 246 function updateString($iKeyId, $iLanguageId, $sString) {247 $sSql = $this->prepare("UPDATE `sys_localization_strings` SET `String`=? WHERE `IDKey`=? AND `IDLanguage`=?", $sString, $iKeyId, $iLanguageId);248 return (int)$this->query($sSql) > 0;249 }250 251 function deleteString($iKeyId, $iLanguageId) {252 $sSql = $this->prepare("DELETE FROM `sys_localization_strings` WHERE `IDKey`=? AND `IDLanguage`=?", $iKeyId, $iLanguageId);253 return (int)$this->query($sSql) > 0;254 }255 256 304 function getCategories() { 257 305 $sSql = "SELECT `ID`, `Name` FROM `sys_localization_categories` ORDER BY `Name`"; … … 259 307 } 260 308 309 function addCategory($sName) { 310 $sQuery = $this->prepare("INSERT IGNORE INTO `sys_localization_categories` SET `Name`=?", $sName); 311 $iResult = (int)$this->query($sQuery); 312 313 if($iResult > 0) 314 return (int)$this->lastId(); 315 316 $iCategoryId = 0; 317 $this->getCategoriesBy(array('type' => 'id_by_name', 'value' => $sName), $iCategoryId); 318 return $iCategoryId; 319 } 320 321 function deleteCategory($sName) { 322 $sQuery = $this->prepare("DELETE FROM `sys_localization_categories` WHERE `Name`=?", $sName); 323 $this->query($sQuery); 324 } 325 261 326 function getCategoriesBy($aParams, &$aItems) { 262 327 $aMethod = array('name' => 'getAll', 'params' => array(0 => 'query')); 263 328 $sSelectClause = $sJoinClause = $sWhereClause = $sOrderClause = $sLimitClause = ""; 264 329 330 $sSelectClause = "`tc`.`ID` AS `id`, `tc`.`Name` AS `name`"; 331 265 332 if(!isset($aParams['order']) || empty($aParams['order'])) 266 333 $sOrderClause = " `tc`.`ID` ASC "; 267 334 268 335 switch($aParams['type']) { 336 case 'id_by_name': 337 $aMethod['name'] = 'getOne'; 338 $sSelectClause = "`tc`.`ID` AS `id`"; 339 $sWhereClause = $this->prepare(" AND `tc`.`Name`=?", $aParams['value']); 340 break; 269 341 case 'by_name': 270 342 $aMethod['name'] = 'getRow'; 271 $sWhereClause = " AND `tc`.`Name`='" . $aParams['value'] . "'";343 $sWhereClause = $this->prepare(" AND `tc`.`Name`=?", $aParams['value']); 272 344 break; 273 345 case 'all': … … 277 349 278 350 $aMethod['params'][0] = "SELECT 279 `tc`.`ID` AS `id`, 280 `tc`.`Name` AS `name`" . $sSelectClause . " 351 " . $sSelectClause . " 281 352 FROM `sys_localization_categories` AS `tc`" . $sJoinClause . " 282 353 WHERE 1" . $sWhereClause . " -
trunk/inc/classes/BxDolModuleQuery.php
r15529 r15664 55 55 } 56 56 function getModules() { 57 $sSql = "SELECT `id`, `t itle`, `vendor`, `version`, `product_url`, `update_url`, `path`, `uri`, `class_prefix`, `db_prefix`, `lang_category`, `date`, `enabled` FROM `sys_modules` ORDER BY `title`";57 $sSql = "SELECT `id`, `type` `title`, `vendor`, `version`, `product_url`, `update_url`, `path`, `uri`, `class_prefix`, `db_prefix`, `lang_category`, `date`, `enabled` FROM `sys_modules` ORDER BY `title`"; 58 58 return $this->fromMemory('sys_modules', 'getAll', $sSql); 59 } 60 function getModulesBy($aParams = array()) { 61 $sPostfix = $sWhereClause = ""; 62 63 switch($aParams['type']) { 64 case 'languages': 65 $sPostfix .= '_modules'; 66 $sWhereClause .= $this->prepare(" AND `type`=?", BX_DOL_MODULE_TYPE_LANGUAGE); 67 break; 68 case 'modules': 69 $sPostfix .= '_languages'; 70 $sWhereClause .= $this->prepare(" AND `type`=?", BX_DOL_MODULE_TYPE_MODULE); 71 break; 72 case 'templates': 73 $sPostfix .= '_templates'; 74 $sWhereClause .= $this->prepare(" AND `type`=?", BX_DOL_MODULE_TYPE_TEMPLATE); 75 break; 76 } 77 78 if(isset($aParams['active'])) { 79 $sPostfix .= "_active"; 80 $sWhereClause .= $this->prepare(" AND `enabled`=?", (int)$aParams['active']); 81 } 82 83 $sSql = "SELECT `id`, `type` `title`, `vendor`, `version`, `product_url`, `update_url`, `path`, `uri`, `class_prefix`, `db_prefix`, `lang_category`, `date`, `enabled` FROM `sys_modules` WHERE 1" . $sWhereClause . " ORDER BY `title`"; 84 return $this->fromMemory('sys_modules' . $sPostfix, 'getAll', $sSql); 85 } 86 function getModulesUri() { 87 $sSql = "SELECT `uri` FROM `sys_modules` ORDER BY `uri`"; 88 return $this->fromMemory('sys_modules_uri', 'getColumn', $sSql); 59 89 } 60 90 function getDependent($sUri) { -
trunk/inc/languages.inc.php
r15529 r15664 12 12 define('BX_DOL_LANGUAGE_CATEGORY_SYSTEM', 1); 13 13 14 if (!defined ('BX_SKIP_INSTALL_CHECK')) { 15 16 $sCurrentLanguage = getCurrentLangName(false); 17 if( !$sCurrentLanguage ) { 18 echo '<br /><b>Fatal error:</b> Cannot apply localization.'; 14 /** 15 * Trying to initialize default language. 16 */ 17 $sCurrentLanguage = getCurrentLangName(false); 18 if($sCurrentLanguage != '') { 19 $sPath = BX_DIRECTORY_PATH_ROOT . 'langs/lang-' . $sCurrentLanguage . '.php'; 20 if(file_exists($sPath)) 21 require_once($sPath); 22 } 23 24 getCurrentLangName(true); 25 if (isset($_GET['lang'])) { 26 bx_import('BxDolPermalinks'); 27 $oPermalinks = new BxDolPermalinks(); 28 if ($oPermalinks->redirectIfNecessary(array('lang'))) 19 29 exit; 20 } 21 require_once( BX_DIRECTORY_PATH_ROOT . "langs/lang-{$sCurrentLanguage}.php" ); 22 23 getCurrentLangName(true); 24 25 if (isset($_GET['lang'])) { 26 bx_import('BxDolPermalinks'); 27 $oPermalinks = new BxDolPermalinks(); 28 if ($oPermalinks->redirectIfNecessary(array('lang'))) 29 exit; 30 } 31 } 32 33 function getCurrentLangName($isSetCookie = true) { 30 } 31 32 function getCurrentLangName($bSetCookie = true) { 34 33 $sLang = ''; 35 34 36 35 if(!$sLang && !empty($_GET['lang'])) 37 $sLang = tryToGetLang($_GET['lang'], $ isSetCookie);36 $sLang = tryToGetLang($_GET['lang'], $bSetCookie); 38 37 39 38 if(!$sLang && !empty($_POST['lang'])) 40 $sLang = tryToGetLang($_POST['lang'], $ isSetCookie);39 $sLang = tryToGetLang($_POST['lang'], $bSetCookie); 41 40 42 41 if(!$sLang && !empty($_COOKIE['lang'])) … … 105 104 return false; 106 105 106 $iLangId = BxDolLanguagesQuery::getInstance()->getLanguageId($sLang); 107 if(!$iLangId) 108 return false; 109 107 110 if(file_exists( BX_DIRECTORY_PATH_ROOT . "langs/lang-{$sLang}.php")) 108 111 return true; 109 110 $iLangId = BxDolLanguagesQuery::getInstance()->getLanguageId($sLang);111 if(!$iLangId)112 return false;113 112 114 113 if(compileLanguage($iLangId)) … … 139 138 } 140 139 141 function compileLanguage($mixedLang = 0) { 140 function getLanguages($bIdAsKey = false, $bActiveOnly = false) { 141 return BxDolLanguagesQuery::getInstance()->getLanguages($bIdAsKey, $bActiveOnly); 142 } 143 144 function compileLanguage($mixedLang = 0, $bForce = false) { 142 145 $sType = 'all'; 143 146 if(!empty($mixedLang)) { … … 160 163 $sNewLine = "\r\n"; 161 164 foreach($aLanguages as $aLanguage) { 165 if(!$bForce && (int)$aLanguage['enabled'] != 1) 166 continue; 167 162 168 $aKeys = array(); 163 169 $iKeys = $oDb->getKeysBy(array('type' => 'by_language_id', 'value' => $aLanguage['id']), $aKeys); … … 187 193 } 188 194 189 function restoreLanguage($mixedLang = 0, $mixedModule = 0 ) {195 function restoreLanguage($mixedLang = 0, $mixedModule = 0, $bRecompile = true) { 190 196 $oDb = BxDolLanguagesQuery::getInstance(); 191 197 … … 193 199 $sLanguageName = ''; 194 200 if(!empty($mixedLang)) { 195 $sType = 'by_id';196 if(is_string($mixedLang) && !is_numeric($mixedLang))197 $sType = 'by_name';198 199 201 $aLanguage = array(); 200 $iLanguage = $oDb->getLanguagesBy(array('type' => $sType, 'value' => $mixedLang), $aLanguage);202 $iLanguage = $oDb->getLanguagesBy(array('type' => (is_string($mixedLang) && !is_numeric($mixedLang) ? 'by_name' : 'by_id'), 'value' => $mixedLang), $aLanguage); 201 203 202 204 if($iLanguage == 1) { … … 206 208 } 207 209 208 $iCategoryId = BX_DOL_LANGUAGE_CATEGORY_SYSTEM; //default 'System' category 209 $sPath = BX_DIRECTORY_PATH_ROOT . 'install/langs/'; 210 if(!empty($mixedModule)) { 211 $sMethod = 'getModuleById'; 212 if(is_string($mixedModule) && !is_numeric($mixedModule)) 213 $sMethod = 'getModuleByUri'; 214 210 $sPath = BX_DIRECTORY_PATH_ROOT . 'langs/'; 211 $iCategoryId = BX_DOL_LANGUAGE_CATEGORY_SYSTEM; 212 213 $bModule = !empty($mixedModule); 214 if($bModule && is_array($mixedModule)) { 215 $sPath = BX_DIRECTORY_PATH_MODULES . $mixedModule['path'] . 'install/langs/'; 216 $iCategoryId = (int)$mixedModule['category_id']; 217 } 218 else if($bModule) { 215 219 bx_import('BxDolModuleQuery'); 220 $sMethod = is_string($mixedModule) && !is_numeric($mixedModule) ? 'getModuleByUri' : 'getModuleById'; 216 221 $aModule = BxDolModuleQuery::getInstance()->$sMethod($mixedModule); 217 222 … … 224 229 if($iCategory == 1) 225 230 $iCategoryId = (int)$aCategory['id']; 226 } 227 } 228 229 $oDb->deleteKeysBy(array('type' => 'by_cat_and_lang', 'category_id' => $iCategoryId, 'language_id' => $iLanguageId)); 231 } 232 } 233 234 /** 235 * If the action is applied to all languages ($iLanguageId == 0) then keys can be removed before the action. 236 * If the action is applied to some language then only strings can be removed. 237 */ 238 if($iLanguageId == 0) 239 $oDb->deleteKeysBy(array('type' => 'by_cat_id', 'value' => $iCategoryId)); 240 else 241 $oDb->deleteStringsBy(array('type' => 'by_cat_and_lang', 'category_id' => $iCategoryId, 'language_id' => $iLanguageId)); 230 242 231 243 if(!($rHandler = opendir($sPath))) 232 244 return false; 245 246 bx_import('BxDolXmlParser'); 247 $oXmlParser = BxDolXmlParser::getInstance(); 233 248 234 249 $bResult = true; 235 250 while(($sFileName = readdir($rHandler)) !== false) { 236 if(substr($sFileName, -3) != ' php')251 if(substr($sFileName, -3) != 'xml') 237 252 continue; 238 253 239 // Restore language keys from 'System' category 240 if($iCategoryId == BX_DOL_LANGUAGE_CATEGORY_SYSTEM) { 241 require_once($sPath . $sFileName); 242 if(!isset($LANG_INFO['Name']) || !isset($LANG) || ($sLanguageName != '' && $LANG_INFO['Name'] != $sLanguageName)) 243 continue; 244 245 if($sLanguageName == '') 246 $oDb->getLanguagesBy(array('type' => 'by_name', 'value' => $LANG_INFO['Name']), $aLanguage); 247 248 if(!empty($aLanguage)) 249 foreach($LANG as $sKey => $sValue) 250 $bResult &= addLanguageString($sKey, $sValue, $aLanguage['id'], $iCategoryId, false); 251 } 252 // Restore language keys from modules' categories. 253 else { 254 $sLanguageNameFile = substr($sFileName, 0, 2); 255 if($sLanguageName != '' && $sLanguageNameFile != $sLanguageName) 256 continue; 257 258 if($sLanguageName == '') 259 $oDb->getLanguagesBy(array('type' => 'by_name', 'value' => $sLanguageNameFile), $aLanguage); 260 261 require_once($sPath . $sFileName); 262 if(!empty($aLanguage) && isset($aLangContent)) 263 foreach($aLangContent as $sKey => $sValue) 264 $bResult &= addLanguageString($sKey, $sValue, $aLanguage['id'], $iCategoryId, false); 265 } 254 $sXmlContent = file_get_contents($sPath . $sFileName); 255 $sName = $oXmlParser->getAttribute($sXmlContent, 'resources', 'name'); 256 $aStrings = $oXmlParser->getValues($sXmlContent, 'string'); 257 258 if(empty($sName) || empty($aStrings) || ($sLanguageName != '' && $sName != $sLanguageName)) 259 continue; 260 261 if($sLanguageName == '') 262 $oDb->getLanguagesBy(array('type' => 'by_name', 'value' => $sName), $aLanguage); 263 264 if(!empty($aLanguage)) 265 foreach($aStrings as $sKey => $sValue) 266 $bResult &= addLanguageString($sKey, $sValue, $aLanguage['id'], $iCategoryId, false); 266 267 } 267 268 closedir($rHandler); 268 269 269 return $bResult && compileLanguage($iLanguageId); 270 return $bResult && ($bRecompile ? compileLanguage($iLanguageId) : true); 271 } 272 273 function removeLanguage($mixedLang = 0, $mixedModule = 0, $bRecompile = true) { 274 $oDb = BxDolLanguagesQuery::getInstance(); 275 276 $iLanguageId = 0; 277 $sLanguageName = ''; 278 if(!empty($mixedLang)) { 279 $aLanguage = array(); 280 $iLanguage = $oDb->getLanguagesBy(array('type' => (is_string($mixedLang) && !is_numeric($mixedLang) ? 'by_name' : 'by_id'), 'value' => $mixedLang), $aLanguage); 281 282 if($iLanguage == 1) { 283 $iLanguageId = $aLanguage['id']; 284 $sLanguageName = $aLanguage['name']; 285 } 286 } 287 288 $iCategoryId = BX_DOL_LANGUAGE_CATEGORY_SYSTEM; 289 290 $bModule = !empty($mixedModule); 291 if($bModule && is_array($mixedModule)) 292 $iCategoryId = (int)$mixedModule['category_id']; 293 else if($bModule) { 294 bx_import('BxDolModuleQuery'); 295 $sMethod = is_string($mixedModule) && !is_numeric($mixedModule) ? 'getModuleByUri' : 'getModuleById'; 296 $aModule = BxDolModuleQuery::getInstance()->$sMethod($mixedModule); 297 298 if(!empty($aModule)) { 299 $aCategory = array(); 300 $iCategory = $oDb->getCategoriesBy(array('type' => 'by_name', 'value' => $aModule['lang_category']), $aCategory); 301 302 if($iCategory == 1) 303 $iCategoryId = (int)$aCategory['id']; 304 } 305 } 306 307 /** 308 * If the action is applied to all languages ($iLanguageId == 0) then keys should be removed. 309 * If the action is applied to some language then only strings can be removed. 310 */ 311 $bResult = false; 312 if($iLanguageId == 0) 313 $bResult = (int)$oDb->deleteKeysBy(array('type' => 'by_cat_id', 'value' => $iCategoryId)) >= 0; 314 else 315 $bResult = (int)$oDb->deleteStringsBy(array('type' => 'by_cat_and_lang', 'category_id' => $iCategoryId, 'language_id' => $iLanguageId)) >= 0; 316 317 return $bResult && ($bRecompile ? compileLanguage($iLanguageId) : true); 270 318 } 271 319 … … 376 424 377 425 return $oDb->deleteKey($iKeyId); 426 } 427 428 function addLanguageKeys($iLanguageId, $iCategoryId, &$aKeys) { 429 BxDolLanguagesQuery::getInstance()->addKeys($iLanguageId, $iCategoryId, $aKeys); 430 } 431 432 function deleteLanguageKeys($aKeys) { 433 BxDolLanguagesQuery::getInstance()->deleteKeys($aKeys); 434 } 435 436 function getLanguageCategory($sName) { 437 $iId = 0; 438 BxDolLanguagesQuery::getInstance()->getCategoriesBy(array('type' => 'id_by_name', 'value' => $sName), $iId); 439 440 return (int)$iId; 441 } 442 443 function addLanguageCategory($sName) { 444 return BxDolLanguagesQuery::getInstance()->addCategory($sName); 445 } 446 447 function deleteLanguageCategory($sName) { 448 return BxDolLanguagesQuery::getInstance()->deleteCategory($sName); 378 449 } 379 450 … … 448 519 * @see addLanguageString 449 520 */ 450 function addStringToLanguage($sKey, $sString, $iLangId = -1, $iCategoryId = BX_DOL_LANGUAGE_CATEGORY_SYSTEM, $bRecompile = true) {521 function addStringToLanguage($sKey, $sString, $iLangId = 0, $iCategoryId = BX_DOL_LANGUAGE_CATEGORY_SYSTEM, $bRecompile = true) { 451 522 return addLanguageString($sKey, $sString, $iLangId, $iCategoryId, $bRecompile); 452 523 } -
trunk/install/index.php
r15657 r15664 114 114 define('BX_SYSTEM_COMPOSITE', '%dir_composite%'); 115 115 define('BX_SYSTEM_PHPBIN', '%dir_php%'); 116 117 define('BX_DOL_DIR_RIGHTS', 0777); 118 define('BX_DOL_FILE_RIGHTS', 0666); 116 119 117 120 //--- Module types ---// -
trunk/install/sql/v70.sql
r15663 r15664 1240 1240 1241 1241 INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `extra`, `check`, `check_error`, `order`) VALUES 1242 (@iCategoryId, 'lang_default', 'Default Language', ' en', 'select', 'PHP:bx_import(''BxDolLanguagesQuery''); $aValues = BxDolLanguagesQuery::getInstance()->getLanguages(); $aResult = array(); foreach($aValues as $sKey => $sValue) $aResult[] = array(\'key\' => $sKey, \'value\' => $sValue); return $aResult;', '', '', 1),1242 (@iCategoryId, 'lang_default', 'Default Language', '', 'select', 'PHP:$aValues = getLanguages(false, true); $aResult = array(); foreach($aValues as $sKey => $sValue) $aResult[] = array(\'key\' => $sKey, \'value\' => $sValue); return $aResult;', '', '', 1), 1243 1243 (@iCategoryId, 'lang_selector', 'Show Language Selector', 'on', 'checkbox', '', '', '', 2); 1244 1244 … … 1249 1249 INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `extra`, `check`, `check_error`, `order`) VALUES 1250 1250 (@iCategoryId, 'site_title', 'Site Name', 'Unite Community', 'digit', '', '', '', 1), 1251 (@iCategoryId, 'template', 'Default Template', ' uni', 'select', 'PHP:$aValues = get_templates_array(); $aResult = array(); foreach($aValues as $sKey => $sValue) $aResult[] = array(\'key\' => $sKey, \'value\' => $sValue); return $aResult;', 'return (strlen($arg0) > 0 && file_exists(BX_DIRECTORY_PATH_ROOT . "templates/tmpl_" . $arg0)) ? true : false;', 'Template cannot be empty and must have a valid name.', 2),1251 (@iCategoryId, 'template', 'Default Template', '', 'select', 'PHP:$aValues = get_templates_array(); $aResult = array(); foreach($aValues as $sKey => $sValue) $aResult[] = array(\'key\' => $sKey, \'value\' => $sValue); return $aResult;', 'return (strlen($arg0) > 0 && file_exists(BX_DIRECTORY_PATH_ROOT . "templates/tmpl_" . $arg0)) ? true : false;', 'Template cannot be empty and must have a valid name.', 2), 1252 1252 (@iCategoryId, 'enable_template', 'Show Template Switcher', 'on', 'checkbox', '', '', '', 3), 1253 1253 (@iCategoryId, 'sys_template_cache_enable', 'Enable cache for HTML files', '', 'checkbox', '', '', '', 4), … … 1368 1368 `Flag` varchar(2) NOT NULL default '', 1369 1369 `Title` varchar(255) NOT NULL default '', 1370 `Enabled` tinyint(1) unsigned NOT NULL default '0', 1370 1371 PRIMARY KEY (`ID`), 1371 1372 UNIQUE KEY `Name` (`Name`) … … 4782 4783 4783 4784 INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES 4784 (3, 'language_en', '', '', 'pi-lang-en.png');4785 SET @iIdLanguageEn = LAST_INSERT_ID();4786 4787 INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES4788 4785 (3, 'builder_pages', '_adm_page_cpt_builder_pages', '_adm_page_cpt_builder_pages', 'pi-builder-pages.png'); 4789 4786 SET @iIdBuilderPages = LAST_INSERT_ID(); … … 4848 4845 INSERT INTO `sys_std_pages_widgets`(`page_id`, `widget_id`, `order`) VALUES(@iIdLanguages, LAST_INSERT_ID(), 1); 4849 4846 4850 INSERT INTO `sys_std_widgets`(`page_id`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`, `status`) VALUES4851 (@iIdLanguageEn, '{url_studio}languages.php?name=en', '', 'wi-lang-english.png', '_adm_wgt_cpt_language_en', '', '', 1);4852 INSERT INTO `sys_std_pages_widgets`(`page_id`, `widget_id`, `order`) VALUES(@iIdLanguages, LAST_INSERT_ID(), 1);4853 4854 4847 -- 4855 4848 -- Builders Page -
trunk/langs/.htaccess
r15211 r15664 1 1 Deny from all 2 <FilesMatch "^.*\.php| .*\.html$">2 <FilesMatch "^.*\.php|^.*\.xml|.*\.html$"> 3 3 ForceType application/x-httpd-php-source 4 4 </FilesMatch> -
trunk/modules/boonex/basic/install/config.php
r15655 r15664 53 53 'move_sources' => 1, 54 54 'execute_sql' => 1, 55 'update_languages' => 0,56 'recompile_global_paramaters' => 0,55 'update_languages' => 1, 56 'recompile_global_paramaters' => 1, 57 57 'clear_db_cache' => 0, 58 58 'show_conclusion' => 1 … … 63 63 'move_sources' => 1, 64 64 'execute_sql' => 1, 65 'update_languages' => 0,66 'recompile_global_paramaters' => 0,65 'update_languages' => 1, 66 'recompile_global_paramaters' => 1, 67 67 'clear_db_cache' => 0, 68 68 'show_conclusion' => 1 … … 79 79 */ 80 80 'dependencies' => array(), 81 81 82 /** 82 83 * Category for language keys. 83 84 */ 84 'language_category' => 'BoonEx Sundance',85 'language_category' => 'BoonEx Basic', 85 86 86 87 /** … … 90 91 'uninstall_permissions' => array(), 91 92 93 /** 94 * List of modules which are included in this templte(language file) 95 * Usage: module uri => path 96 * 97 * Note. If template(language file) supports a module but don't need to copy any specific files 98 * leave the 'path' an empty or don't specify the module at all. 99 * 100 */ 101 'includes' => array( 102 'system' => 'templates/tmpl_basic', 103 ), 104 92 105 /** 93 106 * Introduction and Conclusion Section. -
trunk/modules/boonex/basic/install/langs/en.xml
r15655 r15664 1 <? 2 /*************************************************************************** 3 * Dolphin Smart Community Builder 4 * ------------------- 5 * begin : Mon Mar 23 2006 6 * copyright : (C) 2007 BoonEx Group 7 * website : http://www.boonex.com 8 * This file is part of Dolphin - Smart Community Builder 9 * 10 * Dolphin is free software; you can redistribute it and/or modify it under 11 * the terms of the GNU General Public License as published by the 12 * Free Software Foundation; either version 2 of the 13 * License, or any later version. 14 * 15 * Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 16 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 * See the GNU General Public License for more details. 18 * You should have received a copy of the GNU General Public License along with Dolphin, 19 * see license.txt file; if not, write to marketing@boonex.com 20 ***************************************************************************/ 21 22 $aLangContent = array(); 23 ?> 1 <?xml version="1.0" encoding="utf-8"?> 2 <resources name="en" flag="gb" title="English"> 3 <string name="_bx_bsc_wgt_cpt"><![CDATA[Basic]]></string> 4 <string name="_bx_bsc_stg_cpt_type"><![CDATA[Basic]]></string> 5 <string name="_bx_bsc_stg_cpt_category_system"><![CDATA[General]]></string> 6 </resources> -
trunk/modules/boonex/basic/install/sql/install.sql
r15655 r15664 14 14 SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id`=@iParentPageId); 15 15 INSERT INTO `sys_std_widgets`(`page_id`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`, `status`) VALUES 16 (@iPageId, '{url_studio}design.php?name=basic', '', 'modules/boonex/basic/|std-wi.png', '_ adm_wgt_cpt_template_basic', '', '', 2);16 (@iPageId, '{url_studio}design.php?name=basic', '', 'modules/boonex/basic/|std-wi.png', '_bx_bsc_wgt_cpt', '', '', 2); 17 17 INSERT INTO `sys_std_pages_widgets`(`page_id`, `widget_id`, `order`) VALUES 18 18 (@iParentPageId, LAST_INSERT_ID(), @iParentPageOrder + 1); … … 23 23 -- 24 24 INSERT INTO `sys_options_types`(`group`, `name`, `caption`, `icon`, `order`) VALUES 25 ('templates', @sModuleName, '_ adm_stg_cpt_type_templ_basic', 'modules/boonex/basic/|std-mi.png', 2);25 ('templates', @sModuleName, '_bx_bsc_stg_cpt_type', 'modules/boonex/basic/|std-mi.png', 2); 26 26 SET @iTypeId = LAST_INSERT_ID(); 27 27 28 28 INSERT INTO `sys_options_categories`(`type_id`, `name`, `caption`, `order`) VALUES 29 (@iTypeId, CONCAT(@sModuleName, '_system'), '_ adm_stg_cpt_category_system', 1);29 (@iTypeId, CONCAT(@sModuleName, '_system'), '_bx_bsc_stg_cpt_category_system', 1); 30 30 SET @iCategoryId = LAST_INSERT_ID(); 31 31 -
trunk/modules/boonex/sundance/install/config.php
r15655 r15664 53 53 'move_sources' => 1, 54 54 'execute_sql' => 1, 55 'update_languages' => 0,56 'recompile_global_paramaters' => 0,55 'update_languages' => 1, 56 'recompile_global_paramaters' => 1, 57 57 'clear_db_cache' => 0, 58 58 'show_conclusion' => 1 … … 63 63 'move_sources' => 1, 64 64 'execute_sql' => 1, 65 'update_languages' => 0,66 'recompile_global_paramaters' => 0,65 'update_languages' => 1, 66 'recompile_global_paramaters' => 1, 67 67 'clear_db_cache' => 0, 68 68 'show_conclusion' => 1 … … 79 79 */ 80 80 'dependencies' => array(), 81 81 82 /** 82 83 * Category for language keys. … … 89 90 'install_permissions' => array(), 90 91 'uninstall_permissions' => array(), 92 93 /** 94 * List of modules which are included in this templte(language file) 95 * Usage: module uri => path 96 * 97 * Note. If template(language file) supports a module but don't need to copy any specific files 98 * leave the 'path' an empty or don't specify the module at all. 99 */ 100 'includes' => array( 101 'system' => 'templates/tmpl_sundance', 102 ), 91 103 92 104 /** -
trunk/modules/boonex/sundance/install/langs/en.xml
r15655 r15664 1 <? 2 /*************************************************************************** 3 * Dolphin Smart Community Builder 4 * ------------------- 5 * begin : Mon Mar 23 2006 6 * copyright : (C) 2007 BoonEx Group 7 * website : http://www.boonex.com 8 * This file is part of Dolphin - Smart Community Builder 9 * 10 * Dolphin is free software; you can redistribute it and/or modify it under 11 * the terms of the GNU General Public License as published by the 12 * Free Software Foundation; either version 2 of the 13 * License, or any later version. 14 * 15 * Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 16 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 * See the GNU General Public License for more details. 18 * You should have received a copy of the GNU General Public License along with Dolphin, 19 * see license.txt file; if not, write to marketing@boonex.com 20 ***************************************************************************/ 21 22 $aLangContent = array(); 23 ?> 1 <?xml version="1.0" encoding="utf-8"?> 2 <resources name="en" flag="gb" title="English"> 3 <string name="_bx_snd_wgt_cpt"><![CDATA[Sundance]]></string> 4 <string name="_bx_snd_stg_cpt_type"><![CDATA[Sundance]]></string> 5 <string name="_bx_snd_stg_cpt_category_system"><![CDATA[General]]></string> 6 <string name="_bx_snd_lmi_cpt_general"><![CDATA[General]]></string> 7 <string name="_bx_snd_lmi_cpt_colors"><![CDATA[Colors]]></string> 8 <string name="_bx_snd_lmi_cpt_fonts"><![CDATA[Fonts]]></string> 9 </resources> -
trunk/modules/boonex/sundance/install/sql/install.sql
r15655 r15664 15 15 SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id`=@iParentPageId); 16 16 INSERT INTO `sys_std_widgets`(`page_id`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`, `status`) VALUES 17 (@iPageId, '{url_studio}design.php?name=sundance', '', 'modules/boonex/sundance/|std-wi.png', '_ adm_wgt_cpt_template_sundance', '', '', 2);17 (@iPageId, '{url_studio}design.php?name=sundance', '', 'modules/boonex/sundance/|std-wi.png', '_bx_snd_wgt_cpt', '', '', 2); 18 18 INSERT INTO `sys_std_pages_widgets`(`page_id`, `widget_id`, `order`) VALUES 19 19 (@iParentPageId, LAST_INSERT_ID(), @iParentPageOrder + 1); … … 24 24 -- 25 25 INSERT INTO `sys_options_types`(`group`, `name`, `caption`, `icon`, `order`) VALUES 26 ('templates', @sModuleName, '_ adm_stg_cpt_type_templ_sundance', 'modules/boonex/sundance/|std-mi.png', 2);26 ('templates', @sModuleName, '_bx_snd_stg_cpt_type', 'modules/boonex/sundance/|std-mi.png', 2); 27 27 SET @iTypeId = LAST_INSERT_ID(); 28 28 29 29 INSERT INTO `sys_options_categories`(`type_id`, `name`, `caption`, `order`) VALUES 30 (@iTypeId, CONCAT(@sModuleName, '_system'), '_ adm_stg_cpt_category_system', 1);30 (@iTypeId, CONCAT(@sModuleName, '_system'), '_bx_snd_stg_cpt_category_system', 1); 31 31 SET @iCategoryId = LAST_INSERT_ID(); 32 32 -
trunk/studio/classes/BxDolStudioInstaller.php
r15656 r15664 95 95 'title' => _t('_adm_txt_modules_execute_sql'), 96 96 ), 97 'install_language' => array( 98 'title' => _t('_adm_txt_modules_install_language'), 99 ), 97 100 'update_languages' => array( 98 101 'title' => _t('_adm_txt_modules_update_languages'), … … 177 180 ); 178 181 182 //--- Check for available translations ---// 183 $oFile = $this->_getFileManager(); 184 $sModuleUri = $this->_aConfig['home_uri']; 185 186 $aLanguages = $this->oDb->getModulesBy(array('type' => 'languages')); 187 foreach($aLanguages as $aLanguage) { 188 if($aLanguage['uri'] == 'en') 189 continue; 190 191 $sLanguageConfig = BX_DIRECTORY_PATH_MODULES . $aLanguage['path'] . '/install/config.php'; 192 if(!file_exists($sLanguageConfig)) 193 continue; 194 195 include_once($sLanguageConfig); 196 $aLanguageConfig = &$aConfig; 197 198 if(!isset($aLanguageConfig['includes'][$sModuleUri]) || empty($aLanguageConfig['includes'][$sModuleUri])) 199 continue; 200 201 $sSrcPath = 'modules/' . $aLanguage['path'] . 'install/data/' . $aLanguageConfig['includes'][$sModuleUri]; 202 $sDstPath = $aLanguageConfig['includes'][$sModuleUri]; 203 $oFile->copy($sSrcPath, $sDstPath); 204 } 205 179 206 //--- Check actions ---// 180 207 $aResult = $this->_perform('install'); … … 488 515 } 489 516 function actionMoveSources($sOperation) { 490 $bUseFtp = false; //true; 491 492 if($bUseFtp) { 493 bx_import('BxDolFtp'); 494 $oFile = new BxDolFtp(BX_DOL_URL_ROOT, $this->oDb->getParam('sys_ftp_login'), $this->oDb->getParam('sys_ftp_password'), $this->oDb->getParam('sys_ftp_dir')); 495 } 496 else { 497 bx_import('BxDolFile'); 498 $oFile = BxDolFile::getInstance(); 499 } 500 501 $bResult = false; 502 $sFolder = 'tmpl_' . $this->_aConfig['home_uri'] . '/'; 503 if($sOperation == 'install') { 504 $sSrcPath = 'modules/' . $this->_aConfig['home_dir'] . 'install/data/' . $sFolder; 505 $sDstPath = 'templates/' . $sFolder; 506 $bResult = $oFile->copy($sSrcPath, $sDstPath); 507 } 508 else if($sOperation == 'uninstall') { 509 $sPath = 'templates/' . $sFolder; 510 $bResult = $oFile->delete($sPath); 517 $oFile = $this->_getFileManager(); 518 $aInstalled = array_merge(array('system'), $this->oDb->getModulesUri()); 519 520 $bResult = true; 521 foreach($this->_aConfig['includes'] as $sUri => $sPath) { 522 if(!in_array($sUri, $aInstalled) || empty($sPath)) 523 continue; 524 525 if($sOperation == 'install') { 526 $sSrcPath = 'modules/' . $this->_aConfig['home_dir'] . 'install/data/' . $sPath; 527 $sDstPath = $sPath; 528 $bResult &= $oFile->copy($sSrcPath, $sDstPath); 529 } 530 else if($sOperation == 'uninstall') 531 $bResult &= $oFile->delete($sPath); 511 532 } 512 533 … … 571 592 return $sResult; 572 593 } 594 function actionInstallLanguage($sOperation) { 595 $sLanguage = isset($this->_aConfig['name']) ? $this->_aConfig['name'] : ''; 596 597 $bResult = true; 598 if($sOperation == 'install') { 599 $bResult = restoreLanguage($sLanguage, 0, false); 600 601 bx_import('BxDolModuleQuery'); 602 $aModules = BxDolModuleQuery::getInstance()->getModulesUri(); 603 foreach($aModules as $sUri) 604 $bResult &= restoreLanguage($sLanguage, $sUri, 0, false); 605 } 606 607 return $bResult && compileLanguage(0, true) ? BX_DOL_STUDIO_INSTALLER_SUCCESS : BX_DOL_STUDIO_INSTALLER_FAILED; 608 } 573 609 function actionUpdateLanguages($sOperation) { 574 $aLanguages = $this->oDb->getLanguages(); 610 $bResult = true; 611 $aResult = array(); 575 612 576 613 //--- Process Language Category ---// 577 $iCategoryId = 100;614 $iCategoryId = BX_DOL_LANGUAGE_CATEGORY_SYSTEM; 578 615 $sCategoryName = isset($this->_aConfig['language_category']) ? $this->_aConfig['language_category'] : ''; 579 616 if($sOperation == 'install' && !empty($sCategoryName)) 580 $iCategoryId = $this->oDb->insertLanguageCategory($sCategoryName);581 else if ($sOperation == 'uninstall' && !empty($sCategoryName))582 $ this->oDb->deleteLanguageCategory($sCategoryName);617 $iCategoryId = addLanguageCategory($sCategoryName); 618 else if($sOperation == 'uninstall' && !empty($sCategoryName)) 619 $iCategoryId = getLanguageCategory($sCategoryName); 583 620 584 621 //--- Process languages' key=>value pears ---// 585 foreach($aLanguages as $aLanguage) 586 $this->_updateLanguage($sOperation, $aLanguage, $iCategoryId); 587 588 //--- Recompile all language files ---// 589 $aResult = array(); 590 foreach($aLanguages as $aLanguage) { 591 $bResult = compileLanguage($aLanguage['id']); 592 593 if(!$bResult) 594 $aResult[] = $aLanguage['title']; 595 } 596 return empty($aResult) ? BX_DOL_STUDIO_INSTALLER_SUCCESS : array('code' => BX_DOL_STUDIO_INSTALLER_FAILED, 'content' => $aResult); 622 if($sOperation == 'install') 623 $bResult = restoreLanguage(0, array('path' => $this->_aConfig['home_dir'], 'category_id' => $iCategoryId), false); 624 else if($sOperation == 'uninstall') 625 $bResult = removeLanguage(0, array('category_id' => $iCategoryId), false); 626 627 if($sOperation == 'uninstall' && !empty($sCategoryName) && $bResult) 628 deleteLanguageCategory($sCategoryName); 629 630 return $bResult && compileLanguage(0, true) ? BX_DOL_STUDIO_INSTALLER_SUCCESS : BX_DOL_STUDIO_INSTALLER_FAILED; 597 631 } 598 632 function actionUpdateLanguagesFailed($mixedResult) { … … 711 745 712 746 //--- Protected methods ---// 713 protected function _updateLanguage($sOperation, $aLanguage, $iCategoryId = 0) {714 $oDb = BxDolDb::getInstance();715 716 $sPath = $this->_sHomePath . 'install/langs/' . $aLanguage['name'] . '.php';717 if(!file_exists($sPath))718 return false;719 720 include($sPath);721 if(!(isset($aLangContent) && is_array($aLangContent)))722 return false;723 724 if((int)$iCategoryId <= 0)725 $iCategoryId = $this->oDb->getLanguageCategoryId($this->_aConfig['language_category']);726 727 if($sOperation == 'install')728 $this->oDb->insertLanguageKeys($aLanguage['id'], $iCategoryId, $aLangContent);729 else if($sOperation == 'uninstall')730 $this->oDb->deleteLanguageKeys($aLangContent);731 732 return true;733 }734 747 protected function _getPermissions($sFilePath) { 735 748 clearstatcache(); … … 739 752 return substr( decoct( $hPerms ), -3 ); 740 753 } 754 protected function _getFileManager($bUseFtp = false) { 755 $oFile = null; 756 757 if($bUseFtp) { 758 bx_import('BxDolFtp'); 759 $oFile = new BxDolFtp(BX_DOL_URL_ROOT, $this->oDb->getParam('sys_ftp_login'), $this->oDb->getParam('sys_ftp_password'), $this->oDb->getParam('sys_ftp_dir')); 760 } 761 else { 762 bx_import('BxDolFile'); 763 $oFile = BxDolFile::getInstance(); 764 } 765 766 return $oFile; 767 } 741 768 } 742 769 /** @} */ -
trunk/studio/classes/BxDolStudioInstallerQuery.php
r15656 r15664 15 15 parent::BxDolModuleQuery(); 16 16 } 17 17 18 function insertModule(&$aConfig) { 18 19 $sProductUrl = isset($aConfig['product_url']) ? $aConfig['product_url'] : ''; … … 28 29 return $iResult > 0 ? (int)$this->lastId() : 0; 29 30 } 31 30 32 function insertModuleTrack($iModuleId, &$aFile) { 31 33 $sQuery = $this->prepare("INSERT IGNORE INTO `sys_modules_file_tracks`(`module_id`, `file`, `hash`) VALUES(?, ?, ?)", $iModuleId, $aFile['file'], $aFile['hash']); 32 34 $this->query($sQuery); 33 35 } 36 34 37 function deleteModule($aConfig) { 35 38 $sQuery = $this->prepare("SELECT `id` FROM `sys_modules` WHERE `vendor`=? AND `path`=? LIMIT 1", $aConfig['vendor'], $aConfig['home_dir']); … … 39 42 $this->query($sQuery); 40 43 41 42 43 44 $sQuery = $this->prepare("DELETE FROM `sys_modules_file_tracks` WHERE `module_id`=?", $iId); 44 45 $this->query($sQuery); … … 46 47 return $iId; 47 48 } 48 function getLanguages() {49 return $this->getAll("SELECT `ID` AS `id`, `Name` AS `name`, `Title` AS `title` FROM `sys_localization_languages` WHERE 1");50 }51 function getLanguageCategoryId($sName) {52 $sQuery = $this->prepare("SELECT `ID` FROM `sys_localization_categories` WHERE `Name`=? LIMIT 1", $sName);53 return (int)$this->getOne($sQuery);54 }55 function insertLanguageCategory($sName) {56 $sQuery = $this->prepare("INSERT IGNORE INTO `sys_localization_categories` SET `Name`=?", $sName);57 $iResult = (int)$this->query($sQuery);58 59 if($iResult > 0)60 return (int)$this->lastId();61 62 return $this->getLanguageCategoryId($sName);63 }64 function deleteLanguageCategory($sName) {65 $sQuery = $this->prepare("DELETE FROM `sys_localization_categories` WHERE `Name`=?", $sName);66 $this->query($sQuery);67 }68 function insertLanguageKeys($iLanguageId, $iCategoryId, &$aKeys) {69 foreach($aKeys as $sKey => $sValue) {70 $sQuery = $this->prepare("SELECT `ID` FROM `sys_localization_keys` WHERE `IDCategory`=? AND `Key`=? LIMIT 1", $iCategoryId, $sKey);71 $iKeyId = (int)$this->getOne($sQuery);72 73 if($iKeyId == 0) {74 $sQuery = $this->prepare("INSERT INTO `sys_localization_keys`(`IDCategory`, `Key`) VALUES(?, ?)", $iCategoryId, $sKey);75 if((int)$this->query($sQuery) <= 0)76 continue;77 78 $iKeyId = (int)$this->lastId();79 }80 81 $sQuery = $this->prepare("INSERT IGNORE INTO `sys_localization_strings`(`IDKey`, `IDLanguage`, `String`) VALUES(?, ?, ?)", $iKeyId, $iLanguageId, $sValue);82 $this->query($sQuery);83 }84 }85 function deleteLanguageKeys($aKeys) {86 foreach($aKeys as $sKey => $sValue) {87 $sQuery = $this->prepare("DELETE FROM `sys_localization_keys`, `sys_localization_strings` USING `sys_localization_keys`, `sys_localization_strings` WHERE `sys_localization_keys`.`ID`=`sys_localization_strings`.`IDKey` AND `sys_localization_keys`.`Key`=?", $sKey);88 $this->query($sQuery);89 }90 }91 49 } 92 50 /** @} */ -
trunk/studio/classes/BxDolStudioLanguage.php
r15639 r15664 12 12 bx_import('BxDolStudioLanguageQuery'); 13 13 14 define('BX_DOL_STUDIO_LNG_TYPE_DEFAULT', 'en'); 14 define('BX_DOL_STUDIO_LANG_DEFAULT', 'en'); 15 16 define('BX_DOL_STUDIO_LANG_TYPE_DEFAULT', 'general'); 15 17 16 18 class BxDolStudioLanguage extends BxTemplStudioPage { … … 19 21 protected $aLanguage; 20 22 21 function BxDolStudioLanguage($sLanguage ) {22 parent::BxTemplStudioPage(' language_' . $sLanguage);23 function BxDolStudioLanguage($sLanguage, $sPage) { 24 parent::BxTemplStudioPage('bx_lang_' . $sLanguage); 23 25 24 26 $this->oDb = new BxDolStudioLanguageQuery(); 25 27 26 $this->sLanguage = BX_DOL_STUDIO_L NG_TYPE_DEFAULT;28 $this->sLanguage = BX_DOL_STUDIO_LANG_DEFAULT; 27 29 if(is_string($sLanguage) && !empty($sLanguage)) 28 30 $this->sLanguage = $sLanguage; 29 31 32 $this->sPage = BX_DOL_STUDIO_LANG_TYPE_DEFAULT; 33 if(is_string($sPage) && !empty($sPage)) 34 $this->sPage = $sPage; 35 36 //--- Check actions ---// 37 if(($sAction = bx_get('lang_action')) !== false) { 38 $sAction = bx_process_input($sAction); 39 40 $aResult = array('code' => 1, 'message' => _t('_adm_pgt_err_cannot_process_action')); 41 switch($sAction) { 42 case 'activate': 43 $sValue = bx_process_input(bx_get('lang_value')); 44 if(empty($sValue)) 45 break; 46 47 $aResult = $this->activate($sValue); 48 break; 49 } 50 51 $oJson = new Services_JSON(); 52 echo $oJson->encode($aResult); 53 exit; 54 } 55 30 56 $this->aLanguage = array(); 31 57 $iLanguage = $this->oDb->getLanguagesBy(array('type' => 'by_name', 'value' => $this->sLanguage), $this->aLanguage); 58 if($iLanguage != 1 || empty($this->aLanguage)) 59 return; 32 60 33 if(!empty($this->aLanguage)) { 34 $this->aPage['header'] = $this->aLanguage['title']; 35 $this->aPage['caption'] = $this->aLanguage['title']; 61 $this->aPage['header'] = $this->aLanguage['title']; 62 $this->aPage['caption'] = $this->aLanguage['title']; 63 64 $this->addAction(array( 65 'name' => 'activate', 66 'url' => 'javascript:void(0)', 67 'onclick' => "javascript:" . $this->getPageJsObject() . ".activate('" . $this->sLanguage . "', this)", 68 'icon' => (int)$this->aLanguage['enabled'] == 1 ? 'ics-switcher-act.png' : 'ics-switcher-pas.png', 69 'title' => (int)$this->aLanguage['enabled'] == 1 ? '_adm_txt_switcher_deactivate' : '_adm_txt_switcher_activate' 70 ), false); 71 } 72 73 function activate($sLanguage) { 74 $aLanguages = array(); 75 $iLanguages = $this->oDb->getLanguagesBy(array('type' => 'active'), $aLanguages); 76 if($iLanguages == 1 && $aLanguages[0]['name'] == $sLanguage) 77 return array('code' => 1, 'message' => _t('_adm_pgt_err_last_active')); 78 79 $sLanguageDefault = $this->oDb->getParam('lang_default'); 80 if($sLanguage == $sLanguageDefault) 81 return array('code' => 2, 'message' => _t('_adm_pgt_err_deactivate_default')); 82 83 $iResult = 0; 84 if(($iResult = $this->oDb->activate($this->aPage, $sLanguage)) === false) 85 return array('code' => 3, 'message' => _t('_adm_err_operation_failed')); 86 87 bx_import('BxDolStudioTemplate'); 88 $oTemplate = BxDolStudioTemplate::getInstance(); 89 90 $aResult = array('code' => 0, 'message' => _t('_adm_scs_operation_done')); 91 if($iResult == 1) { 92 $aResult['icon'] = $oTemplate->getIconUrl('ics-switcher-act.png'); 93 $aResult['title'] = bx_js_string(_t('_adm_txt_switcher_deactivate')); 36 94 } 95 else { 96 $aResult['icon'] = $oTemplate->getIconUrl('ics-switcher-pas.png'); 97 $aResult['title'] = bx_js_string(_t('_adm_txt_switcher_activate')); 98 } 99 100 return $aResult; 37 101 } 38 102 } -
trunk/studio/classes/BxDolStudioLanguageQuery.php
r15521 r15664 15 15 parent::BxDolStudioPolyglotQuery(); 16 16 } 17 18 function activate($aPage, $sLanguage) { 19 $aLanguage = array(); 20 $iLanguage = $this->getLanguagesBy(array('type' => 'by_name', 'value' => $sLanguage), $aLanguage); 21 if($iLanguage != 1) 22 return false; 23 24 $iResult = (int)$aLanguage['enabled'] == 0 ? 1 : 0; 25 $sSqlModule = $this->prepare("UPDATE `sys_modules` SET `enabled`=? WHERE `uri`=?", $iResult, $sLanguage); 26 $sSqlLanguage = $this->prepare("UPDATE `sys_localization_languages` SET `Enabled`=? WHERE `name`=?", $iResult, $sLanguage); 27 if((int)$this->query($sSqlModule) <= 0 || (int)$this->query($sSqlLanguage) <= 0) 28 return false; 29 30 bx_import('BxDolStudioWidgets'); 31 bx_import('BxDolStudioWidgetsQuery'); 32 if(!BxDolStudioWidgetsQuery::getInstance()->activate($aPage['wid_id'], $iResult)) 33 return false; 34 35 return $iResult; 36 } 17 37 } 18 38 /** @} */ -
trunk/studio/classes/BxDolStudioModulesQuery.php
r15656 r15664 45 45 `tm`.`enabled` AS `enabled`" . $sSelectClause . " 46 46 FROM `sys_modules` AS `tm` 47 WHERE 1 AND `tm`.`type`='" . BX_DOL_MODULE_TYPE_MODULE . "'" . $sWhereClause . " " . $sOrderClause . " " . $sLimitClause;47 WHERE 1 " . $sWhereClause . " " . $sOrderClause . " " . $sLimitClause; 48 48 $aItems = call_user_func_array(array($this, $aMethod['name']), $aMethod['params']); 49 49 //AND `tm`.`type`='" . BX_DOL_MODULE_TYPE_MODULE . "' 50 50 $sQuery = "SELECT 51 51 COUNT(`tm`.`id`) -
trunk/studio/design.php
r15650 r15664 23 23 if($sName === false) 24 24 $sName = bx_get('templ_value'); 25 $s Page = $sName !== false ? bx_process_input($sName) : '';25 $sName = $sName !== false ? bx_process_input($sName) : ''; 26 26 27 27 $sPage = bx_get('page'); -
trunk/studio/language.php
r15639 r15664 16 16 require_once(BX_DIRECTORY_PATH_INC . 'languages.inc.php'); 17 17 18 require_once(BX_DIRECTORY_PATH_PLUGINS . 'Services_JSON.php'); 19 18 20 $logged['admin'] = member_auth( 1, true, true ); 19 21 20 22 $sName = bx_get('name'); 21 $sName = $sName !== false ? bx_process_input($sName) : ''; 23 if($sName === false) 24 $sName = bx_get('lang_value'); 25 $sName = $sName !== false ? bx_process_input($sName) : ''; 22 26 23 if($sName != '') { 24 bx_import('BxTemplStudioLanguage'); 25 $oPage = new BxTemplStudioLanguage($sName); 26 } 27 else { 28 /** 29 * Is used if AJAX based Launcher is disabled. 30 * It displays Widget based Languages page. 31 */ 27 $sPage = bx_get('page'); 28 $sPage = $sPage !== false ? bx_process_input($sPage) : ''; 32 29 33 bx_import('BxTemplStudioMenuTop'); 34 BxTemplStudioMenuTop::getInstance()->setActive('languages'); 35 36 bx_import('BxTemplStudioWidgets'); 37 $oPage = new BxTemplStudioWidgets('languages'); 38 } 30 bx_import('BxTemplStudioLanguage'); 31 $oPage = new BxTemplStudioLanguage($sName, $sPage); 39 32 40 33 bx_import('BxDolStudioTemplate'); … … 43 36 $oTemplate->setPageHeader($oPage->getPageHeader()); 44 37 $oTemplate->setPageContent('page_caption_code', $oPage->getPageCaption()); 38 $oTemplate->setPageContent('page_attributes', $oPage->getPageAttributes()); 45 39 $oTemplate->setPageContent('page_menu_code', $oPage->getPageMenu()); 46 40 $oTemplate->setPageContent('page_main_code', $oPage->getPageCode()); -
trunk/studio/templates/base/scripts/BxBaseStudioDesign.php
r15639 r15664 14 14 15 15 class BxBaseStudioDesign extends BxDolStudioDesign { 16 protected $aMenuItems = array('general'); 16 protected $aMenuItems = array( 17 'general' => '_adm_lmi_cpt_general' 18 ); 17 19 18 20 function BxBaseStudioDesign($sTemplate = "", $sPage = "") { … … 47 49 48 50 $aMenu = array(); 49 foreach($this->aMenuItems as $s MenuItem)51 foreach($this->aMenuItems as $sName => $sCaption) 50 52 $aMenu[] = array( 51 53 'type' => BX_DOL_STUDIO_MIT_ITEM, 52 'name' => $s MenuItem,53 'icon' => 'mi-templ-' . $s MenuItem. '.png',54 'url' => BX_DOL_URL_STUDIO . 'design.php?name=' . $this->sTemplate . '&page=' . $s MenuItem,54 'name' => $sName, 55 'icon' => 'mi-templ-' . $sName . '.png', 56 'url' => BX_DOL_URL_STUDIO . 'design.php?name=' . $this->sTemplate . '&page=' . $sName, 55 57 'onclick' => '', 56 'caption' => _t( '_adm_lmi_cpt_' . $sMenuItem),57 'active' => $s MenuItem== $this->sPage58 'caption' => _t($sCaption), 59 'active' => $sName == $this->sPage 58 60 ); 59 61 -
trunk/studio/templates/base/scripts/BxBaseStudioLanguage.php
r15639 r15664 14 14 15 15 class BxBaseStudioLanguage extends BxDolStudioLanguage { 16 function BxBaseStudioLanguage($sLanguage) { 17 parent::BxDolStudioLanguage($sLanguage); 16 protected $aMenuItems = array( 17 'general' => '_adm_lmi_cpt_general' 18 ); 19 20 function BxBaseStudioLanguage($sLanguage = "", $sPage = "") { 21 parent::BxDolStudioLanguage($sLanguage, $sPage); 18 22 } 19 23 function getPageCss() { … … 21 25 } 22 26 function getPageJs() { 23 return array('common_anim.js', 'page.js', ' language.js');27 return array('common_anim.js', 'page.js', 'settings.js', 'language.js'); 24 28 } 25 29 function getPageJsObject() { 26 30 return 'oBxDolStudioLanguage'; 27 31 } 32 function getPageCaption() { 33 $oTemplate = BxDolStudioTemplate::getInstance(); 34 35 $aTmplVars = array( 36 'js_object' => $this->getPageJsObject(), 37 'content' => parent::getPageCaption(), 38 ); 39 return $oTemplate->parseHtmlByName('lng_page_caption.html', $aTmplVars); 40 } 41 function getPageAttributes() { 42 if((int)$this->aLanguage['enabled'] == 0) 43 return 'style="display:none"'; 44 45 return parent::getPageAttributes(); 46 } 47 48 function getPageMenu() { 49 $sJsObject = $this->getPageJsObject(); 50 51 $aMenu = array(); 52 foreach($this->aMenuItems as $sName => $sCaption) 53 $aMenu[] = array( 54 'type' => BX_DOL_STUDIO_MIT_ITEM, 55 'name' => $sName, 56 'icon' => 'mi-lang-' . $sName . '.png', 57 'url' => BX_DOL_URL_STUDIO . 'languages.php?name=' . $this->sLanguage . '&page=' . $sName, 58 'onclick' => '', 59 'caption' => _t($sCaption), 60 'active' => $sName == $this->sPage 61 ); 62 63 bx_import('BxTemplStudioMenuSide'); 64 BxTemplStudioMenuSide::getInstance()->load($aMenu); 65 66 return parent::getPageMenu(); 67 } 68 28 69 function getPageCode() { 70 $sMethod = 'get' . ucfirst($this->sPage); 71 if(!method_exists($this, $sMethod)) 72 return ''; 73 74 return $this->$sMethod(); 75 } 76 77 protected function getGeneral() { 29 78 $oTemplate = BxDolStudioTemplate::getInstance(); 30 return "You'll see '" . $this->aLanguage['title'] . "' language here."; 79 80 bx_import('BxTemplStudioSettings'); 81 $oPage = new BxTemplStudioSettings('bx_lang_' . $this->sLanguage, 'bx_lang_' . $this->sLanguage . '_' . BX_DOL_STUDIO_STG_CATEGORY_SYSTEM); 82 83 $aTmplVars = array( 84 'bx_repeat:blocks' => $oPage->getPageCode(), 85 ); 86 return $oTemplate->parseHtmlByName('language.html', $aTmplVars); 31 87 } 32 88 } -
trunk/studio/templates/tmpl_uni/scripts/BxTemplStudioLanguage.php
r15639 r15664 13 13 14 14 class BxTemplStudioLanguage extends BxBaseStudioLanguage { 15 function BxTemplStudioLanguage($sLanguage ) {16 parent::BxBaseStudioLanguage($sLanguage );15 function BxTemplStudioLanguage($sLanguage="", $sPage = "") { 16 parent::BxBaseStudioLanguage($sLanguage, $sPage); 17 17 } 18 18 } -
trunk/templates/base/scripts/BxBaseCmtsView.php
r15590 r15664 318 318 319 319 if ($isJustPosted && $n && !$isEditAllowedPermanently) 320 $sRet .= _t('_ (available for <span>N</span> seconds)', $n);320 $sRet .= _t('_available_for_n_seconds', $n); 321 321 322 322 $sRet .= '</td><td class="' . $this->_sStylePrefix . '-cont-r"> </td></tr>';
Note: See TracChangeset
for help on using the changeset viewer.