| 160 |
function fixLanguage () { |
function fixLanguage () { |
| 161 |
if (isset($this->mosConfig_lang) AND $this->mosConfig_lang); |
if (isset($this->mosConfig_lang) AND $this->mosConfig_lang); |
| 162 |
else $this->set('mosConfig_lang', 'english'); |
else $this->set('mosConfig_lang', 'english'); |
| 163 |
$language_file = "$this->mosConfig_absolute_path/languages/$this->mosConfig_lang.php"; |
$language_file = "$this->mosConfig_absolute_path/language/$this->mosConfig_lang.php"; |
| 164 |
if (file_exists($language_file)) require_once ($language_file); |
if (file_exists($language_file)) require_once ($language_file); |
|
|
|
|
DEFINE('_ISO','charset=utf-8'); |
|
|
DEFINE('_DATE_FORMAT_LC',"%A, %d %B %Y"); //Uses PHP's strftime Command Format |
|
|
DEFINE('_DATE_FORMAT_LC2',"%A, %d %B %Y %H:%M"); |
|
|
// include phpgettext library |
|
|
require_once( 'includes/phpgettext/phpgettext.class.php' ); |
|
|
require_once( 'includes/phpgettext/error.php' ); |
|
|
#set_error_handler('error_handler'); |
|
|
$domain = 'administrator'; |
|
|
$textdomain = $this->rootPath().DIRECTORY_SEPARATOR.'languages'; |
|
|
$charset = 'utf-8'; |
|
|
$phpgettext =& phpgettext(); |
|
|
$phpgettext->setlocale($this->mosConfig_locale); |
|
|
$phpgettext->bindtextdomain($domain, $textdomain); |
|
|
$phpgettext->bind_textdomain_codeset($domain, $charset); |
|
|
$phpgettext->textdomain($domain); |
|
|
// dump($phpgettext); |
|
|
|
|
| 165 |
} |
} |
| 166 |
|
|
| 167 |
function secure () { |
function secure () { |
| 219 |
$this->Itemid = $handler->getItemid(mosGetParam($_REQUEST, 'id', 0 )); |
$this->Itemid = $handler->getItemid(mosGetParam($_REQUEST, 'id', 0 )); |
| 220 |
$_REQUEST['Itemid'] = $this->Itemid; |
$_REQUEST['Itemid'] = $this->Itemid; |
| 221 |
} |
} |
| 222 |
|
else { |
| 223 |
|
$menuhandler = mosMenuHandler::getInstance(); |
| 224 |
|
$this->Itemid = $menuhandler->getIdLikeLink("index.php?option=$option"); |
| 225 |
|
if ($this->Itemid === 0) { |
| 226 |
|
$menuhandler = mosMenuHandler::getInstance(); |
| 227 |
|
$menus =& $menuhandler->getByParentOrder($this->Itemid, 'mainmenu'); |
| 228 |
|
} |
| 229 |
|
} |
| 230 |
} |
} |
| 231 |
return $option; |
return $option; |
| 232 |
} |
} |
| 561 |
return $instance; |
return $instance; |
| 562 |
} |
} |
| 563 |
|
|
| 564 |
|
function deleteFile ($file) { |
| 565 |
|
if (file_exists($file)) unlink($file); |
| 566 |
|
} |
| 567 |
|
|
| 568 |
|
function deleteDirectory ($dir) { |
| 569 |
|
rmdir($dir); |
| 570 |
|
} |
| 571 |
|
|
| 572 |
|
function createDirectory ($dir) { |
| 573 |
|
mkdir($dir); |
| 574 |
|
} |
| 575 |
|
|
| 576 |
|
function forceCopy ($from, $to) { |
| 577 |
|
$todir = dirname($to); |
| 578 |
|
if (!file_exists($todir)) $this->createDirectory($todir); |
| 579 |
|
$name = mamboCore::getLastPart('/', $from); |
| 580 |
|
$this->deleteFile($to.$name); |
| 581 |
|
copy($from, $to); |
| 582 |
|
} |
| 583 |
|
|
| 584 |
|
|
| 585 |
/** |
/** |
| 586 |
* Function to strip additional / or \ in a path name |
* Function to strip additional / or \ in a path name |
| 587 |
* @param string The path |
* @param string The path |
| 657 |
else $this->path = $path.'/'; |
else $this->path = $path.'/'; |
| 658 |
} |
} |
| 659 |
|
|
| 660 |
function &listFiles ($pattern='', $type='file', $recurse=false, $fullpath=false) { |
function &listAll ($type='file', $recurse=false, $fullpath=false) { |
| 661 |
$results = array(); |
$results = array(); |
| 662 |
if ($dir = @opendir($this->path)) { |
if ($dir = @opendir($this->path)) { |
| 663 |
while ($file = readdir($dir)) { |
while ($file = readdir($dir)) { |
| 664 |
if (($file == 'index.html') OR (substr($file,0,1) == '.')) continue; |
if ($file == '.' OR $file == '..') continue; |
| 665 |
if (is_dir($this->path.$file)) { |
if (is_dir($this->path.$file)) { |
| 666 |
if ($recurse) { |
if ($recurse) { |
| 667 |
$subdir =& new mosDirectory($this->path.$file); |
$subdir = new mosDirectory($this->path.$file); |
| 668 |
$results = array_merge($results, $subdir->listFiles($pattern, $type, $recurse, $fullpath)); |
$results = array_merge($results, $subdir->listAll($type, $recurse, $fullpath)); |
| 669 |
unset($subdir); |
unset($subdir); |
| 670 |
} |
} |
| 671 |
if ($type == 'file') continue; |
if ($type == 'file') continue; |
| 672 |
} |
} |
| 673 |
elseif ($type == 'dir') continue; |
elseif ($type == 'dir') continue; |
|
if ($pattern AND !preg_match( "/$pattern/", $file )) continue; |
|
| 674 |
if ($fullpath) $results[] = $this->path.$file; |
if ($fullpath) $results[] = $this->path.$file; |
| 675 |
else $results[] = $file; |
else $results[] = $file; |
| 676 |
} |
} |
| 679 |
return $results; |
return $results; |
| 680 |
} |
} |
| 681 |
|
|
| 682 |
|
function soleDir () { |
| 683 |
|
$found = ''; |
| 684 |
|
if ($dir = @opendir($this->path)) { |
| 685 |
|
while ($file = readdir($dir)) { |
| 686 |
|
if ($file == '.' OR $file == '..') continue; |
| 687 |
|
if (is_dir($this->path.$file)) { |
| 688 |
|
if ($found) return ''; |
| 689 |
|
else $found = $file; |
| 690 |
|
} |
| 691 |
|
else return ''; |
| 692 |
|
} |
| 693 |
|
closedir($dir); |
| 694 |
|
} |
| 695 |
|
return $found; |
| 696 |
|
} |
| 697 |
|
|
| 698 |
|
function deleteAll () { |
| 699 |
|
if (!file_exists($this->path)) return; |
| 700 |
|
$subdirs =& $this->listAll ('dir', false, true); |
| 701 |
|
foreach ($subdirs as $subdir) { |
| 702 |
|
$subdirectory = new mosDirectory($subdir); |
| 703 |
|
$subdirectory->deleteAll(); |
| 704 |
|
unset($subdirectory); |
| 705 |
|
} |
| 706 |
|
$filemanager = mosFileManager::getInstance(); |
| 707 |
|
$files =& $this->listAll ('file', false, true); |
| 708 |
|
foreach ($files as $file) $filemanager->deleteFile($file); |
| 709 |
|
$filemanager->deleteDirectory($this->path); |
| 710 |
|
} |
| 711 |
|
|
| 712 |
|
function createFresh () { |
| 713 |
|
$this->deleteAll(); |
| 714 |
|
$filemanager = mosFileManager::getInstance(); |
| 715 |
|
$filemanager->createDirectory($this->path); |
| 716 |
|
return true; |
| 717 |
|
} |
| 718 |
|
|
| 719 |
|
function createIfNeeded () { |
| 720 |
|
if (!file_exists($this->path)) { |
| 721 |
|
$filemanager = mosFileManager::getInstance(); |
| 722 |
|
$filemanager->createDirectory($this->path); |
| 723 |
|
} |
| 724 |
|
} |
| 725 |
|
|
| 726 |
|
function &listFiles ($pattern='', $type='file', $recurse=false, $fullpath=false) { |
| 727 |
|
$results = array(); |
| 728 |
|
$all =& $this->listAll($type, $recurse, $fullpath); |
| 729 |
|
foreach ($all as $file) { |
| 730 |
|
$name = basename($file); |
| 731 |
|
if ($pattern AND !preg_match( "/$pattern/", $name )) continue; |
| 732 |
|
if (($name != 'index.html') AND ($name[0] != '.')) $results[] = $file; |
| 733 |
|
} |
| 734 |
|
return $results; |
| 735 |
|
} |
| 736 |
|
|
| 737 |
function getSize () { |
function getSize () { |
| 738 |
$totalsize = 0; |
$totalsize = 0; |
| 739 |
$files = $this->listFiles(); |
$files = $this->listFiles(); |
| 1152 |
* Constructor |
* Constructor |
| 1153 |
*/ |
*/ |
| 1154 |
function mosMambotHandler() { |
function mosMambotHandler() { |
| 1155 |
if (mamboCore::is_set('currentUser')) { |
$my = mamboCore::is_set('currentUser') ? mamboCore::get('currentUser') : null; |
| 1156 |
$cu = mamboCore::get('currentUser'); |
$gid = $my ? $my->gid : 0; |
|
$gid = $cu->gid; |
|
|
} |
|
|
else $gid = 0; |
|
| 1157 |
$this->_events = array(); |
$this->_events = array(); |
| 1158 |
$database = mamboDatabase::getInstance(); |
$database = mamboDatabase::getInstance(); |
| 1159 |
$database->setQuery( "SELECT folder, element, published, params, CONCAT_WS('/',folder,element) AS lookup" |
$database->setQuery( "SELECT folder, element, published, params, CONCAT_WS('/',folder,element) AS lookup" |
| 1445 |
*/ |
*/ |
| 1446 |
function &getInstance () { |
function &getInstance () { |
| 1447 |
static $mainframe; |
static $mainframe; |
| 1448 |
if (!isset($mainframe) && func_num_args()) { |
if (func_num_args()) { |
| 1449 |
$mainframe = func_get_arg(0); |
$args =& func_get_args(); |
| 1450 |
|
$mainframe = $args[0]; |
| 1451 |
} |
} |
| 1452 |
return $mainframe; |
if (isset($mainframe)) $result =& $mainframe; |
| 1453 |
|
else $result = null; |
| 1454 |
|
return $result; |
| 1455 |
} |
} |
| 1456 |
/** |
/** |
| 1457 |
* @param string |
* @param string |
| 1674 |
* |
* |
| 1675 |
*/ |
*/ |
| 1676 |
function getPath( $varname, $option='' ) { |
function getPath( $varname, $option='' ) { |
|
|
|
| 1677 |
$base = mamboCore::get('mosConfig_absolute_path'); |
$base = mamboCore::get('mosConfig_absolute_path'); |
| 1678 |
|
$origoption = $option; |
| 1679 |
if (!$option) $option = $this->_option; |
if (!$option) $option = $this->_option; |
| 1680 |
$name = substr($option,4); |
$name = substr($option,4); |
| 1681 |
$bac_admin = "$base/administrator/components/com_admin/"; |
$bac_admin = "$base/administrator/components/com_admin/"; |
| 1696 |
case 'class': return $this->tryFiles ($bco."$name.class.php", $baco."$name.class.php", $bi."$name.php"); |
case 'class': return $this->tryFiles ($bco."$name.class.php", $baco."$name.class.php", $bi."$name.php"); |
| 1697 |
case 'com_xml': return $this->tryFiles ($baco."$name.xml", $bco."$name.xml"); |
case 'com_xml': return $this->tryFiles ($baco."$name.xml", $bco."$name.xml"); |
| 1698 |
case 'mod0_xml': |
case 'mod0_xml': |
| 1699 |
if ($option) $path = $base."/modules/$option.xml"; |
if ($origoption) $path = $base."/modules/$option.xml"; |
| 1700 |
else $path = $base.'/modules/custom.xml'; |
else $path = $base.'/modules/custom.xml'; |
| 1701 |
return $this->tryFiles ($path); |
return $this->tryFiles ($path); |
| 1702 |
case 'mod1_xml': |
case 'mod1_xml': |
| 1703 |
if ($option) $path = $base."/administrator/modules/$option.xml"; |
if ($origoption) $path = $base."/administrator/modules/$option.xml"; |
| 1704 |
else $path = $base.'/administrator/modules/custom.xml'; |
else $path = $base.'/administrator/modules/custom.xml'; |
| 1705 |
return $this->tryFiles ($path); |
return $this->tryFiles ($path); |
| 1706 |
case 'bot_xml': return $this->tryFiles ($base."/mambots/$option.xml"); |
case 'bot_xml': return $this->tryFiles ($base."/mambots/$option.xml"); |
| 1707 |
case 'menu_xml': return $this->tryFiles ($base."/administrator/comonents/com_menus/$option/$option.xml"); |
case 'menu_xml': return $this->tryFiles ($base."/administrator/components/com_menus/$option/$option.xml"); |
| 1708 |
case 'installer_html': return $this->tryFiles($base."/administrator/components/com_installer/$option/$option.html.php"); |
case 'installer_html': return $this->tryFiles($base."/administrator/components/com_installer/$option/$option.html.php"); |
| 1709 |
case 'installer_class': return $this->tryFiles($base."/administrator/components/com_installer/$option/$option.class.php"); |
case 'installer_class': return $this->tryFiles($base."/administrator/components/com_installer/$option/$option.class.php"); |
| 1710 |
} |
} |
| 1738 |
$sql['browser'] = "INSERT INTO #__stats_agents (agent,type) VALUES ('$browser',0)"; |
$sql['browser'] = "INSERT INTO #__stats_agents (agent,type) VALUES ('$browser',0)"; |
| 1739 |
$sql['os'] = "INSERT INTO #__stats_agents (agent,type) VALUES ('$os',1)"; |
$sql['os'] = "INSERT INTO #__stats_agents (agent,type) VALUES ('$os',1)"; |
| 1740 |
$sql['domain'] = "INSERT INTO #__stats_agents (agent,type) VALUES ('$tldomain',2)"; |
$sql['domain'] = "INSERT INTO #__stats_agents (agent,type) VALUES ('$tldomain',2)"; |
| 1741 |
foreach ($stats as $stat) { |
if ($stats) foreach ($stats as $stat) { |
| 1742 |
if ($stat->type == 0) $sql['agents'] = "UPDATE #__stats_agents SET hits=(hits+1) WHERE agent='$browser' AND type=0"; |
if ($stat->type == 0) $sql['agents'] = "UPDATE #__stats_agents SET hits=(hits+1) WHERE agent='$browser' AND type=0"; |
| 1743 |
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"; |
| 1744 |
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"; |
| 2100 |
} |
} |
| 2101 |
} |
} |
| 2102 |
|
|
|
|
|
| 2103 |
if (!isset($adminside)) $adminside = 0; |
if (!isset($adminside)) $adminside = 0; |
| 2104 |
if (!isset($indextype)) $indextype = 1; |
if (!isset($indextype)) $indextype = 1; |
| 2105 |
|
|
|
|
|
| 2106 |
$configuration =& mamboCore::getMamboCore(); |
$configuration =& mamboCore::getMamboCore(); |
| 2107 |
$configuration->handleGlobals(); |
$configuration->handleGlobals(); |
| 2108 |
|
|
| 2186 |
require_once ($configuration->rootPath().'/includes/mambofunc.php'); |
require_once ($configuration->rootPath().'/includes/mambofunc.php'); |
| 2187 |
require_once ($configuration->rootPath().'/includes/mamboHTML.php'); |
require_once ($configuration->rootPath().'/includes/mamboHTML.php'); |
| 2188 |
require_once( $configuration->rootPath().'/administrator/includes/mosAdminMenus.php'); |
require_once( $configuration->rootPath().'/administrator/includes/mosAdminMenus.php'); |
|
require_once( $configuration->rootPath().'/includes/mamboxml.php' ); |
|
| 2189 |
require_once($configuration->rootPath().'/administrator/includes/admin.php'); |
require_once($configuration->rootPath().'/administrator/includes/admin.php'); |
| 2190 |
require_once( $configuration->rootPath() . '/includes/cmtclasses.php' ); |
require_once( $configuration->rootPath() . '/includes/cmtclasses.php' ); |
| 2191 |
$_MAMBOTS = mosMambotHandler::getInstance(); |
$_MAMBOTS = mosMambotHandler::getInstance(); |
| 2224 |
|
|
| 2225 |
$mainframe =& new mosMainFrame($database, $option, '.'); |
$mainframe =& new mosMainFrame($database, $option, '.'); |
| 2226 |
$session = mosSession::getCurrent(); |
$session = mosSession::getCurrent(); |
|
|
|
| 2227 |
if ($option == 'login') $configuration->handleLogin($session); |
if ($option == 'login') $configuration->handleLogin($session); |
| 2228 |
elseif ($option == 'logout') $configuration->handleLogout($session); |
elseif ($option == 'logout') $configuration->handleLogout($session); |
| 2229 |
|
|
| 2239 |
require_once( $configuration->rootPath().'/includes/mambo.php' ); |
require_once( $configuration->rootPath().'/includes/mambo.php' ); |
| 2240 |
require_once ($configuration->rootPath().'/includes/mambofunc.php'); |
require_once ($configuration->rootPath().'/includes/mambofunc.php'); |
| 2241 |
require_once ($configuration->rootPath().'/includes/mamboHTML.php'); |
require_once ($configuration->rootPath().'/includes/mamboHTML.php'); |
|
require_once( $configuration->rootPath().'/includes/mamboxml.php' ); |
|
| 2242 |
|
|
| 2243 |
if ($indextype == 2 AND $do_pdf == 1 ) { |
if ($indextype == 2 AND $do_pdf == 1 ) { |
| 2244 |
include_once('includes/pdf.php'); |
include_once('includes/pdf.php'); |
| 2314 |
} |
} |
| 2315 |
} |
} |
| 2316 |
|
|
|
|
|
| 2317 |
$configuration->doGzip(); |
$configuration->doGzip(); |
| 2318 |
} |
} |
| 2319 |
// displays queries performed for page |
// displays queries performed for page |