<?php
defined( '_VALID_MOS' ) or die( 'Restricted access' );
global $mosConfig_absolute_path, $mosConfig_live_site;
$numberimg			= $params->get('numberimg');
$folder 			= 'modules/js_flashrotator/img';
$width 				= $params->get('width');
$height 			= $params->get( 'height' );
$linktarget 		= $params->get('linktarget' );
$transition 		= $params->get( 'transition' );
$lightcolor			= $params->get( 'lightcolor' );
$frontcolor 		= $params->get( 'frontcolor' );
$backcolor 			= $params->get( 'backcolor' );
$rotatetime 		= $params->get( 'rotatetime' );
$debug				= ($params->get( 'debug' ));
$autostart			= ($params->get('autostart'));
if ($autostart == 1) { $Myautostart = "true"; }
if ($autostart == 0) { $Myautostart = "false"; }
$repeat 			= ($params->get('repeat'));
if ($repeat == 1) { $Myrepeat = "true"; }
if ($repeat == 0) { $Myrepeat = "false"; }
if ($repeat == 2) { $Myrepeat = "list"; }
$shuffle 			= ($params->get('shuffle'));
if ($shuffle == 1) { $Myshuffle = "true"; }
if ($shuffle == 0) { $Myshuffle = "false"; }
$shownavigation 	= ($params->get( 'shownavigation' ));
if ($shownavigation == 1) { $Mynavigation = "true"; }
if ($shownavigation == 0) { $Mynavigation = "false"; }
$showicons 			= ($params->get( 'showicons' ));
if ($showicons == 1) { $Myshowicons = "true"; }
if ($showicons == 0) { $Myshowicons = "false"; }
$linkfromdisplay 	= ($params->get( 'linkfromdisplay' ));
if ($linkfromdisplay == 1) { $Mylinkfromdisplay = "true"; }
if ($linkfromdisplay == 0) { $Mylinkfromdisplay = "false"; }
$overstretch		= ($params->get( 'overstretch' ));
if ($overstretch == 1) { $Myoverstretch = "true"; }
if ($overstretch == 0) { $Myoverstretch = "false"; }
if ($overstretch == 2) { $Myoverstretch = "fit"; }
if ($overstretch == 3) { $Myoverstretch = "none"; }
$kenburns 	= ($params->get( 'kenburns' ));
if ($kenburns == 1) { $Mykenburns = "true"; }
if ($kenburns == 0) { $Mykenburns = "false"; }


$title1 			= $params->get( 'title1' );
$link1 				= $params->get( 'link1' );
$image1 			= $params->get( 'image1' );
$title2 			= $params->get( 'title2' );
$link2 				= $params->get( 'link2' );
$image2 			= $params->get( 'image2' );
$title3 			= $params->get( 'title3' );
$link3 				= $params->get( 'link3' );
$image3 			= $params->get( 'image3' );
$title4 			= $params->get( 'title4' );
$link4				= $params->get( 'link4' );
$image4 			= $params->get( 'image4' );
$title5 			= $params->get( 'title5' );
$link5				= $params->get( 'link5' );
$image5 			= $params->get( 'image5' );
$title6 			= $params->get( 'title6' );
$link6				= $params->get( 'link6' );
$image6 			= $params->get( 'image6' );
$title7 			= $params->get( 'title7' );
$link7				= $params->get( 'link7' );
$image7 			= $params->get( 'image7' );
$title8 			= $params->get( 'title8' );
$link8				= $params->get( 'link8' );
$image8 			= $params->get( 'image8' );
$title9 			= $params->get( 'title9' );
$link9				= $params->get( 'link9' );
$image9 			= $params->get( 'image9' );
$title10 			= $params->get( 'title10' );
$link10				= $params->get( 'link10' );
$image10 			= $params->get( 'image10' );
$title11 			= $params->get( 'title11' );
$link11				= $params->get( 'link11' );
$image11 			= $params->get( 'image11' );
$title12 			= $params->get( 'title12' );
$link12				= $params->get( 'link12' );
$image12 			= $params->get( 'image12' );
$title13 			= $params->get( 'title13' );
$link13				= $params->get( 'link13' );
$image13 			= $params->get( 'image13' );
$title14 			= $params->get( 'title14' );
$link14				= $params->get( 'link14' );
$image14 			= $params->get( 'image14' );
$title15 			= $params->get( 'title15' );
$link15				= $params->get( 'link15' );
$image15 			= $params->get( 'image15' );
$xmlout= "<playlist version=\"1\" xmlns=\"http://xspf.org/ns/0/\">";
$xmlout.= "<trackList>";
$xmlout.= "<track>";
$xmlout.= "<title>$title1</title>";
$xmlout.= "<info>$link1</info>";
$xmlout.= "<location>$folder/$image1</location>";
$xmlout.= "</track>";
$xmlout.= "<track>";
$xmlout.= "<title>$title2</title>";
$xmlout.= "<info>$link2</info>";
$xmlout.= "<location>$folder/$image2</location>";
$xmlout.= "</track>";
if ($numberimg > 2) {
$xmlout.= "<track>";
$xmlout.= "<title>$title3</title>";
$xmlout.= "<info>$link3</info>";
$xmlout.= "<location>$folder/$image3</location>";
$xmlout.= "</track>";
}
if ($numberimg > 3) {
$xmlout.= "<track>";
$xmlout.= "<title>$title4</title>";
$xmlout.= "<info>$link4</info>";
$xmlout.= "<location>$folder/$image4</location>";
$xmlout.= "</track>";
}
if ($numberimg > 4) {
$xmlout.= "<track>";
$xmlout.= "<title>$title5</title>";
$xmlout.= "<info>$link5</info>";
$xmlout.= "<location>$folder/$image5</location>";
$xmlout.= "</track>";
}
if ($numberimg > 5) {
$xmlout.= "<track>";
$xmlout.= "<title>$title6</title>";
$xmlout.= "<info>$link6</info>";
$xmlout.= "<location>$folder/$image6</location>";
$xmlout.= "</track>";
 }
