diff --git a/apps/bookmarks/ajax/editBookmark.php b/apps/bookmarks/ajax/editBookmark.php
old mode 100644
new mode 100755
index a834cd216e6e435879ee261410a07b766f15f63b..5bed9d08448a8dc08c81a83a70fc270dadb1e3bc
--- a/apps/bookmarks/ajax/editBookmark.php
+++ b/apps/bookmarks/ajax/editBookmark.php
@@ -30,7 +30,7 @@ $RUNTIME_NOSETUPFS=true;
 OC_JSON::checkLoggedIn();
 OC_JSON::checkAppEnabled('bookmarks');
 
-$CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
+$CONFIG_DBTYPE = OCP\Config::getSystemValue( "dbtype", "sqlite" );
 if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
 	$_ut = "strftime('%s','now')";
 } elseif($CONFIG_DBTYPE == 'pgsql') {
diff --git a/apps/bookmarks/bookmarksHelper.php b/apps/bookmarks/bookmarksHelper.php
index 25c9b4cc7f219a113bcaa5efd39f1b8eb6155ed0..e299f9ee19b984d4ad8cc18b004c80621ff9fdb3 100755
--- a/apps/bookmarks/bookmarksHelper.php
+++ b/apps/bookmarks/bookmarksHelper.php
@@ -72,7 +72,7 @@ function getURLMetadata($url) {
 }
 
 function addBookmark($url, $title, $tags='') {
-	$CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
+	$CONFIG_DBTYPE = OCP\Config::getSystemValue( "dbtype", "sqlite" );
 	if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
 		$_ut = "strftime('%s','now')";
 	} elseif($CONFIG_DBTYPE == 'pgsql') {
diff --git a/apps/bookmarks/lib/bookmarks.php b/apps/bookmarks/lib/bookmarks.php
index 3f27af09557bf7b1c589f3a506cc2cbeed859b6e..cbc50fdb81c00d7d5862fc3cbacb2ca76a0bb0c0 100755
--- a/apps/bookmarks/lib/bookmarks.php
+++ b/apps/bookmarks/lib/bookmarks.php
@@ -35,7 +35,7 @@ class OC_Bookmarks_Bookmarks{
 	 */
 	public static function findBookmarks($offset, $sqlSortColumn, $filter, $filterTagOnly){
 		//OCP\Util::writeLog('bookmarks', 'findBookmarks ' .$offset. ' '.$sqlSortColumn.' '. $filter.' '. $filterTagOnly ,OCP\Util::DEBUG);
-		$CONFIG_DBTYPE = OC_Config::getValue( 'dbtype', 'sqlite' );
+		$CONFIG_DBTYPE = OCP\Config::getSystemValue( 'dbtype', 'sqlite' );
 	
 		$params=array(OCP\USER::getUser());
 	
diff --git a/apps/files/admin.php b/apps/files/admin.php
index c14a97568f00eae60a1670891905ce194aacf999..a59a73f0a5b2667f1b719d7a0724a8eec799f90d 100755
--- a/apps/files/admin.php
+++ b/apps/files/admin.php
@@ -40,14 +40,14 @@ if($_POST) {
 	}
 	if(isset($_POST['maxZipInputSize'])) {
 		$maxZipInputSize=$_POST['maxZipInputSize'];
-		OC_Config::setValue('maxZipInputSize', OCP\Util::computerFileSize($maxZipInputSize));
+		OCP\Config::setSystemValue('maxZipInputSize', OCP\Util::computerFileSize($maxZipInputSize));
 	}
 	if(isset($_POST['submitFilesAdminSettings'])) {
-		OC_Config::setValue('allowZipDownload', isset($_POST['allowZipDownload']));
+		OCP\Config::setSystemValue('allowZipDownload', isset($_POST['allowZipDownload']));
 	}
 }
-$maxZipInputSize = OCP\Util::humanFileSize(OC_Config::getValue('maxZipInputSize', OCP\Util::computerFileSize('800 MB')));
-$allowZipDownload = intval(OC_Config::getValue('allowZipDownload', true));
+$maxZipInputSize = OCP\Util::humanFileSize(OCP\Config::getSystemValue('maxZipInputSize', OCP\Util::computerFileSize('800 MB')));
+$allowZipDownload = intval(OCP\Config::getSystemValue('allowZipDownload', true));
 
 OCP\App::setActiveNavigationEntry( "files_administration" );
 
diff --git a/apps/files/index.php b/apps/files/index.php
index 86b877115ca75710ce8d09970b845d2036ccbe86..e2a0eb80a03e9b4751dee1e6130aaf2237220431 100755
--- a/apps/files/index.php
+++ b/apps/files/index.php
@@ -96,7 +96,7 @@ $tmpl->assign( 'readonly', !OC_Filesystem::is_writable($dir));
 $tmpl->assign( "files", $files );
 $tmpl->assign( 'uploadMaxFilesize', $maxUploadFilesize);
 $tmpl->assign( 'uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize));
-$tmpl->assign( 'allowZipDownload', intval(OC_Config::getValue('allowZipDownload', true)));
+$tmpl->assign( 'allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true)));
 $tmpl->printPage();
 
 ?>
diff --git a/apps/files_versions/ajax/togglesettings.php b/apps/files_versions/ajax/togglesettings.php
old mode 100644
new mode 100755
index 8cb5057672d2c4425aeef628db427870f3c2fbff..49e314f86aa17d348447422508a215b7f53c97e4
--- a/apps/files_versions/ajax/togglesettings.php
+++ b/apps/files_versions/ajax/togglesettings.php
@@ -2,10 +2,10 @@
 
 OC_JSON::checkAppEnabled('files_versions');
 OC_JSON::checkAdminUser();
-if (OC_Config::getValue('versions', 'true')=='true') {
-	OC_Config::setValue('versions', 'false');
+if (OCP\Config::getSystemValue('versions', 'true')=='true') {
+	OCP\Config::setSystemValue('versions', 'false');
 } else {
-	OC_Config::setValue('versions', 'true');
+	OCP\Config::setSystemValue('versions', 'true');
 }
 
 ?>
diff --git a/apps/files_versions/templates/settings.php b/apps/files_versions/templates/settings.php
old mode 100644
new mode 100755
index 74882473168605501fc7c0238edb2d4096a60337..c3a856bc196e6951a231a49c72e446a41046ba40
--- a/apps/files_versions/templates/settings.php
+++ b/apps/files_versions/templates/settings.php
@@ -1,5 +1,5 @@
 <form id="versions">
         <fieldset class="personalblock">
-	        <input type="checkbox" name="versions" id="versions" value="1" <?php if (OC_Config::getValue('versions', 'true')=='true') echo ' checked="checked"'; ?> /> <label for="versions"><?php echo $l->t('Enable Files Versioning'); ?></label> <br/>
+	        <input type="checkbox" name="versions" id="versions" value="1" <?php if (OCP\Config::getSystemValue('versions', 'true')=='true') echo ' checked="checked"'; ?> /> <label for="versions"><?php echo $l->t('Enable Files Versioning'); ?></label> <br/>
         </fieldset>
 </form>
diff --git a/apps/files_versions/versions.php b/apps/files_versions/versions.php
index 5f8767fd76835b77a20460669f8e7771386de4ba..082dfbf7fd07b4dbc5dd25a37395444bca1b24b2 100755
--- a/apps/files_versions/versions.php
+++ b/apps/files_versions/versions.php
@@ -42,9 +42,9 @@ class Storage {
 	 * init the versioning and create the versions folder.
 	 */
 	public static function init() {
-		if(\OC_Config::getValue('files_versions', Storage::DEFAULTENABLED)=='true') {
+		if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') {
 			// create versions folder
-			$foldername=\OC_Config::getValue('datadirectory').'/'. \OCP\USER::getUser() .'/'.\OC_Config::getValue('files_versionsfolder', Storage::DEFAULTFOLDER);
+			$foldername=\OCP\Config::getSystemValue('datadirectory').'/'. \OCP\USER::getUser() .'/'.\OCP\Config::getSystemValue('files_versionsfolder', Storage::DEFAULTFOLDER);
 			if(!is_dir($foldername)){
 				mkdir($foldername);
 			}
@@ -56,7 +56,7 @@ class Storage {
 	 * listen to write event.
 	 */
 	public static function write_hook($params) {
-		if(\OC_Config::getValue('files_versions', Storage::DEFAULTENABLED)=='true') {
+		if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') {
 			$path = $params[\OC_Filesystem::signal_param_path];
 			if($path<>'') Storage::store($path);
 		}
@@ -68,9 +68,9 @@ class Storage {
 	 * store a new version of a file.
 	 */
 	public static function store($filename) {
-		if(\OC_Config::getValue('files_versions', Storage::DEFAULTENABLED)=='true') {
-			$versionsfoldername=\OC_Config::getValue('datadirectory').'/'. \OCP\USER::getUser() .'/'.\OC_Config::getValue('files_versionsfolder', Storage::DEFAULTFOLDER);
-			$filesfoldername=\OC_Config::getValue('datadirectory').'/'. \OCP\USER::getUser() .'/files';
+		if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') {
+			$versionsfoldername=\OCP\Config::getSystemValue('datadirectory').'/'. \OCP\USER::getUser() .'/'.\OCP\Config::getSystemValue('files_versionsfolder', Storage::DEFAULTFOLDER);
+			$filesfoldername=\OCP\Config::getSystemValue('datadirectory').'/'. \OCP\USER::getUser() .'/files';
 			Storage::init();
 
 			// check if filename is a directory
@@ -79,7 +79,7 @@ class Storage {
 			}
 
 			// check filetype blacklist
-			$blacklist=explode(' ',\OC_Config::getValue('files_versionsblacklist', Storage::DEFAULTBLACKLIST));
+			$blacklist=explode(' ',\OCP\Config::getSystemValue('files_versionsblacklist', Storage::DEFAULTBLACKLIST));
 			foreach($blacklist as $bl) {
 				$parts=explode('.', $filename);
 				$ext=end($parts);
@@ -89,7 +89,7 @@ class Storage {
 			}
 			
 			// check filesize
-			if(filesize($filesfoldername.$filename)>\OC_Config::getValue('files_versionsmaxfilesize', Storage::DEFAULTMAXFILESIZE)){
+			if(filesize($filesfoldername.$filename)>\OCP\Config::getSystemValue('files_versionsmaxfilesize', Storage::DEFAULTMAXFILESIZE)){
 				return false;
 			}
 
@@ -122,11 +122,11 @@ class Storage {
 	 */
 	public static function rollback($filename,$revision) {
 	
-		if(\OC_Config::getValue('files_versions', Storage::DEFAULTENABLED)=='true') {
+		if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') {
 		
-			$versionsfoldername=\OC_Config::getValue('datadirectory').'/'. \OCP\USER::getUser() .'/'.\OC_Config::getValue('files_versionsfolder', Storage::DEFAULTFOLDER);
+			$versionsfoldername=\OCP\Config::getSystemValue('datadirectory').'/'. \OCP\USER::getUser() .'/'.\OCP\Config::getSystemValue('files_versionsfolder', Storage::DEFAULTFOLDER);
 			
-			$filesfoldername=\OC_Config::getValue('datadirectory').'/'. \OCP\USER::getUser() .'/files';
+			$filesfoldername=\OCP\Config::getSystemValue('datadirectory').'/'. \OCP\USER::getUser() .'/files';
 			
 			// rollback
 			if ( @copy($versionsfoldername.$filename.'.v'.$revision,$filesfoldername.$filename) ) {
@@ -147,8 +147,8 @@ class Storage {
 	 * check if old versions of a file exist.
 	 */
 	public static function isversioned($filename) {
-		if(\OC_Config::getValue('files_versions', Storage::DEFAULTENABLED)=='true') {
-			$versionsfoldername=\OC_Config::getValue('datadirectory').'/'. \OCP\USER::getUser() .'/'.\OC_Config::getValue('files_versionsfolder', Storage::DEFAULTFOLDER);
+		if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') {
+			$versionsfoldername=\OCP\Config::getSystemValue('datadirectory').'/'. \OCP\USER::getUser() .'/'.\OCP\Config::getSystemValue('files_versionsfolder', Storage::DEFAULTFOLDER);
 
 			// check for old versions
 			$matches=glob($versionsfoldername.$filename.'.v*');
@@ -168,8 +168,8 @@ class Storage {
          * get a list of old versions of a file.
          */
         public static function getversions($filename,$count=0) {
-                if(\OC_Config::getValue('files_versions', Storage::DEFAULTENABLED)=='true') {
-			$versionsfoldername=\OC_Config::getValue('datadirectory').'/'. \OCP\USER::getUser() .'/'.\OC_Config::getValue('files_versionsfolder', Storage::DEFAULTFOLDER);
+                if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') {
+			$versionsfoldername=\OCP\Config::getSystemValue('datadirectory').'/'. \OCP\USER::getUser() .'/'.\OCP\Config::getSystemValue('files_versionsfolder', Storage::DEFAULTFOLDER);
 			$versions=array();         
  
 	              // fetch for old versions
@@ -199,14 +199,14 @@ class Storage {
          * expire old versions of a file.
          */
         public static function expire($filename) {
-                if(\OC_Config::getValue('files_versions', Storage::DEFAULTENABLED)=='true') {
+                if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') {
 
-			$versionsfoldername=\OC_Config::getValue('datadirectory').'/'. \OCP\USER::getUser() .'/'.\OC_Config::getValue('files_versionsfolder', Storage::DEFAULTFOLDER);
+			$versionsfoldername=\OCP\Config::getSystemValue('datadirectory').'/'. \OCP\USER::getUser() .'/'.\OCP\Config::getSystemValue('files_versionsfolder', Storage::DEFAULTFOLDER);
 
 			// check for old versions
 			$matches=glob($versionsfoldername.$filename.'.v*');
-			if(count($matches)>\OC_Config::getValue('files_versionmaxversions', Storage::DEFAULTMAXVERSIONS)){
-				$numbertodelete=count($matches-\OC_Config::getValue('files_versionmaxversions', Storage::DEFAULTMAXVERSIONS));
+			if(count($matches)>\OCP\Config::getSystemValue('files_versionmaxversions', Storage::DEFAULTMAXVERSIONS)){
+				$numbertodelete=count($matches-\OCP\Config::getSystemValue('files_versionmaxversions', Storage::DEFAULTMAXVERSIONS));
 
 				// delete old versions of a file
 				$deleteitems=array_slice($matches,0,$numbertodelete);
diff --git a/apps/gallery/ajax/sharing.php b/apps/gallery/ajax/sharing.php
old mode 100644
new mode 100755
index ce56d652c6025746a246129edb6e1a53ed878389..04de57eb1778b51ea386ebde03c565a13626adbf
--- a/apps/gallery/ajax/sharing.php
+++ b/apps/gallery/ajax/sharing.php
@@ -80,7 +80,7 @@ function handleGetThumbnail($token, $imgpath) {
 function handleGetAlbumThumbnail($token, $albumname)
 {
   $owner = OC_Gallery_Sharing::getTokenOwner($token);
-  $file = OC_Config::getValue("datadirectory").'/'. $owner .'/gallery/'.$albumname.'.png';
+  $file = OCP\Config::getSystemValue("datadirectory").'/'. $owner .'/gallery/'.$albumname.'.png';
   $image = new OC_Image($file);
   if ($image->valid()) {
     $image->centerCrop();
@@ -93,7 +93,7 @@ function handleGetAlbumThumbnail($token, $albumname)
 
 function handleGetPhoto($token, $photo) {
   $owner = OC_Gallery_Sharing::getTokenOwner($token);
-  $file = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" ).'/'.$owner.'/files'.urldecode($photo);
+  $file = OCP\Config::getSystemValue( "datadirectory", OC::$SERVERROOT."/data" ).'/'.$owner.'/files'.urldecode($photo);
   header('Content-Type: '.OC_Image::getMimeTypeForFile($file));
   OC_Response::sendFile($file);
 }
diff --git a/apps/gallery/index.php b/apps/gallery/index.php
index 0ae6b15d7639d0b33a5dd938f3972cefb840f89a..4d49e3212e2c754e86bd4b9b693876014a980ec9 100755
--- a/apps/gallery/index.php
+++ b/apps/gallery/index.php
@@ -27,8 +27,8 @@ OCP\User::checkLoggedIn();
 OC_Util::checkAppEnabled('gallery');
 OCP\App::setActiveNavigationEntry( 'gallery_index' );
 
-if (!file_exists(OC_Config::getValue("datadirectory").'/'. OCP\USER::getUser() .'/gallery')) {
-  mkdir(OC_Config::getValue("datadirectory").'/'. OCP\USER::getUser() .'/gallery');
+if (!file_exists(OCP\Config::getSystemValue("datadirectory").'/'. OCP\USER::getUser() .'/gallery')) {
+  mkdir(OCP\Config::getSystemValue("datadirectory").'/'. OCP\USER::getUser() .'/gallery');
 }
 
 if (!isset($_GET['view'])) {
diff --git a/apps/gallery/lib/photo.php b/apps/gallery/lib/photo.php
index 455ac5036d90e2722e2ea2c66c0c1218bb808726..7885ce2bf5605160ee4ada58306ab3a0bdb232f7 100755
--- a/apps/gallery/lib/photo.php
+++ b/apps/gallery/lib/photo.php
@@ -68,7 +68,7 @@ class OC_Gallery_Photo {
 
 	public static function getThumbnail($image_name, $owner = null) {
 		if (!$owner) $owner = OCP\USER::getUser();
-		$save_dir = OC_Config::getValue("datadirectory").'/'. $owner .'/gallery/';
+		$save_dir = OCP\Config::getSystemValue("datadirectory").'/'. $owner .'/gallery/';
 		$save_dir .= dirname($image_name). '/';
 		$image_path = $image_name;
 		$thumb_file = $save_dir . basename($image_name);
diff --git a/apps/gallery/lib/scanner.php b/apps/gallery/lib/scanner.php
index 9cf8c113d1f89cf529e254ebc2b7686268777f76..11c7541a75fefb3ab40c2a1498bc1c9054773192 100755
--- a/apps/gallery/lib/scanner.php
+++ b/apps/gallery/lib/scanner.php
@@ -81,7 +81,7 @@ class OC_Gallery_Scanner {
 				$image->destroy();
 			}
 		}
-		imagepng($thumbnail, OC_Config::getValue("datadirectory").'/'. OCP\USER::getUser() .'/gallery/' . $albumName.'.png');
+		imagepng($thumbnail, OCP\Config::getSystemValue("datadirectory").'/'. OCP\USER::getUser() .'/gallery/' . $albumName.'.png');
 		imagedestroy($thumbnail);
 	}
 
diff --git a/apps/user_migrate/admin.php b/apps/user_migrate/admin.php
index 028433939c59bcb5b949747ed59a99cfb93f0109..518e4f43f61e76bbc30d7a5c564a2fec98f4d1c8 100755
--- a/apps/user_migrate/admin.php
+++ b/apps/user_migrate/admin.php
@@ -30,7 +30,7 @@ if (isset($_POST['user_import'])) {
 	$importname = "owncloud_import_" . date("y-m-d_H-i-s");
 	
 	// Save data dir for later
-	$datadir = OC_Config::getValue( 'datadirectory' );
+	$datadir = OCP\Config::getSystemValue( 'datadirectory' );
 	
 	// Copy the uploaded file
 	$from = $_FILES['owncloud_import']['tmp_name'];
diff --git a/apps/user_openid/phpmyid.php b/apps/user_openid/phpmyid.php
index a86e8070fc816a97bc7246c7bf0b9fe8c0e2df3f..21d1c0a45459cd9f0eeb0b75e8ab1e6e448ee027 100755
--- a/apps/user_openid/phpmyid.php
+++ b/apps/user_openid/phpmyid.php
@@ -1067,7 +1067,7 @@ function destroy_assoc_handle ( $id ) {
 	session_write_close();
 
 	session_id($id);
-	if (OC_Config::getValue( "forcessl", false )) {
+	if (OCP\Config::getSystemValue( "forcessl", false )) {
 		ini_set("session.cookie_secure", "on");
 	}
 	session_start();
@@ -1195,7 +1195,7 @@ function new_assoc ( $expiration ) {
 		session_write_close();
 	}
 
-	if (OC_Config::getValue( "forcessl", false )) {
+	if (OCP\Config::getSystemValue( "forcessl", false )) {
 		ini_set("session.cookie_secure", "on");
 	}
 	session_start();
@@ -1269,7 +1269,7 @@ function secret ( $handle ) {
 	}
 
 	session_id($handle);
-	if (OC_Config::getValue( "forcessl", false )) {
+	if (OCP\Config::getSystemValue( "forcessl", false )) {
 		ini_set("session.cookie_secure", "on");
 	}
 	session_start();
@@ -1447,7 +1447,7 @@ function user_session () {
 	global $proto, $profile;
 
 	session_name('phpMyID_Server');
-	if (OC_Config::getValue( "forcessl", false )) {
+	if (OCP\Config::getSystemValue( "forcessl", false )) {
 		ini_set("session.cookie_secure", "on");
 	}
 	@session_start();
diff --git a/lib/public/config.php b/lib/public/config.php
new file mode 100644
index 0000000000000000000000000000000000000000..de9d163624b9dade7d581e558d9b0da5c1134741
--- /dev/null
+++ b/lib/public/config.php
@@ -0,0 +1,70 @@
+<?php
+/**
+* ownCloud
+*
+* @author Frank Karlitschek
+* @copyright 2010 Frank Karlitschek karlitschek@kde.org
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+* License as published by the Free Software Foundation; either
+* version 3 of the License, or any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+*
+* You should have received a copy of the GNU Affero General Public
+* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+/**
+ * Public interface of ownCloud for apps to use.
+ * Config Class
+ *
+ */
+
+// use OCP namespace for all classes that are considered public. 
+// This means that they should be used by apps instead of the internal ownCloud classes
+namespace OCP;
+
+class Config {
+
+
+
+
+	/**
+	 * @brief Gets a value from config.php
+	 * @param $key key
+	 * @param $default = null default value
+	 * @returns the value or $default
+	 *
+	 * This function gets the value from config.php. If it does not exist,
+	 * $default will be returned.
+	 */
+	public static function getSystemValue( $key, $default = null ){
+		return(\OC_Config::getValue( $key, $default ));
+	}
+
+
+	/**
+	 * @brief Sets a value
+	 * @param $key key
+	 * @param $value value
+	 * @returns true/false
+	 *
+	 * This function sets the value and writes the config.php. If the file can
+	 * not be written, false will be returned.
+	 */
+	public static function setSystemValue( $key, $value ){
+		return(\OC_Config::setValue( $key, $value ));
+	}
+
+
+
+
+}
+
+?>