Ejemplo n.º 1
0
    $authManager = new AuthManager();
    switch ($page_action) {
        case 'update_by_id':
            //$db_update_success = $userManager->updateRecord ($id, $user_type, $username, $password);
            $db_update_success = $authManager->updateRecord($id, $user_type, $username, $new_password);
            break;
        case "add_user":
            //$userManager->addRecord($user_type, $username, $password);
            $db_add_success = $authManager->addUser($user_type, $username, $password);
            break;
        case "delete_by_id":
            //$userManager->deleteRecord ($id);
            $db_delete_success = $authManager->deleteUser($id);
            break;
    }
    $users_data = $userManager->getAllRecords();
    $page_title = 'Manage users';
    $alt_menu = '<a href="#" class="add">Add</a>';
    $addView = new AddView('Add', 'add_user');
    $addView->addOptionBox('user_type', 'User type', $usertype_options);
    $addView->addRow('username', 'Username', null, 'eg. Neil');
    $addView->addRow('password', 'Password', null, 'eg. Sm4rtH0uSe');
    $tableView = new TableView(array('View', ''));
    while (($users_row = mysql_fetch_array($users_data)) != null) {
        $tableView->addRow(array(TableView::createCell('user_type', $users_row['user_type']), TableView::createCell('username', $users_row['username']), TableView::createEdit($users_row['USER_ID'])));
    }
    $views_to_load = array();
    $views_to_load[] = '../../views/_add.php';
    $views_to_load[] = '../../views/_table.php';
    include '../../views/_generic.php';
}
    switch ($page_action) {
        case 'update_by_id':
            $db_update_success = PasswordManager::updateRecord($PASSMAN_ID, $USER_ID, $site, $url, $username, $password);
            break;
        case 'add_password':
            $db_add_success = PasswordManager::addRecord($USER_ID, $site, $url, $username, $password);
            break;
        case 'delete_by_id':
            $db_delete_success = PasswordManager::deleteRecord($PASSMAN_ID, $USER_ID);
            break;
    }
    $passman_records = PasswordManager::getAllRecords($USER_ID);
    $page_title = 'PassMan';
    $alt_menu = getAddButton();
    // build add view
    $addView = new AddView('Add', 'add_password');
    $addView->addRow('site', 'Site');
    $addView->addRow('url', 'URL');
    $addView->addRow('username', 'Username');
    $addView->addRow('password', 'Password');
    // build table view
    $tableView = new TableView(array('Site', 'Username', 'Password', ''));
    foreach ($passman_records as $record) {
        $tableView->addRow(array(TableView::createCell('site', '<a href="' . $record->getUrl() . '" target="_blank">' . $record->getSite() . '</a>'), TableView::createCell('username', $record->getUsername()), TableView::createCell('password', '<span class="mask">************</span><span class="password-actual">' . $record->getPassword() . '</span>'), TableView::createEdit($record->getPassmanId())));
    }
    // load views to be used in front end
    $views_to_load = array();
    $views_to_load[] = '../../views/_add.php';
    $views_to_load[] = '../../views/_table.php';
    include '../../views/_generic.php';
}
Ejemplo n.º 3
0
 public function createEdit($id)
 {
     return TableView::createCell('edit', '<a class="edit" href="edit.php?id=' . $id . '">Edit</a>');
 }
