From 854da1d9ca19ded3bddbd79f4c70d630148bb916 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 17 May 2013 15:48:51 +0200 Subject: [PATCH 1/4] Add classes replaced by the public api to the code checker --- lib/installer.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/installer.php b/lib/installer.php index 49ba4492632..2229559208a 100644 --- a/lib/installer.php +++ b/lib/installer.php @@ -436,10 +436,28 @@ class OC_Installer{ $blacklist=array( 'exec(', - 'eval(' + 'eval(', // more evil pattern will go here later - // will will also check if an app is using private api once the public api is in place + // classes replaced by the public api + 'OC_API::', + 'OC_App::', + 'OC_AppConfig::', + 'OC_BackgroundJob::', + 'OC_Config::', + 'OC_DB::', + 'OC_Files::', + 'OC_Helper::', + 'OC_Hook::', + 'OC_JSON::', + 'OC_Log::', + 'OC_Mail::', + 'OC_Preferences::', + 'OC_Request::', + 'OC_Response::', + 'OC_Template::', + 'OC_User::', + 'OC_Util::', ); // is the code checker enabled? From 9379cbf602362443f1084303c50234470acd15b7 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 19 Jul 2013 11:23:47 +0200 Subject: [PATCH 2/4] Add OC_Image to public api --- lib/installer.php | 1 + lib/public/image.php | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 lib/public/image.php diff --git a/lib/installer.php b/lib/installer.php index 2229559208a..97f4e2b5fb8 100644 --- a/lib/installer.php +++ b/lib/installer.php @@ -449,6 +449,7 @@ class OC_Installer{ 'OC_Files::', 'OC_Helper::', 'OC_Hook::', + 'OC_Image::', 'OC_JSON::', 'OC_Log::', 'OC_Mail::', diff --git a/lib/public/image.php b/lib/public/image.php new file mode 100644 index 00000000000..dcecc077e2f --- /dev/null +++ b/lib/public/image.php @@ -0,0 +1,29 @@ + +* +* 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 . +* +*/ + +namespace OCP; + +/** + * This class provides functions to handle images + */ +class Image extends OC_Image { +} From a22940d3cd461a4d8f48b9bbd6eecbb380837d21 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 19 Jul 2013 11:40:11 +0200 Subject: [PATCH 3/4] Add OC_L10N to public api --- lib/installer.php | 1 + lib/public/util.php | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/lib/installer.php b/lib/installer.php index 97f4e2b5fb8..dcd29f9e1ad 100644 --- a/lib/installer.php +++ b/lib/installer.php @@ -451,6 +451,7 @@ class OC_Installer{ 'OC_Hook::', 'OC_Image::', 'OC_JSON::', + 'OC_L10N::', 'OC_Log::', 'OC_Mail::', 'OC_Preferences::', diff --git a/lib/public/util.php b/lib/public/util.php index 6744c2d37bd..cad1c5fd64e 100644 --- a/lib/public/util.php +++ b/lib/public/util.php @@ -77,6 +77,15 @@ class Util { \OC_LOG::write( $app, $message, $level ); } + /** + * @brief get l10n object + * @param string $app + * @return OC_L10N + */ + public static function getL10N( $application ) { + \OC_L10N::get( $application ); + } + /** * @brief add a css file * @param string $url From cbe1c22b5f027d010c1b6bb5d27d79526261f76a Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 19 Jul 2013 17:32:31 +0200 Subject: [PATCH 4/4] Correct casing of OC_User and pass through the params to getUsers --- lib/public/user.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/public/user.php b/lib/public/user.php index 9edebe0e7cf..23ff991642d 100644 --- a/lib/public/user.php +++ b/lib/public/user.php @@ -40,7 +40,7 @@ class User { * @return string uid or false */ public static function getUser() { - return \OC_USER::getUser(); + return \OC_User::getUser(); } /** @@ -50,7 +50,7 @@ class User { * Get a list of all users. */ public static function getUsers($search = '', $limit = null, $offset = null) { - return \OC_USER::getUsers(); + return \OC_User::getUsers($search, $limit, $offset); } /** @@ -58,7 +58,7 @@ class User { * @return string display name */ public static function getDisplayName($user=null) { - return \OC_USER::getDisplayName($user); + return \OC_User::getDisplayName($user); } /** @@ -68,7 +68,7 @@ class User { * Get a list of all display names and user ids. */ public static function getDisplayNames($search = '', $limit = null, $offset = null) { - return \OC_USER::getDisplayNames($search, $limit, $offset); + return \OC_User::getDisplayNames($search, $limit, $offset); } /** @@ -78,7 +78,7 @@ class User { * Checks if the user is logged in */ public static function isLoggedIn() { - return \OC_USER::isLoggedIn(); + return \OC_User::isLoggedIn(); } /** @@ -88,14 +88,14 @@ class User { * @return boolean */ public static function userExists( $uid, $excludingBackend = null ) { - return \OC_USER::userExists( $uid, $excludingBackend ); + return \OC_User::userExists( $uid, $excludingBackend ); } /** * @brief Loggs the user out including all the session data * Logout, destroys session */ public static function logout() { - \OC_USER::logout(); + \OC_User::logout(); } /** @@ -107,7 +107,7 @@ class User { * Check if the password is correct without logging in the user */ public static function checkPassword( $uid, $password ) { - return \OC_USER::checkPassword( $uid, $password ); + return \OC_User::checkPassword( $uid, $password ); } /**