* | * | ||||
*/ | */ | ||||
$RUNTIME_NOAPPS=true;//no apps, yet | |||||
require_once( 'lib/base.php' ); | require_once( 'lib/base.php' ); | ||||
require_once( 'appconfig.php' ); | require_once( 'appconfig.php' ); | ||||
require_once( 'template.php' ); | require_once( 'template.php' ); | ||||
exit(); | exit(); | ||||
} | } | ||||
}elseif(isset($_POST["user"])){ | }elseif(isset($_POST["user"])){ | ||||
OC_APP::loadApps(); | |||||
if( OC_USER::login( $_POST["user"], $_POST["password"] )){ | if( OC_USER::login( $_POST["user"], $_POST["password"] )){ | ||||
header( "Location: ".$WEBROOT.'/'.OC_APPCONFIG::getValue( "core", "defaultpage", "files/index.php" )); | header( "Location: ".$WEBROOT.'/'.OC_APPCONFIG::getValue( "core", "defaultpage", "files/index.php" )); | ||||
exit(); | exit(); | ||||
OC_TEMPLATE::printGuestPage( "", "login", array( "error" => true)); | OC_TEMPLATE::printGuestPage( "", "login", array( "error" => true)); | ||||
} | } | ||||
}else{ | }else{ | ||||
OC_APP::loadApps(); | |||||
OC_TEMPLATE::printGuestPage( "", "login", array( "error" => false )); | OC_TEMPLATE::printGuestPage( "", "login", array( "error" => false )); | ||||
} | } | ||||
OC_GROUP::createGroup('admin'); | OC_GROUP::createGroup('admin'); | ||||
OC_GROUP::addToGroup($username,'admin'); | OC_GROUP::addToGroup($username,'admin'); | ||||
//create htaccess files for apache hosts | |||||
self::createHtaccess();//TODO detect if apache is used | |||||
//and we are done | //and we are done | ||||
OC_CONFIG::setValue('installed',true); | OC_CONFIG::setValue('installed',true); | ||||
} | } | ||||
$query="CREATE USER '$name'@'%' IDENTIFIED BY '$password'"; | $query="CREATE USER '$name'@'%' IDENTIFIED BY '$password'"; | ||||
$result = mysql_query($query,$connection); | $result = mysql_query($query,$connection); | ||||
} | } | ||||
/** | |||||
* create .htaccess files for apache hosts | |||||
*/ | |||||
private static function createHtaccess(){ | |||||
global $SERVERROOT; | |||||
global $WEBROOT; | |||||
$content="ErrorDocument 404 /$WEBROOT/templates/404.php\n"; | |||||
file_put_contents($SERVERROOT.'/.htaccess',$content); | |||||
$content="deny from all"; | |||||
file_put_contents(OC_CONFIG::getValue('datadirectory',$SERVERROOT.'/data').'/.htaccess',$content); | |||||
} | |||||
} | } | ||||
?> | ?> |