if ($numberimg > 6) {
$xmlout.= "<track>";
$xmlout.= "<title>$title7</title>";
$xmlout.= "<info>$link7</info>";
$xmlout.= "<location>$folder/$image7</location>";
$xmlout.= "</track>";
}
if ($numberimg > 7) {
$xmlout.= "<track>";
$xmlout.= "<title>$title8</title>";
$xmlout.= "<info>$link8</info>";
$xmlout.= "<location>$folder/$image8</location>";
$xmlout.= "</track>";
}
if ($numberimg > 8) {
$xmlout.= "<track>";
$xmlout.= "<title>$title9</title>";
$xmlout.= "<info>$link9</info>";
$xmlout.= "<location>$folder/$image9</location>";
$xmlout.= "</track>";
}
if ($numberimg > 9) {
$xmlout.= "<track>";
$xmlout.= "<title>$title10</title>";
$xmlout.= "<info>$link10</info>";
$xmlout.= "<location>$folder/$image10</location>";
$xmlout.= "</track>";
}
if ($numberimg > 10) {
$xmlout.= "<track>";
$xmlout.= "<title>$title11</title>";
$xmlout.= "<info>$link11</info>";
$xmlout.= "<location>$folder/$image11</location>";
$xmlout.= "</track>";
}
if ($numberimg > 11) {
$xmlout.= "<track>";
$xmlout.= "<title>$title12</title>";
$xmlout.= "<info>$link12</info>";
$xmlout.= "<location>$folder/$image12</location>";
$xmlout.= "</track>";
}
if ($numberimg > 12) {
$xmlout.= "<track>";
$xmlout.= "<title>$title13</title>";
$xmlout.= "<info>$link13</info>";
$xmlout.= "<location>$folder/$image13</location>";
$xmlout.= "</track>";
}
if ($numberimg > 13) {
$xmlout.= "<track>";
$xmlout.= "<title>$title14</title>";
$xmlout.= "<info>$link14</info>";
$xmlout.= "<location>$folder/$image14</location>";
$xmlout.= "</track>";
}
if ($numberimg > 14) {
$xmlout.= "<track>";
$xmlout.= "<title>$title15</title>";
$xmlout.= "<info>$link15</info>";
$xmlout.= "<location>$folder/$image15</location>";
$xmlout.= "</track>";
}
$xmlout.= "</trackList>";
$xmlout.= "</playlist>";
$xml=fopen('modules/js_flashrotator/js_flashrotator.xml','w');
fwrite($xml,$xmlout);
fclose($xml);
if (!file_exists('modules/js_flashrotator/js_flashrotator' . $module->id . '.xml')) {
   touch('modules/js_flashrotator/js_flashrotator' . $module->id . '.xml');
}
$xml=fopen('modules/js_flashrotator/js_flashrotator' . $module->id . '.xml','w');
fwrite($xml,$xmlout);
fclose($xml);
$init= "<br />Flash Image Rotator Module by <a href=\"http://www.joomlashack.com\" title=\"Joomla Templates, Modules and Components\">Joomlashack</a>.";
$seotext= "<a href=\"$link1\">$title1</a><br /><a href=\"$link2\">$title2</a><br /><a href=\"$link3\">$title3</a><br /><a href=\"$link4\">$title4</a><br /><a href=\"$link5\">$title5</a><br />";
?>


