Esempio n. 1
0
 function parse($args, $page)
 {
     global $pagestore, $LkTbl, $PgTbl;
     $text = '';
     $first = 1;
     $q1 = $pagestore->dbh->query("SELECT link, SUM(count) AS ct FROM {$LkTbl} " . "GROUP BY link ORDER BY ct DESC, link");
     while ($result = $pagestore->dbh->result($q1)) {
         $q2 = $pagestore->dbh->query("SELECT lastversion FROM {$PgTbl} " . "WHERE title='{$result['0']}'");
         if (!($r2 = $pagestore->dbh->result($q2)) || empty($r2[0])) {
             if (!$first) {
                 $text = $text . "\n";
             } else {
                 $first = 0;
             }
             $text = $text . '(' . html_url(findURL($result[0]), $result[1]) . ') ' . html_ref($result[0], $result[0]);
         }
     }
     return html_code($text);
 }
Esempio n. 2
0
function view_macro_refs()
{
    global $pagestore, $LkTbl, $PgTbl;
    $text = '';
    $first = 1;
    // It's not quite as straightforward as one would imagine to turn the
    // following code into a JOIN, since we want to avoid multiplying the
    // number of links to a page by the number of versions of that page that
    // exist.  If anyone has some efficient suggestions, I'd be welcome to
    // entertain them.  -- ScottMoonen
    $q1 = $pagestore->dbh->query("SELECT link, SUM(count) AS ct FROM {$LkTbl} " . "GROUP BY link ORDER BY ct DESC, link");
    while ($result = $pagestore->dbh->result($q1)) {
        $esc_page = addslashes($result[0]);
        $q2 = $pagestore->dbh->query("SELECT MAX(version) FROM {$PgTbl} " . "WHERE title='{$esc_page}'");
        if (($r2 = $pagestore->dbh->result($q2)) && !empty($r2[0])) {
            if (!$first) {
                $text = $text . "\n";
            } else {
                $first = 0;
            }
            $text = $text . '(' . html_url(findURL($result[0]), $result[1]) . ') ' . html_ref($result[0], $result[0]);
        }
    }
    return html_code($text);
}
Esempio n. 3
0
        $pagestore->unlock();
        header('Location: ' . $AdminScript);
    }
} else {
    if ($blocking) {
        if (empty($Block) && empty($Unblock)) {
            $html = '';
            if ($RatePeriod == 0) {
                $html = $html . html_bold_start() . ACTION_RateControlIpBlocking . html_bold_end() . html_newline();
            }
            $html = $html . html_rate_start();
            $blocklist = rateBlockList($pagestore->dbh);
            foreach ($blocklist as $block) {
                $html = $html . html_rate_entry($block);
            }
            $html = $html . html_rate_end();
            template_admin(array('html' => $html));
        } else {
            if (!empty($Block)) {
                rateBlockAdd($pagestore->dbh, $address);
            } else {
                if (!empty($Unblock)) {
                    rateBlockRemove($pagestore->dbh, $address);
                }
            }
            header('Location: ' . $AdminScript);
        }
    } else {
        template_admin(array('html' => html_url($AdminScript . '?locking=1', ACTION_LockUnlockPages) . html_newline() . html_url($AdminScript . '?blocking=1', ACTION_BLockUnblockHosts) . html_newline()));
    }
}
Esempio n. 4
0
    }
} else {
    if ($blocking) {
        if (empty($Block) && empty($Unblock)) {
            $GLOBALS['phpgw']->common->phpgw_header();
            $html = '';
            if ($RatePeriod == 0) {
                $html = $html . html_bold_start() . lang('Rate control / IP blocking disabled') . html_bold_end() . html_newline();
            }
            $html = $html . html_rate_start();
            $blocklist = $pagestore->rateBlockList();
            foreach ($blocklist as $block) {
                $html = $html . html_rate_entry($block);
            }
            $html = $html . html_rate_end();
            template_admin(array('html' => $html));
        } else {
            if (!empty($Block)) {
                $pagestore->rateBlockAdd($address);
            } else {
                if (!empty($Unblock)) {
                    $pagestore->rateBlockRemove($address);
                }
            }
            header('Location: ' . $AdminScript);
        }
    } else {
        $GLOBALS['phpgw']->common->phpgw_header();
        template_admin(array('html' => html_url($AdminScript . '&locking=1', lang('Lock / unlock pages')) . html_newline() . html_url($AdminScript . '&blocking=1', lang('Block / unblock hosts')) . html_newline()));
    }
}