| 4 |
* @author Mambo Foundation Inc see README.php |
* @author Mambo Foundation Inc see README.php |
| 5 |
* @copyright Mambo Foundation Inc. |
* @copyright Mambo Foundation Inc. |
| 6 |
* See COPYRIGHT.php for copyright notices and details. |
* See COPYRIGHT.php for copyright notices and details. |
| 7 |
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see |
* @license GNU/GPL Version 2, see LICENSE.php |
|
* LICENSE.php |
|
| 8 |
* Mambo is free software; you can redistribute it and/or |
* Mambo is free software; you can redistribute it and/or |
| 9 |
* modify it under the terms of the GNU General Public License |
* modify it under the terms of the GNU General Public License |
| 10 |
* as published by the Free Software Foundation; version 2 of the |
* as published by the Free Software Foundation; version 2 of the License. |
|
* License. |
|
| 11 |
*/ |
*/ |
| 12 |
|
|
| 13 |
/** |
/** |
| 229 |
//$this->rootPath = str_replace('\\', '/', realpath(str_replace('includes', '', dirname(__FILE__)))); |
//$this->rootPath = str_replace('\\', '/', realpath(str_replace('includes', '', dirname(__FILE__)))); |
| 230 |
$this->rootPath = str_replace('\\', '/',str_replace('includes', '', dirname(__FILE__))); |
$this->rootPath = str_replace('\\', '/',str_replace('includes', '', dirname(__FILE__))); |
| 231 |
$this->checkConfig(); |
$this->checkConfig(); |
| 232 |
$this->Itemid = mosGetParam($_REQUEST, 'Itemid', 0); |
$this->Itemid = (int)mosGetParam($_REQUEST, 'Itemid', 0); |
| 233 |
$this->getConfig(); |
$this->getConfig(); |
| 234 |
$this->fixLanguage(); |
$this->fixLanguage(); |
| 235 |
@set_magic_quotes_runtime( 0 ); |
@set_magic_quotes_runtime( 0 ); |
| 402 |
session_name(md5($this->mosConfig_live_site)); |
session_name(md5($this->mosConfig_live_site)); |
| 403 |
session_start(); |
session_start(); |
| 404 |
$session =& mosSession::getCurrent(); |
$session =& mosSession::getCurrent(); |
| 405 |
|
if (!isset($_SESSION['initiated'])) { |
| 406 |
|
session_regenerate_id(); |
| 407 |
|
$_SESSION['initiated'] = true; |
| 408 |
|
} |
| 409 |
$my =& new mosUser(); |
$my =& new mosUser(); |
| 410 |
$my->getSessionData(); |
$my->getSessionData(); |
| 411 |
if (mosSession::validate($my)) return; |
if (mosSession::validate($my)) return; |
| 423 |
require_once($this->mosConfig_absolute_path.'/includes/phpgettext/error.php'); |
require_once($this->mosConfig_absolute_path.'/includes/phpgettext/error.php'); |
| 424 |
require_once($this->mosConfig_absolute_path.'/includes/mambofunc.php'); |
require_once($this->mosConfig_absolute_path.'/includes/mambofunc.php'); |
| 425 |
require_once($this->mosConfig_absolute_path.'/includes/mambolanguage.class.php'); |
require_once($this->mosConfig_absolute_path.'/includes/mambolanguage.class.php'); |
| 426 |
$this->mosConfig_locale = mosGetParam($_REQUEST, 'lang', $this->mosConfig_locale); |
if (!mosGetParam($_REQUEST, 'lang')); |
| 427 |
|
else $this->mosConfig_locale = mosGetParam($_REQUEST, 'lang', $this->mosConfig_locale); |
| 428 |
$language =& new mamboLanguage($this->mosConfig_locale, $this->rootPath.'/language/'); |
$language =& new mamboLanguage($this->mosConfig_locale, $this->rootPath.'/language/'); |
| 429 |
$languages = $language->getLanguages(); |
$languages = $language->getLanguages(); |
| 430 |
$charset = $language->get('charset'); |
$charset = $language->get('charset'); |
| 484 |
* @return unknown |
* @return unknown |
| 485 |
*/ |
*/ |
| 486 |
function determineOptionAndItemid () { |
function determineOptionAndItemid () { |
| 487 |
$this->Itemid = mosGetParam($_REQUEST, 'Itemid', 0); |
$this->Itemid = (int)mosGetParam($_REQUEST, 'Itemid', 0); |
| 488 |
if ($option = strtolower(mosGetParam($_REQUEST, 'option'))); |
if ($option = strtolower(mosGetParam($_REQUEST, 'option'))); |
| 489 |
else { |
else { |
| 490 |
$menuhandler =& mosMenuHandler::getInstance(); |
$menuhandler =& mosMenuHandler::getInstance(); |
| 491 |
$menus =& $menuhandler->getByParentOrder($this->Itemid, 'mainmenu'); |
$menus =& $menuhandler->getByParentOrder($this->Itemid, 'mainmenu'); |
| 492 |
|
if (count($menus)) { |
| 493 |
$this->Itemid = $menus[0]->id; |
$this->Itemid = $menus[0]->id; |
| 494 |
$_REQUEST['Itemid'] = $this->Itemid; |
$_REQUEST['Itemid'] = $this->Itemid; |
| 495 |
$link = $menus[0]->link; |
$link = $menus[0]->link; |
| 501 |
if (isset($temp['option'])) $option = $temp['option']; |
if (isset($temp['option'])) $option = $temp['option']; |
| 502 |
else return ''; |
else return ''; |
| 503 |
} |
} |
| 504 |
|
} |
| 505 |
/** patch to lessen the impact on templates */ |
/** patch to lessen the impact on templates */ |
| 506 |
if ($option == 'search') $option = 'com_search'; |
if ($option == 'search') $option = 'com_search'; |
| 507 |
// checking if we can find the Itemid thru the component |
// checking if we can find the Itemid thru the component |
| 509 |
if ( $option == 'com_content') { |
if ( $option == 'com_content') { |
| 510 |
require_once($this->rootPath().'/components/com_content/content.class.php'); |
require_once($this->rootPath().'/components/com_content/content.class.php'); |
| 511 |
$handler =& contentHandler::getInstance(); |
$handler =& contentHandler::getInstance(); |
| 512 |
$this->Itemid = $handler->getItemid(mosGetParam($_REQUEST, 'id', 0 )); |
$this->Itemid = (int)$handler->getItemid(mosGetParam($_REQUEST, 'id', 0 )); |
| 513 |
$_REQUEST['Itemid'] = $this->Itemid; |
$_REQUEST['Itemid'] = $this->Itemid; |
| 514 |
} |
} |
| 515 |
else { |
else { |
| 521 |
} |
} |
| 522 |
} |
} |
| 523 |
} |
} |
| 524 |
return $option; |
return trim(htmlspecialchars($option)); |
| 525 |
} |
} |
| 526 |
|
|
| 527 |
/** |
/** |
| 836 |
if (file_exists( "$rootpath/$imgPath" )) $img = "<img src='$config->mosConfig_live_site/images/M_images/arrow.png' alt='arrow' />"; |
if (file_exists( "$rootpath/$imgPath" )) $img = "<img src='$config->mosConfig_live_site/images/M_images/arrow.png' alt='arrow' />"; |
| 837 |
else $img = '>'; |
else $img = '>'; |
| 838 |
} |
} |
| 839 |
|
$uri =& mosUriHelper::getInstance(); |
| 840 |
foreach ($this->_names as $i=>$name) { |
foreach ($this->_names as $i=>$name) { |
| 841 |
|
$uri->setUri($this->_urls[$i]); |
| 842 |
if ($i === $last AND count($customs) == 0) $result .= "$name</span>"; |
if ($i === $last AND count($customs) == 0) $result .= "$name</span>"; |
| 843 |
elseif (strstr($this->_urls[$i], 'view')) $result .= ""; |
elseif (strstr($uri->get('task'), 'view')) $result .= ""; |
| 844 |
else { |
else { |
| 845 |
$sefurl = sefRelToAbs($this->_urls[$i]); |
$sefurl = sefRelToAbs($this->_urls[$i]); |
| 846 |
$result .= "<a href='$sefurl' class='pathway'>$name</a>"; |
$result .= "<a href='$sefurl' class='pathway'>$name</a>"; |
| 1217 |
} |
} |
| 1218 |
closedir($dir); |
closedir($dir); |
| 1219 |
} |
} |
| 1220 |
|
asort($results); |
| 1221 |
return $results; |
return $results; |
| 1222 |
} |
} |
| 1223 |
|
|
| 1586 |
function setPathway ($Itemid) { |
function setPathway ($Itemid) { |
| 1587 |
if ($Itemid) { |
if ($Itemid) { |
| 1588 |
$menu =& $this->getMenuByID($Itemid); |
$menu =& $this->getMenuByID($Itemid); |
| 1589 |
|
if (!$menu) return; |
| 1590 |
if ($menu->parent) $this->setPathway($menu->parent); |
if ($menu->parent) $this->setPathway($menu->parent); |
| 1591 |
$pathway =& mosPathway::getInstance(); |
$pathway =& mosPathway::getInstance(); |
| 1592 |
$pathway->addItem($menu->name, $menu->link."&Itemid=$Itemid"); |
$pathway->addItem($menu->name, $menu->link."&Itemid=$Itemid"); |
| 1607 |
if ($this->getIDLikeLink($dblink) == 0) return true; |
if ($this->getIDLikeLink($dblink) == 0) return true; |
| 1608 |
if ($Itemid) { |
if ($Itemid) { |
| 1609 |
$menu =& $this->getMenuByID($Itemid); |
$menu =& $this->getMenuByID($Itemid); |
| 1610 |
|
if (!$menu) return false; |
| 1611 |
if (strpos($menu->link,$dblink) ===0) { |
if (strpos($menu->link,$dblink) ===0) { |
| 1612 |
$access = $menu->access; |
$access = $menu->access; |
| 1613 |
} elseif ($menu_option == 'com_content' AND $Itemid == 1) { |
} elseif ($menu_option == 'com_content' AND $Itemid == 1) { |
| 1707 |
*/ |
*/ |
| 1708 |
function mosShowVIMenu( &$params ) { |
function mosShowVIMenu( &$params ) { |
| 1709 |
global $my, $cur_template, $Itemid; |
global $my, $cur_template, $Itemid; |
| 1710 |
if (mamboCore::get('mosConfig_shownoauth')) $maxaccess = 0; |
if (mamboCore::get('mosConfig_shownoauth')) $maxaccess = 9999999; |
| 1711 |
else $maxaccess = $my->gid; |
else $maxaccess = $my->getAccessGid(); |
| 1712 |
$rows =& $this->getByParentOrder(0, $params->get('menutype'), $maxaccess); |
$rows =& $this->getByParentOrder(0, $params->get('menutype'), $maxaccess); |
| 1713 |
foreach ($rows as $i=>$row) $crosslink[$row->id] = $i; |
foreach ($rows as $i=>$row) $crosslink[$row->id] = $i; |
| 1714 |
// indent icons |
// indent icons |
| 1794 |
function mosShowHFMenu( &$params, $style=0 ) { |
function mosShowHFMenu( &$params, $style=0 ) { |
| 1795 |
global $my, $cur_template, $Itemid; |
global $my, $cur_template, $Itemid; |
| 1796 |
|
|
| 1797 |
if (mamboCore::get('mosConfig_shownoauth')) $maxaccess = 0; |
if (mamboCore::get('mosConfig_shownoauth')) $maxaccess = 9999999; |
| 1798 |
else $maxaccess = $my->gid; |
else $maxaccess = $my->getAccessGid(); |
| 1799 |
$rows =& $this->getByParentOrder(0, $params->get('menutype'), $maxaccess, true); |
$rows =& $this->getByParentOrder(0, $params->get('menutype'), $maxaccess, true); |
| 1800 |
|
|
| 1801 |
$links = array(); |
$links = array(); |
| 2072 |
$this->grp = mosGetParam( $_SESSION, 'session_grp', 0); |
$this->grp = mosGetParam( $_SESSION, 'session_grp', 0); |
| 2073 |
} |
} |
| 2074 |
/** |
/** |
| 2075 |
|
* User access level |
| 2076 |
|
*/ |
| 2077 |
|
function getAccessGid() { |
| 2078 |
|
static $access; |
| 2079 |
|
if (!isset($access)) { |
| 2080 |
|
$acl = new gacl; |
| 2081 |
|
$access = $this->id > 0 ? 1 : 0; |
| 2082 |
|
$access += $acl->acl_check( 'action', 'access', 'users', $this->usertype, 'frontend', 'special' ); |
| 2083 |
|
} |
| 2084 |
|
return $access; |
| 2085 |
|
} |
| 2086 |
|
/** |
| 2087 |
* Validation and filtering |
* Validation and filtering |
| 2088 |
* @return boolean True is satisfactory |
* @return boolean True is satisfactory |
| 2089 |
*/ |
*/ |
| 2612 |
<?php |
<?php |
| 2613 |
} |
} |
| 2614 |
} |
} |
| 2615 |
|
/** |
| 2616 |
|
* Render head tags |
| 2617 |
|
* tags are assembled into an associative array with the following elements: |
| 2618 |
|
* - title |
| 2619 |
|
* - meta |
| 2620 |
|
* - mambojavascript |
| 2621 |
|
* - custom (custom head tags) |
| 2622 |
|
* - livebookmark |
| 2623 |
|
* - favicon |
| 2624 |
|
* @param unknown keys - array elements to output (null = output all) |
| 2625 |
|
* @param unknown exclude - array elements to exclude in output |
| 2626 |
|
* |
| 2627 |
|
* Usage: mosShowHead() - to render all tags |
| 2628 |
|
* mosShowHead('title') - to render a single tag |
| 2629 |
|
* mosShowHead(array('title', 'meta')) - to selectively render tags (in order) |
| 2630 |
|
* mosShowHead(null, 'custom') - to exclude a single tag |
| 2631 |
|
* mosShowHead(null, array('custom','favicon')) - to exclude multiple tags |
| 2632 |
|
*/ |
| 2633 |
|
function mosShowHead($keys='', $exclude='') { |
| 2634 |
|
if (!is_array($keys)) |
| 2635 |
|
if ($keys !== '' && !is_null($keys)) |
| 2636 |
|
$keys = array($keys); |
| 2637 |
|
else $keys = array(); |
| 2638 |
|
if (!is_array($exclude)) |
| 2639 |
|
if ($exclude !== '') |
| 2640 |
|
$exclude = array($exclude); |
| 2641 |
|
else $exclude = array(); |
| 2642 |
|
|
| 2643 |
|
$this->_head['output'] = array(); |
| 2644 |
|
|
| 2645 |
|
$head = array();; |
| 2646 |
|
$head['title'] = '<title>'.$this->_head['title'].'</title>'; |
| 2647 |
|
|
|
function mosShowHead () { |
|
|
global $_VERSION; |
|
|
$mosConfig_live_site = mamboCore::get('mosConfig_live_site'); |
|
| 2648 |
$this->appendMetaTag( 'description', mamboCore::get('mosConfig_MetaDesc'), true ); |
$this->appendMetaTag( 'description', mamboCore::get('mosConfig_MetaDesc'), true ); |
| 2649 |
$this->appendMetaTag( 'keywords', mamboCore::get('mosConfig_MetaKeys'), true ); |
$this->appendMetaTag( 'keywords', mamboCore::get('mosConfig_MetaKeys'), true ); |
| 2650 |
echo $this->getHead(); |
$head['meta'] = array(); |
| 2651 |
if (mamboCore::get('mosConfig_sef')) { |
foreach ($this->_head['meta'] as $name=>$meta) { |
| 2652 |
echo "<base href=\"$mosConfig_live_site/\" />\r\n"; |
if ($meta[1]) $head['meta'][] = $meta[1]; |
| 2653 |
|
$head['meta'][] = '<meta name="' . $name . '" content="' . $meta[0] . '" />'; |
| 2654 |
|
if ($meta[2]) $head['meta'][] = $meta[2]; |
| 2655 |
} |
} |
| 2656 |
|
$head['meta'] = implode( "\n", $head['meta'] ); |
| 2657 |
|
|
| 2658 |
$my = mamboCore::get('currentUser'); |
$my = mamboCore::get('currentUser'); |
| 2659 |
if ( $my->id ) { |
$head['mambojavascript'] = $my->id ? '<script type="text/javascript" src="'.mamboCore::get('mosConfig_live_site').'/includes/js/mambojavascript.js"></script>' : ''; |
| 2660 |
?> |
|
| 2661 |
<script language="JavaScript1.2" src="<?php echo $mosConfig_live_site;?>/includes/js/mambojavascript.js" type="text/javascript"></script> |
$head['custom'] = array(); |
| 2662 |
<?php |
foreach ($this->_head['custom'] as $html) |
| 2663 |
} |
if (trim($html) !== '') |
| 2664 |
|
$head['custom'][] = $html; |
| 2665 |
|
if (count($head['custom']) !== 0) |
| 2666 |
|
$head['custom'] = implode( "\n", $head['custom'] ); |
| 2667 |
|
else |
| 2668 |
|
$head['custom'] = ''; |
| 2669 |
|
|
| 2670 |
|
ob_start(); |
| 2671 |
$this->liveBookMark(); |
$this->liveBookMark(); |
| 2672 |
// outputs link tag for page |
$head['livebookmark'] = ob_get_contents(); |
| 2673 |
|
ob_end_clean(); |
| 2674 |
|
|
| 2675 |
$configuration =& mamboCore::getMamboCore(); |
$configuration =& mamboCore::getMamboCore(); |
| 2676 |
?> |
$head['favicon'] = "<link rel=\"shortcut icon\" href=\"".$configuration->getFavIcon()."\" />"; |
|
<link rel="shortcut icon" href="<?php echo $configuration->getFavIcon();?>" /> |
|
|
<?php |
|
|
} |
|
| 2677 |
|
|
| 2678 |
|
foreach($head as $key=>$value) |
| 2679 |
|
$this->_head['output'][$key] = "$value"; |
| 2680 |
|
|
| 2681 |
|
$tags = $this->_head['output']; |
| 2682 |
|
if (count($keys) == 0) { |
| 2683 |
|
foreach($tags as $key=>$value) |
| 2684 |
|
if (!in_array($key, $exclude)) |
| 2685 |
|
if ($value !== '') |
| 2686 |
|
echo trim($value)."\n"; |
| 2687 |
|
} else { |
| 2688 |
|
foreach($keys as $key) |
| 2689 |
|
if (isset($tags[$key])) |
| 2690 |
|
if(trim($tags[$key]) !== '') |
| 2691 |
|
echo trim($tags[$key])."\n"; |
| 2692 |
|
} |
| 2693 |
|
} |
| 2694 |
|
|
| 2695 |
/** |
/** |
| 2696 |
* retained for backward compatability |
* retained for backward compatability |
| 3655 |
} // function DebugOutput |
} // function DebugOutput |
| 3656 |
|
|
| 3657 |
} //class ends here |
} //class ends here |
| 3658 |
|
|
| 3659 |
?> |
?> |