Example #1
0
    $inputValue[4] = "";
    /* we need to always clear the captcha field, because it will regenerate after a reresh*/
    if ($Error->captcha($_POST['register-captcha'])) {
        $errorClass[4] = 'success';
    } else {
        $errorClass[4] = 'error';
    }
} else {
    if (isset($_POST['action'])) {
        $Error->add('error', 'Captcha cannot be left empty');
        $errorClass[4] = 'error';
    }
}
// Instantiontiate the erroring before we need to refresh the page
$msg = $Error->alert();
// Check if the form was submitted without any errors.
if (isset($_POST['register-username']) && isset($_POST['register-password']) && isset($_POST['register-confirm']) && isset($_POST['register-email']) && isset($_POST['register-captcha']) && !$Error->ok()) {
    $complete = true;
    // Create the actual user
    Auth::createNewUser($_POST['register-username'], $_POST['register-password'], $_POST['register-email']);
    Auth::changeGroup($_POST['register-username'], 'user');
    $userId = Auth::userId($_POST['register-username']);
    $link = full_url_to_script('activate.php') . "?action=activate&code=" . Activation::get($userId) . "&id=" . $userId;
    //echo $link;
    Emailtemplate::setBaseDir('./assets/email_templates');
    $html = Emailtemplate::loadTemplate('activation', array('title' => 'Activation Email', 'prettyName' => get_option('prettyName'), 'name' => $_POST['register-username'], 'siteName' => get_option('emailName'), 'activationLink' => $link, 'footerLink' => get_option('siteName'), 'footerEmail' => get_option('emailInfo')));
    send_html_mail(array($_POST['register-username'] => $_POST['register-email']), 'Activation Email', $html, array(get_option('siteName') => get_option('emailAdmin')));
}
Template::setBaseDir('./assets/tmpl');
$html = Template::loadTemplate('layout', array('header' => Template::loadTemplate('header', array('title' => $title, 'user' => $user, 'admin' => $isadmin, 'msg' => $msg, 'meta' => $meta, 'selected' => 'register')), 'content' => Template::loadTemplate('register', array('errorClass' => $errorClass, 'inputValue' => $inputValue, 'complete' => $complete, 'callback' => $callback)), 'footer' => Template::loadTemplate('footer', array('time_start' => $time_start))));
echo $html;
Example #2
0
    addColumn("options", '`type`', "ENUM('input', 'date', 'checkbox', 'hidden', 'textarea')", "default 'input'");
    addColumn("options", '`group`', "varchar(65)", "default 'Miscellaneous'");
    // This table will be where the settings are kept
    createTable("options_groups", "`group` varchar(65) NOT NULL", True, False);
    addColumn("options_groups", '`desc`', "varchar(65)", "default NULL");
    // This table will be where the settings are kept
    createTable("settings", "setting varchar(65) NOT NULL", True, False);
    addColumn("settings", '`desc`', "varchar(65)", "default NULL");
    addColumn("settings", 'type', "ENUM('input', 'date', 'checkbox', 'hidden', 'textarea')", "default 'input'");
    // This is where we will add the clien'ts ability to add values to the settings.
    createTable("repositry", "user_id int(11) NOT NULL", false, false);
    addColumn("repositry", '`key`', "varchar(65)", "default NULL");
    addColumn("repositry", 'value', "varchar(65)", "default NULL");
    // Create the default system user
    // Username: demo
    // Password: demo
    Auth::createNewUser('admin', 'password', '*****@*****.**');
    // Add a user, when the username does not exist
    Auth::changeGroup('admin', 'admin');
    // Promote the user to administrator by running the following snippet*/
    $getId = Auth::userId('admin');
    Activation::generate($getId, 20);
    Activation::activate($getId);
    // Set the timestamp and filesize
    Options::add('installModified', $lastEdit, 'input');
    // Do not modify these, they need to be static
    Options::add('installFilesize', $fileSize, 'input');
    // Do not modify these, they need to be static*/
    $installRan = true;
}
// End of installation action
Example #3
0
    addColumn("users", 'level', "ENUM('free', 'user', 'admin', 'moderator')", "default 'user'");
    addColumn("users", 'email', "varchar(65)", "default NULL");
    // Add the options table columns
    addColumn("options", '`type`', "ENUM('input', 'date', 'bool', 'hidden', 'textarea')", "default 'input'");
    addColumn("options", '`group`', "varchar(65)", "default 'Miscellaneous'");
    // This table will be where the settings are kept
    createTable("options_groups", "`group` varchar(65) NOT NULL", True, False);
    addColumn("options_groups", '`desc`', "varchar(65)", "default NULL");
    // This is where we will add the clien'ts ability to add values to the settings.
    createTable("options_users", "user_id int(11) NOT NULL", false, false);
    addColumn("options_users", '`key`', "varchar(65)", "default NULL");
    addColumn("options_users", 'value', "varchar(65)", "default NULL");
    $defaultUser = '******';
    $defaultPass = '******';
    $adminEmail = '*****@*****.**';
    // Create the default system user
    Auth::createNewUser($defaultUser, $defaultPass, $adminEmail);
    // Add a user, when the username does not exist
    Auth::changeGroup($defaultUser, 'admin');
    // Promote the user to administrator by running the following snippet*/
    $getId = Auth::userId($defaultUser);
    Activation::generate($getId, 20);
    Activation::activate($getId);
    // Set the timestamp and filesize
    Options::add('installModified', $lastEdit, 'hidden', 'Miscellaneous');
    // Do not modify these, they need to be static
    Options::add('installFilesize', $fileSize, 'hidden', 'Miscellaneous');
    // Do not modify these, they need to be static*/
    $installRan = true;
}
// End of installation action
Example #4
0
{
    echo "POST: " . $key . "=" . $val ."<br />";
}*/
// Lets update the details getting posted to us
if ($isadmin == true) {
    switch (@$_POST['action']) {
        case 'update-email':
            Auth::changeEmail($_POST['user_id'], $_POST['email']);
            message($_POST['user_id'], 'email address has been updated');
            break;
        case 'update-password':
            Auth::changePassword($_POST['user_id'], $_POST['password']);
            message($_POST['user_id'], 'password has been updated');
            break;
        case 'update-group':
            Auth::changeGroup($_POST['user_id'], $_POST['group']);
            message($_POST['user_id'], 'group has been updated');
            break;
        case 'update-activation':
            switch (@$_POST['active']) {
                case '0':
                    Activation::deactivate($_POST['user_id']);
                    message($_POST['user_id'], 'account has been de-activated');
                    break;
                case '1':
                    Activation::activate($_POST['user_id']);
                    message($_POST['user_id'], 'account has been activated');
                    break;
            }
            break;
    }