Location: PHPKode > projects > Anahita Social Engine > admin/install/install.php
<?php
/**
 * @version		1.0.0
 * @category	Anahita Social Engine™
 * @copyright	Copyright (C) 2008 - 2010 rmdStudio Inc. and Peerglobe Technology Inc. All rights reserved.
 * @license		GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
 * @link     	http://www.anahitapolis.com
 */

global $anahita_source_path;

$anahita_source_path = $this->parent->getPath('source').DS.'dependencies';

function com_install() {
			
	global $anahita_source_path;

	jimport('joomla.filesystem.folder');
				
	// Set the installation path
	$path    = $anahita_source_path;
	$default_anahita_tmpl = null;
	if (JFolder::exists($path)) {
		$tmpDest = JPATH_ROOT.DS.'tmp'.DS.'install_'.(rand(0,999999999));
		JFolder::copy($path,$tmpDest);
		foreach(JFolder::folders($tmpDest) as $folder) 
		{				
			$installer = new JInstaller();
			$installer->install($tmpDest.DS.$folder);
			if ( $folder == 'tmpl_anahita' )
				$default_anahita_tmpl = $folder;
		}
	}
	
	//install socialengine as an application
	/*
	$db = JFactory::getDBO();
	$row = new stdClass();
	$row->component = 'com_socialengine';
	$row->enabled   = true;
	$row->global	= 1;
	$db->insertObject('#__socialengine_applications', $row);*/
	
	$query   = "SELECT * FROM #__plugins WHERE ( folder = 'system' OR folder = 'user' ) AND element IN ('socialengine','koowa')";
	$db	   	 = JFactory::getDBO();
	$db->setQuery($query);
	$objects = $db->loadObjectList();
	foreach($objects as &$object) {	
		$object->published = 1;
		$db->updateObject('#__plugins',$object,'id');
	}
	if ( $default_anahita_tmpl )
	{
		$query = "DELETE FROM #__templates_menu WHERE client_id = 0 AND menuid = 0"; //delete default template
		$db->setQuery($query);
		$db->query();
		$template = new stdClass();
		$template->template  = 'anahita';
		$template->menuid	 = 0;
		$template->client_id = 0;
		$db->insertObject('#__templates_menu', $template);
	}
 
	print '<h2>Click  <a href="index.php?option=com_socialengine&view=maintenance">here</a>  to migrate your <strong>users</strong> to people.</h2>';
	//enable the koowa, socialengine user and system plugins	
}
Return current item: Anahita Social Engine