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 .= ''."\n"; $playlist .= "\t\n\n"; $counter = 0; for ($i = 0; $i\n"; } if (isset($image[$i])) { $playlist .= "\t\t\t".$image[$i]."\n"; } if (isset($link[$i])) { $playlist .= "\t\t\t".$link[$i]."\n"; } $playlist .= "\t\t\t".$audiofile[$i]."\n"; $playlist .= "\t\t\n\n"; $counter++; } $playlist .= ("\t\n"); $playlist .= (""); return $playlist; } function cleanLine($line) { $line = preg_replace("#\t|^\s*?|^
|
$|\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;$iget($playerid, false); $query = "SELECT params FROM #__mgmediabot_playerscache WHERE md5 = '$playerid'"; $database->setQuery( $query ); $params = $database->loadResult($database->query()); if ($params != "") { $urlparams = parseQs2($params); #print_r ($urlparams); if (!isset($urlparams["path"])) {$urlparams["path"] = Array(); $urlparams["path"][0] = "";} if (!isset($urlparams["title"])) {$urlparams["title"] = Array();} if (!isset($urlparams["author"])) {$urlparams["author"] = Array();} if (!isset($urlparams["image"])) {$urlparams["image"] = Array();} if (!isset($urlparams["link"])) {$urlparams["link"] = Array();} if (!isset($urlparams["width"])) {$urlparams["width"] = "";} if (!isset($urlparams["height"])) {$urlparams["height"] = "";} if ($mode == "script") { header("Content-type: text/javascript; charset=UTF-8"); $rows = explode("\n", outputPlayer2($urlparams['type'], $urlparams['path'][0],$urlparams['width'],$urlparams['height'], $lastmode, $playerid, $params, $urlparams)); $playerjs = ""; foreach ($rows as $key => $value) { $playerjs .= $value; } echo ""; } elseif ($mode == "playlist"){ $playlist = createPlaylist2($urlparams["path"], $urlparams["title"], $urlparams["author"], $urlparams["image"], $urlparams["link"]); header("Content-type: text/xml; charset=UTF-8"); echo $playlist; } elseif ($mode == "popup") { header("Content-type: text/html; charset=UTF-8"); echo ""; echo ""; echo "Mediaplayer"; echo ""; echo ""; echo ""; echo "
"; echo ""; echo "
"; echo ""; echo ""; } elseif ($mode == "lightbox") { header("Content-type: text/html; charset=UTF-8"); echo ""; echo ""; echo "Mediaplayer"; echo ""; echo ""; echo ""; echo "
"; echo ""; echo "
"; echo ""; echo ""; } } else { $warning = "Player $playerid was not found in cache!"; if ($mode == "script") { echo ""; } elseif ($mode == "popup") { echo $warning; } elseif ($mode == "playlist") { echo "\n"; } } } else { ?>