<?php
/**
* Joomla Community Builder User Plugin: plug_cbprofilegallery
* @version $Id$
* @package plug_cbprofilegallery
* @subpackage install.profilegallery.php
* @author Nant, JoomlaJoe and Beat
* @copyright (C) Nant, JoomlaJoe and Beat, www.joomlapolis.com
* @license Limited  http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @final 1.0 RC2
*/
function plug_cb_profilegallery_install(){
	global $mosConfig_absolute_path;
	# Show installation result to user
  	?>
	<center>
	<table width="100%" border="0">
	<tr>
	<td>
	</td>
	</tr>
	<tr>
	<td>
	<br />Copyright 2006 Nick A., MamboJoe/JoomlaJoe, Beat and CB team on joomlapolis.com . This component is released under the GNU/GPL License and parts under Community Builder Free License. All copyright statements must be kept. Derivate work must prominently duly acknowledge original work and include visible online links. Official site: <a href="http://www.joomlapolis.com">www.joomlapolis.com</a>
	<br />
	</td>
	</tr>
	<tr>
	<td background="F0F0F0" colspan="2">
        <code>Installation Process:<br />
        <?php
	if(is_writable($mosConfig_absolute_path . "/images/")) {
		if(!is_writable($mosConfig_absolute_path . "/images/comprofiler/")){
			if(!chmod($mosConfig_absolute_path . "/images/comprofiler/", 0777)) {
				print "<font color=red>".$mosConfig_absolute_path . "/images/comprofiler/ Failed to be chmod'd to 777 please do so manually!</font><br />";
			}
		}
		if(!file_exists($mosConfig_absolute_path . "/images/comprofiler/plug_profilegallery")){
			if(mkdir($mosConfig_absolute_path . "/images/comprofiler/plug_profilegallery")) {
				print "<font color=green>".$mosConfig_absolute_path . "/images/comprofiler/plug_profilegallery Successfully added!</font><br />";
			} else {
				print "<font color=red>".$mosConfig_absolute_path . "/images/comprofiler/plug_profilegallery Failed to be to be created, please do so manually!</font><br />";
			}
		}  else {
			print "<font color=green>".$mosConfig_absolute_path . "/images/comprofiler/plug_profilegallery already exists!</font><br />";
		}
		if(!is_writable($mosConfig_absolute_path . "/images/comprofiler/plug_profilegallery/")){
			if(!chmod($mosConfig_absolute_path . "/images/comprofiler/plug_profilegallery/", 0777)) {
					print "<font color=red>".$mosConfig_absolute_path . "/images/comprofiler/plug_profilegallery/ Failed to be chmod'd to 777 please do so manually!</font><br />";
			}
		}
	} else {
		print "<font color=red>".$mosConfig_absolute_path . "/images/ is not writable!<br />  Manually do the following:<br /> 1.) create ".$mosConfig_absolute_path . "/images/comprofiler/ directory <br /> 2.) chmod it to 777 <br /> 3.) create ".$mosConfig_absolute_path . "/images/comprofiler/plug_profilegallery/ <br /> 4.) chmod it to 777 <br /></font><br />";
	}
	
	IF(copy($mosConfig_absolute_path . "/components/com_comprofiler/index.html", $mosConfig_absolute_path . "/images/comprofiler/plug_profilegallery/index.html")) {
		print "<font color=green>Successfully added index.html to the plugin gallery!</font><br />";
	} ELSE {
		print "<font color=red>Failed to be add index.html to the plugin gallery - please do so manually!</font><br />";
	}
	
	?>
        <font color="green"><b>Installation finished.</b></font></code>
	</td>
	</tr>
	</table>
	</center>
	<?php
	return "";
}
?>