예제 #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
예제 #2
0
파일: users.php 프로젝트: repsycle/baseline
        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;
    }
}
// Create the update message
function message($userID, $string)
{
    global $update;
    $u = new User($userID);
    $update = "<strong>UPDATE:</strong><br />" . nl();
    $update .= ucfirst($u->username) . "'s " . $string;
}
// Instantiate the pager
예제 #3
0
    }
    if (isset($_REQUEST['code']) && $_REQUEST['code'] !== $inputValue[1]) {
        $code = $_REQUEST['code'];
        $inputValue[1] = $code;
    } else {
        $errorClass[1] = 'error';
        $Error->add('error', 'Invalid activation code');
    }
}
if ($uid and $code) {
    // First check the client's username and get the id if it's not one
    $userId = Auth::userId($uid);
    $activationCode = Activation::get($userId);
    /*echo $uid . "<br />";
      echo $userId . "<br />";
      echo $activationCode . "<br />";
      echo $code . "<br />";*/
    if ($activationCode !== $code) {
        $errorClass[0] = 'error';
        $errorClass[1] = 'error';
        $Error->add('error', 'Activation unsuccessfull, please confirm that the details are correct or follow the link in the activation email sent to you.');
    }
}
$msg = $Error->alert();
if (!$Error->ok() && ($uid and $code)) {
    $complete = true;
    echo Activation::activate($userId);
}
Template::setBaseDir('./assets/tmpl');
$html = Template::loadTemplate('layout', array('header' => Template::loadTemplate('header', array('title' => $title, 'user' => $user, 'admin' => $isadmin, 'msg' => $msg, 'selected' => 'activate')), 'content' => Template::loadTemplate('activate', array('complete' => $complete, 'errorClass' => $errorClass, 'inputValue' => $inputValue)), 'footer' => Template::loadTemplate('footer', array('time_start' => $time_start))));
echo $html;
예제 #4
0
<?php

include_once 'classes/activation.class.php';
// Definiuje nowy system wyświetlania wyjątków.
include_once 'classes/exception_handler.class.php';
set_exception_handler(array('Exception_Handler', 'handle_exception'));
$activation = new Activation($_GET['code']);
if ($activation->activate()) {
    throw new Exception('Konto zostało aktywowane. Możesz się zalogować.');
}