Example #1
0
 public function composeAction(Player $me, Request $request)
 {
     if (!$me->hasPermission(Permission::SEND_PRIVATE_MSG)) {
         throw new ForbiddenException("You are not allowed to send messages");
     }
     $creator = new GroupFormCreator($me);
     $form = $creator->create()->handleRequest($request);
     if ($form->isSubmitted()) {
         if (count($form->get('Recipients')->getData()) < 2) {
             $form->get('Recipients')->addError(new FormError("You can't send a message to yourself!"));
         }
         if ($form->isValid()) {
             $subject = $form->get('Subject')->getData();
             $content = $form->get('Message')->getData();
             $recipientIds = array();
             foreach ($form->get('Recipients')->getData() as $player) {
                 $recipientIds[] = $player->getId();
             }
             $group_to = Group::createGroup($subject, $me->getId(), $recipientIds);
             $message = $group_to->sendMessage($me, $content);
             $event = new NewMessageEvent($message, true);
             $this->dispatch(Events::MESSAGE_NEW, $event);
             if ($this->isJson()) {
                 return new JsonResponse(array('success' => true, 'message' => 'Your message was sent successfully', 'id' => $group_to->getId()));
             } else {
                 return new RedirectResponse($group_to->getUrl());
             }
         } elseif ($this->isJson()) {
             throw new BadRequestException($this->getErrorMessage($form));
         }
     }
     return array("form" => $form->createView());
 }
Example #2
0
 /**
  * pdo_dependant function
  * args dynInfo related to users insertion
  * call to queryInsertUser
  */
 public function callQueryInsertUser($nickname, $name, $password, $email, $ip_address)
 {
     $pdo_object = $this->pdo_object;
     $user_data_correct = $this->verifUserDataCorrect($nickname, $name, $password, $email, $ip_address);
     if ($user_data_correct) {
         $this->queryInsertUser($pdo_object, $nickname, $name, $password, $email, $ip_address);
         $group = new Group();
         $group->createGroup($pdo_object);
     } else {
         Tools::throwErrorMessage('user_data_incorrect');
     }
 }
Example #3
0
/**
 * Removes a user from a group.
 *
 * @param $uid The id of the user that is being removed
 * @param $sid The id of the sheet
 */
function removeUserFromGroup($uid, $sid)
{
    global $databaseURI;
    $newGroupSettings = Group::encodeGroup(Group::createGroup($uid, $uid, $sid));
    $URI = $databaseURI . "/group/user/{$uid}/exercisesheet/{$sid}";
    http_put_data($URI, $newGroupSettings, true, $message);
    if ($message == "201") {
        return true;
    } else {
        return false;
    }
}
 public function create()
 {
     if (Gsub::where('user_fp', self::userFp())->where('role', 'owner')->count() > 4) {
         App::abort(500, "You can only own 5 groups");
     }
     if (Request::isMethod('GET')) {
         return View::make('group.create');
     } else {
         $input = Input::only('group_name', 'group_title', 'description', 'submit_text', 'is_private');
         Group::validate($input);
         Group::checkUniq($input['group_name']);
         $post = Group::createGroup(self::userFp(), $input);
         return Redirect::to("group/edit/" . $input['group_name']);
     }
 }
Example #5
0
 public function action_create()
 {
     $group = new Group($_POST);
     if ($group->createGroup()) {
         if (isset($_FILES['img_up'])) {
             $updir = PUBLIC_ROOT . "/img/group/";
             $path_part = pathinfo($_FILES['img_up']['name']);
             $upfile = $group->gid % 100 . "/" . $group->gid . "." . $path_part["extension"];
             if (move_uploaded_file($_FILES['img_up']['tmp_name'], $updir . $upfile)) {
                 if ($group->updateImage($upfile)) {
                     Page::redirect("/group/view?gid=" . $group->gid);
                 }
             }
         }
     }
 }
 public function executeNewgroup($eventData)
 {
     $tempGroup = new Group();
     $groupData['groupname'] = $eventData['groupname'];
     $tempGroup->createGroup($groupData);
 }
