125 |
125 |
$admin->print_header();
|
126 |
126 |
$admin->print_error($MESSAGE['PAGES_NOT_FOUND']);
|
127 |
127 |
}
|
|
128 |
/* -------------------------------------------------------------------------------------*/
|
|
129 |
|
|
130 |
/*-- test if multilanguage page_code -----------------------------------------------------*/
|
|
131 |
function getLangInUsedDbResult ( $sLangKey='' ) {
|
|
132 |
global $admin,$aCurrentPage;
|
|
133 |
$aPage = array();
|
|
134 |
$aRetval = array();
|
|
135 |
$oDb = WbDatabase::getInstance();
|
|
136 |
if( (defined('PAGE_LANGUAGES') && PAGE_LANGUAGES) && class_exists('m_MultiLingual_Lib'))
|
|
137 |
{
|
|
138 |
$sql = 'SELECT DISTINCT `language`,'
|
|
139 |
. '`page_id`,`level`,`parent`,`root_parent`,`page_code`,`link`,'
|
|
140 |
. '`visibility`,`viewing_groups`,`viewing_users`,`position`,`page_title` '
|
|
141 |
. 'FROM `'.$oDb->TablePrefix.'pages` '
|
|
142 |
. 'WHERE `level`= 0 '
|
|
143 |
. 'AND `root_parent`=`page_id` '
|
|
144 |
. 'AND (`visibility`!=\'none\' '
|
|
145 |
. 'AND `visibility`!=\'hidden\') '
|
|
146 |
. ( ($sLangKey!='') ? ' AND `language` = \''.$sLangKey.'\' ' : '')
|
|
147 |
// . ( (defined('MULTIPLE_MENUS') && MULTIPLE_MENUS == 'true') ? ' AND `menu` = \''.$aCurrentPage['menu'].'\' ' : '')
|
|
148 |
. 'GROUP BY `language` '
|
|
149 |
. 'ORDER BY `position`';
|
|
150 |
if($oRes = $oDb->query($sql)){
|
|
151 |
while($aPage = $oRes->fetchRow(MYSQL_ASSOC))
|
|
152 |
{
|
|
153 |
if(!$admin->page_is_visible($aPage)) {continue;}
|
|
154 |
$aRetval[$aPage['language']] = $aPage;
|
|
155 |
}
|
|
156 |
}
|
|
157 |
}
|
|
158 |
return ( sizeof($aRetval) ? $aRetval : false);
|
|
159 |
}
|
|
160 |
/* -------------------------------------------------------------------------------------*/
|
128 |
161 |
// Get display name of person who last modified the page
|
129 |
162 |
$user=$admin->get_user_details($aCurrentPage['modified_by']);
|
130 |
163 |
// Convert the unix ts for modified_when to human a readable form
|
... | ... | |
277 |
310 |
}
|
278 |
311 |
/*-- show visibility select box --------------------------------------------------------*/
|
279 |
312 |
$aVisibility = array();
|
|
313 |
$sLangKey = '';
|
|
314 |
if( sizeof(getLangInUsedDbResult())>1 ) {
|
|
315 |
$sLangKey = DEFAULT_LANGUAGE;
|
|
316 |
$aLangStartPageId = array();
|
|
317 |
$aLangStartPageId = getLangInUsedDbResult($sLangKey);
|
|
318 |
$iLangStartPageId = $aLangStartPageId[$sLangKey]['page_id'];
|
|
319 |
}
|
|
320 |
|
280 |
321 |
$aVisibility['PUBLIC_SELECTED'] = ($aCurrentPage['visibility'] == 'public' ? $sSelected : '');
|
281 |
322 |
$aVisibility['PRIVATE_SELECTED'] = ($aCurrentPage['visibility'] == 'private' ? $sSelected : '');
|
282 |
323 |
$aVisibility['REGISTERED_SELECTED'] = ($aCurrentPage['visibility'] == 'registered' ? $sSelected : '');
|
283 |
324 |
$aVisibility['HIDDEN_SELECTED'] = ($aCurrentPage['visibility'] == 'hidden' ? $sSelected : '');
|
284 |
325 |
$aVisibility['NO_VIS_SELECTED'] = ($aCurrentPage['visibility'] == 'none' ? $sSelected : '');
|
|
326 |
if( ($aCurrentPage['language'] == $sLangKey) && ($aCurrentPage['page_id']==$iLangStartPageId) ) {
|
|
327 |
$aVisibility['HIDDEN_SELECTED'] = ($aCurrentPage['visibility'] == 'hidden' ? $sDisabled : $sDisabled);
|
|
328 |
$aVisibility['NO_VIS_SELECTED'] = ($aCurrentPage['visibility'] == 'none' ? $sDisabled : $sDisabled);
|
|
329 |
}
|
285 |
330 |
$oTpl->set_var($aVisibility);
|
286 |
|
|
287 |
331 |
/*-- admin group list block ------------------------------------------------------------*/
|
288 |
332 |
$aAdminGroups = explode(',', '1,'.$aCurrentPage['admin_groups']);
|
289 |
333 |
$sAdminGroups = implode(',', array_unique($aAdminGroups));
|
... | ... | |
419 |
463 |
$oTpl->set_var('DISPLAY_VIEWERS', 'display:none;');
|
420 |
464 |
}
|
421 |
465 |
/*-- start multilanguage page_code -----------------------------------------------------*/
|
|
466 |
// $sLangKey='';
|
422 |
467 |
$oTpl->set_block('main_block', 'show_page_code_block', 'show_page_code');
|
423 |
468 |
if( (defined('PAGE_LANGUAGES') && PAGE_LANGUAGES) &&
|
424 |
|
isset($aCurrentPage['page_code']) && class_exists('m_MultiLingual_Lib'))
|
|
469 |
isset($aCurrentPage['page_code']) && sizeof(getLangInUsedDbResult())>1 )
|
425 |
470 |
{
|
426 |
471 |
$aTplBlockData = array();
|
427 |
472 |
// workout field is set but module missing
|
428 |
473 |
$aTplBlockData['PAGE_CODE_LABEL_TEXT'] = $mLang->TEXT_PAGE_CODE;
|
429 |
474 |
$aTplBlockData['PAGE_CODE_UPDATE_URL'] = WB_REL.'/modules/MultiLingual/update_keys.php?page_id='.$page_id;
|
430 |
|
// get the root element(level 0) of current page with same language in same menu
|
431 |
|
// $sql = 'SELECT `page_id` FROM `'.$oDb->TablePrefix.'pages` '
|
432 |
|
// . 'WHERE `language`=\''.DEFAULT_LANGUAGE.'\' '
|
433 |
|
// . 'AND `level`=0 ';
|
434 |
|
// if(defined('MULTIPLE_MENUS') && MULTIPLE_MENUS == 'true') {
|
435 |
|
//// $sql .= 'AND `menu`='.$aCurrentPage['menu'].' ';
|
436 |
|
// }
|
437 |
|
// $sql .= 'ORDER BY `position` ASC';
|
438 |
|
$sLangKey = DEFAULT_LANGUAGE;
|
439 |
|
$sql = 'SELECT DISTINCT `page_id` '
|
440 |
|
. 'FROM `'.$oDb->TablePrefix.'pages` '
|
441 |
|
. 'WHERE `level`= \'0\' '
|
442 |
|
. 'AND `root_parent`=`page_id` '
|
443 |
|
. 'AND `visibility`!=\'none\' '
|
444 |
|
. 'AND `visibility`!=\'hidden\' '
|
445 |
|
. ( ($sLangKey!='') ? ' AND `language` = \''.$sLangKey.'\'' : '')
|
446 |
|
. 'GROUP BY `language` '
|
447 |
|
. 'ORDER BY `position`';
|
448 |
|
$iLangStartPageId = $oDb->get_one($sql);
|
449 |
475 |
// read the tree of the found root element
|
450 |
476 |
$oPageList = new a_pages_SmallRawPageTree();
|
451 |
477 |
$aLangCodePagesList = $oPageList->getParentList($iLangStartPageId);
|
! update fix pages/settings.php page code list
deactivate hidden and none visibility for first default_language sub