<?php

/**
 * ownCloud - Documents App
 *
 * @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\Documents;

class UserController extends Controller{
	
	/**
	 * Invite users to the editing session
	 */
	public static function invite(){
		self::preDispatch();
		$invitees = @$_POST['users'];
		
		if (is_array($invitees)){
			$invitees = array_unique($invitees);
		
			$esId = @$_POST['esId'];
			foreach ($invitees as $userId){
				try {
					Invite::add($esId, $userId);
				} catch (\Exception $e) {
					
				}
			}
		}
		\OCP\JSON::success();
	}
	
	/**
	 * Stub - sends a generic avatar
	 */
	public static function sendAvatar(){
		$uid = self::preDispatch(false);
		$image = new \OC_Image('[encoded data, 7756 characters]');
		\OC_Util::obEnd();

		echo $image->show();
	}
}