Example #7
0
Match::enterMatch($olfm->getId(), $lweak->getId(), 5, 4, 20, $kierra->getId());
Match::enterMatch($reptitles->getId(), $gsepar->getId(), 1, 1500, 20, $autoreport->getId());
Match::enterMatch($olfm->getId(), $lweak->getId(), 1, 1, 30, $autoreport->getId());
Match::enterMatch($fradis->getId(), $gsepar->getId(), 1, 2, 20, $kierra->getId());
echo " done!";
echo "\nUpdating teams...";
$reptitles->update("activity", 9000, "i");
$fflood->update("activity", -18, "i");
$fradis->update("activity", 3.141592653589793, "d");
echo " done!";
echo "\nAdding servers...";
Server::addServer("BZPro Public HiX FFA", "bzpro.net:5154", 227, $tw1sted->getId());
Server::addServer("BZPro Public HiX Rabbit Chase", "bzpro.net:5155", 227, $tw1sted->getId());
echo " done!";
echo "\nAdding messages...";
$group_to = Group::createGroup("New blog", $snake->getId(), array($alezakos->getId(), $allejo->getId(), $ashvala->getId(), $autoreport->getId(), $blast->getId(), $kierra->getId(), $mdskpr->getId(), $snake->getId(), $tw1sted->getId()));
$event = new GroupRenameEvent($group_to, "New message", "New blorg", $snake);
GroupEvent::storeEvent($group_to->getId(), $event, Events::GROUP_RENAME);
$event = new GroupRenameEvent($group_to, "New blorg", "New blog", $snake);
GroupEvent::storeEvent($group_to->getId(), $event, Events::GROUP_RENAME);
$group_to->sendMessage($snake, "Check out my new blog!");
echo " done!";
echo "\nAdding bans...";
Ban::addBan($snake->getId(), $alezakos->getId(), "2014-09-15", "Snarke 12534 has been barned again", "Cuz you're snake", "256.512.104.1");
Ban::addBan($allejo->getId(), $tw1sted->getId(), "2014-05-17", "for using 'dope'", "dope", array("127.0.2.1", "128.0.3.2"));
Ban::addBan($tw1sted->getId(), $alezakos->getId(), "2014-06-12", "tw1sted banned for being too awesome");
Ban::addBan($alezakos->getId(), $tw1sted->getId(), "2014-11-01", "alezakos banned for breaking the build", "For breaking the build", array("256.512.124.1", "256.512.124.3"));
echo " done!";
echo "\nAdding pages...";
Page::addPage("Rules", "<p>This is a test page.</p>\n<p>Let's hope this works!</p>", $tw1sted->getId());
Page::addPage("Contact", "<p>If you find anything wrong, please stop by irc.freenode.net channel #sujevo and let a developer know.<br /><br />Thanks", $tw1sted->getId());
Example #8
0
 /**
  * @When :sender sends :recipient a message about :content
  */
 public function sendsAMessageAbout($sender, $recipient, $content)
 {
     $sender = Player::getFromUsername($sender);
     if ($recipient === 'me') {
         $recipient = $this->me;
     } else {
         $recipient = Player::getFromUsername($recipient);
     }
     $participants = array($sender->getId(), $recipient->getId());
     $group = Group::createGroup("Subject", $sender->getId(), $participants);
     $message = $group->sendMessage($sender, $content);
     // Empty message so that the results are not skewed by showing the
     // contents of the message in the sidebar
     $group->sendMessage($sender, '--');
 }
Example #9
0
        die;
    }
}
if (!$_SESSION['user']) {
    echo '<br><br><br><br><br><h1 style="text-align: center; color: red; background-color: yellow">You are not authorized to see this page !!!<br><br> Immediately Call someone smarter !!!';
    die;
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    //zarzadzanie grupa
    if (isset($_POST['sel1'])) {
        $groupToDelete = $_POST['sel1'];
        Group::removeGroup($groupToDelete);
    }
    if (isset($_POST['newgroup'])) {
        $groupToAdd = $_POST['newgroup'];
        Group::createGroup($groupToAdd);
    }
    //zarzadzenie produktem
}
if (isset($_POST['product'])) {
    $productToDelete = $_POST['product'];
    Product::removeProduct($productToDelete);
}
if (isset($_POST['productname'])) {
    $productName = $_POST['productname'];
}
if (isset($_POST['productdescription'])) {
    $productDescription = $_POST['productdescription'];
}
if (isset($_POST['productstock'])) {
    $productStock = $_POST['productstock'];
            $errmsg = 'Group not must be 4 characters<br>';
        }
        if ($errmsg == '') {
            function check_input($data)
            {
                $data = trim($data);
                $data = stripslashes($data);
                $data = htmlspecialchars($data);
                $data = mysql_real_escape_string($data);
                return $data;
            }
            $Groupid = check_input($_POST['Groupid']);
            $Group_name = check_input($_POST['Group_name']);
            $Groupobj = new Group();
            if (!$Groupobj->groupExist($Groupid)) {
                if ($Groupobj->createGroup($Groupid, $Group_name)) {
                    $msg .= 'Group has been created.<br>';
                } else {
                    $errmsg .= '!Opps Some thing went wrong.<br>';
                }
            } else {
                $errmsg .= "Group Name already exsist";
            }
        }
    }
}
$Groupid = "";
$Group_name = "";
include_once "../../includes/dbclose.inc.php";
require_once "../layouts/user_header.php";
?>
Example #11
0
    }
}
$html_data = null;
//working
$group = new Group();
if (array_key_exists(GET_GROUP_VIEW, $_GET)) {
    $group->getGroupView($_GET[GET_GROUP_VIEW]);
}
//working
//start Naina
if (array_key_exists(CREATE_GROUP, $_GET)) {
    echo "In create group";
    $html_data = json_decode($_GET[CREATE_GROUP]);
    if ($html_data != null) {
        $group_profile = new Group();
        $group_profile->createGroup($html_data->user_email, $html_data->group_name, $html_data->about_info, $html_data->skill_list, $html_data->group_img);
    }
} else {
    if (array_key_exists(DISPLAY_UPDATE_GROUP, $_GET)) {
        echo "In diaplay update";
        $html_data = json_decode($_GET[DISPLAY_UPDATE_GROUP]);
        if ($html_data != null) {
            $group_profile = new Group();
            $group_profile->displayUpdateGroup($html_data->group_id);
        }
    } else {
        if (array_key_exists(GET_MEMBER_DATA, $_GET)) {
            echo "In member data update";
            $html_data = json_decode($_GET[GET_MEMBER_DATA]);
            if ($html_data != null) {
                $group_profile = new Group();