Beispiel #1
0
 public static function makePerms($perms, $is_admin)
 {
     $flags = new PlFlagSet($perms);
     if ($is_admin) {
         $flags->addFlag(PERMS_ADMIN);
     }
     // Access to private directory implies access to 'less'-private version.
     if ($flags->hasFlag('directory_private')) {
         $flags->addFlag('directory_ax');
     }
     return $flags;
 }
Beispiel #2
0
require '../connect.db.inc.php';
require_once '../../classes/address.php';
$admin_visibility = Visibility::get(Visibility::VIEW_ADMIN);
// Enumerate every profile
$pids = XDB::iterRow("SELECT pid from profiles");
while ($row = $pids->next()) {
    $pid = $row[0];
    // Find the address which would be selected as "AX mail"
    // But don't update anything
    $best_mail = Address::updateBestMail($pid, true);
    if (is_null($best_mail)) {
        continue;
    }
    // Just continue if the returned address is already selected
    $flags = new PlFlagSet($best_mail['flags']);
    if ($flags->hasFlag('dn_best_mail')) {
        continue;
    }
    // The current profile is buggy.
    // Let's fetch more data to print detailed information
    $profile = Profile::get($pid);
    $addresses = ProfileField::getForPID('ProfileAddresses', array($pid), $admin_visibility);
    $addresses = $addresses->get(Profile::ADDRESS_POSTAL);
    $old_mail = null;
    $new_mail = null;
    foreach ($addresses as $addr) {
        if ($addr->flags->hasFlag('dn_best_mail')) {
            $old_mail = $addr;
        } else {
            if ($addr->id == $best_mail['id']) {
                $new_mail = $addr;