setQuery( $query );
$id = $database->loadResult();
$mambot = new mosMambot( $database );
$mambot->load( $id );
$mambotParams =& new mosParameters( $mambot->params );
$config['popupAutorun'] = $mambotParams->get( 'popupAutorun', '1' );
$config['contentAutorun'] = $mambotParams->get( 'contentAutorun', '0' );
$config['debug'] = $mambotParams->get( 'debug', '0' );
# get current template path
$query = "SELECT template FROM #__templates_menu WHERE client_id='0' AND menuid='0'";
$database->setQuery( $query );
$config['j_template'] = $database->loadResult();
// Assigned template
if ( isset( $Itemid ) && $Itemid != "" && $Itemid != 0 ) {
$query = "SELECT template FROM #__templates_menu WHERE client_id='0' AND menuid='$Itemid' LIMIT 1";
$database->setQuery( $query );
$config['j_template'] = $database->loadResult() ? $database->loadResult() : $config['j_template'];
}
return $config;
}
function outputPlayer2($type, $path, $width, $height, $mode, $playerid, $params, $urlparams) {
global $mosConfig_live_site, $mosConfig_absolute_path;
$config = getConfig();
if (!$playerid) $playerid=$params;
$path = html_entity_decode($path);
$template = "";
if (is_dir("$mosConfig_absolute_path/templates/".$config['j_template']."/mgmediabot")) {
$templatesdir = "$mosConfig_absolute_path/templates/".$config['j_template']."/mgmediabot";
} else {
$templatesdir = "$mosConfig_absolute_path/mambots/content/mgmediabot2/templates";
}
$ap = Array("1","0");
if ($templateshandle = opendir($templatesdir)) {
while (false !== ($file = readdir($templateshandle))) {
if ($file != "." && $file != ".." && preg_match("#tmpl$#", $file)) {
$contents = file_get_contents($templatesdir."/".$file);
#echo $contents;
if (preg_match("#--start filetypes supported.*?types=.*?".$urlparams['type'].".*?--end filetypes supported(.*?)--start template(.*?)--end template#s", $contents, $matches1)) {
if (preg_match("#--start autoplay values.*?autoplay=(.*?)--end autoplay values#s", $matches1[1], $matches2)) {
$ap = explode(",", chop($matches2[1]));
}
$template = chop($matches1[2]);
$template = preg_replace("#\t#", "", $template);
break;
}
}
}
closedir($templateshandle);
}
if (isset($urlparams['autoplay'])) {
$autoplay = $urlparams['autoplay'];
} elseif ((($mode == "popup"|| $mode == "lightbox") && $config['popupAutorun']) || (($mode != "popup"|| $mode != "lightbox") && $config['contentAutorun'])) {
$autoplay = $ap[0];
} else {
$autoplay = $ap[1];
}
$urlparams['autoplay'] = $autoplay;
$urlparams['playerid'] = $playerid;
$urlparams['mosConfig_live_site'] = $mosConfig_live_site;
if ($template == "") {
$template = "No template of type ".$urlparams['type']." found!";
} else {
foreach ($urlparams as $key => $value) {
if (is_array($value)) {
if (count($value) > 0) {
$template = preg_replace("#\<\{$key.*?\}\>#i", $value[0], $template);
}
} else {
if ($value != "") {
$template = preg_replace("#\<\{$key.*?\}\>#i", $value, $template);
}
}
}
}
$template = preg_replace("#<\{.*?(default=(.*?)){0,1}\}>#s", "\\2", $template);
return $template;
}
function createPlaylist2($audiofile, $title = null, $author = null, $image = null, $link = null) {
global $mosConfig_absolute_path, $mosConfig_live_site;
$playlist = '' . "\n";
$playlist .= '
|
$|\s*?$#m", "", $line);
$line = preg_replace("#
|
|
#m", "|", $line); $line = preg_replace("#\|\|#m", "|", $line); return $line; } function parseQs2($qs) { global $mosConfig_live_site; $params = preg_split('#=|,|\|#', $qs); if (count($params) >0 && count($params)%2 == 0) { for ($i=0;$i