summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/api.php3
-rw-r--r--lib/app.php98
-rw-r--r--lib/base.php48
-rw-r--r--lib/db.php17
-rw-r--r--lib/filecache.php9
-rw-r--r--lib/filestorage/local.php2
-rw-r--r--lib/filesystemview.php6
-rw-r--r--lib/helper.php19
-rw-r--r--lib/l10n/fa.php1
-rw-r--r--lib/l10n/fr.php1
-rw-r--r--lib/l10n/gl.php1
-rw-r--r--lib/l10n/hu_HU.php4
-rw-r--r--lib/l10n/lb.php6
-rw-r--r--lib/l10n/ro.php1
-rw-r--r--lib/l10n/sr.php1
-rw-r--r--lib/l10n/sv.php1
-rw-r--r--lib/l10n/th_TH.php1
-rw-r--r--lib/l10n/tr.php1
-rw-r--r--lib/l10n/zh_TW.php13
-rw-r--r--lib/mail.php12
-rw-r--r--lib/mimetypes.list.php2
-rw-r--r--lib/setup.php4
-rw-r--r--lib/template.php12
-rw-r--r--lib/templatelayout.php12
24 files changed, 207 insertions, 68 deletions
diff --git a/lib/api.php b/lib/api.php
index 0fce109a423..545b55757ff 100644
--- a/lib/api.php
+++ b/lib/api.php
@@ -90,6 +90,9 @@ class OC_API {
if(self::isAuthorised(self::$actions[$name])) {
if(is_callable(self::$actions[$name]['action'])) {
$response = call_user_func(self::$actions[$name]['action'], $parameters);
+ if(!($response instanceof OC_OCS_Result)) {
+ $response = new OC_OCS_Result(null, 996, 'Internal Server Error');
+ }
} else {
$response = new OC_OCS_Result(null, 998, 'Api method not found');
}
diff --git a/lib/app.php b/lib/app.php
index 662af56d258..108226fc1a1 100644
--- a/lib/app.php
+++ b/lib/app.php
@@ -63,17 +63,17 @@ class OC_App{
if (!defined('DEBUG') || !DEBUG) {
if (is_null($types)
- && empty(OC_Util::$core_scripts)
- && empty(OC_Util::$core_styles)) {
+ && empty(OC_Util::$core_scripts)
+ && empty(OC_Util::$core_styles)) {
OC_Util::$core_scripts = OC_Util::$scripts;
- OC_Util::$scripts = array();
- OC_Util::$core_styles = OC_Util::$styles;
- OC_Util::$styles = array();
- }
+ OC_Util::$scripts = array();
+ OC_Util::$core_styles = OC_Util::$styles;
+ OC_Util::$styles = array();
}
- // return
- return true;
}
+ // return
+ return true;
+}
/**
* load a single app
@@ -299,7 +299,7 @@ class OC_App{
if(OC_Config::getValue('knowledgebaseenabled', true)==true) {
$settings = array(
array( "id" => "help", "order" => 1000, "href" => OC_Helper::linkToRoute( "settings_help" ), "name" => $l->t("Help"), "icon" => OC_Helper::imagePath( "settings", "help.svg" ))
- );
+ );
}
// if the user is logged-in
@@ -519,16 +519,16 @@ class OC_App{
$forms=array();
switch($type) {
case 'settings':
- $source=self::$settingsForms;
- break;
+ $source=self::$settingsForms;
+ break;
case 'admin':
- $source=self::$adminForms;
- break;
+ $source=self::$adminForms;
+ break;
case 'personal':
- $source=self::$personalForms;
- break;
+ $source=self::$personalForms;
+ break;
default:
- return array();
+ return array();
}
foreach($source as $form) {
$forms[]=include $form;
@@ -589,6 +589,72 @@ class OC_App{
}
/**
+ * @brief: Lists all apps, this is used in apps.php
+ * @return array
+ */
+ public static function listAllApps() {
+ $installedApps = OC_App::getAllApps();
+
+ //TODO which apps do we want to blacklist and how do we integrate blacklisting with the multi apps folder feature?
+
+ $blacklist = array('files');//we dont want to show configuration for these
+ $appList = array();
+
+ foreach ( $installedApps as $app ) {
+ if ( array_search( $app, $blacklist ) === false ) {
+
+ $info=OC_App::getAppInfo($app);
+
+ if (!isset($info['name'])) {
+ OC_Log::write('core', 'App id "'.$app.'" has no name in appinfo', OC_Log::ERROR);
+ continue;
+ }
+
+ if ( OC_Appconfig::getValue( $app, 'enabled', 'no') == 'yes' ) {
+ $active = true;
+ } else {
+ $active = false;
+ }
+
+ $info['active'] = $active;
+
+ if(isset($info['shipped']) and ($info['shipped']=='true')) {
+ $info['internal']=true;
+ $info['internallabel']='Internal App';
+ } else {
+ $info['internal']=false;
+ $info['internallabel']='3rd Party App';
+ }
+
+ $info['preview'] = OC_Helper::imagePath('settings', 'trans.png');
+ $info['version'] = OC_App::getAppVersion($app);
+ $appList[] = $info;
+ }
+ }
+ $remoteApps = OC_App::getAppstoreApps();
+ if ( $remoteApps ) {
+ // Remove duplicates
+ foreach ( $appList as $app ) {
+ foreach ( $remoteApps AS $key => $remote ) {
+ if (
+ $app['name'] == $remote['name']
+ // To set duplicate detection to use OCS ID instead of string name,
+ // enable this code, remove the line of code above,
+ // and add <ocs_id>[ID]</ocs_id> to info.xml of each 3rd party app:
+ // OR $app['ocs_id'] == $remote['ocs_id']
+ ) {
+ unset( $remoteApps[$key]);
+ }
+ }
+ }
+ $combinedApps = array_merge( $appList, $remoteApps );
+ } else {
+ $combinedApps = $appList;
+ }
+ return $combinedApps;
+}
+
+ /**
* @brief: get a list of all apps on apps.owncloud.com
* @return array, multi-dimensional array of apps. Keys: id, name, type, typename, personid, license, detailpage, preview, changed, description
*/
diff --git a/lib/base.php b/lib/base.php
index 4b198c4f784..aff3e1d5a11 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -96,7 +96,14 @@ class OC
} elseif (strpos($className, 'OCP\\') === 0) {
$path = 'public/' . strtolower(str_replace('\\', '/', substr($className, 3)) . '.php');
} elseif (strpos($className, 'OCA\\') === 0) {
- $path = 'apps/' . strtolower(str_replace('\\', '/', substr($className, 3)) . '.php');
+ foreach(self::$APPSROOTS as $appDir) {
+ $path = $appDir['path'] . '/' . strtolower(str_replace('\\', '/', substr($className, 3)) . '.php');
+ $fullPath = stream_resolve_include_path($path);
+ if (file_exists($fullPath)) {
+ require_once $fullPath;
+ return false;
+ }
+ }
} elseif (strpos($className, 'Sabre_') === 0) {
$path = str_replace('_', '/', $className) . '.php';
} elseif (strpos($className, 'Symfony\\Component\\Routing\\') === 0) {
@@ -268,7 +275,7 @@ class OC
{
// Add the stuff we need always
OC_Util::addScript("jquery-1.7.2.min");
- OC_Util::addScript("jquery-ui-1.8.16.custom.min");
+ OC_Util::addScript("jquery-ui-1.10.0.custom");
OC_Util::addScript("jquery-showpassword");
OC_Util::addScript("jquery.infieldlabel");
OC_Util::addScript("jquery-tipsy");
@@ -282,8 +289,9 @@ class OC
OC_Util::addStyle("styles");
OC_Util::addStyle("multiselect");
- OC_Util::addStyle("jquery-ui-1.8.16.custom");
+ OC_Util::addStyle("jquery-ui-1.10.0.custom");
OC_Util::addStyle("jquery-tipsy");
+ OC_Util::addScript("oc-requesttoken");
}
public static function initSession()
@@ -540,22 +548,6 @@ class OC
*/
public static function handleRequest()
{
- if (!OC_Config::getValue('installed', false)) {
- require_once 'core/setup.php';
- exit();
- }
- // Handle redirect URL for logged in users
- if (isset($_REQUEST['redirect_url']) && OC_User::isLoggedIn()) {
- $location = OC_Helper::makeURLAbsolute(urldecode($_REQUEST['redirect_url']));
- header('Location: ' . $location);
- return;
- }
- // Handle WebDAV
- if ($_SERVER['REQUEST_METHOD'] == 'PROPFIND') {
- header('location: ' . OC_Helper::linkToRemote('webdav'));
- return;
- }
-
// load all the classpaths from the enabled apps so they are available
// in the routing files of each app
OC::loadAppClassPaths();
@@ -577,6 +569,24 @@ class OC
self::loadCSSFile($param);
return;
}
+
+ if (!OC_Config::getValue('installed', false)) {
+ require_once 'core/setup.php';
+ exit();
+ }
+
+ // Handle redirect URL for logged in users
+ if (isset($_REQUEST['redirect_url']) && OC_User::isLoggedIn()) {
+ $location = OC_Helper::makeURLAbsolute(urldecode($_REQUEST['redirect_url']));
+ header('Location: ' . $location);
+ return;
+ }
+ // Handle WebDAV
+ if ($_SERVER['REQUEST_METHOD'] == 'PROPFIND') {
+ header('location: ' . OC_Helper::linkToRemote('webdav'));
+ return;
+ }
+
// Someone is logged in :
if (OC_User::isLoggedIn()) {
OC_App::loadApps();
diff --git a/lib/db.php b/lib/db.php
index 7cc65673d10..51f7c7679d4 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -184,7 +184,14 @@ class OC_DB {
try{
self::$PDO=new PDO($dsn, $user, $pass, $opts);
}catch(PDOException $e) {
- OC_Template::printErrorPage( 'can not connect to database, using '.$type.'. ('.$e->getMessage().')' );
+ OC_Log::write('core', $e->getMessage(), OC_Log::FATAL);
+ OC_User::setUserId(null);
+
+ // send http status 503
+ header('HTTP/1.1 503 Service Temporarily Unavailable');
+ header('Status: 503 Service Temporarily Unavailable');
+ OC_Template::printErrorPage('Failed to connect to database');
+ die();
}
// We always, really always want associative arrays
self::$PDO->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
@@ -281,7 +288,13 @@ class OC_DB {
if( PEAR::isError( self::$MDB2 )) {
OC_Log::write('core', self::$MDB2->getUserInfo(), OC_Log::FATAL);
OC_Log::write('core', self::$MDB2->getMessage(), OC_Log::FATAL);
- OC_Template::printErrorPage( 'can not connect to database, using '.$type.'. ('.self::$MDB2->getUserInfo().')' );
+ OC_User::setUserId(null);
+
+ // send http status 503
+ header('HTTP/1.1 503 Service Temporarily Unavailable');
+ header('Status: 503 Service Temporarily Unavailable');
+ OC_Template::printErrorPage('Failed to connect to database');
+ die();
}
// We always, really always want associative arrays
diff --git a/lib/filecache.php b/lib/filecache.php
index 2f4a6daf216..7764890ef1a 100644
--- a/lib/filecache.php
+++ b/lib/filecache.php
@@ -23,9 +23,14 @@
* provide caching for filesystem info in the database
*
* not used by OC_Filesystem for reading filesystem info,
- * instread apps should use OC_FileCache::get where possible
+ * instead apps should use OC_FileCache::get where possible
+ *
+ * It will try to keep the data up to date but changes from outside
+ * ownCloud can invalidate the cache
+ *
+ * Methods that take $path and $root params expect $path to be relative, like
+ * /admin/files/file.txt, if $root is false
*
- * It will try to keep the data up to date but changes from outside ownCloud can invalidate the cache
*/
class OC_FileCache{
diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php
index 910b3fa039d..4a4019a3224 100644
--- a/lib/filestorage/local.php
+++ b/lib/filestorage/local.php
@@ -92,7 +92,7 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{
public function file_get_contents($path) {
return file_get_contents($this->datadir.$path);
}
- public function file_put_contents($path, $data) {
+ public function file_put_contents($path, $data) {//trigger_error("$path = ".var_export($path, 1));
return file_put_contents($this->datadir.$path, $data);
}
public function unlink($path) {
diff --git a/lib/filesystemview.php b/lib/filesystemview.php
index ea9cbecee0e..1fc8e83d68f 100644
--- a/lib/filesystemview.php
+++ b/lib/filesystemview.php
@@ -36,8 +36,12 @@
*
* Filesystem functions are not called directly; they are passed to the correct
* OC_Filestorage object
+ *
+ * @note default root (if $root is empty or '/') is /data/[user]/
+ * @note If you don't include a leading slash, you may encounter problems.
+ * e.g. use $v = new \OC_FilesystemView( '/' . $params['uid'] ); not
+ * $v = new \OC_FilesystemView( $params['uid'] );
*/
-
class OC_FilesystemView {
private $fakeRoot='';
private $internal_path_cache=array();
diff --git a/lib/helper.php b/lib/helper.php
index a7b2a429952..d2c6b1695bd 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -785,4 +785,23 @@ class OC_Helper {
}
return true;
}
+
+ /**
+ * Calculate the disc space
+ */
+ public static function getStorageInfo() {
+ $rootInfo = OC_FileCache::get('');
+ $used = $rootInfo['size'];
+ if ($used < 0) {
+ $used = 0;
+ }
+ $free = OC_Filesystem::free_space();
+ $total = $free + $used;
+ if ($total == 0) {
+ $total = 1; // prevent division by zero
+ }
+ $relative = round(($used / $total) * 10000) / 100;
+
+ return array('free' => $free, 'used' => $used, 'total' => $total, 'relative' => $relative);
+ }
}
diff --git a/lib/l10n/fa.php b/lib/l10n/fa.php
index ce7c7c6e970..8cbdcb03b3b 100644
--- a/lib/l10n/fa.php
+++ b/lib/l10n/fa.php
@@ -10,6 +10,7 @@
"seconds ago" => "ثانیه‌ها پیش",
"1 minute ago" => "1 دقیقه پیش",
"%d minutes ago" => "%d دقیقه پیش",
+"1 hour ago" => "1 ساعت پیش",
"today" => "امروز",
"yesterday" => "دیروز",
"last month" => "ماه قبل",
diff --git a/lib/l10n/fr.php b/lib/l10n/fr.php
index 218c22c1d53..c6bf8f7f9c3 100644
--- a/lib/l10n/fr.php
+++ b/lib/l10n/fr.php
@@ -9,6 +9,7 @@
"Files need to be downloaded one by one." => "Les fichiers nécessitent d'être téléchargés un par un.",
"Back to Files" => "Retour aux Fichiers",
"Selected files too large to generate zip file." => "Les fichiers sélectionnés sont trop volumineux pour être compressés.",
+"couldn't be determined" => "impossible à déterminer",
"Application is not enabled" => "L'application n'est pas activée",
"Authentication error" => "Erreur d'authentification",
"Token expired. Please reload page." => "La session a expiré. Veuillez recharger la page.",
diff --git a/lib/l10n/gl.php b/lib/l10n/gl.php
index 1e897959e41..532b3443b44 100644
--- a/lib/l10n/gl.php
+++ b/lib/l10n/gl.php
@@ -9,6 +9,7 @@
"Files need to be downloaded one by one." => "Os ficheiros necesitan seren descargados de un en un.",
"Back to Files" => "Volver aos ficheiros",
"Selected files too large to generate zip file." => "Os ficheiros seleccionados son demasiado grandes como para xerar un ficheiro zip.",
+"couldn't be determined" => "non puido ser determinado",
"Application is not enabled" => "O aplicativo non está activado",
"Authentication error" => "Produciuse un erro na autenticación",
"Token expired. Please reload page." => "Testemuña caducada. Recargue a páxina.",
diff --git a/lib/l10n/hu_HU.php b/lib/l10n/hu_HU.php
index c95358011f0..e25de3e1ed6 100644
--- a/lib/l10n/hu_HU.php
+++ b/lib/l10n/hu_HU.php
@@ -5,11 +5,11 @@
"Users" => "Felhasználók",
"Apps" => "Alkalmazások",
"Admin" => "Admin",
-"ZIP download is turned off." => "A ZIP-letöltés nem engedélyezett.",
+"ZIP download is turned off." => "A ZIP-letöltés nincs engedélyezve.",
"Files need to be downloaded one by one." => "A fájlokat egyenként kell letölteni",
"Back to Files" => "Vissza a Fájlokhoz",
"Selected files too large to generate zip file." => "A kiválasztott fájlok túl nagyok a zip tömörítéshez.",
-"couldn't be determined" => "nem sikerült azonosítani",
+"couldn't be determined" => "nem határozható meg",
"Application is not enabled" => "Az alkalmazás nincs engedélyezve",
"Authentication error" => "Hitelesítési hiba",
"Token expired. Please reload page." => "A token lejárt. Frissítse az oldalt.",
diff --git a/lib/l10n/lb.php b/lib/l10n/lb.php
index a5a9adca187..06e8b2ca094 100644
--- a/lib/l10n/lb.php
+++ b/lib/l10n/lb.php
@@ -4,5 +4,9 @@
"Settings" => "Astellungen",
"Authentication error" => "Authentifikatioun's Fehler",
"Files" => "Dateien",
-"Text" => "SMS"
+"Text" => "SMS",
+"1 hour ago" => "vrun 1 Stonn",
+"last month" => "Läschte Mount",
+"last year" => "Läscht Joer",
+"years ago" => "Joren hier"
);
diff --git a/lib/l10n/ro.php b/lib/l10n/ro.php
index d3ce066c8c1..3f8e59cdac2 100644
--- a/lib/l10n/ro.php
+++ b/lib/l10n/ro.php
@@ -9,6 +9,7 @@
"Files need to be downloaded one by one." => "Fișierele trebuie descărcate unul câte unul.",
"Back to Files" => "Înapoi la fișiere",
"Selected files too large to generate zip file." => "Fișierele selectate sunt prea mari pentru a genera un fișier zip.",
+"couldn't be determined" => "nu poate fi determinat",
"Application is not enabled" => "Aplicația nu este activată",
"Authentication error" => "Eroare la autentificare",
"Token expired. Please reload page." => "Token expirat. Te rugăm să reîncarci pagina.",
diff --git a/lib/l10n/sr.php b/lib/l10n/sr.php
index 2ae7400ba79..34ae89a6219 100644
--- a/lib/l10n/sr.php
+++ b/lib/l10n/sr.php
@@ -9,6 +9,7 @@
"Files need to be downloaded one by one." => "Датотеке морате преузимати једну по једну.",
"Back to Files" => "Назад на датотеке",
"Selected files too large to generate zip file." => "Изабране датотеке су превелике да бисте направили ZIP датотеку.",
+"couldn't be determined" => "није одређено",
"Application is not enabled" => "Апликација није омогућена",
"Authentication error" => "Грешка при провери идентитета",
"Token expired. Please reload page." => "Жетон је истекао. Поново учитајте страницу.",
diff --git a/lib/l10n/sv.php b/lib/l10n/sv.php
index 5799e2dd1a8..36f00636b2b 100644
--- a/lib/l10n/sv.php
+++ b/lib/l10n/sv.php
@@ -9,6 +9,7 @@
"Files need to be downloaded one by one." => "Filer laddas ner en åt gången.",
"Back to Files" => "Tillbaka till Filer",
"Selected files too large to generate zip file." => "Valda filer är för stora för att skapa zip-fil.",
+"couldn't be determined" => "kunde inte bestämmas",
"Application is not enabled" => "Applikationen är inte aktiverad",
"Authentication error" => "Fel vid autentisering",
"Token expired. Please reload page." => "Ogiltig token. Ladda om sidan.",
diff --git a/lib/l10n/th_TH.php b/lib/l10n/th_TH.php
index 75fa02f84b0..0da607a0589 100644
--- a/lib/l10n/th_TH.php
+++ b/lib/l10n/th_TH.php
@@ -9,6 +9,7 @@
"Files need to be downloaded one by one." => "ไฟล์สามารถดาวน์โหลดได้ทีละครั้งเท่านั้น",
"Back to Files" => "กลับไปที่ไฟล์",
"Selected files too large to generate zip file." => "ไฟล์ที่เลือกมีขนาดใหญ่เกินกว่าที่จะสร้างเป็นไฟล์ zip",
+"couldn't be determined" => "ไม่สามารถกำหนดได้",
"Application is not enabled" => "แอพพลิเคชั่นดังกล่าวยังไม่ได้เปิดใช้งาน",
"Authentication error" => "เกิดข้อผิดพลาดในสิทธิ์การเข้าใช้งาน",
"Token expired. Please reload page." => "รหัสยืนยันความถูกต้องหมดอายุแล้ว กรุณาโหลดหน้าเว็บใหม่อีกครั้ง",
diff --git a/lib/l10n/tr.php b/lib/l10n/tr.php
index 9b7f1815fa3..e55caa15972 100644
--- a/lib/l10n/tr.php
+++ b/lib/l10n/tr.php
@@ -9,6 +9,7 @@
"Files need to be downloaded one by one." => "Dosyaların birer birer indirilmesi gerekmektedir.",
"Back to Files" => "Dosyalara dön",
"Selected files too large to generate zip file." => "Seçilen dosyalar bir zip dosyası oluşturmak için fazla büyüktür.",
+"couldn't be determined" => "tespit edilemedi",
"Application is not enabled" => "Uygulama etkinleştirilmedi",
"Authentication error" => "Kimlik doğrulama hatası",
"Token expired. Please reload page." => "Jetonun süresi geçti. Lütfen sayfayı yenileyin.",
diff --git a/lib/l10n/zh_TW.php b/lib/l10n/zh_TW.php
index 4dbf89c2e0e..62ab8fedd52 100644
--- a/lib/l10n/zh_TW.php
+++ b/lib/l10n/zh_TW.php
@@ -9,26 +9,27 @@
"Files need to be downloaded one by one." => "檔案需要逐一下載",
"Back to Files" => "回到檔案列表",
"Selected files too large to generate zip file." => "選擇的檔案太大以致於無法產生壓縮檔",
+"couldn't be determined" => "無法判斷",
"Application is not enabled" => "應用程式未啟用",
"Authentication error" => "認證錯誤",
-"Token expired. Please reload page." => "Token 過期. 請重新整理頁面",
+"Token expired. Please reload page." => "Token 過期,請重新整理頁面。",
"Files" => "檔案",
"Text" => "文字",
"Images" => "圖片",
"seconds ago" => "幾秒前",
"1 minute ago" => "1 分鐘前",
"%d minutes ago" => "%d 分鐘前",
-"1 hour ago" => "1小時之前",
-"%d hours ago" => "%d小時之前",
+"1 hour ago" => "1 小時之前",
+"%d hours ago" => "%d 小時之前",
"today" => "今天",
"yesterday" => "昨天",
"%d days ago" => "%d 天前",
"last month" => "上個月",
-"%d months ago" => "%d個月之前",
+"%d months ago" => "%d 個月之前",
"last year" => "去年",
"years ago" => "幾年前",
-"%s is available. Get <a href=\"%s\">more information</a>" => "%s 已經可用. 取得 <a href=\"%s\">更多資訊</a>",
+"%s is available. Get <a href=\"%s\">more information</a>" => "%s 已經可用。取得 <a href=\"%s\">更多資訊</a>",
"up to date" => "最新的",
"updates check is disabled" => "檢查更新已停用",
-"Could not find category \"%s\"" => "找不到分類-\"%s\""
+"Could not find category \"%s\"" => "找不到分類:\"%s\""
);
diff --git a/lib/mail.php b/lib/mail.php
index 4683a1b4eee..1bb202ac977 100644
--- a/lib/mail.php
+++ b/lib/mail.php
@@ -38,8 +38,12 @@ class OC_Mail {
$SMTPHOST = OC_Config::getValue( 'mail_smtphost', '127.0.0.1' );
$SMTPPORT = OC_Config::getValue( 'mail_smtpport', 25 );
$SMTPAUTH = OC_Config::getValue( 'mail_smtpauth', false );
+ $SMTPAUTHTYPE = OC_Config::getValue( 'mail_smtpauthtype', 'LOGIN' );
$SMTPUSERNAME = OC_Config::getValue( 'mail_smtpname', '' );
$SMTPPASSWORD = OC_Config::getValue( 'mail_smtppassword', '' );
+ $SMTPDEBUG = OC_Config::getValue( 'mail_smtpdebug', false );
+ $SMTPTIMEOUT = OC_Config::getValue( 'mail_smtptimeout', 10 );
+ $SMTPSECURE = OC_Config::getValue( 'mail_smtpsecure', '' );
$mailo = new PHPMailer(true);
@@ -57,12 +61,16 @@ class OC_Mail {
$mailo->Host = $SMTPHOST;
$mailo->Port = $SMTPPORT;
$mailo->SMTPAuth = $SMTPAUTH;
+ $mailo->SMTPDebug = $SMTPDEBUG;
+ $mailo->SMTPSecure = $SMTPSECURE;
+ $mailo->AuthType = $SMTPAUTHTYPE;
$mailo->Username = $SMTPUSERNAME;
$mailo->Password = $SMTPPASSWORD;
+ $mailo->Timeout = $SMTPTIMEOUT;
- $mailo->From =$fromaddress;
+ $mailo->From = $fromaddress;
$mailo->FromName = $fromname;;
- $mailo->Sender =$fromaddress;
+ $mailo->Sender = $fromaddress;
$a=explode(' ', $toaddress);
try {
foreach($a as $ad) {
diff --git a/lib/mimetypes.list.php b/lib/mimetypes.list.php
index 77b97917583..fc87d011ecd 100644
--- a/lib/mimetypes.list.php
+++ b/lib/mimetypes.list.php
@@ -95,4 +95,6 @@ return array(
'cdr' => 'application/coreldraw',
'impress' => 'text/impress',
'ai' => 'application/illustrator',
+ 'epub' => 'application/epub+zip',
+ 'mobi' => 'application/x-mobipocket-ebook',
);
diff --git a/lib/setup.php b/lib/setup.php
index 28882b6bede..4dd190b99fb 100644
--- a/lib/setup.php
+++ b/lib/setup.php
@@ -165,7 +165,9 @@ class OC_Setup {
if(count($error) == 0) {
OC_Appconfig::setValue('core', 'installedat', microtime(true));
OC_Appconfig::setValue('core', 'lastupdatedat', microtime(true));
-
+ OC_AppConfig::setValue('core', 'remote_core.css', '/core/minimizer.php');
+ OC_AppConfig::setValue('core', 'remote_core.js', '/core/minimizer.php');
+
OC_Group::createGroup('admin');
OC_Group::addToGroup($username, 'admin');
OC_User::login($username, $password);
diff --git a/lib/template.php b/lib/template.php
index f7124ebc09c..238d8a8ad0f 100644
--- a/lib/template.php
+++ b/lib/template.php
@@ -186,9 +186,15 @@ class OC_Template{
$this->l10n = OC_L10N::get($parts[0]);
// Some headers to enhance security
- header('X-Frame-Options: Sameorigin');
- header('X-XSS-Protection: 1; mode=block');
- header('X-Content-Type-Options: nosniff');
+ header('X-Frame-Options: Sameorigin'); // Disallow iFraming from other domains
+ header('X-XSS-Protection: 1; mode=block'); // Enforce browser based XSS filters
+ header('X-Content-Type-Options: nosniff'); // Disable sniffing the content type for IE
+
+ // Content Security Policy
+ // If you change the standard policy, please also change it in config.sample.php
+ $policy = OC_Config::getValue('custom_csp_policy', 'default-src \'self\'; script-src \'self\' \'unsafe-eval\'; style-src \'self\' \'unsafe-inline\'; frame-src *; img-src *');
+ header('Content-Security-Policy:'.$policy); // Standard
+ header('X-WebKit-CSP:'.$policy); // Older webkit browsers
$this->findTemplate($name);
}
diff --git a/lib/templatelayout.php b/lib/templatelayout.php
index 4173e008ba7..37ece91047f 100644
--- a/lib/templatelayout.php
+++ b/lib/templatelayout.php
@@ -33,18 +33,6 @@ class OC_TemplateLayout extends OC_Template {
} else {
parent::__construct('core', 'layout.base');
}
-
- $apps_paths = array();
- foreach(OC_App::getEnabledApps() as $app) {
- $apps_paths[$app] = OC_App::getAppWebPath($app);
- }
- $this->assign( 'apps_paths', str_replace('\\/', '/', json_encode($apps_paths)), false ); // Ugly unescape slashes waiting for better solution
-
- if (OC_Config::getValue('installed', false) && !OC_AppConfig::getValue('core', 'remote_core.css', false)) {
- OC_AppConfig::setValue('core', 'remote_core.css', '/core/minimizer.php');
- OC_AppConfig::setValue('core', 'remote_core.js', '/core/minimizer.php');
- }
-
// Add the js files
$jsfiles = self::findJavascriptFiles(OC_Util::$scripts);
$this->assign('jsfiles', array(), false);