erster schritt:
die änderungen in der (bezieht sich auf contenido-cvs-2005-01-18.tar)
class.navigation.php
Code: Alles auswählen
class Contenido_Navigation {
/**
* @var debug
*/
var $debug = 0;
/**
* array storing all data
* @var array
*/
var $data = array();
/**
* Constructor
*/
function Contenido_Navigation() {
global $db, $xml, $cfg, $sess, $perm, $belang, $cfgPath;
$db2 = new DB_Contenido;
$plugxml = new XML_Doc;
# Load language file
if ($xml->load($cfg['path']['xml'] . $cfg['lang'][$belang]) == false)
{
if ($xml->load($cfg['path']['xml'] . 'lang_en_US.xml') == false)
{
die("Unable to load any XML language file");
}
}
# Load main items
$sql = "SELECT idnavm, location FROM ".$cfg["tab"]["nav_main"]." ORDER BY idnavm";
$db->query($sql);
# Loop result and build array
while ( $db->next_record() ) {
# Extract caption from the xml language file
# including plugins third level
# extended multilang version
if(strstr($db->f("location"), ';')) {
$locs = explode(";", $db->f("location"));
$file = trim($locs[0]);
$xpath = trim($locs[1]);
$filepath = explode('/',$file);
$counter = count($filepath)-1;
if ($filepath[$counter] == "") {
unset($filepath[$counter]);
$counter--;
}
if(strstr($filepath[$counter], '.xml')) {
$filename = $filepath[$counter];
unset($filepath[$counter]);
$counter--;
}
$filepath[($counter+1)] = "";
$filepath = implode("/",$filepath);
if ($plugxml->load($cfg["path"]["plugins"] . $filepath . $cfg['lang'][$belang]) == false)
{
if (!isset($filename)) { $filename = 'lang_en_US.xml'; }
if ($plugxml->load($cfg["path"]["plugins"] . $filepath . $filename) == false)
{
die("Unable to load any XML language file");
}
}
$main = $plugxml->valueOf( $cfgPath['xmlroot'] . $xpath );
unset($file, $filename, $filepath);
} else {
$main = $xml->valueOf( $cfgPath['xmlroot'] . $db->f("location") );
}
# Build data array
$this->data[$db->f('idnavm')] = array($main);
$sql = "SELECT
a.location AS location,
b.name AS area,
b.relevant
FROM
".$cfg["tab"]["nav_sub"]." AS a,
".$cfg["tab"]["area"]." AS b
WHERE
a.idnavm = '".$db->f('idnavm')."' AND
a.level = '0' AND
b.idarea = a.idarea AND
a.online = '1' AND
b.online = '1'
ORDER BY
a.idnavs";
$db2->query($sql);
while ( $db2->next_record() ) {
$area = $db2->f('area');
if ($perm->have_perm_area_action($area) || $db2->f('relevant') == 0){
# Extract caption from the xml language file
# including plugins third level
# extended multilang version
if(strstr($db2->f("location"), ';')) {
$locs = explode(";", $db2->f("location"));
$file = trim($locs[0]);
$xpath = trim($locs[1]);
$filepath = explode('/',$file);
$counter = count($filepath)-1;
if ($filepath[$counter] == "") {
unset($filepath[$counter]);
$counter--;
}
if(strstr($filepath[$counter], '.xml')) {
$filename = $filepath[$counter];
unset($filepath[$counter]);
$counter--;
}
$filepath[($counter+1)] = "";
$filepath = implode("/",$filepath);
if ($plugxml->load($cfg["path"]["plugins"] . $filepath . $cfg['lang'][$belang]) == false)
{
if (!isset($filename)) { $filename = 'lang_en_US.xml'; }
if ($plugxml->load($cfg["path"]["plugins"] . $filepath . $filename) == false)
{
die("Unable to load any XML language file");
}
}
$name = $plugxml->valueOf( $cfgPath['xmlroot'] . $xpath );
unset($file, $filename, $filepath);
} else {
$name = $xml->valueOf( $cfgPath['xmlroot'] . $db2->f("location") );
}
$this->data[$db->f('idnavm')][] = array($name, $area);
}
} // end while
} // end while
# debugging information
if ($this->debug) {
echo '<pre>';
print_r($this->data);
echo '</pre>';
}
} # end function
#
# Method thats builds the
# Contenido header document
#
function buildHeader($lang) {
global $cfg, $sess, $client, $changelang, $auth, $cfgClient;
wird ersetzt durch
Code: Alles auswählen
class Contenido_Navigation {
/**
* @var debug
*/
var $debug = 0;
/**
* array storing all data
* @var array
*/
var $data = array();
/**
* Constructor
*/
function Contenido_Navigation() {
global $cfg, $belang;
if (!class_exists('XML_doc')) {
cInclude ("classes", 'class.xml.php');
}
$this->xml = new XML_Doc;
$this->plugxml = new XML_Doc;
# Load language file
if ($this->xml->load($cfg['path']['xml'] . $cfg['lang'][$belang]) == false)
{
if ($this->xml->load($cfg['path']['xml'] . 'lang_en_US.xml') == false)
{
die("Unable to load any XML language file");
}
}
}
function getName($location) {
global $cfg, $belang;
# Extract caption from the xml language file
# including plugins extended multilang version
# If a ";" is found entry is from a plugin ->
# explode location, first is xml file path,
# second is xpath location in xml file
if(strstr($location, ';')) {
$locs = explode(";", $location);
$file = trim($locs[0]);
$xpath = trim($locs[1]);
$filepath = explode('/',$file);
$counter = count($filepath)-1;
if ($filepath[$counter] == "") {
unset($filepath[$counter]);
$counter--;
}
if(strstr($filepath[$counter], '.xml')) {
$filename = $filepath[$counter];
unset($filepath[$counter]);
$counter--;
}
$filepath[($counter+1)] = "";
$filepath = implode("/",$filepath);
if ($this->plugxml->load($cfg["path"]["plugins"] . $filepath . $cfg['lang'][$belang]) == false)
{
if (!isset($filename)) { $filename = 'lang_en_US.xml'; }
if ($this->plugxml->load($cfg["path"]["plugins"] . $filepath . $filename) == false)
{
die("Unable to load $filepath XML language file");
}
}
$caption = $this->plugxml->valueOf( $xpath );
} else {
$caption = $this->xml->valueOf( $location );
}
return $caption;
}
function _buildHeaderData() {
global $cfg, $perm, $belang;
$db = new DB_Contenido;
$db2 = new DB_Contenido;
# Load main items
$sql = "SELECT idnavm, location FROM ".$cfg["tab"]["nav_main"]." ORDER BY idnavm";
$db->query($sql);
# Loop result and build array
while ( $db->next_record() ) {
/* Extract names from the XML document. */
$main = $this->getName($db->f("location"));
# Build data array
$this->data[$db->f('idnavm')] = array($main);
$sql = "SELECT
a.location AS location,
b.name AS area,
b.relevant
FROM
".$cfg["tab"]["nav_sub"]." AS a,
".$cfg["tab"]["area"]." AS b
WHERE
a.idnavm = '".$db->f('idnavm')."' AND
a.level = '0' AND
b.idarea = a.idarea AND
a.online = '1' AND
b.online = '1'
ORDER BY
a.idnavs";
$db2->query($sql);
while ( $db2->next_record() ) {
$area = $db2->f('area');
if ($perm->have_perm_area_action($area) || $db2->f('relevant') == 0){
/* Extract names from the XML document. */
$name = $this->getName($db2->f("location"));
$this->data[$db->f('idnavm')][] = array($name, $area);
}
} // end while
} // end while
# debugging information
if ($this->debug) {
echo '<pre>';
print_r($this->data);
echo '</pre>';
}
} # end function
#
# Method thats builds the
# Contenido header document
#
function buildHeader($lang) {
global $cfg, $sess, $client, $changelang, $auth, $cfgClient;
$this->_buildHeaderData();