Example #1
0
<?php

/**
 * Check post objects
 */
$post_check = Post::Check(array("msg", "name", "email"));
/**
 * If post objects are set and not empty, continue to post email
 */
if ($post_check) {
    try {
        /**
         * Start Email class and try to send the email
         */
        $email = new Email();
        $email->MailFrom($_POST['email']);
        $email->MailTo($_['MAIL_FROM']);
        $email->Subject($_['MAIL_SUBJECT']);
        $email->Content($_POST['msg']);
        $email->SendMail();
        /**
         * Build an array on success
         */
        $success = array("msg" => $_['EMAIL_SENT'], "response" => 1);
        /**
         * Pass it to javascript with json
         */
        echo json_encode($success);
    } catch (Exception $e) {
        /**
         * Email sending failed, prepare an array for error
Example #2
0
<?php

$perms = new Permission();
if (!$perms->IsAllowed('history')) {
    Exceptions::PrintOut("You do not have access to the History");
}
/**
 * Check $_POST variables for "search"
 */
$post_check = Post::Check(array("search"));
if ($post_check) {
    /**
     * If variable is passed, search for the historic messages with passed variable
     */
    $historic = History::SearchHistory($_POST['search']);
} else {
    /**
     * Else output the default historic messages
     */
    $historic = History::ListHistory();
}
include 'views/template/history.html';
Example #3
0
<?php

$post = Post::Check(array("user", "status"));
if ($post) {
    $status = new UploadStatus($_POST['status'], $_POST['user']);
}
Example #4
0
<?php

/**
 * Check the $_POST variables: "msg" and "to"
 */
$post_check = Post::Check(array("msg", "to"));
if ($post_check) {
    /**
     * If variables are passed we set the $html variable. This defines
     * if html is allowed or not. We don't allow html for messages, but
     * we will have to allow it when administrator sends a file to the user.
     */
    $html = isset($_GET['html']) && $_GET['html'] == 1 ? true : false;
    if ($_POST['to'] > 0) {
        /**
         * Add message if there is someone to pass it
         */
        $post = new AddMsg($_POST['msg'], $_POST['to'], $html);
    }
}
/**
 * Start Messaging class
 */
$msg = new Messaging();
/**
 * Delete all messages older that 520 minutes. This can be adjusted, but must
 * be adjusted in the client area as well, because all the users trigger this
 * function.
 */
$msg->DeleteOld(520);
/**
Example #5
0
<?php

$perms = new Permission();
if (!$perms->IsAllowed('groups')) {
    Exceptions::PrintOut("You do not have access to the Users and groups");
}
/**
 * Check if post names are set
 */
$post_check = Post::Check(array("title", "users", "banned", "history"));
/**
 * If post names are all set, try to insert the group
 */
if ($post_check) {
    $new_user = new UsersAndGroups();
    $result = $new_user->NewGroup($_POST['title'], array($_POST['users'], $_POST['banned'], $_POST['history']));
    /*
     * If result is not true, output the error variable
     */
    if (!$result) {
        $error = $new_user->error;
    }
}
/**
 * Include view template file
 */
include 'views/template/new_group.html';
Example #6
0
<?php

$perms = new Permission();
if (!$perms->IsAllowed('groups')) {
    Exceptions::PrintOut("You do not have access to the Users and groups");
}
/**
 * Check if $_GET['id] is set and is greater than 0
 */
$id_check = Post::GCheck(array('id'));
/*
 * If id is ok and we are not editing administrators group proceed with operation
 */
if ($id_check) {
    $id = $_GET['id'];
    $post_check = Post::Check(array("username", "group"));
    if ($post_check) {
        $edit = new UsersAndGroups();
        $result = $edit->UserEditor($id, $_POST['password'], $_POST['password2'], $_POST['group']);
        if (!$result) {
            $error = $edit->error;
        }
    }
    $user = UsersAndGroups::GetUser($id);
    /**
     * List groups to select element
     */
    $groups = UsersAndGroups::ListGroups();
    include 'views/template/useredit.html';
} else {
    /*
Example #7
0
<?php

$fields = array("username", "password");
/**
 * Check the $_POST for fields "username" and "password"
 */
$checkfields = Post::Check($fields);
$post = $_POST;
/**
 * Start login class
 */
$login = new Login();
/**
 * Set the name of the cookie that will hold remember status
 */
$login->SetCookieName('login');
/**
 * Continue if $checkfield are passed
 */
if ($checkfields) {
    /**
     * If remember hidden field is set, fill the remember variable with 1
     */
    $remember = isset($post['remember']) ? $post['remember'] : "";
    /**
     * Set the passed credentials to function
     */
    $login->SetCredentials($post['username'], $post['password'], $remember);
    /**
     * Check if login succeded
     */
Example #8
0
<?php

$perms = new Permission();
if (!$perms->IsAllowed('banned')) {
    Exceptions::PrintOut("You do not have access to the Banned area");
}
/**
 * Check if $_POST variable user has been set and ban the user.
 */
$check = Post::Check(array("user"));
if ($check) {
    UserBan::BanUser($_POST['user']);
}
Example #9
0
<?php

$check_post = Post::Check(array("nick"));
if ($check_post) {
    $new_nick = new ChangeNick($_POST['nick']);
    $new_nick->ChangeIt();
}
Example #10
0
<?php

$perms = new Permission();
if (!$perms->IsAllowed('groups')) {
    Exceptions::PrintOut("You do not have access to the Users and groups");
}
/**
 * Check if post names are set
 */
$post_check = Post::Check(array("username", "password", "password2", "group"));
/**
 * If post names are all set, try to insert the user
 */
if ($post_check) {
    $new_user = new UsersAndGroups();
    $result = $new_user->NewUser($_POST['username'], $_POST['password'], $_POST['password2'], $_POST['group']);
    /*
     * If result is not true, output the error variable
     */
    if (!$result) {
        $error = $new_user->error;
    }
}
/**
 * List groups to select element
 */
$groups = UsersAndGroups::ListGroups();
/**
 * Include view template file
 */
include 'views/template/new_user.html';