diff options
author | Jakob Sack <kde@jakobsack.de> | 2011-04-18 15:07:51 +0200 |
---|---|---|
committer | Jakob Sack <kde@jakobsack.de> | 2011-04-18 15:07:51 +0200 |
commit | 6f07cf26514db25e228a2a194384fff49af98b87 (patch) | |
tree | 40f0920d2e00c218b0702e1d358eeb117ea21860 | |
parent | b57823baa5d4f0d23be8d034550a0ffcb788a2ca (diff) | |
parent | a977ba31ce2dfa5b29151fd34166178a9ac1f6bd (diff) | |
download | nextcloud-server-6f07cf26514db25e228a2a194384fff49af98b87.tar.gz nextcloud-server-6f07cf26514db25e228a2a194384fff49af98b87.zip |
Merge branch 'refactoring' of git://anongit.kde.org/owncloud into refactoring
-rw-r--r-- | index.php | 4 | ||||
-rw-r--r-- | lib/installer.php | 16 | ||||
-rw-r--r-- | plugins/publiclink/get.php | 7 | ||||
-rw-r--r-- | templates/404.php | 10 |
4 files changed, 37 insertions, 0 deletions
diff --git a/index.php b/index.php index c582cbdaace..6815aa43dcc 100644 --- a/index.php +++ b/index.php @@ -21,6 +21,8 @@ * */ +$RUNTIME_NOAPPS=true;//no apps, yet + require_once( 'lib/base.php' ); require_once( 'appconfig.php' ); require_once( 'template.php' ); @@ -48,6 +50,7 @@ if(count($errors)>0){ exit(); } }elseif(isset($_POST["user"])){ + OC_APP::loadApps(); if( OC_USER::login( $_POST["user"], $_POST["password"] )){ header( "Location: ".$WEBROOT.'/'.OC_APPCONFIG::getValue( "core", "defaultpage", "files/index.php" )); exit(); @@ -55,6 +58,7 @@ if(count($errors)>0){ OC_TEMPLATE::printGuestPage( "", "login", array( "error" => true)); } }else{ + OC_APP::loadApps(); OC_TEMPLATE::printGuestPage( "", "login", array( "error" => false )); } diff --git a/lib/installer.php b/lib/installer.php index 965642e8476..1222a22e71c 100644 --- a/lib/installer.php +++ b/lib/installer.php @@ -97,6 +97,9 @@ class OC_INSTALLER{ OC_GROUP::createGroup('admin'); OC_GROUP::addToGroup($username,'admin'); + //create htaccess files for apache hosts + self::createHtaccess();//TODO detect if apache is used + //and we are done OC_CONFIG::setValue('installed',true); } @@ -125,6 +128,19 @@ class OC_INSTALLER{ $query="CREATE USER '$name'@'%' IDENTIFIED BY '$password'"; $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); + } } ?>
\ No newline at end of file diff --git a/plugins/publiclink/get.php b/plugins/publiclink/get.php index fb8a13b5417..41b10484f9b 100644 --- a/plugins/publiclink/get.php +++ b/plugins/publiclink/get.php @@ -19,6 +19,13 @@ if($path!==false){ $subPath=''; } $path.=$subPath; + if(!OC_FILESYSTEM::file_exists($path)){ + header("HTTP/1.0 404 Not Found"); + $tmpl = new OC_TEMPLATE( '', '404', 'guest' ); + $tmpl->assign('file',$subPath); + $tmpl->printPage(); + exit; + } if(OC_FILESYSTEM::is_dir($path)){ $files = array(); $rootLength=strlen($root); diff --git a/templates/404.php b/templates/404.php index 7696d16f8e2..8909db29a40 100644 --- a/templates/404.php +++ b/templates/404.php @@ -1,3 +1,13 @@ +<?php +if(!isset($_)){//also provide standalone error page + require_once '../lib/base.php'; + require( 'template.php' ); + + $tmpl = new OC_TEMPLATE( '', '404', 'guest' ); + $tmpl->printPage(); + exit; +} +?> <div id="login"> <img src="<?php echo image_path("", "weather-clear.png"); ?>" alt="ownCloud" /> <ul> |