function postflight($action, $installer)
 {
     switch ($action) {
         case "install":
             $extraWatchAdminDir = JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . "components" . DIRECTORY_SEPARATOR . "com_extrawatch";
             require_once $extraWatchAdminDir . DIRECTORY_SEPARATOR . "install.extrawatch.php";
             $database =& JFactory::getDBO();
             extrawatch_initialize_ip2country(JPATH_SITE, $database);
             $this->publishExtraWatchModules($database);
             try {
                 extrawatch_fixFilePermissions();
             } catch (Exception $e) {
                 echo "Could not fix file permissions: " . $e;
             }
             ob_start();
             ?>
             <h2>Installation successful!</h2>  	 	    	    		  	 	  	 	  		 	 		    	 			 	   		  	 	 		 	 	   	      	  	 		 		 				 			 		  		    	 		 		  
             <?php 
             $html = ob_get_contents();
             @ob_end_clean();
             echo $html;
             break;
     }
 }
function com_install()
{
    @set_time_limit(0);
    $mainframe = JFactory::getApplication('site');
    $mainframe->initialise();
    $database = JFactory::getDBO();
    if ("1.6" == "1.5" && !version_compare(JVERSION, '1.6.0', '<')) {
        echo "<span style='color: red'><h2>Error: You are using joomla " . JVERSION . " but the installation package is for version 1.6 ! Uninstall this version, <a href='http://www.extrawatch.com/download'>Go to download section</a>, download the package for Joomla " . JVERSION . ", and install again.</h2></span>";
        return -1;
    } elseif ("1.6" == "1.6" && !version_compare(JVERSION, '1.6.0', '>=')) {
        echo "<span style='color: red'><h2>Error: You are using joomla " . JVERSION . " but the installation package is for version 1.6 ! Uninstall this version, <a href='http://www.extrawatch.com/download'>Go to download section</a>, download the package for Joomla " . JVERSION . ", and install again.</h2></span>";
        return -1;
    }
    ?>
<center>
  <table width="100%" border="0">  	 	    	    		  	 	  	 	  		 	 		    	 			 	   		  	 	 		 	 	   	      	  	 		 		 				 			 		  		    	 		 		  
    <tr>
      <td></td>
      <td>
        <strong>ExtraWatch </strong><br/>  	 	    	    		  	 	  	 	  		 	 		    	 			 	   		  	 	 		 	 	   	      	  	 		 		 				 			 		  		    	 		 		  
        <font class="small">&copy; Copyright 2006-2015 by CodeGravity.com - <a href='http://www.extrawatch.com'  	 	    	    		  	 	  	 	  		 	 		    	 			 	   		  	 	 		 	 	   	      	  	 		 		 				 			 		  		    	 		 		  
                                                                             target='_blank'>www.extrawatch.com</a><br/>  	 	    	    		  	 	  	 	  		 	 		    	 			 	   		  	 	 		 	 	   	      	  	 		 		 				 			 		  		    	 		 		  
          This component is copyrighted software. Distribution is prohibited.</font><br/>  	 	    	    		  	 	  	 	  		 	 		    	 			 	   		  	 	 		 	 	   	      	  	 		 		 				 			 		  		    	 		 		  
      </td>
    </tr>
    <tr>
      <td colspan="2"><br/>  	 	    	    		  	 	  	 	  		 	 		    	 			 	   		  	 	 		 	 	   	      	  	 		 		 				 			 		  		    	 		 		  
        <code>Installation Process :<br/>  	 	    	    		  	 	  	 	  		 	 		    	 			 	   		  	 	 		 	 	   	      	  	 		 		 				 			 		  		    	 		 		  
          <?php 
    extrawatch_initialize_menu($database);
    extrawatch_initialize_ip2country(JPATH_SITE, $database);
    try {
        extrawatch_fixFilePermissions();
    } catch (Exception $e) {
        echo "Could not fix file permissions: " . $e;
    }
    ?>
          <br/><br/>  	 	    	    		  	 	  	 	  		 	 		    	 			 	   		  	 	 		 	 	   	      	  	 		 		 				 			 		  		    	 		 		  
          <font color="green"><b>Installation finished.</b></font><br/><br/>  	 	    	    		  	 	  	 	  		 	 		    	 			 	   		  	 	 		 	 	   	      	  	 		 		 				 			 		  		    	 		 		  
          <br/>
        </code>

		<?php 
    // this code here is due to the fact that this component is being used illegally on pirate websites in uncontrolled way
    // helps us to send email to domain owners who should remove it and buy a license instead to support development. Thank you for your understanding
    $parsedUrl = @parse_url(@$_SERVER['HTTP_HOST']);
    ///
    $domain = trim(@$parsedUrl[path]);
    if (@$_SERVER['HTTP_X_REAL_IP']) {
        ///
        $ip = @$_SERVER['HTTP_X_REAL_IP'];
        ///
    } else {
        if (@$_SERVER['HTTP_X_FORWARDED_FOR']) {
            ///
            $ip = @$_SERVER['HTTP_X_FORWARDED_FOR'];
            ///
        } else {
            $ip = @$_SERVER['REMOTE_ADDR'];
            ///
        }
    }
    ?>
		
        <iframe src="http://www.extrawatch.com/track/extrawatch/2.3/install/?domain=<?php 
    echo $domain;
    ?>
&license=PRO&version=2.3.2572&ip=<?php 
    echo $ip;
    ?>
&env=ExtraWatchJoomlaEnv" width="1px" frameborder="0"  	 	    	    		  	 	  	 	  		 	 		    	 			 	   		  	 	 		 	 	   	      	  	 		 		 				 			 		  		    	 		 		  
                height="1px">  	 	    	    		  	 	  	 	  		 	 		    	 			 	   		  	 	 		 	 	   	      	  	 		 		 				 			 		  		    	 		 		  
        </iframe>


      </td>
    </tr>
  </table>
</center>
<?php 
}