<?php /** * ownCloud * * @author Oliver Gasser * @copyright 2013 Oliver Gasser * */ // Check if this file is called by admin user, otherwise send JSON error \OCP\JSON::checkAdminUser(); // Check if valid requesttoken was sent \OCP\JSON::callCheck(); // Load translations $l = OC_L10N::get('mozilla_sync'); // Get inputs and set correct settings $quota = filter_var($_POST['quota'], FILTER_VALIDATE_INT); if ($quota === false) { // Send error message \OCP\JSON::error(array("data" => array("message" => $l->t("Invalid input")))); } else { // Update settings values \OCA\mozilla_sync\User::setQuota($quota); // Send success message \OCP\JSON::success(array("data" => array("message" => $l->t("Quota saved")))); } /* vim: set ts=4 sw=4 tw=80 noet : */
</h2> <p> <input type="checkbox" name="restrictgroup" id="restrictgroup" <?php if ($_['mozillaSyncRestrictGroup']) { print_unescaped('checked="checked" '); } ?> /> <label for="restrictgroup"><?php p($l->t("Restrict to group")); ?> </label> <select id="groupselect" name="groupselect"> <?php foreach (\OCA\mozilla_sync\User::getAllGroups() as $group) { ?> <option value="<?php p($group); ?> " <?php if ($group === $_['mozillaSyncRestrictGroup']) { p(" selected"); } ?> ><?php p($group); ?> </option> <?php
<?php // Check if this file is called by admin user, otherwise send JSON error \OCP\JSON::checkAdminUser(); // Check if valid requesttoken was sent \OCP\JSON::callCheck(); // Load translations $l = OC_L10N::get('mozilla_sync'); // Get inputs and set correct settings $autocreate = filter_var($_POST['autocreate'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); if ($autocreate === null) { // Send error message \OCP\JSON::error(array("data" => array("message" => $l->t("Invalid input")))); } else { // Update settings values \OCA\mozilla_sync\User::setAutoCreateUser($autocreate); // Send success message if ($autocreate) { \OCP\JSON::success(array("data" => array("message" => $l->t("Auto create sync account enabled")))); } else { \OCP\JSON::success(array("data" => array("message" => $l->t("Auto create sync account disabled")))); } } /* vim: set ts=4 sw=4 tw=80 noet : */
<?php /** * ownCloud * * @author Oliver Gasser * @copyright 2013 Oliver Gasser * */ // Check if user is logged in \OCP\JSON::checkLoggedIn(); // Check if valid requesttoken was sent \OCP\JSON::callCheck(); // Load translations $l = OC_L10N::get('mozilla_sync'); // Get inputs and set correct settings $email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL); if ($email === false) { // Send error message \OCP\JSON::error(array("data" => array("message" => $l->t("Invalid input")))); } else { // Update settings values \OCA\mozilla_sync\User::setEmail($email); // Send success message \OCP\JSON::success(array("data" => array("message" => $l->t("Sync email saved")))); } /* vim: set ts=4 sw=4 tw=80 noet : */
<?php // Check if user is admin, redirect to home if not \OCP\User::checkAdminUser(); // Load JavaScript files \OCP\Util::addScript("mozilla_sync", "admin"); \OCP\Util::addScript("mozilla_sync", "show_notification"); // Assign admin template $tmpl = new \OCP\Template('mozilla_sync', 'admin'); $tmpl->assign('mozillaSyncRestrictGroup', \OCA\mozilla_sync\User::getAuthorizedGroup()); $tmpl->assign('mozillaSyncQuota', \OCA\mozilla_sync\User::getQuota()); $tmpl->assign('mozillaSyncAutoCreateUser', \OCA\mozilla_sync\User::isAutoCreateUser()); return $tmpl->fetchPage(); /* vim: set ts=4 sw=4 tw=80 noet : */
<?php /** * ownCloud * * @author Oliver Gasser * @copyright 2013 Oliver Gasser * */ // Check if this file is called by admin user, otherwise send JSON error \OCP\JSON::checkAdminUser(); // Check if valid requesttoken was sent \OCP\JSON::callCheck(); // Load translations $l = OC_L10N::get('mozilla_sync'); // Get inputs and set correct settings $restrictGroup = filter_var($_POST['restrictgroup'], FILTER_VALIDATE_BOOLEAN); if ($restrictGroup === true) { $group = filter_var($_POST['groupselect'], FILTER_SANITIZE_STRING); } else { $group = null; } // Update settings value \OCA\mozilla_sync\User::setAuthorizedGroup($group); // Send success message \OCP\JSON::success(array("data" => array("message" => $l->t("Restriction saved")))); /* vim: set ts=4 sw=4 tw=80 noet : */
<?php p($lastMod); ?> </p> <p> <?php p($l->t('Size of stored data:')); ?> <?php $size = \OCA\mozilla_sync\Storage::getSyncSize(); if ($size === false) { p($l->t('No data stored yet.')); } else { $quota = \OCA\mozilla_sync\User::getQuota(); if ($quota === 0) { $quotaString = "(unlimited quota)"; } else { $percentage = 100.0 * (double) $size / (double) $quota; $quotaString = "(" . number_format($percentage, 1) . "% used of quota " . human_file_size($quota * 1024) . ")"; } p(human_file_size($size * 1024) . " " . $quotaString); } ?> </p> <p> <?php p($l->t('Number of synced devices:')); ?>
* @author Andreas Ihrig * @copyright 2013 Andreas Ihrig * */ // Check if user is logged in \OCP\JSON::checkLoggedIn(); // Check if valid requesttoken was sent \OCP\JSON::callCheck(); // Load translations $l = OC_L10N::get('mozilla_sync'); // Get userId and try to delete the user $syncId = \OCA\mozilla_sync\User::userNameToSyncId(\OCP\User::getUser()); if ($syncId) { // delete storage and user if (\OCA\mozilla_sync\Storage::deleteStorage($syncId) === false) { // Send error message \OCP\JSON::error(array("data" => array("message" => $l->t("Failed to delete storage")))); } else { if (\OCA\mozilla_sync\User::deleteUser($syncId) === false) { // Send error message \OCP\JSON::error(array("data" => array("message" => $l->t("Failed to delete user")))); } else { // Send success message \OCP\JSON::success(array("data" => array("message" => $l->t("Storage deleted")))); } } } else { // Send error message \OCP\JSON::error(array("data" => array("message" => $l->t("User not found")))); } /* vim: set ts=4 sw=4 tw=80 noet : */