registerFunction( 'onAfterStart', 'botRokboxSystem' ); // looks for a reference to mootools in the if (!function_exists('mootoolsExists')) { function mootoolsExists() { global $mainframe; foreach($mainframe->_head['custom'] as $row) { if (strpos($row,'mootools') > 0 && strpos($row,'.js') > 0) { return true; } } return false; } } function botRokboxSystem() { global $database, $my, $mainframe, $mosConfig_live_site; $template_path = $mosConfig_live_site ."/templates/" . $mainframe->getTemplate(); // load rokbox properties $query = "SELECT params" . "\n FROM #__mambots" . "\n WHERE element = 'rokbox'" . "\n AND folder = 'system'" ; $database->setQuery( $query ); $database->loadObject($mambot); $params = new mosParameters( $mambot->params ); $theme = $params->get('theme', 'light'); $rokboxJS = $mosConfig_live_site."/mambots/system/rokbox/rokbox.js"; $remoteFolder = $mosConfig_live_site."/mambots/system/rokbox/themes"; $localFolder = dirname($_SERVER['SCRIPT_FILENAME']) . "/mambots/system/rokbox/themes"; if ($theme == 'custom') $theme = $params->get('custom-theme', 'sample'); $config_exists = file_exists($localFolder . "/$theme/rokbox-config.js"); $rokboxFix = false; $rokboxConfig = false; $rokbox = "\r\n"; $rokboxStyle = "\r\n"; // Load style for ie6 or ie7 if exist $browser = getBrowser(); if ($browser == 7 || $browser == 6) { if (file_exists($localFolder . "/$theme/rokbox-style-ie$browser.php")) { $rokboxFix = "\r\n"; } elseif (file_exists($localFolder . "/$theme/rokbox-style-ie$browser.css")) { $rokboxFix = "\r\n"; } } if ($params->get('custom-legacy', 0) == 1) { $rokboxConfig = loadManualConfiguration($theme, $params); } else { if ($config_exists) { $rokboxConfig = "\r\n"; } else $rokboxConfig = loadManualConfiguration($theme, $params); } if ($params->get('jslib', 1) && !mootoolsExists()) { $mainframe->addCustomHeadTag(""); } $mainframe->addCustomHeadTag($rokbox); $mainframe->addCustomHeadTag($rokboxStyle); if ($rokboxFix != false) $mainframe->addCustomHeadTag($rokboxFix); if ($rokboxConfig != false) $mainframe->addCustomHeadTag($rokboxConfig); } function getBrowser() { $agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : false; $ie_version = false; if (eregi("msie", $agent) && !eregi("opera", $agent)){ $val = explode(" ",stristr($agent, "msie")); $ver = explode(".", $val[1]); $ie_version = $ver[0]; $ie_version = ereg_replace("[^0-9,.,a-z,A-Z]", "", $ie_version); } return $ie_version; } function loadManualConfiguration($theme, $params) { $manual = "\r\n"; return $manual; } ?>