Example #1
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:'));
    ?>
&nbsp;&nbsp;&nbsp;
        <code><?php 
    p(\OCA\mozilla_sync\Storage::getNumClients());
    ?>
</code>
    </p>

    <br/>

	<p>
        <button type="button" id="deletestorage">
		    <?php 
    p($l->t('Delete Sync data'));
    ?>
	        </button>
    <br/>
    <em><?php 
    p($l->t('Attention! This will delete all your Sync data on the server.'));
Example #2
0
*
* @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"))));
}