- cleanups;
- required templates implemented; - password-protection implemented and tested; - elaspe date tested; Calendar-sharing functionality can now be considered fully implemented.master
parent
2a70aa4169
commit
807b848c66
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
OC_Log::write('calendar', __FILE__ . ' : ' . __LINE__ . ' [' . __FUNCTION__ . ']', OC_Log::ERROR);
|
||||
$l = OCP\Util::getL10N('calendar');
|
||||
OC::$CLASSPATH['OC_Calendar_App'] = 'calendar/lib/app.php';
|
||||
OC::$CLASSPATH['OC_Calendar_Calendar'] = 'calendar/lib/calendar.php';
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
|
||||
OC_Log::write('calendar', __FILE__ . ' : ' . __LINE__ . ' [' . __FUNCTION__ . ']', OC_Log::ERROR);
|
||||
// OCS API
|
||||
|
||||
//TODO: SET: mail notification, waiting for PR #4689 to be accepted
|
||||
|
|
|
@ -287,6 +287,7 @@ button.category{margin:0 3px;}
|
|||
width:100%;
|
||||
height:44px;
|
||||
top:43px;
|
||||
font-size:80%;
|
||||
}
|
||||
|
||||
#linksharedinfo a {
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
OC_Log::write('calendar', __FILE__ . ' : ' . __LINE__ . ' [' . __FUNCTION__ . ']', OC_Log::ERROR);
|
||||
|
||||
class OC_Share_Backend_Calendar implements OCP\Share_Backend_Collection {
|
||||
const FORMAT_CALENDAR = 1;
|
||||
|
||||
|
@ -37,9 +35,6 @@ class OC_Share_Backend_Calendar implements OCP\Share_Backend_Collection {
|
|||
* The formatItems() function will translate the source returned back into the item
|
||||
*/
|
||||
public function isValidSource($itemSource, $uidOwner) {
|
||||
OC_Log::write('calendar', __FILE__ . ' : ' . __LINE__ . ' [' . __FUNCTION__ . ']', OC_Log::ERROR);
|
||||
OC_Log::write('calendar', '+- $itemSource: ' . var_export($itemSource, true), OC_Log::ERROR);
|
||||
OC_Log::write('calendar', '+- $uidOwner : ' . var_export($uidOwner, true), OC_Log::ERROR);
|
||||
$calendar = OC_Calendar_App::getCalendar( $itemSource );
|
||||
if ($calendar === false || $calendar['userid'] != $uidOwner) {
|
||||
return false;
|
||||
|
@ -58,10 +53,6 @@ class OC_Share_Backend_Calendar implements OCP\Share_Backend_Collection {
|
|||
* If it does generate a new name e.g. name_#
|
||||
*/
|
||||
public function generateTarget($itemSource, $shareWith, $exclude = null) {
|
||||
OC_Log::write('calendar', __FILE__ . ' : ' . __LINE__ . ' [' . __FUNCTION__ . ']', OC_Log::ERROR);
|
||||
OC_Log::write('calendar', '+- $itemSource: ' . var_export($itemSource, true), OC_Log::ERROR);
|
||||
OC_Log::write('calendar', '+- $shareWith : ' . var_export($shareWith, true), OC_Log::ERROR);
|
||||
OC_Log::write('calendar', '+- $exclude : ' . var_export($exclude, true), OC_Log::ERROR);
|
||||
$calendar = OC_Calendar_App::getCalendar( $itemSource );
|
||||
$user_calendars = array();
|
||||
foreach(OC_Calendar_Calendar::allCalendars($shareWith) as $user_calendar) {
|
||||
|
@ -73,7 +64,6 @@ class OC_Share_Backend_Calendar implements OCP\Share_Backend_Collection {
|
|||
$suffix++;
|
||||
}
|
||||
|
||||
OC_Log::write('calendar', '+- generated name: ' . var_export($name.$suffix, true), OC_Log::ERROR);
|
||||
return $name.$suffix;
|
||||
}
|
||||
|
||||
|
@ -91,7 +81,6 @@ class OC_Share_Backend_Calendar implements OCP\Share_Backend_Collection {
|
|||
* It is only called through calls to the public getItem(s)Shared(With) functions.
|
||||
*/
|
||||
public function formatItems($items, $format, $parameters = null) {
|
||||
OC_Log::write('calendar', __FILE__ . ' : ' . __LINE__ . ' [' . __FUNCTION__ . ']', OC_Log::ERROR);
|
||||
$calendars = array();
|
||||
if ($format == self::FORMAT_CALENDAR) {
|
||||
foreach ($items as $item) {
|
||||
|
@ -114,7 +103,6 @@ class OC_Share_Backend_Calendar implements OCP\Share_Backend_Collection {
|
|||
}
|
||||
|
||||
public function getChildren($itemSource) {
|
||||
OC_Log::write('calendar', __FILE__ . ' : ' . __LINE__ . ' [' . __FUNCTION__ . ']', OC_Log::ERROR);
|
||||
$query = OCP\DB::prepare('SELECT `id`, `summary` FROM `*PREFIX*clndr_objects` WHERE `calendarid` = ?');
|
||||
$result = $query->execute(array($itemSource));
|
||||
$children = array();
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* later.
|
||||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
OC_Log::write('calendar', __FILE__ . ' : ' . __LINE__ . ' [' . __FUNCTION__ . ']', OC_Log::ERROR);
|
||||
|
||||
class OC_Share_Backend_Event implements OCP\Share_Backend {
|
||||
|
||||
|
|
40
share.php
40
share.php
|
@ -8,13 +8,28 @@
|
|||
|
||||
OCP\App::checkAppEnabled('calendar');
|
||||
|
||||
if (\OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes') !== 'yes') {
|
||||
function calendar404($msg=null) {
|
||||
$errorTemplate = new OCP\Template('calendar', 'part.404', '');
|
||||
if ($msg !== null) $errorTemplate->assign('message', $msg);
|
||||
$errorContent = $errorTemplate->fetchPage();
|
||||
|
||||
header('HTTP/1.0 404 Not Found');
|
||||
$tmpl = new OCP\Template('', '404', 'guest');
|
||||
$tmpl->assign('content', $errorContent);
|
||||
$tmpl->printPage();
|
||||
exit();
|
||||
}
|
||||
|
||||
function calendar403() {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
$tmpl = new OCP\Template('', '403', 'guest');
|
||||
$tmpl->printPage();
|
||||
exit();
|
||||
}
|
||||
|
||||
if (\OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes') !== 'yes')
|
||||
calendar404('Link-sharing is disabled by admin.');
|
||||
|
||||
if (isset($_GET['t'])) {
|
||||
$token = $_GET['t'];
|
||||
$linkItem = OCP\Share::getShareByToken($token);
|
||||
|
@ -32,14 +47,11 @@ if (isset($rootLinkItem)) {
|
|||
if (!isset($linkItem['item_type'])) {
|
||||
// nope -> 404
|
||||
OCP\Util::writeLog('share', 'No item type set for share id: ' . $linkItem['id'], \OCP\Util::ERROR);
|
||||
header('HTTP/1.0 404 Not Found');
|
||||
$tmpl = new OCP\Template('', '404', 'guest');
|
||||
$tmpl->printPage();
|
||||
exit();
|
||||
calendar404('No such share.');
|
||||
}
|
||||
|
||||
// the full URL
|
||||
$url = OCP\Util::linkToPublic('files') . '&t=' . $token;
|
||||
$url = OCP\Util::linkToPublic('calendar') . '&t=' . $token;
|
||||
// let's set the token in the session for further reference
|
||||
\OC::$session->set('public_link_token', $token);
|
||||
|
||||
|
@ -63,7 +75,6 @@ if (isset($rootLinkItem)) {
|
|||
// NOPE! Chuck Testa! Log it.
|
||||
OCP\Util::writeLog('share', 'Wrong password!', \OCP\Util::ERROR);
|
||||
// inform the user
|
||||
OCP\Util::addStyle('calendar', 'authenticate');
|
||||
$tmpl = new OCP\Template('calendar', 'authenticate', 'guest');
|
||||
$tmpl->assign('URL', $url);
|
||||
$tmpl->assign('wrongpw', true);
|
||||
|
@ -79,10 +90,7 @@ if (isset($rootLinkItem)) {
|
|||
// ...if it is not SHARE_TYPE_LINK, complain!
|
||||
OCP\Util::writeLog('share', 'Unknown share type '.$linkItem['share_type']
|
||||
.' for share id '.$linkItem['id'], \OCP\Util::ERROR);
|
||||
header('HTTP/1.0 404 Not Found');
|
||||
$tmpl = new OCP\Template('', '404', 'guest');
|
||||
$tmpl->printPage();
|
||||
exit();
|
||||
calendar404('Unknown share type.');
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -91,7 +99,6 @@ if (isset($rootLinkItem)) {
|
|||
|| \OC::$session->get('public_link_authenticated') !== $linkItem['id']
|
||||
) {
|
||||
// Prompt for password
|
||||
OCP\Util::addStyle('calendar', 'authenticate');
|
||||
$tmpl = new OCP\Template('calendar', 'authenticate', 'guest');
|
||||
$tmpl->assign('URL', $url);
|
||||
$tmpl->printPage();
|
||||
|
@ -138,11 +145,4 @@ if (isset($rootLinkItem)) {
|
|||
OCP\Util::writeLog('share', 'could not resolve linkItem', \OCP\Util::DEBUG);
|
||||
}
|
||||
|
||||
$errorTemplate = new OCP\Template('calendar', 'part.404', '');
|
||||
$errorContent = $errorTemplate->fetchPage();
|
||||
|
||||
header('HTTP/1.0 404 Not Found');
|
||||
OCP\Util::addStyle('calendar', '404');
|
||||
$tmpl = new OCP\Template('', '404', 'guest');
|
||||
$tmpl->assign('content', $errorContent);
|
||||
$tmpl->printPage();
|
||||
calendar404();
|
|
@ -0,0 +1,5 @@
|
|||
<form action="<?php p($_['URL']) ?>" method="POST">
|
||||
<?php if ($_['wrongpw'] === true) { ?><p class="error"><?php p($l->t('Wrong password!')); ?></p><?php } ?>
|
||||
<input type="password" id="public-calendar-auth-password" name="password"/>
|
||||
<input type="submit" class="submit actionsfloatright primary" id="public-calendar-auth-submit" value="<?php p($l->t('Authenticate!'));?>"/>
|
||||
</form>
|
|
@ -0,0 +1,10 @@
|
|||
<ul>
|
||||
<li class="error">
|
||||
<?php if (isset($_['message'])) {
|
||||
p($l->t( $_['message']) );
|
||||
} else {
|
||||
p($l->t( 'Public calendar not found' ));
|
||||
} ?><br/>
|
||||
<p class='hint'><?php if(isset($_['file'])) p($_['file'])?></p>
|
||||
</li>
|
||||
</ul>
|
Loading…
Reference in New Issue