aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php10
-rw-r--r--lib/helper.php2
-rw-r--r--lib/mimetypes.list.php1
-rw-r--r--lib/template.php8
-rw-r--r--lib/templatelayout.php3
-rwxr-xr-xlib/util.php2
6 files changed, 16 insertions, 10 deletions
diff --git a/lib/base.php b/lib/base.php
index 8133882811f..2704cdecf7a 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -72,11 +72,14 @@ class OC{
*/
public static function autoload($className) {
if(array_key_exists($className, OC::$CLASSPATH)) {
+ $path = OC::$CLASSPATH[$className];
/** @TODO: Remove this when necessary
Remove "apps/" from inclusion path for smooth migration to mutli app dir
*/
- $path = str_replace('apps/', '', OC::$CLASSPATH[$className]);
- require_once $path;
+ if (strpos($path, 'apps/')===0) {
+ OC_Log::write('core', 'include path for class "'.$className.'" starts with "apps/"', OC_Log::DEBUG);
+ $path = str_replace('apps/', '', $path);
+ }
}
elseif(strpos($className, 'OC_')===0) {
$path = strtolower(str_replace('_', '/', substr($className, 3)) . '.php');
@@ -110,7 +113,7 @@ class OC{
public static function initPaths() {
// calculate the root directories
- OC::$SERVERROOT=str_replace("\\", '/', substr(__FILE__, 0, -13));
+ OC::$SERVERROOT=str_replace("\\", '/', substr(__DIR__, 0, -4));
OC::$SUBURI= str_replace("\\", "/", substr(realpath($_SERVER["SCRIPT_FILENAME"]), strlen(OC::$SERVERROOT)));
$scriptName=$_SERVER["SCRIPT_NAME"];
if(substr($scriptName, -1)=='/') {
@@ -199,6 +202,7 @@ class OC{
public static function checkSSL() {
// redirect to https site if configured
if( OC_Config::getValue( "forcessl", false )) {
+ header('Strict-Transport-Security: max-age=31536000');
ini_set("session.cookie_secure", "on");
if(OC_Request::serverProtocol()<>'https' and !OC::$CLI) {
$url = "https://". OC_Request::serverHost() . $_SERVER['REQUEST_URI'];
diff --git a/lib/helper.php b/lib/helper.php
index 48e16cebd00..88bff5dc4a2 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -661,7 +661,7 @@ class OC_Helper {
$length = mb_strlen($search, $encoding);
while(($i = mb_strrpos($subject, $search, $offset, $encoding)) !== false ) {
$subject = OC_Helper::mb_substr_replace($subject, $replace, $i, $length);
- $offset = $i - mb_strlen($subject, $encoding) - 1;
+ $offset = $i - mb_strlen($subject, $encoding);
$count++;
}
return $subject;
diff --git a/lib/mimetypes.list.php b/lib/mimetypes.list.php
index 8386bcb93f3..77b97917583 100644
--- a/lib/mimetypes.list.php
+++ b/lib/mimetypes.list.php
@@ -94,4 +94,5 @@ return array(
'sgf' => 'application/sgf',
'cdr' => 'application/coreldraw',
'impress' => 'text/impress',
+ 'ai' => 'application/illustrator',
);
diff --git a/lib/template.php b/lib/template.php
index fb81ec62519..1c529932a30 100644
--- a/lib/template.php
+++ b/lib/template.php
@@ -159,9 +159,11 @@ class OC_Template{
$this->vars['requestlifespan'] = OC_Util::$callLifespan;
$parts = explode('/', $app); // fix translation when app is something like core/lostpassword
$this->l10n = OC_L10N::get($parts[0]);
- header('X-Frame-Options: Sameorigin');
- header('X-XSS-Protection: 1; mode=block');
- header('X-Content-Type-Options: nosniff');
+
+ // Some headers to enhance security
+ header('X-Frame-Options: Sameorigin');
+ header('X-XSS-Protection: 1; mode=block');
+ header('X-Content-Type-Options: nosniff');
$this->findTemplate($name);
}
diff --git a/lib/templatelayout.php b/lib/templatelayout.php
index c898628bcdf..4f26775b48e 100644
--- a/lib/templatelayout.php
+++ b/lib/templatelayout.php
@@ -12,8 +12,7 @@ class OC_TemplateLayout extends OC_Template {
if( $renderas == 'user' ) {
parent::__construct( 'core', 'layout.user' );
- $this->assign('searchurl',OC_Helper::linkTo( 'search', 'index.php' ), false);
- if(array_search(OC_APP::getCurrentApp(),array('settings','admin','help'))!==false) {
+ if(in_array(OC_APP::getCurrentApp(),array('settings','admin','help'))!==false) {
$this->assign('bodyid','body-settings', false);
}else{
$this->assign('bodyid','body-user', false);
diff --git a/lib/util.php b/lib/util.php
index 5cf76574574..be56f7bda39 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -82,7 +82,7 @@ class OC_Util {
* @return string
*/
public static function getVersionString() {
- return '4.5';
+ return '5.0 pre alpha';
}
/**