Example #1
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 #2
0
if (isset($_POST['register-captcha'])) {
    $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']);
    $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' => Options::get('prettyName'), 'name' => $_POST['register-username'], 'siteName' => Options::get('emailName'), 'activationLink' => $link, 'footerLink' => Options::get('siteName'), 'footerEmail' => Options::get('emailInfo')));
    send_html_mail(array($_POST['register-username'] => $_POST['register-email']), 'Activation Email', $html, array(Options::get('siteName') => Options::get('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 #3
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