<?php
/**
 * SEF module for Joomla!
 *
 * @author      $Author: michal $
 * @copyright   ARTIO s.r.o., http://www.artio.cz
 * @package     JoomSEF
 * @version     $Name$, ($Revision: 4994 $, $Date: 2005-11-03 20:50:05 +0100 (??t, 03 XI 2005) $)
 */

// Security check to ensure this file is being included by a parent file.
if (!defined('_VALID_MOS')) die('Direct Access to this location is not allowed.');

/**
 * @package JoomSEF
 */
class HTML_sef
{

    function configuration(&$lists, $txt404)
    {
        global $sefConfig, $sef_config_file;
	?>
		<table class="adminheading">
		<tr><th>
		<?php
		echo _COM_SEF_TITLE_CONFIG.(file_exists($sef_config_file) ? (is_writable($sef_config_file) ? _COM_SEF_WRITEABLE : _COM_SEF_UNWRITEABLE) : _COM_SEF_USING_DEFAULT)
		?>
		<br/><font class="small" align="left"><a href="index2.php?option=com_sef"><?php echo _COM_SEF_BACK?></a></font>
		</th></tr>
		</table>
		<?php if (!$GLOBALS['mosConfig_sef']) {
		    echo _COM_SEF_DISABLED;
		}
		$x = 0;
	       	?>
	        <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>
	        <script language="Javascript" src="<?php echo $GLOBALS['mosConfig_live_site']; ?>/includes/js/overlib_mini.js"></script>
	        <script language="Javascript">
	        function submitbutton(pressbutton) {
	            var purge = confirm("<?php echo _COM_SEF_PURGE_URLS; ?>");
	            if (purge) document.getElementById("purge").value = "1";
	            
	            <?php getEditorContents( 'editor1', 'introtext') ; ?>
	            submitform(pressbutton);
	        }
	        //-->
					</script>
	    <form action="index2.php?option=com_sef&task=saveconfig" method="post" name="adminForm" id="adminForm">
        <table class="adminform">
	        <tr>
	            <th colspan="4"><?php echo _COM_SEF_TITLE_BASIC; ?></th>
	        </tr>
	        <?php //Dit zit hier niet goed; ?>
	        <tr<?php $x++; echo (($x % 2) ? '':' class="row1"' );?>>
	            <td width="200"><?php echo _COM_SEF_ENABLED;?>?</td>
	            <td width="100"><?php echo $lists['enabled'];?></td>
	            <td><?php echo mosToolTip(_COM_SEF_TT_ENABLED,_COM_SEF_ENABLED);?></td>
	            <td rowspan="13" valign="top" align="right"><b>
	             <?php echo _COM_SEF_DEF_404_PAGE;?></b><br/><br/>
			<?php
			// parameters : areaname, content, hidden field, width, height, cols, rows
			editorArea('editor1', $txt404, 'introtext', '450', '150', '50', '11');
			?>
	            </td>
	        </tr>
	        <tr<?php $x++; echo (($x % 2) ? '':' class="row1"' );?>>
	            <td width="200"><?php echo _COM_SEF_REPLACE_CHAR;?></td>
	            <td width="100"><input type="text" name="replacement" value="<?php echo $sefConfig->replacement;?>" size="1" maxlength="1"></td>
	            <td><?php echo mosToolTip(_COM_SEF_TT_REPLACE_CHAR,_COM_SEF_REPLACE_CHAR);?></td>
	        </tr>
	        <tr<?php $x++; echo (($x % 2) ? '':' class="row1"' );?>>
	            <td width="200"><?php echo _COM_SEF_PAGEREP_CHAR;?></td>
	            <td width="100"><input type="text" name="pagerep" value="<?php echo $sefConfig->pagerep;?>" size="1" maxlength="1"></td>
	            <td><?php echo mosToolTip(_COM_SEF_TT_PAGEREP_CHAR,_COM_SEF_PAGEREP_CHAR);?></td>
	        </tr>
	        <tr<?php $x++; echo (($x % 2) ? '':' class="row1"' );?>>
	            <td width="200"><?php echo _COM_SEF_STRIP_CHAR;?></td>
	            <td width="100"><input type="text" name="stripthese" value="<?php echo $sefConfig->stripthese;?>" size="60" maxlength="255"></td>
	            <td><?php echo mosToolTip(_COM_SEF_TT_STRIP_CHAR,_COM_SEF_STRIP_CHAR);?></td>
	        </tr>
	        <tr<?php $x++; echo (($x % 2) ? '':' class="row1"' );?>>
	            <td width="200"><?php echo _COM_SEF_FRIENDTRIM_CHAR;?></td>
	            <td width="100"><input type="text" name="friendlytrim" value="<?php echo $sefConfig->friendlytrim;?>" size="60" maxlength="255"></td>
	            <td><?php echo mosToolTip(_COM_SEF_TT_FRIENDTRIM_CHAR,_COM_SEF_FRIENDTRIM_CHAR);?></td>
	        </tr>
	        <tr<?php $x++; echo (($x % 2) ? '':' class="row1"' );?>>
	            <td width="200"><?php echo _COM_SEF_USE_ALIAS;?>?</td>
	            <td width="100"><?php echo $lists['useAlias'];?></td>
	            <td><?php echo mosToolTip(_COM_SEF_TT_USE_ALIAS,_COM_SEF_USE_ALIAS);?></td>
	        </tr>
	        <tr<?php $x++; echo (($x % 2) ? '':' class="row1"' );?>>
	            <td width="200"><?php echo _COM_SEF_SUFFIX;?></td>
	            <td width="100"><input type="text" name="suffix" value="<?php echo $sefConfig->suffix; ?>" size="6" maxlength="6"></td>
	            <td><?php echo mosToolTip(_COM_SEF_TT_SUFFIX,_COM_SEF_SUFFIX);?></td>
	        </tr>
	        <tr<?php $x++; echo (($x % 2) ? '':' class="row1"' );?>>
	            <td width="200"><?php echo _COM_SEF_ADDFILE;?></td>
	            <td width="100"><input type="text" name="addFile" value="<?php echo $sefConfig->addFile; ?>" size="60" maxlength="60"></td>
	            <td><?php echo mosToolTip(_COM_SEF_TT_ADDFILE,_COM_SEF_ADDFILE);?></td>
	        </tr>
	        <tr<?php $x++; echo (($x % 2) ? '':' class="row1"' );?>>
	            <td width="200"><?php echo _COM_SEF_PAGETEXT;?></td>
	            <td width="100"><input type="text" name="pagetext" value="<?php echo $sefConfig->pagetext; ?>" size="10" maxlength="20"></td>
	            <td><?php echo mosToolTip(_COM_SEF_TT_PAGETEXT,_COM_SEF_PAGETEXT);?></td>
	        </tr>
	        <tr<?php $x++; echo (($x % 2) ? '':' class="row1"' );?>>
	            <td width="200"><?php echo _COM_SEF_LOWER;?>?</td>
	            <td width="100"><?php echo $lists['lowerCase'];?></td>
	            <td><?php echo mosToolTip(_COM_SEF_TT_LOWER,_COM_SEF_LOWER);?></td>
	        </tr>
	        <tr<?php $x++; echo (($x % 2) ? '':' class="row1"' );?>>
	            <td width="200"><?php echo _COM_SEF_SHOW_SECT;?>?</td>
	            <td width="100"><?php echo $lists['showSection'];?></td>
	            <td><?php echo mosToolTip(_COM_SEF_TT_SHOW_SECT, _COM_SEF_SHOW_SECT);?></td>
	        </tr>
	        <tr<?php $x++; echo (($x % 2) ? '':' class="row1"' );?>>
	            <td width="200"><?php echo _COM_SEF_SHOW_CAT;?>?</td>
	            <td width="100"><?php echo $lists['showCat'];?></td>
	            <td><?php echo mosToolTip(_COM_SEF_TT_HIDE_CAT, _COM_SEF_SHOW_CAT);?></td>
	        </tr>
	        <tr<?php $x++; echo (($x % 2) ? '':' class="row1"' );?>>
	            <td width="200"><?php echo _COM_SEF_404PAGE;?></td>
	            <td width="100"><?php echo $lists['page404'];?></td>
	            <td><?php echo mosToolTip(_COM_SEF_TT_404PAGE, _COM_SEF_404PAGE);?></td>
	        </tr>
	        <tr>
	            <th colspan="4"><?php echo _COM_SEF_TITLE_ADV_CONF;?></th>
	        </tr>
	        <tr<?php $x++; echo (($x % 2) ? '':' class="row1"' );?>>
	            <td width="200"><?php echo _COM_SEF_REPLACEMENTS;?></td>
	            <td width="100"><textarea name="replacements" cols="60" rows="5"><?php echo $sefConfig->replacements;?></textarea></td>
	            <td><?php echo mosToolTip(_COM_SEF_TT_REPLACEMENTS, _COM_SEF_REPLACEMENTS);?></td>
	            <td></td>
	        </tr>
<?php if (is_dir($GLOBALS['mosConfig_absolute_path'] .'/components/com_joomfish')) { ?>
	        <tr>
	            <th colspan="4"><?php echo _COM_SEF_JOOMFISH_CONF;?></th>
	        </tr>
	        <tr<?php $x++; echo (($x % 2) ? '':' class="row1"' );?>>
	            <td width="200"><?php echo _COM_SEF_JF_LANG_TO_PATH;?></td>
	            <td width="100"><?php echo $lists['langToPath'];?></td>
	            <td><?php echo mosToolTip(_COM_SEF_TT_JF_LANG_TO_PATH, _COM_SEF_JF_LANG_TO_PATH);?></td>
	            <td></td>
	        </tr>
	        <tr<?php $x++; echo (($x % 2) ? '':' class="row1"' );?>>
	            <td width="200"><?php echo _COM_SEF_JF_ALWAYS_USE_LANG;?></td>
	            <td width="100"><?php echo $lists['alwaysUseLang'];?></td>
	            <td><?php echo mosToolTip(_COM_SEF_TT_JF_ALWAYS_USE_LANG, _COM_SEF_JF_ALWAYS_USE_LANG);?></td>
	            <td></td>
	        </tr>
	        <tr<?php $x++; echo (($x % 2) ? '':' class="row1"' );?>>
	            <td width="200"><?php echo _COM_SEF_JF_TRANSLATE;?></td>
	            <td width="100"><?php echo $lists['translateNames'];?></td>
	            <td><?php echo mosToolTip(_COM_SEF_TT_JF_TRANSLATE, _COM_SEF_JF_TRANSLATE);?></td>
	            <td></td>
	        </tr>
<?php } ?>
	        <tr>
	            <th colspan="4"><?php echo _COM_SEF_TITLE_COM_CONF;?></th>
	        </tr>
	<?php
	foreach($lists['adv_config'] as $key => $option) {
	    $x++;
	    echo '<tr'.(($x % 2) ? '':' class="row1"' ).">\n";
	    echo '<td width="200">'.$key."</td>\n";
	    echo '<td width="100">'.$option."</td>\n";
	    echo "<td>".mosToolTip(_COM_SEF_TT_ADV,_COM_SEF_TT_ADV4.$key)."</td>\n";
	    echo "<td></td>\n";
	    echo "</tr>\n";
	}
	?>
	        <tr>
	            <th colspan="4"></th>
	        </tr>
	    </table>
	    <input type="hidden" name="id" value="">
	    <input type="hidden" name="task" value="saveconfig">
	    <input type="hidden" name="option" value="com_sef">
	    <input type="hidden" name="section" value="config">
	    <input type="hidden" name="purge" value="0">
	    </form>
    <?php
    }

