server/settings/ajax/creategroup.php
Thomas Müller 83575a4436 Update settings/ajax/creategroup.php
$l->t added to error messages
2012-09-04 12:48:42 +03:00

29 lines
761 B
PHP

<?php
// Init owncloud
require_once '../../lib/base.php';
OCP\JSON::callCheck();
// Check if we are a user
if( !OC_User::isLoggedIn() || !OC_Group::inGroup( OC_User::getUser(), 'admin' )) {
OC_JSON::error(array("data" => array( "message" => $l->t("Authentication error") )));
exit();
}
OCP\JSON::callCheck();
$groupname = $_POST["groupname"];
// Does the group exist?
if( in_array( $groupname, OC_Group::getGroups())) {
OC_JSON::error(array("data" => array( "message" => $l->t("Group already exists") )));
exit();
}
// Return Success story
if( OC_Group::createGroup( $groupname )) {
OC_JSON::success(array("data" => array( "groupname" => $groupname )));
}
else{
OC_JSON::error(array("data" => array( "message" => $l->t("Unable to add group") )));
}