Ejemplo n.º 4
0
    $id = request_isset('id');
    $key = request_isset('key');
    $value = request_isset('value');
    $settingsManager = new SettingsManager();
    switch ($page_action) {
        case 'add_setting':
            $settingsManager->addRecord($key, $value);
            break;
        case 'delete_by_id':
            $settingsManager->deleteRecord($id);
            break;
        case 'update_by_id':
            $settingsManager->updateRecord($id, $key, $value);
            break;
    }
    $settings_data = $settingsManager->getAllRecords();
    $page_title = 'Settings';
    $alt_menu = '<a href="#" class="add">Add</a>';
    $addView = new AddView('Add', 'add_setting');
    $addView->addRow('key', 'Key');
    $addView->addRow('value', 'Value');
    $tableView = new TableView(array('Key', 'Value', ''));
    while (($settings_row = mysql_fetch_array($settings_data)) != null) {
        $tableView->addRow(array(TableView::createCell('key', $settings_row['key']), TableView::createCell('value', $settings_row['value']), TableView::createEdit($settings_row['SETTING_ID'])));
    }
    $views_to_load = array();
    $views_to_load[] = '../../views/_add.php';
    $views_to_load[] = '_warning.php';
    $views_to_load[] = '../../views/_table.php';
    include '../../views/_generic.php';
}
Ejemplo n.º 5
0
    $headerView = new HeaderView(($sessionManager->getUserType() == 'ADMIN' ? 'Indexer | ' : '') . 'Stocks');
    $headerView->setLink('<link rel="stylesheet" type="text/css" href="css/styles.css" />');
    if ($sessionManager->getUserType() == 'ADMIN') {
        $headerView->setMeta('<meta http-equiv="refresh" content="1800;url=#" />');
    } else {
        $headerView->setAltMenu('<a class="add" href="#">Add</a>');
        // build add view
        $addView = new AddView('Add', 'add_stock');
        $addView->addRow('ticker', 'Ticker');
    }
    // build table view
    if ($sessionManager->getUserType() == 'ADMIN') {
        $tableView = new TableView(array('Stock', 'Price', 'Change'));
    } else {
        $tableView = new TableView(array('Stock', 'Price', 'Change', ''));
    }
    foreach ($stock_records as $record) {
        if ($sessionManager->getUserType() == 'ADMIN') {
            $tableView->addRow(array(TableView::createCell('stock', $record->getStock()), TableView::createCell('price', $record->getPrice(true)), TableView::createCell('change', $record->getChangePoints(true) . ' (' . $record->getChangePercent(true) . ')')));
            StockManager::updateHistory($record->getStock(), $record->getTicker(), $record->getPrice(), $record->getChangePoints(), $record->getChangePercent(), $record->getUpdateTime());
        } else {
            $tableView->addRow(array(TableView::createCell('stock', $record->getStock()), TableView::createCell('price', $record->getPrice(true)), TableView::createCell('change ' . ($record->getChangePoints() < 0 ? 'negitive' : 'positive'), $record->getChangePoints(true) . ' (' . $record->getChangePercent(true) . ')'), TableView::createEdit($record->getTicker())));
        }
        $updated = $record->getUpdateTime();
    }
    $views_to_load = array();
    $views_to_load[] = '../../views/_add.php';
    $views_to_load[] = '../../views/_table.php';
    $views_to_load[] = '_update.php';
    include '../../views/_generic.php';
}
Ejemplo n.º 6
0
    $passphrase = request_isset('passphrase');
    switch ($page_action) {
        case 'update_by_id':
            $db_update_success = KeyManager::updateRecord($KEYSTORE_ID, $USER_ID, $name, $private_key, $public_key, $passphrase);
            break;
        case 'add_key':
            $db_add_success = KeyManager::addRecord($KEYSTORE_ID, $USER_ID, $name, $private_key, $public_key, $passphrase);
            break;
        case 'delete_by_id':
            $db_delete_success = KeyManager::deleteRecord($KEYSTORE_ID, $USER_ID);
            break;
    }
    $keyman_records = KeyManager::getAllRecords($USER_ID);
    $alt_menu = getAddButton();
    // build add view
    $addView = new AddView('Add', 'add_key');
    $addView->addRow('name', 'Name');
    $addView->addRow('private_key', 'Private key');
    $addView->addRow('public_key', 'Public key');
    $addView->addRow('passphrase', 'Passphrase');
    // build table view
    $tableView = new TableView(array('Name', 'Public key', 'Private key', 'Passphrase', ''));
    foreach ($keyman_records as $record) {
        $tableView->addRow(array(TableView::createCell('name', $record->getName()), TableView::createCell('public_key', $record->getPublicKey()), TableView::createCell('private_key', $record->getPrivateKey()), TableView::createCell('passphrase', '<span class="mask">************</span><span class="password-actual">' . $record->getPassphrase() . '</span>'), TableView::createEdit($record->getKeystoreId())));
    }
    // load views to be used in front end
    $views_to_load = array();
    $views_to_load[] = '../../views/_add.php';
    $views_to_load[] = '../../views/_table.php';
    include '../../views/_generic.php';
}