Project

General

Profile

« Previous | Next » 

Revision 1983

Added by Dietmar about 11 years ago

! /framework/class.wb.php::getLanguagesDetailsInUsed() optimized
+ /framework/class.wb.php::getAvailableLanguagesObjectInstance()
! /framework/class.wb.php::getLanguagesInUsed() method optimized
! /framework/class.frontend.php update changes made in class.wb.php
! /framework/functions.php::rebuild_all_accessfiles() is no longer creating FolderProtectFiles

View differences:

branches/2.8.x/CHANGELOG
11 11
! = Update/Change
12 12
===============================================================================
13 13

  
14
19 Oct-2013 Build 1983 Dietmar Woellbrink (Luisehahne)
15
! /framework/class.wb.php::getLanguagesDetailsInUsed() optimized
16
+ /framework/class.wb.php::getAvailableLanguagesObjectInstance()
17
! /framework/class.wb.php::getLanguagesInUsed() method optimized
18
! /framework/class.frontend.php update changes made in class.wb.php
19
! /framework/functions.php::rebuild_all_accessfiles() is no longer creating FolderProtectFiles
14 20
17 Oct-2013 Build 1982 Manuela v.d.Decken(DarkViper)
15 21
# /framework/AccessFile  little Typofixes
16 22
+ /framework/AccessFileHelper added new method getDelTreeLog() and add const LOG_PRESERVE and LOG_CLEAR
branches/2.8.x/wb/admin/interface/version.php
51 51

  
52 52
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
53 53
if(!defined('VERSION')) define('VERSION', '2.8.3');
54
if(!defined('REVISION')) define('REVISION', '1982');
54
if(!defined('REVISION')) define('REVISION', '1983');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/framework/class.wb.php
30 30

  
31 31
class wb extends SecureForm
32 32
{
33
/** @var object instance of the database object */
34
	protected $_oDb      = null;
35
/** @var object instance holds several values from the application global scope */
36
	protected $_oReg     = null;
37
/** @var object instance holds all of the translations */
38
	protected $_oTrans   = null;
33 39

  
34 40
 	public $password_chars = 'a-zA-Z0-9\_\-\!\#\*\+\@\$\&\:';	// General initialization function
35 41

  
36 42
	// performed when frontend or backend is loaded.
37 43
	public function  __construct($mode = SecureForm::FRONTEND) {
38 44
		parent::__construct($mode);
45

  
46
		$this->_oDb    = WbDatabase::getInstance();
47
		$this->_oReg   = WbAdaptor::getInstance();
48
		$this->_oTrans = Translate::getInstance();
39 49
	}
40 50

  
41 51
/**
42 52
 *
43 53
 *
54
 * @return object instance of the database object of all visible languages with defined fields
55
 *
56
 */
57
	public function getAvailableLanguagesObjectInstance( ) {
58

  
59
			$sql = 'SELECT `directory`,`name` '
60
			     . 'FROM `'.$this->_oDb->TablePrefix.'addons` '
61
		         . 'WHERE `type` = \'language\' '
62
		         . 'ORDER BY `directory`';
63
        return ($this->_oDb->query($sql));
64
	}
65

  
66

  
67
/**
68
 *
69
 *
70
 * @return array of all visible languages with defined fields
71
 *
72
 */
73
	public function getAvailableLanguages( ) {
74
        $aRetval = array();
75
        if($oRes = $this->getAvailableLanguagesObjectInstance())
76
        {
77
            while($aRow = $oRes->fetchRow(MYSQL_ASSOC))
78
            {
79
                $aRetval[$aRow['directory']] = $aRow['name'];
80
            }
81
        }
82
        
83
        return ( $aRetval);
84
	}
85

  
86
/**
87
 *
88
 *
44 89
 * @return array of first visible language pages with defined fields
45 90
 *
46 91
 */
47
	public function GetLanguagesDetailsInUsed ( ) {
48
        global $database;
92
	public function getLanguagesDetailsInUsed ( ) {
93
//        global $database;
49 94
        $aRetval = array();
50
        $sql =
51
            'SELECT DISTINCT `language`'.
52
            ', `page_id`,`level`,`parent`,`root_parent`,`page_code`,`link`,`language`'.
53
            ', `visibility`,`viewing_groups`,`viewing_users`,`position` '.
54
            'FROM `'.TABLE_PREFIX.'pages` '.
55
            'WHERE `level`= \'0\' '.
56
              'AND `root_parent`=`page_id` '.
57
              'AND `visibility`!=\'none\' '.
58
              'AND `visibility`!=\'hidden\' '.
59
            'GROUP BY `language` '.
60
            'ORDER BY `position`';
61

  
62
            if($oRes = $database->query($sql))
95
		$sql = 'SELECT DISTINCT `language`, `page_id`, `level`, `parent`, `root_parent`, '
96
			 .                 '`page_code`, `link`, `language`, `visibility`, '
97
			 .                 '`viewing_groups`,`viewing_users`,`position` '
98
			 . 'FROM `'.$this->_oDb->TablePrefix.'pages` '
99
			 . 'WHERE `level`= \'0\' '
100
			 .       'AND `root_parent`=`page_id` '
101
			 .       'AND `visibility`!=\'none\' '
102
			 .       'AND `visibility`!=\'hidden\' '
103
			 . 'GROUP BY `language` '
104
			 . 'ORDER BY `position`';
105
        if($oRes = $this->_oDb->query($sql))
106
        {
107
            while($aRow = $oRes->fetchRow(MYSQL_ASSOC))
63 108
            {
64
                while($page = $oRes->fetchRow(MYSQL_ASSOC))
65
                {
66
                    if(!$this->page_is_visible($page)) {continue;}
67
                    $aRetval[$page['language']] = $page;
68
                }
109
                if(!$this->page_is_visible($aRow)) {continue;}
110
                $aRetval[$aRow['language']] = $aRow;
69 111
            }
112
        }
70 113
        return $aRetval;
71 114
	}
72 115

  
116

  
117

  
118

  
73 119
/**
74 120
 *
75 121
 *
76 122
 * @return comma separate list of first visible languages
77 123
 *
78 124
 */
79
	public function GetLanguagesInUsed ( ) {
80
        return implode(',', array_keys($this->GetLanguagesDetailsInUsed()));
125
	public function getLanguagesInUsed ( ) {
126
        $aRetval = array_keys($this->getLanguagesDetailsInUsed()) ;
127
        if(sizeof($aRetval)==0) { return null; }
128
        return implode(',', $aRetval);
81 129
  	}
82 130

  
83 131

  
branches/2.8.x/wb/framework/class.frontend.php
80 80
 */
81 81

  
82 82
        if( $this->get_session('session_started') ) {
83
            $_SESSION['USED_LANGUAGES'] = $this->GetLanguagesInUsed();
83
            $_SESSION['USED_LANGUAGES'] = $this->getLanguagesInUsed();
84 84
        }
85 85

  
86 86
		$maintance = ( defined('SYSTEM_LOCKED') && (SYSTEM_LOCKED==true) ? true : false );
......
173 173

  
174 174
		$bCanRedirect = false;
175 175
// set defaults 
176
		$aLanguagesDetailsInUsed = $this->GetLanguagesDetailsInUsed();
176
		$aLanguagesDetailsInUsed = $this->getLanguagesDetailsInUsed();
177 177
		$_SESSION['HTTP_REFERER'] = WB_URL;
178 178
		$_SESSION['PAGE_ID'] = $this->page_id;
179 179
		if($this->page_id != 0) {
......
189 189
			$this->page = $get_page->fetchRow(MYSQL_ASSOC);
190 190

  
191 191
		//  Check if the page language is also the selected language. If not, send headers again.
192
			if (($this->page['language'] != LANGUAGE) && $this->FrontendLanguage )
192
			if (($this->page['language'] != LANGUAGE) && $this->FrontendLanguage && ($this->_oReg->PageLanguages) )
193 193
            {
194 194
            //  check if there is an query-string
195 195
				if(isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != '') {
branches/2.8.x/wb/framework/functions.php
50 50
				continue;
51 51
			}
52 52
		}
53
        clearstatcache();
53 54
		return true;
54 55
	}	
55 56
	return false;
......
1452 1453
	{
1453 1454
		$oDb = WbDatabase::getInstance();
1454 1455
		$oReg = WbAdaptor::getInstance();
1456
		$aRetval = array();
1455 1457
	// try to remove access files and build new folder protect files
1456 1458
        $sTreeToDelete = $oReg->AppPath.$oReg->PagesDir;
1459

  
1457 1460
    	if(($sTreeToDelete!='') && is_writeable($sTreeToDelete)==true)
1458 1461
		{
1459 1462
			$aDeleteLog = array();
......
1461 1464
		// show details if debug is set
1462 1465
            if($bShowDetails) { $aRetval = $aDeleteLog; }
1463 1466
    	}
1464
	// set logging informations
1465
		$aRetval = array_merge((isset($aRetval) ? $aRetval : array()),
1466
		                       createFolderProtectFile(rtrim( $oReg->AppPath.$oReg->PagesDir, '/') ));
1467 1467
	// Reformat/rebuild all existing access files
1468 1468
		$sql  = 'SELECT `page_id`,`root_parent`,`parent`,`link`,`level`,`page_trail` '
1469 1469
		      . 'FROM `'.$oDb->TablePrefix.'pages` '

Also available in: Unified diff