From f5c9fe9ece6fdfb35bab5eefdf83830b5045b5a8 Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Mon, 23 Apr 2012 15:50:30 +0200 Subject: [PATCH] =?utf8?q?first=20step=20to=20an=20public=20api=20of=20own?= =?utf8?q?Cloud=20for=20the=20apps.=20In=20the=20future=20they=20shouldn?= =?utf8?q?=C2=B4t=20call=20internall=20classes,=20functions=20or=20session?= =?utf8?q?=20variables=20because=20this=20will=20change=20and=20break=20in?= =?utf8?q?=20upcoming=20versions.=20Apps=20should=20only=20call=20this=20p?= =?utf8?q?ublic=20interface=20that=20we=20will=20kepp=20stable=20over=20di?= =?utf8?q?fferent=20releases.=20The=20namespace=20is=20OCP=20for=20ownClou?= =?utf8?q?d=20public.=20This=20is=20just=20the=20first=20step.=20more=20co?= =?utf8?q?ming=20soon?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- lib/base.php | 3 +++ lib/public/util.php | 60 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 lib/public/util.php diff --git a/lib/base.php b/lib/base.php index f3dacdc0f76..5c42000b9e1 100644 --- a/lib/base.php +++ b/lib/base.php @@ -81,6 +81,9 @@ class OC{ elseif(strpos($className,'OC_')===0){ require_once strtolower(str_replace('_','/',substr($className,3)) . '.php'); } + elseif(strpos($className,'OCP\\')===0){ + require_once 'public/'.strtolower(str_replace('\\','/',substr($className,3)) . '.php'); + } elseif(strpos($className,'Sabre_')===0) { require_once str_replace('_','/',$className) . '.php'; } diff --git a/lib/public/util.php b/lib/public/util.php new file mode 100644 index 00000000000..3425ed9df3b --- /dev/null +++ b/lib/public/util.php @@ -0,0 +1,60 @@ +. +* +*/ + +/** + * Public interface of ownCloud for apps to use. + * Utility 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 Util { + + /** + * send an email + * + * @param string $toaddress + * @param string $toname + * @param string $subject + * @param string $mailtext + * @param string $fromaddress + * @param string $fromname + * @param bool $html + */ + public static function sendmail($toaddress,$toname,$subject,$mailtext,$fromaddress,$fromname,$html=0,$altbody='',$ccaddress='',$ccname='',$bcc='') { + + // call the internal mail class + OC_MAIL::send($toaddress,$toname,$subject,$mailtext,$fromaddress,$fromname,$html=0,$altbody='',$ccaddress='',$ccname='',$bcc=''); + + } + + + +} + + + + +?> -- 2.39.5