| 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; |
| 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>"; |
| 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 |
*/ |
*/ |
| 2656 |
$head['meta'] = implode( "\n", $head['meta'] ); |
$head['meta'] = implode( "\n", $head['meta'] ); |
| 2657 |
|
|
| 2658 |
$my = mamboCore::get('currentUser'); |
$my = mamboCore::get('currentUser'); |
| 2659 |
$head['mambojavascript'] = $my->id ? "<script language=\"JavaScript1.2\" src=".mamboCore::get('mosConfig_live_site')."/includes/js/mambojavascript.js\" type=\"text/javascript\"></script>" : ''; |
$head['mambojavascript'] = $my->id ? '<script type="text/javascript" src="'.mamboCore::get('mosConfig_live_site').'/includes/js/mambojavascript.js"></script>' : ''; |
| 2660 |
|
|
| 2661 |
$head['custom'] = array(); |
$head['custom'] = array(); |
| 2662 |
foreach ($this->_head['custom'] as $html) |
foreach ($this->_head['custom'] as $html) |
| 3656 |
|
|
| 3657 |
} //class ends here |
} //class ends here |
| 3658 |
|
|
|
class mosHtmlHelper { |
|
|
var $_docTypes = array( |
|
|
'xhtml-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">', |
|
|
'xhtml-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">', |
|
|
'xhtml-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">', |
|
|
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">' |
|
|
); |
|
|
var $_docTypesText = array( |
|
|
'xhtml-strict' => 'XHTML 1.0 Strict', |
|
|
'xhtml-trans' => 'XHTML 1.0 Transitional', |
|
|
'xhtml-frame' => 'XHTML 1.0 Frameset', |
|
|
'xhtml11' => 'XHTML 1.1' |
|
|
); |
|
|
var $doctype = 'xhtml-trans'; |
|
|
|
|
|
/** |
|
|
* Singleton accessor |
|
|
*/ |
|
|
function &getInstance () { |
|
|
static $instance; |
|
|
if (!is_object($instance)) $instance = new mosHtmlHelper(); |
|
|
return $instance; |
|
|
} |
|
|
function __docType($type=null) { |
|
|
static $obj; |
|
|
if (!is_object($obj)) $obj =& mosHtmlHelper::getInstance(); |
|
|
|
|
|
if (array_key_exists($type, $obj->_docTypes)) return $obj->_docTypes[$type]; |
|
|
return $obj->_docTypes[$obj->doctype]; |
|
|
} |
|
|
function renderDocType($type=null) { |
|
|
static $obj; |
|
|
if (!is_object($obj)) $obj =& mosHtmlHelper::getInstance(); |
|
|
|
|
|
echo $obj->__docType($type)."\n"; |
|
|
} |
|
|
function get($var) { |
|
|
static $obj; |
|
|
if (!is_object($obj)) $obj =& mosHtmlHelper::getInstance(); |
|
|
|
|
|
if(isset($obj->$var)) return $obj->$var; |
|
|
return null; |
|
|
} |
|
|
function set($property, $value) { |
|
|
static $obj; |
|
|
if (!is_object($obj)) $obj =& mosHtmlHelper::getInstance(); |
|
|
|
|
|
if($property{0} == '_') return; // dont set private properties |
|
|
if (isset($obj->$property)) $obj->$property = $value; |
|
|
} |
|
|
} // end class mosHtmlHelper |
|
| 3659 |
?> |
?> |