Location: PHPKode > projects > injooosm > administrator/components/com_injooosm/install.injooosm.php
<?php
/**
 * Joomla! 1.5 component injooosm
 *
 * @version $Id: install.injooosm.php 2009-11-22 14:03:00$
 * @author Christian Knorr
 * @package injooosm
 * @subpackage backend
 * @license GNU/GPL
 * @filesource
 *
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

jimport( 'joomla.filesystem.folder' );

?>
<table class="adminlist">
    <tr>
        <td rowspan="2" valign="top"><img src="<?php echo "..".DS."components".DS."com_injooosm".DS."assets".DS."images".DS."logo.jpg"; ?>" width="200" height="200" alt="injooosm"/>
        </td>
        <td>Welcome to injooosm! Released under the terms and conditions of the <a href="http://www.gnu.org/licenses/gpl-2.0.html" target="_blank">GNU General Public License</a>.<br />
Willkommen bei injooosm! Herausgegeben under den Bestimmungen und Bedingungen der <a href="http://www.gnu.org/licenses/gpl-2.0.html" target="_blank">GNU General Public License</a>.</td>
    </tr>
    <tr>
      <td>Now we create the neccesary folders. If an error occur, create the folders manuel, please!<br />
Nun werden die ben&ouml;tigten Ordner erstellt. Erstelle bei Fehler die Ordner bitte manuell!</td>
    </tr>
</table>
<?php

$folders_to_create = array (
"images".DS."injooosm",
"images".DS."injooosm".DS."cats",
);

$folders_to_chmod = array (
"components".DS."com_injooosm".DS."uploads",
"components".DS."com_injooosm".DS."uploads".DS."import",
"components".DS."com_injooosm".DS."assets".DS."images".DS."symbols",
);

foreach ( $folders_to_create AS $folder ) {
	if(JFolder::exists(JPATH_SITE.DS.$folder))
		echo "<font color='green'>SKIPPED:</font> Directory ".$folder." already exist.<br />";
	elseif(JFolder::create(JPATH_SITE.DS.$folder)) {
		echo "<font color='green'>FINISHED:</font> Directory ".$folder." created.<br />";
	} else {
		echo "<font color='red'>ERROR:</font> Directory ".$folder." NOT created.<br />";
	}
}

foreach ( $folders_to_chmod AS $folder ) {
	if(chmod(JPATH_SITE.DS.$folder, 0777)) {
		echo "<font color='green'>FINISHED:</font> Directory ".$folder." chmodded.<br />";
	} else {
		echo "<font color='red'>ERROR:</font> Directory ".$folder." NOT chmodded.<br />";
	}
}

// Update Joomla‘s UserDB
global $mainframe;
$db =& JFactory::getDBO();
$query = "SELECT osmlat FROM #__users";
$db->setQuery($query);
$osm = $db->loadObject();
if(!$osm) {
	$query = "ALTER IGNORE TABLE `#__users` ADD COLUMN osmlat FLOAT(20,15), ADD COLUMN osmlon FLOAT(20,15), ADD COLUMN osmvisible VARCHAR(3);";
	$db->setQuery($query);
	$db->query();
	if ($db->getErrorNum()) {
		echo ($db->stderr());
		return false;
	} else {
		return true;
	}
}
Return current item: injooosm