Project

General

Profile

« Previous | Next » 

Revision 2000

Added by darkviper about 11 years ago

! WbAdaptor::getWbConstants() now on import skip constants holding database settings

View differences:

Lib.php
78 78
	{
79 79
		// if new Pagecode is missing then set the own page ID
80 80
		$entry = ( !isset($iNewPageCode) ? $iPageId : $iNewPageCode);
81
		$sql = 'UPDATE `'.$this->_oReg->TablePrefix.$sTable.'` '
81
		$sql = 'UPDATE `'.$this->_oDb->TablePrefix.$sTable.'` '
82 82
		     . 'SET `page_code`='.$entry.', '
83 83
		     .     '`modified_when` = '.time().' '
84 84
		     . 'WHERE `page_id` = '.$iPageId;
......
94 94
	{
95 95
		$sql = 'SELECT DISTINCT `language`,'
96 96
		     .                 '`page_id`,`level`,`parent`,`root_parent`,`page_code`,`link`,'
97
		     .                 '`visibility`,`viewing_groups`,`viewing_users`,`position`,`page_title` '
98
		     . 'FROM `'.$this->_oReg->TablePrefix.'pages` '
97
		     .                 '`visibility`,`viewing_groups`,`viewing_users`,`position`,'
98
		     .                 '`page_title`,`tooltip` '
99
		     . 'FROM `'.$this->_oDb->TablePrefix.'pages` '
99 100
		     . 'WHERE `level`= \'0\' '
100 101
		     .   'AND `root_parent`=`page_id` '
101 102
		     .   'AND (`visibility`!=\'none\' '
......
116 117
	{
117 118
		$sql = 'SELECT `language`,'
118 119
		     .        '`page_id`,`level`,`parent`,`root_parent`,`page_code`,`link`,'
119
		     .        '`visibility`,`viewing_groups`,`viewing_users`,`position`,`page_title` '
120
		     .  'FROM `'.$this->_oReg->TablePrefix.'pages`'
120
		     .        '`visibility`,`viewing_groups`,`viewing_users`,`position`,'
121
		     .        '`page_title`,`tooltip` '
122
		     .  'FROM `'.$this->_oDb->TablePrefix.'pages`'
121 123
		     .  'WHERE `page_code` = '.$iPageCode.' '
122 124
		     .  'ORDER BY `position`';
123 125
		return $this->_oDb->query($sql);
......
130 132
	 */
131 133
	private function _getLangAddonsDbResult ( $sLangKey='' ) 
132 134
	{
133
		$sql = 'SELECT `directory`,`name`  FROM `'.$this->_oReg->TablePrefix.'addons` '
135
		$sql = 'SELECT `directory`,`name`  FROM `'.$this->_oDb->TablePrefix.'addons` '
134 136
		     . 'WHERE `type` = \'language\' '
135 137
		     . ( ($sLangKey!='') ? ' AND `directory` = \''.$langKey.'\' ' : '')
136 138
		     . 'ORDER BY `directory`';
......
144 146
	 */
145 147
	private function _getPageListDbResult ( $parent ) 
146 148
	{
147
	    $sql = 'SELECT `language`,'
149
	    $sql = 'SELECT `language`,`tooltip`,'
148 150
		     .        '`page_id`,`page_title`,`menu_title`, `page_code`, `parent` '
149
		     . 'FROM `'.$this->_oReg->TablePrefix.'pages` '
151
		     . 'FROM `'.$this->_oDb->TablePrefix.'pages` '
150 152
		     . 'WHERE `parent` = '.$parent. ' '
151 153
		     . 'ORDER BY `position`';
152 154
		return $this->_oDb->query($sql);
......
159 161
		{
160 162
			while($page = $oRes->fetchRow(MYSQL_ASSOC))
161 163
			{
162
			if(!$this->_oApp->page_is_visible($page)) {continue;}
163
			$aRetval[$page['language']] = $page;
164
				if(!$this->_oApp->page_is_visible($page)) {continue;}
165
				$aRetval[$page['language']] = $page;
164 166
			}
165 167
		}
166 168
		return $aRetval;
......
175 177
			{
176 178
				if (( $value['page_id'] != $this_page ) )
177 179
				{
178
				$entries [$value['page_id']]['language'] = $value['language'];
179
				$entries [$value['page_id']]['menu_title'] = $value['menu_title'];
180
				$this->_getPageList($value['page_id'], $this_page );
180
					$entries [$value['page_id']]['language'] = $value['language'];
181
					$entries [$value['page_id']]['menu_title'] = $value['menu_title'];
182
					$this->_getPageList($value['page_id'], $this_page );
181 183
				}
182 184
			}
183 185
		}
......
237 239
	*/
238 240
	private function _getLangMenuData ( ) 
239 241
	{
240
		$data = array();
241
		$SetLanguageUrl = array();
242
		$SetLanguageIcons = array();
243
		$SetLanguageIcons = $this->_getLanguagesDetailsInUsed( );
244
		if(sizeof($SetLanguageIcons)>1) 
242
		$aTplData = array();
243
	// get root pages for all used languages
244
		$aAllowedRootLanguages = $this->_getLanguagesDetailsInUsed( );
245
		if(sizeof($aAllowedRootLanguages)>1)
245 246
		{
246
			$pages = $this->_getPageCodeValues( $this->_oApp->page_code );
247
			$tmppage = array_intersect_key($pages,$SetLanguageIcons);
248
			$pages = array_merge($SetLanguageIcons,$tmppage);
249
			foreach ( $SetLanguageIcons AS $value) 
247
		// get all pages witch the same page_code
248
			$aMatchingPages = $this->_getPageCodeValues( $this->_oApp->page['page_code'] );
249
		// remove all pages from list with not avaliable languages
250
			$aPossibleMatchingPages = array_intersect_key($aMatchingPages, $aAllowedRootLanguages);
251
		// add Allowed root pages to possible matches
252
			$aAvailablePages = array_merge($aPossibleMatchingPages, $aAllowedRootLanguages);
253
			foreach ( $aAvailablePages AS $aPage)
250 254
			{
251
				$data[] = array(
252
				      'sIconUrl' => $this->_oReg->AppRel . 'modules/' . basename(dirname(__FILE__)) . '/',
253
				      'bCurrent' => ( ($value['language'] == $this->_oReg->Language ) ? true : false),
254
				      'sUrl' => $this->_oReg->AppRel.$this->_oReg->PagesDir.trim($pages[$value['language']]['link'],'/').$this->_oReg->PageExtension,
255
				      'sTitle' => $pages[$value['language']]['page_title'],
256
				      'FilePrefix' => strtolower($pages[$value['language']]['language']),
257
				      'sExtension' => $this->_sExtension,
255
				$aTplData[] = array(
256
				    'sIconUrl'         => $this->_oReg->AppRel . 'modules/'
257
					                    . basename(dirname(__FILE__)) . '/',
258
				    'bCurrentLanguage' => (($aPage['language'] == $this->_oReg->Language) ? true : false),
259
				    'sTargetPageUrl'   => $this->_oReg->AppRel . $this->_oReg->PagesDir
260
				                        . trim($aAvailablePages[$aPage['language']]['link'],'/')
261
					                    . $this->_oReg->PageExtension,
262
				    'sPageTitle'       => $aAvailablePages[$aPage['language']]['page_title'],
263
				    'sFilename'        => strtolower($aAvailablePages[$aPage['language']]['language']),
264
				    'sImageType'       => $this->_sExtension,
265
					'sToolTip'         => $aAvailablePages[$aPage['language']]['tooltip']
258 266
				);
259 267
			}
260 268
		}
261
		return $data;
269
		return $aTplData;
262 270
	}
263 271

  
264 272
	/**
......
279 287
    private function _detectIE()
280 288
    {
281 289
        preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $aMatches);
282

  
283 290
        if (count($aMatches)>1){
284 291
          return true;
285 292
        }

Also available in: Unified diff