<script type="text/javascript" src="<?php echo $mosConfig_live_site;?>/modules/js_flashrotator/swfobject.js"></script>


<p id="player" style="padding:0px; margin:0px; text-align:center;"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.<?php echo $init; ?><br /><?php echo $seotext; ?></p>
<script type="text/javascript" defer="defer">
	var s1 = new SWFObject("./modules/js_flashrotator/flashrotator.swf","rotator","<?php echo $width; ?>","<?php echo $height; ?>","7", "<?php echo $backcolor; ?>");
	s1.addVariable("file","modules/js_flashrotator/js_flashrotator<?php echo $module->id; ?>.xml");
	s1.addVariable("wmode","transparent");
	s1.addVariable("backcolor","0x<?php echo $backcolor; ?>");
	s1.addVariable("autostart","<?php echo $Myautostart; ?>");
	s1.addVariable("shownavigation","<?php echo $Mynavigation; ?>");
	s1.addVariable("kenburns","<?php echo $Mykenburns; ?>");
	s1.addVariable("linkfromdisplay","<?php echo $Mylinkfromdisplay; ?>");
	s1.addVariable("transition","<?php echo $transition ; ?>");
	s1.addVariable("shuffle","<?php echo $Myshuffle; ?>");
	s1.addVariable("repeat","<?php echo $Myrepeat; ?>");
	s1.addVariable("frontcolor","0x<?php echo $frontcolor; ?>");
	s1.addVariable("lightcolor","0x<?php echo $lightcolor; ?>");
	s1.addVariable("linktarget","<?php echo $linktarget; ?>");
	s1.addVariable("overstretch","<?php echo $Myoverstretch; ?>");
	s1.addVariable("rotatetime","<?php echo $rotatetime; ?>");
	s1.addVariable("showicons","<?php echo $Myshowicons; ?>");
	s1.write("player");
</script>




