Exemplo n.º 1
0
    $script->setOffset($x);
}
$offset = $script->offset;
$script->use_regex = $use_regex;
$script->show_locked = $show_locked;
$script->show_hidden = $show_hidden;
#############################
## Input form
#############################
$f_username = $backend->formatValue(isset($name) ? $name : '');
echo "\n\t<form action='", $backend->url('/gusersearch'), "' method='get'>\n\t\t<input type='text' name='name' value='{$f_username}' />\n\t\t", $limit != Script::DEFAULT_LIMIT ? "<input type='hidden' name='limit' value='{$limit}' />" : "", "\n\t\t<input type='submit' value='Search »' /> <br />\n\t\t<div style='padding-left:0.5em; border:1px solid gray; color:gray;'>\n\t\t\t", Form::Checkbox('show_locked', $show_locked), "\n\t\t\t<label for='show_locked'>Show locked accounts</label><br />\n\n\t\t\t", Form::Checkbox('show_hidden', $show_hidden), "\n\t\t\t<label for='show_hidden'>Show hidden accounts</label><br />\n\n\t\t\t", Form::Checkbox('regex', $use_regex, array('onClick' => 'script.toggleRegex(this.checked);')), "\n\t\t\t<label for='regex'>Use <a href='http://www.wellho.net/regex/mysql.html' title='MySQL regex reference'>regular expression</a> (much slower)</label><br />\n\n\t\t\t", Form::Checkbox('icase', $case_insensitive), "\n\t\t\t<label for='icase'>Match any capitalization (much slower)</label><br />\n\t\t\t\n\t\t\t", "\n\n\t\t\t<p>\n\t\t\t\t<b>Search syntax:</b>\n\t\t\t\t<span id='tips-regex'", $use_regex ? "" : " style='display:none;'", ">\n\t\t\t\t\tRegular expressions are much slower, but much more powerful. You will need to escape special characters like [.*^\$]. See the <a href='http://www.wellho.net/regex/mysql.html' title='MySQL regex reference'>MySQL regex reference</a>.\n\t\t\t\t</span>\n\t\t\t\t<span id='tips-like'", $use_regex ? " style='display:none;'" : "", ">\n\t\t\t\t\tAdd % to your search string for multicharacter wildcards, and _ for a single-character wildcard. For example, '%Joe%' finds every username containing the word 'Joe').\n\t\t\t\t</span>\n\t\t\t</p>\n\t\t\t<p>Beware: search is <strong><em>much slower</em></strong> if the user name starts with a wildcard!</p>\n\t\t</div>\n\t</form>\n";
#############################
## Perform search
#############################
$backend->profiler->stop('initialize');
$script->Query();
$backend->profiler->start('output');
$count = $script->db->countRows();
$has_results = (int) (!(bool) $count);
echo "\n\t<h2>Search results</h2>\n\t<p id='search-summary' class='search-results-{$has_results}'>{$script->getFormattedSearchOptions()}.</p>";
#############################
## Output
#############################
if ($count) {
    /* pagination */
    echo "[", $offset > 0 ? $script->paginationLink($limit, $offset - $limit, "&larr;newer {$limit}") : "&larr;newer {$limit}", " | ", $script->db->countRows() >= $limit ? $script->paginationLink($limit, $offset + $limit, "older {$limit}&rarr;") : "older {$limit}&rarr;", "] [show ", $script->paginationLink(50, $offset, 50), ", ", $script->paginationLink(250, $offset, 250), ", ", $script->paginationLink(500, $offset, 500), "]";
    /* table */
    echo "\n\t\t<table class='pretty' id='search-results'>\n\t\t\t<tr>\n\t\t\t\t<th>ID</th>\n\t\t\t\t<th>Name</th>\n\t\t\t\t<th>Unification date</th>\n\t\t\t\t<th>Status</th>\n\t\t\t\t<!--<th>Local wikis</th>-->\n\t\t\t\t<th>Global groups</th>\n\t\t\t\t<th>Links</th>\n\t\t\t</tr>\n";
    $any_oversighted = false;
    while ($row = $script->db->fetchAssoc()) {
        /* get values */