Ejemplo n.º 1
0
function action_find()
{
    global $pagestore, $find, $branch_search;
    $doFindOne = 1;
    // avoid findOne search if empty string, full text search, or branch search
    if (trim($find) == '' || $find[0] == '!' || $branch_search) {
        $doFindOne = 0;
    }
    // remove leading ! if full text search
    if ($find[0] == '!') {
        $find = substr($find, 1);
    }
    // try to find one page by its name
    if ($doFindOne && ($findOne = $pagestore->findOne(trim($find)))) {
        header('Location: ' . viewURL($findOne));
    } else {
        $list = $pagestore->find($find);
        if ($branch_search) {
            $branch_nodes = $pagestore->getTree($branch_search, '', 'FLAT');
            $list = array_intersect($list, $branch_nodes);
        }
        $text = '';
        foreach ($list as $page) {
            if ($page != $find) {
                $text .= html_ref($page, $page) . html_newline();
            }
        }
        template_find(array('find' => $find, 'pages' => $text, 'branch_search' => $branch_search));
    }
}
Ejemplo n.º 2
0
function action_find()
{
    global $pagestore;
    $find = $_POST['find'] ? $_POST['find'] : $_GET['find'];
    $list = $pagestore->find($find);
    $text = '';
    foreach ($list as $page) {
        $text .= html_ref($page, $page) . html_newline();
    }
    template_find(array('find' => $find, 'pages' => $text));
}
Ejemplo n.º 3
0
 function parse($args, $page)
 {
     global $pagestore, $MinEntries, $DayLimit, $full, $page, $Entity;
     global $FlgChr, $UserName, $UseHotPages;
     list($args, $ignoreRegExp) = explode(' ', $args, 2);
     $text = '';
     if (strstr($args, '*')) {
         $list = $pagestore->allpages();
     } else {
         if (strstr($args, '?')) {
             $list = $pagestore->newpages();
         } else {
             if (strstr($args, '~')) {
                 $list = $pagestore->emptypages();
             } else {
                 $parsed = parseText($args, array('parse_wikiname', 'parse_freelink'), '');
                 $pagenames = array();
                 preg_replace('/' . $FlgChr . '(\\d+)' . $FlgChr . '/e', '$pagenames[]=$Entity[\\1][1]', $parsed);
                 $list = $pagestore->givenpages($pagenames);
             }
         }
     }
     if (count($list) == 0) {
         return '';
     }
     usort($list, 'catSort');
     if ($UseHotPages) {
         $hotPagesList = $pagestore->getHotPages();
     } else {
         $hotPagesList = array();
     }
     $newPages = $pagestore->getNewPages();
     $now = time();
     for ($i = 0; $i < count($list); $i++) {
         if ($ignoreRegExp) {
             if (@preg_match($ignoreRegExp, $list[$i][1])) {
                 continue;
             }
         }
         if ($DayLimit && $i >= $MinEntries && !$full && $now - $list[$i][0] > $DayLimit * 24 * 60 * 60) {
             break;
         }
         $text = $text . html_category($list[$i][0], $list[$i][1], $list[$i][2], $list[$i][3], $list[$i][5], $list[$i][7], $hotPagesList, $newPages);
         // Do not put a newline on the last one.
         if ($i < count($list) - 1) {
             $text = $text . html_newline();
         }
     }
     if ($i < count($list)) {
         $text = $text . html_fulllist($page, count($list));
     }
     return $text;
 }
Ejemplo n.º 4
0
function action_find()
{
    global $pagestore, $find, $style, $SeparateLinkWords;
    $list = $pagestore->find($find);
    switch ($style) {
        case 'meta':
            $SeparateLinkWords = 0;
            break;
    }
    $text = '';
    foreach ($list as $page) {
        $text = $text . html_ref($page, $page) . html_newline();
    }
    template_find(array('find' => $find, 'pages' => $text));
}
Ejemplo n.º 5
0
function view_macro_category($args)
{
    global $pagestore, $MinEntries, $DayLimit, $full, $page, $Entity;
    global $FlgChr;
    $text = '';
    if (strstr($args, '*')) {
        $list = $pagestore->allpages();
    } else {
        if (strstr($args, '?')) {
            $list = $pagestore->newpages();
        } else {
            if (strstr($args, '~')) {
                $list = $pagestore->emptypages();
            } else {
                $parsed = parseText($args, array('parse_freelink', 'parse_wikiname'), '');
                $pagenames = array();
                preg_replace('/' . $FlgChr . '!?(\\d+)' . $FlgChr . '/e', '$pagenames[]=$Entity[\\1][1]', $parsed);
                $list = $pagestore->givenpages($pagenames);
            }
        }
    }
    if (count($list) == 0) {
        return '';
    }
    usort($list, 'catSort');
    $now = time();
    for ($i = 0; $i < count($list); $i++) {
        $editTime = mktime(substr($list[$i][0], 8, 2), substr($list[$i][0], 10, 2), substr($list[$i][0], 12, 2), substr($list[$i][0], 4, 2), substr($list[$i][0], 6, 2), substr($list[$i][0], 0, 4));
        if ($DayLimit && $i >= $MinEntries && !$full && $now - $editTime > $DayLimit * 24 * 60 * 60) {
            break;
        }
        $text = $text . html_category($list[$i][0], $list[$i][1], $list[$i][2], $list[$i][3], $list[$i][5]);
        if ($i < count($list) - 1) {
            $text = $text . html_newline();
        }
    }
    if ($i < count($list)) {
        $text = $text . html_fulllist($page, count($list));
    }
    return $text;
}
Ejemplo n.º 6
0
function view_macro_category($args)
{
    global $pagestore, $MinEntries, $DayLimit, $full, $page, $Entity;
    global $FlgChr;
    $text = '';
    if (strstr($args, '*')) {
        $list = $pagestore->allpages();
    } else {
        if (strstr($args, '?')) {
            $list = $pagestore->newpages();
        } else {
            if (strstr($args, '~')) {
                $list = $pagestore->emptypages();
            } else {
                $parsed = parseText($args, array('parse_wikiname', 'parse_freelink'), '');
                $pagenames = array();
                preg_replace('/' . $FlgChr . '(\\d+)' . $FlgChr . '/e', '$pagenames[]=$Entity[\\1][1]', $parsed);
                $list = $pagestore->givenpages($pagenames);
            }
        }
    }
    if (count($list) == 0) {
        return '';
    }
    usort($list, 'catSort');
    $now = time();
    //for($i = 0; $i < count($list); $i++)
    foreach ($list as $i => $lpage) {
        $editTime = $lpage['time'];
        if ($DayLimit && $i >= $MinEntries && !$full && $now - $editTime > $DayLimit * 24 * 60 * 60) {
            break;
        }
        $text = $text . html_category($lpage['time'], $lpage, $lpage['author'], $lpage['username'], $lpage['comment']);
        $text .= html_newline();
    }
    if ($i < count($list) - 1) {
        $text .= html_fulllist($page, count($list));
    }
    return $text;
}
Ejemplo n.º 7
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()));
    }
}
Ejemplo n.º 8
0
function html_lock_page($page, $mutable)
{
    static $count = 0;
    $count++;
    return '<input type="hidden" name="name' . $count . '" value="' . urlencode($page) . '" />' . "\n" . '<input type="checkbox" name="lock' . $count . '" value="1"' . ($mutable ? '' : ' checked="checked"') . ' />' . "\n" . "\n" . $page . html_newline();
}
Ejemplo n.º 9
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()));
    }
}