예제 #1
0
$oprofile = new Ostatus_profile();
$marker = mt_rand(31337, 31337000);
$profileTemplate = common_local_url('userbyid', array('id' => $marker));
$encProfile = $oprofile->escape($profileTemplate, true);
$encProfile = str_replace($marker, '%', $encProfile);
echo "  LIKE '{$encProfile}'\n";
$groupTemplate = common_local_url('groupbyid', array('id' => $marker));
$encGroup = $oprofile->escape($groupTemplate, true);
$encGroup = str_replace($marker, '%', $encGroup);
echo "  LIKE '{$encGroup}'\n";
$sql = "SELECT * FROM ostatus_profile WHERE uri LIKE '%s' OR uri LIKE '%s'";
$oprofile->query(sprintf($sql, $encProfile, $encGroup));
$count = $oprofile->N;
echo "Found {$count}...\n";
while ($oprofile->fetch()) {
    $uri = $oprofile->getUri();
    if (preg_match('!/group/(\\d+)/id!', $oprofile->getUri(), $matches)) {
        $id = intval($matches[1]);
        $group = Local_group::getKV('group_id', $id);
        if ($group) {
            $nick = $group->nickname;
        } else {
            $nick = '<deleted>';
        }
        echo "group {$id} ({$nick}) hidden by {$uri}";
    } else {
        if (preg_match('!/user/(\\d+)!', $uri, $matches)) {
            $id = intval($matches[1]);
            $user = User::getKV('id', $id);
            if ($user) {
                $nick = $user->nickname;