<?php
$debugger= "<div style=\"border:2px solid red; width:600px; background: #FFFFB3; color: black; padding:10px; z-index:9999; white-space:nowrap; display:block; position:relative; margin:0px auto;\" id=\"debug\">";
$debugger.= "<h2 style=\"padding:10px;\">Module Output Debug:</h2>";
$debugger.= "<ul style=\"list-style:none;text-indent:25px;\">";
$debugger.= "<li><b>Image Folder:</b> $folder</li>";
$debugger.= "<li><b>Height:</b> $height</li>";
$debugger.= "<li><b>Width:</b> $width</li>";
$debugger.= "<li><b>Movie Background Color:</b> #$backcolor</li>";
$debugger.= "<li><b>Tween Time:</b> $rotatetime</li>";
$debugger.= "<li><b>Transition:</b> $transition</li>";
$debugger.= "<li><b>Autostart:</b> $Myautostart</li>";
$debugger.= "<li><b>Repeat:</b> $Myrepeat</li>";
$debugger.= "<li><b>Shuffle:</b> $Myshuffle</li>";
$debugger.= "<li><b>Show Navigation:</b> $Mynavigation</li>";
$debugger.= "<li><b>Show Icons:</b> $Myshowicons</li>";
$debugger.= "<li><b>Images Linkable:</b> $Mylinkfromdisplay</li>";
$debugger.= "<li><b>Link Target:</b> $linktarget</li>";
$debugger.= "<li><b>Scaling Method:</b> $Myoverstretch</li>";
$debugger.= "<li><b>Text Color:</b> #$frontcolor</li>";
$debugger.= "<li><b>Text Over Color:</b> #$lightcolor</li>";
$debugger.= "<li><b>Text Underlay Color:</b> #$backcolor</li>";
$debugger.= "</ul>";
$debugger.= "<h2 style=\"padding:10px;\">Image Playist</h2>";
$debugger.= "<strong>Image 1:</strong><br>$title1<br>Image File:<a href=\"$mosConfig_live_site/modules/js_flashrotator/img/$image1\">$mosConfig_live_site/modules/js_flashrotator/img/$image1</a><br>Link: <a href=\"$link1\">$link1</a><br><br>";
$debugger.= "<strong>Image 2:</strong><br>$title2<br>Image File:<a href=\"$mosConfig_live_site/modules/js_flashrotator/img/$image2\">$mosConfig_live_site/modules/js_flashrotator/img/$image2</a><br>Link: <a href=\"$link2\">$link2</a><br><br>";
if ($numberimg > 2) {
$debugger.= "<strong>Image 3:</strong><br>$title3<br>Image File:<a href=\"$mosConfig_live_site/modules/js_flashrotator/img/$image3\">$mosConfig_live_site/modules/js_flashrotator/img/$image3</a><br>Link: <a href=\"$link3\">$link3</a><br><br>";
}
if ($numberimg > 3) {
$debugger.= "<strong>Image 4:</strong><br>$title4<br>Image File:<a href=\"$mosConfig_live_site/modules/js_flashrotator/img/$image4\">$mosConfig_live_site/modules/js_flashrotator/img/$image4</a><br>Link: <a href=\"$link4\">$link4</a><br><br>";
}
if ($numberimg > 4) {
$debugger.= "<strong>Image 5:</strong><br>$title5<br>Image File:<a href=\"$mosConfig_live_site/modules/js_flashrotator/img/$image5\">$mosConfig_live_site/modules/js_flashrotator/img/$image5</a><br>Link: <a href=\"$link5\">$link5</a><br><br>";
}
if ($numberimg > 5) {
$debugger.= "<strong>Image 6:</strong><br>$title6<br>Image File:<a href=\"$mosConfig_live_site/modules/js_flashrotator/img/$image6\">$mosConfig_live_site/modules/js_flashrotator/img/$image6</a><br>Link: <a href=\"$link6\">$link6</a><br><br>";
}
if ($numberimg > 6) {
$debugger.= "<strong>Image 7:</strong><br>$title7<br>Image File:<a href=\"$mosConfig_live_site/modules/js_flashrotator/img/$image7\">$mosConfig_live_site/modules/js_flashrotator/img/$image7</a><br>Link: <a href=\"$link7\">$link7</a><br><br>";
}
if ($numberimg > 7) {
$debugger.= "<strong>Image 8:</strong><br>$title8<br>Image File:<a href=\"$mosConfig_live_site/modules/js_flashrotator/img/$image8\">$mosConfig_live_site/modules/js_flashrotator/img/$image8</a><br>Link: <a href=\"$link8\">$link8</a><br><br>";
}
if ($numberimg > 8) {
$debugger.= "<strong>Image 9:</strong><br>$title9<br>Image File:<a href=\"$mosConfig_live_site/modules/js_flashrotator/img/$image9\">$mosConfig_live_site/modules/js_flashrotator/img/$image9</a><br>Link: <a href=\"$link9\">$link9</a><br><br>";
}
if ($numberimg > 9) {
$debugger.= "<strong>Image 10:</strong><br>$title10<br>Image File:<a href=\"$mosConfig_live_site/modules/js_flashrotator/img/$image10\">$mosConfig_live_site/modules/js_flashrotator/img/$image10</a><br>Link: <a href=\"$link10\">$link10</a><br><br>";
}
if ($numberimg > 10) {
$debugger.= "<strong>Image 11:</strong><br>$title11<br>Image File:<a href=\"$mosConfig_live_site/modules/js_flashrotator/img/$image11\">$mosConfig_live_site/modules/js_flashrotator/img/$image11</a><br>Link: <a href=\"$link11\">$link11</a><br><br>";
}
if ($numberimg > 11) {
$debugger.= "<strong>Image 12:</strong><br>$title12<br>Image File:<a href=\"$mosConfig_live_site/modules/js_flashrotator/img/$image12\">$mosConfig_live_site/modules/js_flashrotator/img/$image12</a><br>Link: <a href=\"$link12\">$link12</a><br><br>";
}
if ($numberimg > 12) {
$debugger.= "<strong>Image 13:</strong><br>$title13<br>Image File:<a href=\"$mosConfig_live_site/modules/js_flashrotator/img/$image13\">$mosConfig_live_site/modules/js_flashrotator/img/$image13</a><br>Link: <a href=\"$link13\">$link6</a><br><br>";
}
if ($numberimg > 13) {
$debugger.= "<strong>Image 14:</strong><br>$title14<br>Image File:<a href=\"$mosConfig_live_site/modules/js_flashrotator/img/$image14\">$mosConfig_live_site/modules/js_flashrotator/img/$image14</a><br>Link: <a href=\"$link14\">$link14</a><br><br>";
}
if ($numberimg > 14) {
$debugger.= "<strong>Image 15:</strong><br>$title15<br>Image File:<a href=\"$mosConfig_live_site/modules/js_flashrotator/img/$image15\">$mosConfig_live_site/modules/js_flashrotator/img/$image15</a><br>Link: <a href=\"$link15\">$link15</a><br><br>";
}
$debugger.= "<b>SWF Writeable?</b>: <a href=\"./modules/js_flashrotator/flashrotator.swf \">Check</a><br>";
$debugger.= "<b>XML Writeable?</b>: <a href=\"modules/js_flashrotator/js_flashrotator$module->id.xml \">Check</a>";
$debugger.= "</div>";
; ?>
<?php if ( $debug == "1" )
echo $debugger
?>