    function viewSEF(&$rows, &$lists, $pageNav, $option, $viewmode = 0)
    {
        global $my;

        if ($viewmode == 0) $path = _COM_SEF_VIEWURLDESC;
        elseif ($viewmode == 1) $path = _COM_SEF_VIEW404DESC;
        else $path = _COM_SEF_VIEWCUSTOMDESC;
        showNavigationBar($path);
		?>
		<form action="index2.php" method="post" name="adminForm">
		<table class="adminheading" cellpadding="2" cellspacing="2">
		<tr>
			<th>
			<?php echo _COM_SEF_TITLE_MANAGER; ?>
			<br/><font class="small" align="left"><a href="index2.php?option=com_sef"><?php echo _COM_SEF_BACK?></a></font>
			</th>
			<td nowrap >
			<?php
			if ($viewmode == 2) {
			?><br/>
			<a href="index2.php?option=<?php echo $option; ?>&task=import_export"><?php echo _COM_SEF_IMPORT_EXPORT; ?></a>&nbsp;&nbsp;
			<?php } else { ?>
			&nbsp;
			</td>
			<?php } ?>
			<td align="right">
			<?php echo _COM_SEF_VIEWMODE.'<br/>'.$lists['viewmode'];?>
			</td>
			<td align="right">
			<?php echo _COM_SEF_SORTBY.$lists['sortby'];?>
			</td>
		</tr>
		<tr>
		  <td>
		  </td>
		  <?php if ($viewmode == 1) echo "<td></td>"; ?>
		  <td align="right">
		    <?php
		    if ($viewmode == 1) echo _COM_SEF_FILTER404;
		    else echo _COM_SEF_FILTERSEF;
		    echo $lists['filterSEF'];
		    ?>
		  </td>
		  <?php if ($viewmode != 1) { ?>
    		<td align="right">
    		  <?php echo _COM_SEF_FILTERREAL.$lists['filterReal']; ?>
    		</td>
    	<?php } ?>
		  <td align="right">
		    <?php echo _COM_SEF_FILTERCOMPONENT.$lists['comList']; ?>
		   </td>
		</tr>
		</table>

		<?php
		// Top navigation bar
		$pageNavTop  = '<table class="adminlist"><tr><th colspan="3">';
		$pageNavTop .= $pageNav->getPagesLinks();
		$pageNavTop .= '</th></tr></table>';
		echo $pageNavTop;
		?>
		
		<table class="adminlist">
		<tr>
			<th width="20px">
			#
			</th>
			<th width="20px">
			<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows ); ?>);" />
			</th>
			<th class="title" width="50px">
			<?php echo _COM_SEF_HITS;?>
			</th>
			<th class="title">
			<?php echo (($viewmode == 1) ? _COM_SEF_DATEADD : _COM_SEF_SEFURL); ?>
			</th>
			<th>
			<?php echo (($viewmode == 1) ? _COM_SEF_URL : _COM_SEF_REALURL); ?>
			</th>
		</tr>
		<?php
		$k = 0;
		//for ($i=0, $n=count( $rows ); $i < $n; $i++) {
		foreach (array_keys($rows) as $i) {
		    $row = &$rows[$i];
			?>
			<tr class="<?php echo 'row'. $k; ?>">
				<td align="center">
				<?php echo $pageNav->rowNumber($i); ?>
				</td>
				<td>
				<?php echo mosHTML::idBox($i, $row->id, false); ?>
				</td>
				<td>
				<?php echo $row->cpt; ?>
				</td>
				<td style="text-align:left;">
				<?php if ($viewmode == 1) {?>
					<?php echo $row->dateadd;?>
				<?php } else { ?>
					<a href="#edit" onclick="return listItemTask('cb<?php echo $i;?>','edit')">
					<?php echo $row->oldurl;?>
					</a>
				<?php } ?>
				</td>
				<td style="text-align:left;" width="80%">
				<?php if ($viewmode == 1) {?>
					<a href="#edit" onclick="return listItemTask('cb<?php echo $i;?>','edit')">
					<?php echo $row->oldurl;?>
					</a>
				<?php }else echo $row->newurl;?>
				</td>
			</tr>
			<?php
			$k = 1 - $k;
		}
		?>
		</table>
		<?php echo $pageNav->getListFooter(); ?>

		<input type="hidden" name="option" value="<?php echo $option;?>" />
		<input type="hidden" name="task" value="view" />
		<input type="hidden" name="boxchecked" value="0" />
		</form>
		<?php
		}

		function editSEF(&$_row, &$lists, $_option)
		{
    ?>
	<div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>
	<script language="Javascript" src="<?php echo $GLOBALS['mosConfig_live_site']; ?>/includes/js/overlib_mini.js"></script>
	<script language="javascript">
	<!--
	function submitbutton(pressbutton)
	{
	    var form = document.adminForm;
	    if (pressbutton == 'cancel') {
	        submitform( pressbutton );
	        return;
	    }
	    // do field validation
	    <?php if ( ($_row->id) && $_row->dateadd == "0000-00-00" ) { ?>
	    if (form.customurl.checked ) {
	        form.dateadd.value = "<?php echo date('Y-m-d'); ?>"
	    } else {
	        form.dateadd.value = "0000-00-00"
	    }
	    <?php } ?>
	    if (form.newurl.value == "") {
	        alert( "<?php echo _COM_SEF_EMPTYURL; ?>" );
	    } else {
	        if (form.newurl.value.match(/^index.php/)) {
	            submitform( pressbutton );
	        } else {
	            alert( "<?php echo _COM_SEF_BADURL; ?>" );
	        }
	    }
	}
	//-->
	</script>
	<?php showNavigationBar('JoomSEF '.($_row->id ? _COM_SEF_EDIT : _COM_SEF_ADD).' URL'); ?>
	<table class="adminheading">
		<tr>
			<th>JoomSEF <?php echo $_row->id ? _COM_SEF_EDIT : _COM_SEF_ADD; ?> URL</th>
		</tr>
	</table>
	<form action="index2.php" method="post" name="adminForm">
	<table class="adminform">
	    <tr><th colspan="2"><?php echo _COM_SEF_URL_TTL; ?></th></tr>
		<tr>
			<td><?php echo _COM_SEF_NEWURL; ?></td>
			<td><input class="inputbox" type="text" size="100" name="oldurl" value="<?php echo $_row->oldurl; ?>">
			<?php echo mosToolTip(_COM_SEF_TT_NEWURL); ?>
			</td>
		</tr>
		<tr>
			<td><?php echo _COM_SEF_OLDURL;?></td>
			<td align="left"><input class="inputbox" type="text" size="100" name="newurl" value="<?php echo $_row->newurl; ?>">
			<?php echo mosToolTip(_COM_SEF_TT_OLDURL);?>
			</td>
		</tr>
		<tr>
  		<td></td>
  		<td>
  			<?php echo (($_row->id) && $_row->dateadd == "0000-00-00") ? _COM_SEF_SAVEAS.'<input type="checkbox" name="customurl" value="0" checked>' : '';?>
  		</td>
		</tr>
		<tr><th colspan="2"><?php echo _COM_SEF_META_TTL; ?></th></tr>
		<tr><td colspan="2"><?php echo  mosToolTip(_COM_SEF_META_TIP).' '._COM_SEF_META_INFO; ?></td></tr>
		<tr>
		  <td><?php echo _COM_SEF_METATITLE; ?></td>
		  <td align="left"><input class="inputbox" type="text" size="100" maxlength="255" name="metatitle" value="<?php echo $_row->metatitle; ?>">
		  </td>
		</tr>
		<tr>
		  <td><?php echo _COM_SEF_METADESCRIPTION; ?></td>
		  <td align="left"><input class="inputbox" type="text" size="100" maxlength="255" name="metadesc" value="<?php echo $_row->metadesc; ?>">
		  </td>
		</tr>
		<tr>
		  <td><?php echo _COM_SEF_METAKEYWORDS; ?></td>
		  <td align="left"><input class="inputbox" type="text" size="100" maxlength="255" name="metakey" value="<?php echo $_row->metakey; ?>">
		  </td>
		</tr>
		<tr>
		  <td><?php echo _COM_SEF_METALANG; ?></td>
		  <td align="left"><input class="inputbox" type="text" size="100" maxlength="30" name="metalang" value="<?php echo $_row->metalang; ?>">
		  </td>
		</tr>
		<tr>
		  <td><?php echo _COM_SEF_METAROBOTS; ?></td>
		  <td align="left"><input class="inputbox" type="text" size="100" maxlength="30" name="metarobots" value="<?php echo $_row->metarobots; ?>">
		  </td>
		</tr>
		<tr>
		  <td><?php echo _COM_SEF_METAGOOGLE; ?></td>
		  <td align="left"><input class="inputbox" type="text" size="100" maxlength="30" name="metagoogle" value="<?php echo $_row->metagoogle; ?>">
		  </td>
		</tr>
		<?php /*
	<tr>
	<td colspan="3">&nbsp;</td>
	</tr>
		*/ ?>
	</table>

	<input type="hidden" name="option" value="<?php echo $_option; ?>">
	<input type="hidden" name="dateadd" value="<?php echo $_row->dateadd; ?>">
	<input type="hidden" name="id" value="<?php echo $_row->id; ?>">
	<input type="hidden" name="task" value="">
	</form>
<?php
		}

		function help()
		{
	?>
		 <table class="adminform">
	        <tr>
	            <th colspan="4"><?php echo _COM_SEF_TITLE_SUPPORT;?></th>
	        </tr>
	        <tr>
	        	<td>
	        	<ol><?php echo _COM_SEF_HELPVIA;?><br />
				    <li><a href="http://www.artio.cz/en/joomla-extensions/artio-joomsef" target="_blank"><?php echo _COM_SEF_PAGES;?></a></li>
				    <li><a href="http://www.artio.cz/en/support-forums" target="_blank"><?php echo _COM_SEF_FORUM;?></a></li>
				    <li><a href="http://www.artio.cz/en/web-support/" target="_blank"><?php echo _COM_SEF_HELPDESK;?></a></li>
	        	</ol>
	        </tr>
	<?php
		}

		function purge($option, $message, $confirmed)
		{
	?>
		<form action="index2.php" method="post" name="adminForm">
		<table class="adminheading">
		<tr>
			<th>
			<?php echo _COM_SEF_TITLE_PURGE;?>
			<br/><font class="small" align="left"><a href="index2.php?option=com_sef"><?php echo _COM_SEF_BACK?></a></font>
			</th>
		</tr>
		<tr>
			<td><p class="message"><?php echo $message ?><br/>
				<input type="hidden" name="option" value="<?php echo $option;?>" />
			<?php if (($message == _COM_SEF_SUCCESSPURGE)||($message == _COM_SEF_NORECORDS)) { ?>
				<input type="hidden" name="task" value="" />
				<input type="submit" name="continue" value="<?php echo _COM_SEF_OK ?>"></p>
			<?php }else{ ?>
			  <input type="hidden" name="task" value="purge" />
				<input type="submit" name="confirmed" value="<?php echo _COM_SEF_PROCEED ?>"></p>
			<?php } ?>
			</td>
		</tr>
	  </table>
	<?php
		}

		function import_export()
		{
    ?>
<script type="text/javascript">
function checkForm(){
    if (document.backupform.userfile.value == "") {
        alert('<?php echo _COM_SEF_SELECT_FILE; ?>');
        return false;
    } else {
        return true;
    }
}

function toggle_display(idname) {
    obj = fetch_object(idname);
    if (obj) {
        if (obj.style.display == "none"){
            obj.style.display = "";
        } else {
            obj.style.display = "none";
        }
    }
    return false;
}
</script>
<center>
<form method="post" action="index2.php?option=com_sef&task=import" enctype="multipart/form-data" onSubmit="return checkForm();" name="backupform">
<input type="file" name="userfile">
<input type="submit" value="<?php echo _COM_SEF_IMPORT; ?>">
</form>
<input type="button" value="<?php echo _COM_SEF_EXPORT; ?>" onClick="javascript:location.href='index2.php?option=com_sef&task=export'"></center>
<?php
		}

		function show_upgrade()
		{
		    global $sefConfig;
		    $newVersion = @file_get_contents($sefConfig->serverNewVersionURL);
		    if ($newVersion == FALSE)
		    $newVersion = "?.?.?";
		    $newVersion = trim($newVersion);
	  ?>
	  <form action="index2.php" method="post" enctype="multipart/form-data" name="adminForm">
		<table class="adminheading">
		<tr>
			<th>
  			<?php echo _COM_SEF_TITLE_UPGRADE; ?>
  			<br/><font class="small" align="left"><a href="index2.php?option=com_sef"><?php echo _COM_SEF_BACK?></a></font>
			</th>
			<td nowrap>
			  <?php echo _COM_SEF_INSTALLED_VERS."<br/>"._COM_SEF_TITLE_NEWVERSION; ?>
			</td>
			<td nowrap align="right" width="35">
        <?php echo SEFTools::getSEFVersion()."<br/>".$newVersion; ?>
			</td>
		</tr>
		</table>
		
		<?php
		if ((strnatcasecmp($newVersion, SEFTools::getSEFVersion()) > 0) || ($newVersion == "?.?.?"))
		{
	    ?>
   		<table class='adminform'>
   		<tr>
   		  <th>
   		    <?php echo _COM_SEF_UPGRADEPACKAGE_HEADER; ?>
   		  </th>
   		</tr>
   		<tr>
   		  <td align="left">
   		    <?php echo _COM_SEF_UPGRADEPACKAGE_LABEL; ?>
   		    <input class="text_area" name="userfile" type="file" size="70" />
   		    <input type="submit" value="<?php echo _COM_SEF_UPGRADEPACKAGE_SUBMIT; ?>" />
   		  </td>
   		</tr>
   		</table>
    		
   		<input type="hidden" name="task" value="upgrade" />
   		<input type="hidden" name="option" value="com_sef" />
   		<input type="hidden" name="fromServer" value="0" />
   		</form>
   		<br />
    	
   		<table class='adminform'>
   		<tr>
   		  <th>
   		    <?php echo _COM_SEF_UPGRADESERVER_HEADER; ?>
   		  </th>
   		</tr>
   		<tr>
   		  <td align="left">
   		    <?php
   		    if ($newVersion == "?.?.?")
   		    echo _COM_SEF_UPGRADE_SERVERUNAVAILABLE;
   		    else
   		    {
   		        echo "<a href=\"index2.php?option=com_sef&task=upgrade&fromServer=1\" title=\""._COM_SEF_UPGRADESERVER_LINKTITLE."\">";
   		        echo _COM_SEF_UPGRADESERVER_LINKTEXT."</a>";
   		    }
   		    ?>
   		  </td>
   		</tr>
   		</table>
   		<?php
		}
		else
		{
		    echo "<p class='message'>Your JoomSEF is up to date.</p>";
		}
		}

}
?>
