| 1 |
<?php |
<?php |
| 2 |
/** |
/** |
| 3 |
* @package Mambo |
* @package Mambo |
|
* @copyright Refer to copyright.php |
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL |
|
| 4 |
* @author Mambo Foundation Inc see README.php |
* @author Mambo Foundation Inc see README.php |
| 5 |
|
* @copyright Mambo Foundation Inc. |
| 6 |
|
* See COPYRIGHT.php for copyright notices and details. |
| 7 |
|
* @license GNU/GPL Version 2, see LICENSE.php |
| 8 |
|
* Mambo is free software; you can redistribute it and/or |
| 9 |
|
* modify it under the terms of the GNU General Public License |
| 10 |
|
* as published by the Free Software Foundation; version 2 of the 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 ); |
| 325 |
if ($f) { |
if ($f) { |
| 326 |
while ($f AND !feof($f)) { |
while ($f AND !feof($f)) { |
| 327 |
$line = fgets($f); |
$line = fgets($f); |
| 328 |
$altered = str_replace('$', '$this->', $line); |
$altered = preg_replace('/^\$/', '$this->', $line); |
| 329 |
if ($altered != $line) $code .= $altered; |
if ($altered != $line) $code .= $altered; |
| 330 |
} |
} |
| 331 |
} |
} |
| 336 |
fclose($f); |
fclose($f); |
| 337 |
eval($code); |
eval($code); |
| 338 |
|
|
|
|
|
|
/*if (isset($_SERVER['DOCUMENT_ROOT']) AND strlen($_SERVER['DOCUMENT_ROOT'])) { |
|
|
$docroot = str_replace('\\', '/', str_replace('\\\\', '\\', $_SERVER['DOCUMENT_ROOT'])); |
|
|
} |
|
|
else {*/ |
|
|
// Find information about where execution started |
|
| 339 |
$origin = array_pop(debug_backtrace()); |
$origin = array_pop(debug_backtrace()); |
| 340 |
// Find the PHP script at the start, with a fix for Windows slashes |
// Find the PHP script at the start, with a fix for Windows slashes |
| 341 |
$absolutepath = str_replace('\\', '/', $origin['file']); |
$absolutepath = str_replace('\\', '/', $origin['file']); |
| 342 |
$localpath = $_SERVER['PHP_SELF']; |
$localpath = $_SERVER['PHP_SELF']; |
| 343 |
|
$userdir= ''; |
| 344 |
|
if (strpos($localpath,'~') !== false){ |
| 345 |
|
$userdir = substr($localpath, 0, strpos(substr($localpath,1),'/')+1); |
| 346 |
|
$localpath = substr($localpath,strpos(substr($localpath,1),'/')+1); |
| 347 |
|
} |
| 348 |
$docroot = substr($absolutepath,0,strpos($absolutepath,$localpath)); |
$docroot = substr($absolutepath,0,strpos($absolutepath,$localpath)); |
|
/*}*/ |
|
| 349 |
$mamboroot = str_replace('\\', '/', rtrim($this->rootPath, '\/')); |
$mamboroot = str_replace('\\', '/', rtrim($this->rootPath, '\/')); |
| 350 |
$this->subdirectory = substr($mamboroot, strlen($docroot)); |
$this->subdirectory = $userdir . substr($mamboroot, strlen($docroot)); |
| 351 |
|
|
| 352 |
$scheme = isset($_SERVER['HTTP_SCHEME']) ? $_SERVER['HTTP_SCHEME'] : ((isset($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS'] != 'off')) ? 'https' : 'http'); |
$scheme = isset($_SERVER['HTTP_SCHEME']) ? $_SERVER['HTTP_SCHEME'] : ((isset($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS'] != 'off')) ? 'https' : 'http'); |
| 353 |
if (isset($_SERVER['HTTP_HOST'])) { |
if (isset($_SERVER['HTTP_HOST'])) { |
| 397 |
global $adminside; |
global $adminside; |
| 398 |
if (($this->mosConfig_offline && !$adminside) OR file_exists($this->rootPath.'/installation/index.php')) { |
if (($this->mosConfig_offline && !$adminside) OR file_exists($this->rootPath.'/installation/index.php')) { |
| 399 |
require_once($this->rootPath().'/administrator/includes/admin.php'); |
require_once($this->rootPath().'/administrator/includes/admin.php'); |
|
session_name(md5($this->mosConfig_live_site)); |
|
| 400 |
session_start(); |
session_start(); |
| 401 |
$session =& mosSession::getCurrent(); |
$session =& mosSession::getCurrent(); |
| 402 |
|
if (!isset($_SESSION['initiated'])) { |
| 403 |
|
session_regenerate_id(true); |
| 404 |
|
$_SESSION['initiated'] = true; |
| 405 |
|
} |
| 406 |
$my =& new mosUser(); |
$my =& new mosUser(); |
| 407 |
$my->getSessionData(); |
$my->getSessionData(); |
| 408 |
if (mosSession::validate($my)) return; |
if (mosSession::validate($my)) return; |
| 411 |
} |
} |
| 412 |
} |
} |
| 413 |
|
|
| 414 |
/** |
function loadLanguage(){ |
| 415 |
* Enter description here... |
if (!mosGetParam($_REQUEST, 'lang')); |
| 416 |
* |
else $this->mosConfig_locale = mosGetParam($_REQUEST, 'lang', $this->mosConfig_locale); |
|
*/ |
|
|
function fixLanguage () { |
|
|
require_once($this->mosConfig_absolute_path.'/includes/phpgettext/phpgettext.class.php'); |
|
|
require_once($this->mosConfig_absolute_path.'/includes/phpgettext/error.php'); |
|
|
require_once($this->mosConfig_absolute_path.'/includes/mambofunc.php'); |
|
|
require_once($this->mosConfig_absolute_path.'/includes/mambolanguage.class.php'); |
|
|
$this->mosConfig_locale = mosGetParam($_POST, 'lang', $this->mosConfig_locale); |
|
|
|
|
| 417 |
$language =& new mamboLanguage($this->mosConfig_locale, $this->rootPath.'/language/'); |
$language =& new mamboLanguage($this->mosConfig_locale, $this->rootPath.'/language/'); |
| 418 |
$languages = $language->getLanguages(); |
$languages = $language->getLanguages(); |
| 419 |
$charset = $language->get('charset'); |
$charset = $language->get('charset'); |
| 421 |
$this->mosConfig_lang = $language->get('lang'); |
$this->mosConfig_lang = $language->get('lang'); |
| 422 |
$this->current_language = $language; |
$this->current_language = $language; |
| 423 |
if (!defined('_ISO')) DEFINE('_ISO','charset='.$charset); |
if (!defined('_ISO')) DEFINE('_ISO','charset='.$charset); |
| 424 |
|
header('Content-type: text/html; '._ISO); |
| 425 |
if (!defined('_DATE_FORMAT_LC')) DEFINE('_DATE_FORMAT_LC', $dateformat); //Uses PHP's strftime Command Format |
if (!defined('_DATE_FORMAT_LC')) DEFINE('_DATE_FORMAT_LC', $dateformat); //Uses PHP's strftime Command Format |
| 426 |
if (!defined('_DATE_FORMAT_LC2')) DEFINE('_DATE_FORMAT_LC2', $dateformat); |
if (!defined('_DATE_FORMAT_LC2')) DEFINE('_DATE_FORMAT_LC2', $dateformat); |
| 427 |
|
|
| 433 |
if (file_exists($language_file)) require_once ($language_file); |
if (file_exists($language_file)) require_once ($language_file); |
| 434 |
else require_once ("$this->mosConfig_absolute_path/language/english.php"); |
else require_once ("$this->mosConfig_absolute_path/language/english.php"); |
| 435 |
################################### |
################################### |
| 436 |
|
} |
| 437 |
|
/** |
| 438 |
|
* Enter description here... |
| 439 |
|
* |
| 440 |
|
*/ |
| 441 |
|
function fixLanguage () { |
| 442 |
|
require_once($this->mosConfig_absolute_path.'/includes/phpgettext/phpgettext.class.php'); |
| 443 |
|
require_once($this->mosConfig_absolute_path.'/includes/phpgettext/error.php'); |
| 444 |
|
require_once($this->mosConfig_absolute_path.'/includes/mambofunc.php'); |
| 445 |
|
require_once($this->mosConfig_absolute_path.'/includes/mambolanguage.class.php'); |
| 446 |
} |
} |
| 447 |
|
|
| 448 |
/** |
/** |
| 479 |
* @return unknown |
* @return unknown |
| 480 |
*/ |
*/ |
| 481 |
function determineOptionAndItemid () { |
function determineOptionAndItemid () { |
| 482 |
$this->Itemid = mosGetParam($_REQUEST, 'Itemid', 0); |
$this->Itemid = (int)mosGetParam($_REQUEST, 'Itemid', 0); |
| 483 |
if ($option = strtolower(mosGetParam($_REQUEST, 'option'))); |
if ($option = strtolower(mosGetParam($_REQUEST, 'option'))); |
| 484 |
else { |
else { |
| 485 |
$menuhandler =& mosMenuHandler::getInstance(); |
$menuhandler =& mosMenuHandler::getInstance(); |
| 486 |
$menus =& $menuhandler->getByParentOrder($this->Itemid, 'mainmenu'); |
$menus =& $menuhandler->getByParentOrder($this->Itemid, 'mainmenu'); |
| 487 |
|
if (count($menus)) { |
| 488 |
$this->Itemid = $menus[0]->id; |
$this->Itemid = $menus[0]->id; |
| 489 |
$_REQUEST['Itemid'] = $this->Itemid; |
$_REQUEST['Itemid'] = $this->Itemid; |
| 490 |
$link = $menus[0]->link; |
$link = $menus[0]->link; |
| 496 |
if (isset($temp['option'])) $option = $temp['option']; |
if (isset($temp['option'])) $option = $temp['option']; |
| 497 |
else return ''; |
else return ''; |
| 498 |
} |
} |
| 499 |
|
} |
| 500 |
/** patch to lessen the impact on templates */ |
/** patch to lessen the impact on templates */ |
| 501 |
if ($option == 'search') $option = 'com_search'; |
if ($option == 'search') $option = 'com_search'; |
| 502 |
// checking if we can find the Itemid thru the component |
// checking if we can find the Itemid thru the component |
| 504 |
if ( $option == 'com_content') { |
if ( $option == 'com_content') { |
| 505 |
require_once($this->rootPath().'/components/com_content/content.class.php'); |
require_once($this->rootPath().'/components/com_content/content.class.php'); |
| 506 |
$handler =& contentHandler::getInstance(); |
$handler =& contentHandler::getInstance(); |
| 507 |
$this->Itemid = $handler->getItemid(mosGetParam($_REQUEST, 'id', 0 )); |
$this->Itemid = (int)$handler->getItemid(mosGetParam($_REQUEST, 'id', 0 )); |
| 508 |
$_REQUEST['Itemid'] = $this->Itemid; |
$_REQUEST['Itemid'] = $this->Itemid; |
| 509 |
} |
} |
| 510 |
else { |
else { |
| 516 |
} |
} |
| 517 |
} |
} |
| 518 |
} |
} |
| 519 |
return $option; |
return trim(htmlspecialchars($option)); |
| 520 |
} |
} |
| 521 |
|
|
| 522 |
/** |
/** |
| 537 |
if (strpos($url, '?')) $url .= '&mosmsg='.urlencode($message); |
if (strpos($url, '?')) $url .= '&mosmsg='.urlencode($message); |
| 538 |
else $url .= '?mosmsg='.urlencode($message); |
else $url .= '?mosmsg='.urlencode($message); |
| 539 |
} |
} |
| 540 |
|
$url = preg_replace("/[\n]|[\r]/",'',$url); |
| 541 |
if (headers_sent()) echo "<script>document.location.href='$url';</script>\n"; |
if (headers_sent()) echo "<script>document.location.href='$url';</script>\n"; |
| 542 |
else { |
else { |
| 543 |
@ob_end_clean(); // clear output buffer |
@ob_end_clean(); // clear output buffer |
| 821 |
$mainframe =& mosMainFrame::getInstance(); |
$mainframe =& mosMainFrame::getInstance(); |
| 822 |
$customs = $mainframe->getCustomPathWay(); |
$customs = $mainframe->getCustomPathWay(); |
| 823 |
$last = count($this->_names) - 1; |
$last = count($this->_names) - 1; |
| 824 |
if ($last == 0 AND count($customs == 0)) return ''; |
if (($last == 0) AND (count($customs) == 0)) return ''; |
| 825 |
$result = "<span class='pathway'>"; |
$result = "<span class='pathway'>"; |
| 826 |
$config =& mamboCore::getMamboCore(); |
$config =& mamboCore::getMamboCore(); |
| 827 |
$rootpath = $config->rootPath(); |
$rootpath = $config->rootPath(); |
| 832 |
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' />"; |
| 833 |
else $img = '>'; |
else $img = '>'; |
| 834 |
} |
} |
| 835 |
|
$uri =& mosUriHelper::getInstance(); |
| 836 |
foreach ($this->_names as $i=>$name) { |
foreach ($this->_names as $i=>$name) { |
| 837 |
|
$uri->setUri($this->_urls[$i]); |
| 838 |
if ($i === $last AND count($customs) == 0) $result .= "$name</span>"; |
if ($i === $last AND count($customs) == 0) $result .= "$name</span>"; |
| 839 |
elseif (strstr($this->_urls[$i], 'view')) $result .= ""; |
elseif (strstr($uri->get('task'), 'view')) $result .= ""; |
| 840 |
else { |
else { |
| 841 |
$sefurl = sefRelToAbs($this->_urls[$i]); |
$sefurl = sefRelToAbs($this->_urls[$i]); |
| 842 |
$result .= "<a href='$sefurl' class='pathway'>$name</a>"; |
$result .= "<a href='$sefurl' class='pathway'>$name</a>"; |
| 1197 |
function &listAll ($type='file', $recurse=false, $fullpath=false) { |
function &listAll ($type='file', $recurse=false, $fullpath=false) { |
| 1198 |
$results = array(); |
$results = array(); |
| 1199 |
if ($dir = @opendir($this->path)) { |
if ($dir = @opendir($this->path)) { |
| 1200 |
while ($file = readdir($dir)) { |
while (false !== ($file = readdir($dir))) { |
| 1201 |
if ($file == '.' OR $file == '..') continue; |
if ($file == '.' OR $file == '..') continue; |
| 1202 |
if (is_dir($this->path.$file)) { |
if (is_dir($this->path.$file)) { |
| 1203 |
if ($recurse) { |
if ($recurse) { |
| 1213 |
} |
} |
| 1214 |
closedir($dir); |
closedir($dir); |
| 1215 |
} |
} |
| 1216 |
|
asort($results); |
| 1217 |
return $results; |
return $results; |
| 1218 |
} |
} |
| 1219 |
|
|
| 1225 |
function soleDir () { |
function soleDir () { |
| 1226 |
$found = ''; |
$found = ''; |
| 1227 |
if ($dir = @opendir($this->path)) { |
if ($dir = @opendir($this->path)) { |
| 1228 |
while ($file = readdir($dir)) { |
while (false !== ($file = readdir($dir))) { |
| 1229 |
if ($file == '.' OR $file == '..') continue; |
if ($file == '.' OR $file == '..') continue; |
| 1230 |
if (is_dir($this->path.$file)) { |
if (is_dir($this->path.$file)) { |
| 1231 |
if ($found) return ''; |
if ($found) return ''; |
| 1455 |
return null; |
return null; |
| 1456 |
} |
} |
| 1457 |
|
|
| 1458 |
|
function getSectionItemId($sectionid, $gbs = 1){ |
| 1459 |
|
static $__sectionsItemds; |
| 1460 |
|
|
| 1461 |
|
if (isset($__sectionsItemids[$sectionid])) return $__sectionsItemids[$sectionid]; |
| 1462 |
|
|
| 1463 |
|
$_Itemid = null; |
| 1464 |
|
if ($_Itemid == null ) { |
| 1465 |
|
// Search in sections |
| 1466 |
|
$_Itemid = $this->getIDByTypeCid ('content_section', $sectionid); |
| 1467 |
|
} |
| 1468 |
|
if ($_Itemid == null ) { |
| 1469 |
|
// Search in sections |
| 1470 |
|
$_Itemid = $this->getIDByTypeCid ('content_blog_section', $sectionid); |
| 1471 |
|
} |
| 1472 |
|
|
| 1473 |
|
if ($_Itemid == null && $gbs) { |
| 1474 |
|
// Search in global blog section |
| 1475 |
|
$_Itemid = $this->getIDByTypeCid('content_blog_section', 0); |
| 1476 |
|
} |
| 1477 |
|
if ($_Itemid != null) $__sectionsItemids[$sectionid] = $_Itemid; |
| 1478 |
|
return $_Itemid; |
| 1479 |
|
} |
| 1480 |
|
|
| 1481 |
|
function getCategoryItemId($catid){ |
| 1482 |
|
static $__categoriesItemids; |
| 1483 |
|
|
| 1484 |
|
if (isset($__categoriesItemids[$catid])) return $__categoriesItemids[$catid]; |
| 1485 |
|
|
| 1486 |
|
$_Itemid = null; |
| 1487 |
|
if ($_Itemid == null) { |
| 1488 |
|
// Search in blog categories |
| 1489 |
|
$_Itemid = $this->getIDByTypeCid ('content_blog_category', $catid); |
| 1490 |
|
} |
| 1491 |
|
if ($_Itemid == null) { |
| 1492 |
|
// Search in categories |
| 1493 |
|
$_Itemid = $this->getIDByTypeCid ('content_category', $catid); |
| 1494 |
|
} |
| 1495 |
|
|
| 1496 |
|
if ($_Itemid != null) $__categoriesItemids[$catid] = $_Itemid; |
| 1497 |
|
|
| 1498 |
|
return $_Itemid; |
| 1499 |
|
} |
| 1500 |
|
|
| 1501 |
/** |
/** |
| 1502 |
* Enter description here... |
* Enter description here... |
| 1503 |
* |
* |
| 1605 |
} |
} |
| 1606 |
} |
} |
| 1607 |
} |
} |
| 1608 |
|
if ($Itemid == 0 && !count($result)){ |
| 1609 |
|
$result[0] = new stdclass; |
| 1610 |
|
$result[0]->id = 1; |
| 1611 |
|
$result[0]->link = 'index.php?option=com_frontpage'; |
| 1612 |
|
$result[0]->parent = 0; |
| 1613 |
|
$result[0]->type = 'components'; |
| 1614 |
|
$result[0]->browserNav = 0; |
| 1615 |
|
$result[0]->name = 'Home'; |
| 1616 |
|
} |
| 1617 |
return $result; |
return $result; |
| 1618 |
} |
} |
| 1619 |
|
|
| 1625 |
function setPathway ($Itemid) { |
function setPathway ($Itemid) { |
| 1626 |
if ($Itemid) { |
if ($Itemid) { |
| 1627 |
$menu =& $this->getMenuByID($Itemid); |
$menu =& $this->getMenuByID($Itemid); |
| 1628 |
|
if (!$menu) return; |
| 1629 |
if ($menu->parent) $this->setPathway($menu->parent); |
if ($menu->parent) $this->setPathway($menu->parent); |
| 1630 |
$pathway =& mosPathway::getInstance(); |
$pathway =& mosPathway::getInstance(); |
| 1631 |
$pathway->addItem($menu->name, $menu->link."&Itemid=$Itemid"); |
$pathway->addItem($menu->name, $menu->link."&Itemid=$Itemid"); |
| 1646 |
if ($this->getIDLikeLink($dblink) == 0) return true; |
if ($this->getIDLikeLink($dblink) == 0) return true; |
| 1647 |
if ($Itemid) { |
if ($Itemid) { |
| 1648 |
$menu =& $this->getMenuByID($Itemid); |
$menu =& $this->getMenuByID($Itemid); |
| 1649 |
|
if (!$menu) return false; |
| 1650 |
if (strpos($menu->link,$dblink) ===0) { |
if (strpos($menu->link,$dblink) ===0) { |
| 1651 |
$access = $menu->access; |
$access = $menu->access; |
| 1652 |
} elseif ($menu_option == 'com_content' AND $Itemid == 1) { |
} elseif ($menu_option == 'com_content' AND $Itemid == 1) { |
| 1746 |
*/ |
*/ |
| 1747 |
function mosShowVIMenu( &$params ) { |
function mosShowVIMenu( &$params ) { |
| 1748 |
global $my, $cur_template, $Itemid; |
global $my, $cur_template, $Itemid; |
| 1749 |
if (mamboCore::get('mosConfig_shownoauth')) $maxaccess = 0; |
if (mamboCore::get('mosConfig_shownoauth')) $maxaccess = 9999999; |
| 1750 |
else $maxaccess = $my->gid; |
else $maxaccess = $my->getAccessGid(); |
| 1751 |
$rows =& $this->getByParentOrder(0, $params->get('menutype'), $maxaccess); |
$rows =& $this->getByParentOrder(0, $params->get('menutype'), $maxaccess); |
| 1752 |
foreach ($rows as $i=>$row) $crosslink[$row->id] = $i; |
foreach ($rows as $i=>$row) $crosslink[$row->id] = $i; |
| 1753 |
// indent icons |
// indent icons |
| 1833 |
function mosShowHFMenu( &$params, $style=0 ) { |
function mosShowHFMenu( &$params, $style=0 ) { |
| 1834 |
global $my, $cur_template, $Itemid; |
global $my, $cur_template, $Itemid; |
| 1835 |
|
|
| 1836 |
if (mamboCore::get('mosConfig_shownoauth')) $maxaccess = 0; |
if (mamboCore::get('mosConfig_shownoauth')) $maxaccess = 9999999; |
| 1837 |
else $maxaccess = $my->gid; |
else $maxaccess = $my->getAccessGid(); |
| 1838 |
$rows =& $this->getByParentOrder(0, $params->get('menutype'), $maxaccess, true); |
$rows =& $this->getByParentOrder(0, $params->get('menutype'), $maxaccess, true); |
| 1839 |
|
|
| 1840 |
$links = array(); |
$links = array(); |
| 1986 |
$result = array(); |
$result = array(); |
| 1987 |
if (isset( $this->_events[$event] )) { |
if (isset( $this->_events[$event] )) { |
| 1988 |
foreach ($this->_events[$event] as $func) { |
foreach ($this->_events[$event] as $func) { |
| 1989 |
|
$botargs = $args; |
| 1990 |
if (is_callable( $func[0] )) { |
if (is_callable( $func[0] )) { |
| 1991 |
$botparams = $this->_bots[$func[1]]->params; |
$botparams = $this->_bots[$func[1]]->params; |
| 1992 |
$args[] = new mosParameters($botparams); |
$botargs[] = new mosParameters($botparams); |
| 1993 |
$args[] = $event; |
$botargs[] = $event; |
| 1994 |
if ($doUnpublished) { |
if ($doUnpublished) { |
| 1995 |
$args[0] = $this->_bots[$func[1]]->published; |
$botargs[0] = $this->_bots[$func[1]]->published; |
| 1996 |
$result[] = call_user_func_array( $func[0], $args ); |
$result[] = call_user_func_array( $func[0], $botargs ); |
| 1997 |
} else if ($this->_bots[$func[1]]->published) { |
} else if ($this->_bots[$func[1]]->published) { |
| 1998 |
$result[] = call_user_func_array( $func[0], $args ); |
$result[] = call_user_func_array( $func[0], $botargs ); |
| 1999 |
} |
} |
| 2000 |
} |
} |
| 2001 |
} |
} |
| 2029 |
if (isset($result[0])) return $result[0]; |
if (isset($result[0])) return $result[0]; |
| 2030 |
return null; |
return null; |
| 2031 |
} |
} |
| 2032 |
|
|
| 2033 |
|
function getBot($element, $folder) { |
| 2034 |
|
$returnBot = ''; |
| 2035 |
|
foreach ($this->_bots as $i=>$bot) { |
| 2036 |
|
if ($bot->folder == $folder && $bot->element == $element){ |
| 2037 |
|
$returnBot = $bot; |
| 2038 |
|
break; |
| 2039 |
|
} |
| 2040 |
|
} |
| 2041 |
|
return $returnBot; |
| 2042 |
|
} |
| 2043 |
} |
} |
| 2044 |
|
|
| 2045 |
/** |
/** |
| 2112 |
$this->grp = mosGetParam( $_SESSION, 'session_grp', 0); |
$this->grp = mosGetParam( $_SESSION, 'session_grp', 0); |
| 2113 |
} |
} |
| 2114 |
/** |
/** |
| 2115 |
|
* User access level |
| 2116 |
|
*/ |
| 2117 |
|
function getAccessGid() { |
| 2118 |
|
static $access; |
| 2119 |
|
if (!isset($access)) { |
| 2120 |
|
$acl = new gacl; |
| 2121 |
|
$access = $this->id > 0 ? 1 : 0; |
| 2122 |
|
$access += $acl->acl_check( 'action', 'access', 'users', $this->usertype, 'frontend', 'special' ); |
| 2123 |
|
} |
| 2124 |
|
return $access; |
| 2125 |
|
} |
| 2126 |
|
/** |
| 2127 |
* Validation and filtering |
* Validation and filtering |
| 2128 |
* @return boolean True is satisfactory |
* @return boolean True is satisfactory |
| 2129 |
*/ |
*/ |
| 2130 |
function check() { |
function check() { |
| 2131 |
Global $mosConfig_absolute_path; |
Global $mosConfig_absolute_path; |
| 2132 |
include $mosConfig_absolute_path . ('/language/english.php'); |
//include $mosConfig_absolute_path . ('/language/english.php'); |
| 2133 |
$this->_error = ''; |
$this->_error = ''; |
| 2134 |
if ($this->name == '') $this->_error = _REGWARN_NAME; |
if ($this->name == '') $this->_error = _REGWARN_NAME; |
| 2135 |
elseif ($this->username == '') $this->_error = _REGWARN_UNAME; |
elseif ($this->username == '') $this->_error = _REGWARN_UNAME; |
| 2603 |
$sql['os'] = "INSERT INTO #__stats_agents (agent,type) VALUES ('$os',1)"; |
$sql['os'] = "INSERT INTO #__stats_agents (agent,type) VALUES ('$os',1)"; |
| 2604 |
$sql['domain'] = "INSERT INTO #__stats_agents (agent,type) VALUES ('$tldomain',2)"; |
$sql['domain'] = "INSERT INTO #__stats_agents (agent,type) VALUES ('$tldomain',2)"; |
| 2605 |
if ($stats) foreach ($stats as $stat) { |
if ($stats) foreach ($stats as $stat) { |
| 2606 |
if ($stat->type == 0) $sql['agents'] = "UPDATE #__stats_agents SET hits=(hits+1) WHERE agent='$browser' AND type=0"; |
if ($stat->type == 0) $sql['browser'] = "UPDATE #__stats_agents SET hits=(hits+1) WHERE agent='$browser' AND type=0"; |
| 2607 |
if ($stat->type == 1) $sql['os'] = "UPDATE #__stats_agents SET hits=(hits+1) WHERE agent='$os' AND type=1"; |
if ($stat->type == 1) $sql['os'] = "UPDATE #__stats_agents SET hits=(hits+1) WHERE agent='$os' AND type=1"; |
| 2608 |
if ($stat->type == 2) $sql['domain'] = "UPDATE #__stats_agents SET hits=(hits+1) WHERE agent='$tldomain' AND type=2"; |
if ($stat->type == 2) $sql['domain'] = "UPDATE #__stats_agents SET hits=(hits+1) WHERE agent='$tldomain' AND type=2"; |
| 2609 |
} |
} |
| 2652 |
<?php |
<?php |
| 2653 |
} |
} |
| 2654 |
} |
} |
| 2655 |
|
/** |
| 2656 |
|
* Render head tags |
| 2657 |
|
* tags are assembled into an associative array with the following elements: |
| 2658 |
|
* - title |
| 2659 |
|
* - meta |
| 2660 |
|
* - mambojavascript |
| 2661 |
|
* - custom (custom head tags) |
| 2662 |
|
* - livebookmark |
| 2663 |
|
* - favicon |
| 2664 |
|
* @param unknown keys - array elements to output (null = output all) |
| 2665 |
|
* @param unknown exclude - array elements to exclude in output |
| 2666 |
|
* |
| 2667 |
|
* Usage: mosShowHead() - to render all tags |
| 2668 |
|
* mosShowHead('title') - to render a single tag |
| 2669 |
|
* mosShowHead(array('title', 'meta')) - to selectively render tags (in order) |
| 2670 |
|
* mosShowHead(null, 'custom') - to exclude a single tag |
| 2671 |
|
* mosShowHead(null, array('custom','favicon')) - to exclude multiple tags |
| 2672 |
|
*/ |
| 2673 |
|
function mosShowHead($keys='', $exclude='') { |
| 2674 |
|
if (!is_array($keys)) |
| 2675 |
|
if ($keys !== '' && !is_null($keys)) |
| 2676 |
|
$keys = array($keys); |
| 2677 |
|
else $keys = array(); |
| 2678 |
|
if (!is_array($exclude)) |
| 2679 |
|
if ($exclude !== '') |
| 2680 |
|
$exclude = array($exclude); |
| 2681 |
|
else $exclude = array(); |
| 2682 |
|
|
| 2683 |
|
$this->_head['output'] = array(); |
| 2684 |
|
|
| 2685 |
|
$head = array();; |
| 2686 |
|
$head['title'] = '<title>'.$this->_head['title'].'</title>'; |
| 2687 |
|
|
|
function mosShowHead () { |
|
|
global $_VERSION; |
|
|
$mosConfig_live_site = mamboCore::get('mosConfig_live_site'); |
|
| 2688 |
$this->appendMetaTag( 'description', mamboCore::get('mosConfig_MetaDesc'), true ); |
$this->appendMetaTag( 'description', mamboCore::get('mosConfig_MetaDesc'), true ); |
| 2689 |
$this->appendMetaTag( 'keywords', mamboCore::get('mosConfig_MetaKeys'), true ); |
$this->appendMetaTag( 'keywords', mamboCore::get('mosConfig_MetaKeys'), true ); |
| 2690 |
echo $this->getHead(); |
$head['meta'] = array(); |
| 2691 |
if (mamboCore::get('mosConfig_sef')) { |
foreach ($this->_head['meta'] as $name=>$meta) { |
| 2692 |
echo "<base href=\"$mosConfig_live_site/\" />\r\n"; |
if ($meta[1]) $head['meta'][] = $meta[1]; |
| 2693 |
|
$head['meta'][] = '<meta name="' . $name . '" content="' . $meta[0] . '" />'; |
| 2694 |
|
if ($meta[2]) $head['meta'][] = $meta[2]; |
| 2695 |
} |
} |
| 2696 |
|
$head['meta'] = implode( "\n", $head['meta'] ); |
| 2697 |
|
|
| 2698 |
$my = mamboCore::get('currentUser'); |
$my = mamboCore::get('currentUser'); |
| 2699 |
if ( $my->id ) { |
$head['mambojavascript'] = $my->id ? '<script type="text/javascript" src="'.mamboCore::get('mosConfig_live_site').'/includes/js/mambojavascript.js"></script>' : ''; |
| 2700 |
?> |
|
| 2701 |
<script language="JavaScript1.2" src="<?php echo $mosConfig_live_site;?>/includes/js/mambojavascript.js" type="text/javascript"></script> |
$head['custom'] = array(); |
| 2702 |
<?php |
foreach ($this->_head['custom'] as $html) |
| 2703 |
} |
if (trim($html) !== '') |
| 2704 |
|
$head['custom'][] = $html; |
| 2705 |
|
if (count($head['custom']) !== 0) |
| 2706 |
|
$head['custom'] = implode( "\n", $head['custom'] ); |
| 2707 |
|
else |
| 2708 |
|
$head['custom'] = ''; |
| 2709 |
|
|
| 2710 |
|
ob_start(); |
| 2711 |
$this->liveBookMark(); |
$this->liveBookMark(); |
| 2712 |
// outputs link tag for page |
$head['livebookmark'] = ob_get_contents(); |
| 2713 |
|
ob_end_clean(); |
| 2714 |
|
|
| 2715 |
$configuration =& mamboCore::getMamboCore(); |
$configuration =& mamboCore::getMamboCore(); |
| 2716 |
?> |
$head['favicon'] = "<link rel=\"shortcut icon\" href=\"".$configuration->getFavIcon()."\" />"; |
| 2717 |
<link rel="shortcut icon" href="<?php echo $configuration->getFavIcon();?>" /> |
|
| 2718 |
<?php |
if (mamboCore::get('mosConfig_sef')) { |
| 2719 |
|
$baseHref = sefRelToAbs('index.php?'.mosGetParam ($_SERVER,"QUERY_STRING","")); |
| 2720 |
|
$head['base'] = "<base href=\"{$baseHref}/\" />"; |
| 2721 |
} |
} |
| 2722 |
|
|
| 2723 |
|
foreach($head as $key=>$value) |
| 2724 |
|
$this->_head['output'][$key] = "$value"; |
| 2725 |
|
|
| 2726 |
|
$tags = $this->_head['output']; |
| 2727 |
|
if (count($keys) == 0) { |
| 2728 |
|
foreach($tags as $key=>$value) |
| 2729 |
|
if (!in_array($key, $exclude)) |
| 2730 |
|
if ($value !== '') |
| 2731 |
|
echo trim($value)."\n"; |
| 2732 |
|
} else { |
| 2733 |
|
foreach($keys as $key) |
| 2734 |
|
if (isset($tags[$key])) |
| 2735 |
|
if(trim($tags[$key]) !== '') |
| 2736 |
|
echo trim($tags[$key])."\n"; |
| 2737 |
|
} |
| 2738 |
|
} |
| 2739 |
|
|
| 2740 |
/** |
/** |
| 2741 |
* retained for backward compatability |
* retained for backward compatability |
| 2769 |
$handler =& new contentHandler(); |
$handler =& new contentHandler(); |
| 2770 |
return $handler->getContentItemLinkCount(); |
return $handler->getContentItemLinkCount(); |
| 2771 |
} |
} |
| 2772 |
|
|
| 2773 |
|
function formId($option='', $task='', $my='') { |
| 2774 |
|
$option=trim($option);$task=trim($task); |
| 2775 |
|
if (!$option) die('Illegal option for mainframe formId in core.classes.php'); |
| 2776 |
|
if (!$task) die('Illegal task for mainframe formId in core.classes.php'); |
| 2777 |
|
if (!is_object($my)) die('Illegal user object for mainframe formId in core.classes.php'); |
| 2778 |
|
mos_session_start(); |
| 2779 |
|
$hash = md5(microtime().mt_rand()); |
| 2780 |
|
$_SESSION['mosfid'] = md5($hash.$option.$task.$my->id.mamboCore::get('mosConfig_secret')); |
| 2781 |
|
return $hash; |
| 2782 |
|
} |
| 2783 |
|
|
| 2784 |
|
function validFormId($option='', $task='', $my='') { |
| 2785 |
|
$option=trim($option);$task=trim($task); |
| 2786 |
|
if (!$option) die('Illegal option for mainframe validFormId in core.classes.php'); |
| 2787 |
|
if (!$task) die('Illegal task for mainframe validFormId in core.classes.php'); |
| 2788 |
|
if (!is_object($my)) die('Illegal user object for mainframe validFormId in core.classes.php'); |
| 2789 |
|
if (!isset($_REQUEST['f'])) die('Missing hash for mainframe validFormId in core.classes.php'); |
| 2790 |
|
if (!isset($_SESSION['mosfid'])) return false; |
| 2791 |
|
$valid = $_SESSION['mosfid'] == md5($_REQUEST['f'].$option.$task.$my->id.mamboCore::get('mosConfig_secret')); |
| 2792 |
|
unset($_SESSION['mosfid']); |
| 2793 |
|
return $valid; |
| 2794 |
|
} |
| 2795 |
|
|
| 2796 |
/** |
/** |
| 2797 |
* retained for backward compatability |
* retained for backward compatability |
| 2798 |
*/ |
*/ |
| 2807 |
/** |
/** |
| 2808 |
* @return object A function cache object |
* @return object A function cache object |
| 2809 |
*/ |
*/ |
| 2810 |
function &getCache( $group='' ) { |
function &getCache( $group='', $plugin = 'Function' ) { |
| 2811 |
|
if (!in_array($plugin,array('Function','Output'))){ |
| 2812 |
|
die('Cache plugin not available'); |
| 2813 |
|
} |
| 2814 |
$mosConfig_absolute_path = mamboCore::get('mosConfig_absolute_path'); |
$mosConfig_absolute_path = mamboCore::get('mosConfig_absolute_path'); |
| 2815 |
require_once($mosConfig_absolute_path.'/includes/Cache/Lite/Function.php'); |
require_once($mosConfig_absolute_path.'/includes/Cache/Lite/'.$plugin.'.php'); |
| 2816 |
$path = mamboCore::get('mosConfig_cachepath'); |
$path = mamboCore::get('mosConfig_cachepath'); |
| 2817 |
$caching = mamboCore::get('mosConfig_caching'); |
$caching = mamboCore::get('mosConfig_caching'); |
| 2818 |
$time = mamboCore::get('mosConfig_cachetime'); |
$time = mamboCore::get('mosConfig_cachetime'); |
| 2822 |
'defaultGroup' => $group, |
'defaultGroup' => $group, |
| 2823 |
'lifeTime' => $time |
'lifeTime' => $time |
| 2824 |
); |
); |
| 2825 |
$cache =& new Cache_Lite_Function( $options ); |
$className = 'Cache_Lite_'.$plugin; |
| 2826 |
|
$cache =& new $className( $options ); |
| 2827 |
return $cache; |
return $cache; |
| 2828 |
} |
} |
| 2829 |
/** |
/** |
| 3712 |
//$Debug [$Group][$Number] = "Message, can by with $Value"; |
//$Debug [$Group][$Number] = "Message, can by with $Value"; |
| 3713 |
//$Group[0] - Errors |
//$Group[0] - Errors |
| 3714 |
//$Group[1] - Notice |
//$Group[1] - Notice |
| 3715 |
$Debug[0][0] = "Error, can NOT read file: " . $Value . "<br>"; |
$Debug[0][0] = "Error, can NOT read file: " . $Value . "<br />"; |
| 3716 |
$Debug[0][1] = "Error, can't find maching char \"". $Value ."\" in destination encoding table!" . "<br>"; |
$Debug[0][1] = "Error, can't find maching char \"". $Value ."\" in destination encoding table!" . "<br />"; |
| 3717 |
$Debug[0][2] = "Error, can't find maching char \"". $Value ."\" in source encoding table!" . "<br>"; |
$Debug[0][2] = "Error, can't find maching char \"". $Value ."\" in source encoding table!" . "<br />"; |
| 3718 |
$Debug[0][3] = "Error, you did NOT set variable " . $Value . " in Convert() function." . "<br>"; |
$Debug[0][3] = "Error, you did NOT set variable " . $Value . " in Convert() function." . "<br />"; |
| 3719 |
$Debug[0][4] = "You can NOT convert string from " . $Value . " to " . $Value . "!" . "<BR>"; |
$Debug[0][4] = "You can NOT convert string from " . $Value . " to " . $Value . "!" . "<br />"; |
| 3720 |
$Debug[1][0] = "Notice, you are trying to convert string from ". $Value ." to ". $Value .", don't you feel it's strange? ;-)" . "<br>"; |
$Debug[1][0] = "Notice, you are trying to convert string from ". $Value ." to ". $Value .", don't you feel it's strange? ;-)" . "<br />"; |
| 3721 |
$Debug[1][1] = "Notice, both charsets " . $Value . " are identical! Check encoding tables files." . "<br>"; |
$Debug[1][1] = "Notice, both charsets " . $Value . " are identical! Check encoding tables files." . "<br />"; |
| 3722 |
$Debug[1][2] = "Notice, there is no unicode char in the string you are trying to convert." . "<br>"; |
$Debug[1][2] = "Notice, there is no unicode char in the string you are trying to convert." . "<br />"; |
| 3723 |
|
|
| 3724 |
if (DEBUG_MODE >= $Group) |
if (DEBUG_MODE >= $Group) |
| 3725 |
{ |
{ |
| 3728 |
} // function DebugOutput |
} // function DebugOutput |
| 3729 |
|
|
| 3730 |
} //class ends here |
} //class ends here |
| 3731 |
|
|
| 3732 |
?> |
?> |