Ejemplo n.º 1
0
 static function activate($uid, $karmalevel = 'pear.dev')
 {
     require_once 'Damblan/Karma.php';
     global $dbh, $auth_user;
     $karma = new Damblan_Karma($dbh);
     $user = user::info($uid, null, 0);
     if (!isset($user['registered'])) {
         return false;
     }
     @($arr = unserialize($user['userinfo']));
     include_once 'pear-database-note.php';
     note::removeAll($uid);
     $data = array();
     $data['registered'] = 1;
     $data['active'] = 1;
     /* $data['ppp_only'] = 0; */
     if (is_array($arr)) {
         $data['userinfo'] = $arr[1];
     }
     $data['created'] = gmdate('Y-m-d H:i');
     $data['createdby'] = $auth_user->handle;
     $data['handle'] = $user['handle'];
     user::update($data, true);
     $karma->grant($user['handle'], $karmalevel);
     if ($karma->has($user['handle'], 'pear.dev')) {
         include_once 'pear-rest.php';
         $pear_rest = new pearweb_Channel_REST_Generator(PEAR_REST_PATH, $dbh);
         $pear_rest->saveMaintainerREST($user['handle']);
         $pear_rest->saveAllMaintainersREST();
     }
     include_once 'pear-database-note.php';
     note::add($uid, "Account opened");
     $msg = "Your PEAR account request has been opened.\n" . "To log in, go to http://" . PEAR_CHANNELNAME . "/ and click on \"login\" in\n" . "the top-right menu.\n";
     $xhdr = 'From: ' . $auth_user->handle . '@php.net';
     if (!DEVBOX) {
         mail($user['email'], "Your PEAR Account Request", $msg, $xhdr, '-f ' . PEAR_BOUNCE_EMAIL);
     }
     return true;
 }
Ejemplo n.º 2
0
foreach (category::listAll() as $category) {
    echo "  {$category['name']}...";
    $pear_rest->saveCategoryREST($category['name']);
    echo "done\n";
}
$pear_rest->saveAllCategoriesREST();
echo "Generating Maintainer REST...\n";
$maintainers = $dbh->getAll('SELECT users.* FROM users, karma WHERE users.handle = karma.user
    AND (karma.level = "pear.dev" OR karma.level = "pear.admin")', array(), DB_FETCHMODE_ASSOC);
foreach ($maintainers as $maintainer) {
    echo "  {$maintainer['handle']}...";
    $pear_rest->saveMaintainerREST($maintainer['handle']);
    echo "done\n";
}
echo "Generating All Maintainers REST...\n";
$pear_rest->saveAllMaintainersREST();
echo "done\n";
echo "Generating Package REST...\n";
$pear_rest->saveAllPackagesREST();
require_once 'Archive/Tar.php';
require_once 'PEAR/PackageFile.php';
$config =& PEAR_Config::singleton();
$pkg = new PEAR_PackageFile($config);
include_once 'pear-database-package.php';
foreach (package::listAllNames() as $package) {
    echo "  {$package}\n";
    $pear_rest->savePackageREST($package);
    echo "     Maintainers...";
    $pear_rest->savePackageMaintainerREST($package);
    echo "...done\n";
    $releases = package::info($package, 'releases');