コード例 #1
0
ファイル: karma.php プロジェクト: stof/pearweb
             $res = $karma->remove($handle, $_GET['level']);
             if ($res) {
                 echo "Successfully <b>removed</b> karma &quot;" . htmlspecialchars($_GET['level']) . "&quot;<br /><br />";
                 note::add($handle, 'removed ' . $_GET['level'] . ' karma', $auth_user->handle);
             }
             break;
         case "grant":
             $res = $karma->grant($handle, $_POST['level']);
             if ($res) {
                 echo "Successfully <b>added</b> karma &quot;" . htmlspecialchars($_POST['level']) . "&quot;<br /><br />";
                 note::add($handle, 'added ' . $_POST['level'] . ' karma', $auth_user->handle);
             }
             break;
     }
 }
 $user_karma = $karma->get($handle);
 if (count($user_karma) == 0) {
     echo 'No karma yet';
 } else {
     $table = new HTML_Table('style="width: 90%"');
     $table->setCaption('Karma levels for ' . htmlspecialchars($handle), 'style="background-color: #CCCCCC;"');
     $table->addRow(array("Level", "Added by", "Added at", "Remove"), null, 'th');
     foreach ($user_karma as $item) {
         $remove = sprintf("karma.php?action=remove&amp;handle=%s&amp;level=%s", htmlspecialchars($handle), htmlspecialchars($item['level']));
         $table->addRow(array(htmlspecialchars($item['level']), htmlspecialchars($item['granted_by']), htmlspecialchars($item['granted_at']), make_link($remove, make_image("delete.gif"), false, 'onclick="javascript:return confirm(\'Do you really want to remove the karma level ' . htmlspecialchars($item['level']) . '?\');"')));
     }
     echo $table->toHTML();
 }
 echo "<br /><br />";
 $table = new HTML_Table('style="width: 100%"');
 $table->setCaption("Grant karma to " . htmlspecialchars($handle), 'style="background-color: #CCCCCC;"');
コード例 #2
0
ファイル: account-info.php プロジェクト: stof/pearweb
require_once 'Damblan/URL.php';
require_once 'HTTP.php';
require 'bugs/pear-bugs.php';
include_once 'pear-database-user.php';
$bugs = new PEAR_Bugs();
$site = new Damblan_URL();
$karma = new Damblan_Karma($dbh);
$params = array('handle' => '', 'action' => '');
$site->getElements($params);
$handle = htmlspecialchars(strtolower($params['handle']));
// Redirect to the accounts list if no handle was specified
if (empty($handle)) {
    localRedirect('/accounts.php');
}
$dbh->setFetchmode(DB_FETCHMODE_ASSOC);
$permissions = $karma->get($handle);
$row = user::info($handle);
if ($row === null) {
    error_handler($handle . ' is not a valid account name.', 'Invalid Account');
}
switch ($params['action']) {
    case 'wishlist':
        if (!empty($row['wishlist'])) {
            HTTP::redirect($row['wishlist']);
        } else {
            PEAR::raiseError(htmlspecialchars($row['name']) . ' has not registered a wishlist');
        }
        break;
    case 'bugs':
        HTTP::redirect('/bugs/search.php?handle=' . $handle . '&cmd=display');
        break;