/** * ownCloud - ownpad_lite plugin * * @author Victor Dubiniuk * @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com * * This file is licensed under the Affero General Public License version 3 or * later. */ namespace OCA\ownpad_lite; \OCP\JSON::checkLoggedIn(); \OCP\JSON::callCheck(); $status = true; $recipients = UrlParam::post(UrlParam::SHARE_WITH); $source = UrlParam::post(UrlParam::SHARE_WHAT); if ($source && $recipients) { $currentUser = \OCP\User::getUser(); $nameFrom = \OCP\User::getDisplayName($currentUser); $subject = App::$l10n->t('Document was shared'); $message = App::$l10n->t('User %s shared quick document %s with you.', array($nameFrom, $source)); $pattern = '/(.*)\\s+<(.*)>$/'; $recipientList = array('name' => array(), 'email' => array()); $sendTo = explode(',', $recipients); foreach ($sendTo as $recipient) { if (preg_match_all($pattern, $recipient, $matches)) { // We have 'John Doe <*****@*****.**>' $recipientList['name'][] = $matches[1][0]; $recipientList['email'][] = $matches[2][0]; } else { // Name is unknown, we have email@example.org
<?php /** * ownCloud - ownpad_lite plugin * * @author Victor Dubiniuk * @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com * * This file is licensed under the Affero General Public License version 3 or * later. */ namespace OCA\ownpad_lite; \OCP\JSON::checkLoggedIn(); \OCP\JSON::callCheck(); $search = UrlParam::post(UrlParam::SHARE_SEARCH); \OCP\JSON::success(array('data' => Contacts::search($search))); exit;
/** * ownCloud - ownpad_lite plugin * * @author Victor Dubiniuk * @copyright 2012 Victor Dubiniuk victor.dubiniuk@gmail.com * * This file is licensed under the Affero General Public License version 3 or * later. */ namespace OCA\ownpad_lite; \OCP\JSON::checkLoggedIn(); \OCP\JSON::callCheck(); $serviceUrl = UrlParam::post(UrlParam::CONFIG_URL); $username = UrlParam::post(UrlParam::CONFIG_USERNAME); $errors = array(); $username = preg_replace('/[^0-9a-zA-Z\\.\\-_]*/i', '', $username); if ($username) { App::setUsername($username); } else { $errors[] = App::ERROR_USERNAME_INVALID; } if ($serviceUrl) { if (preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $serviceUrl)) { App::setServiceUrl($serviceUrl); } else { $errors[] = App::ERROR_URL_INVALID; } } \OCP\JSON::success(array('data' => $errors));