本文整理汇总了PHP中re函数的典型用法代码示例。如果您正苦于以下问题:PHP re函数的具体用法?PHP re怎么用?PHP re使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了re函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: vote
function vote($ajax = false)
{
global $db, $balken_vote_menu, $prev;
$qry = db("SELECT * FROM " . $db['votes'] . " WHERE menu = '1' AND forum = 0");
$get = _fetch($qry);
if (_rows($qry)) {
$qryv = db("SELECT * FROM " . $db['vote_results'] . " WHERE vid = '" . $get['id'] . "' ORDER BY what");
while ($getv = _fetch($qryv)) {
$stimmen = sum($db['vote_results'], " WHERE vid = '" . $get['id'] . "'", "stimmen");
if ($stimmen != 0) {
if (ipcheck("vid_" . $get['id']) || isset($_COOKIE[$prev . "vid_" . $get['id']]) || $get['closed'] == 1) {
$percent = round($getv['stimmen'] / $stimmen * 100, 1);
$rawpercent = round($getv['stimmen'] / $stimmen * 100, 0);
$balken = show(_votes_balken, array("width" => $rawpercent));
$votebutton = "";
$results .= show("menu/vote_results", array("answer" => re($getv['sel']), "percent" => $percent, "stimmen" => $getv['stimmen'], "balken" => $balken));
} else {
$votebutton = '<input id="contentSubmitVote" type="submit" value="' . _button_value_vote . '" class="voteSubmit" />';
$results .= show("menu/vote_vote", array("id" => $getv['id'], "answer" => re($getv['sel'])));
}
} else {
$votebutton = '<input id="contentSubmitVote" type="submit" value="' . _button_value_vote . '" class="voteSubmit" />';
$results .= show("menu/vote_vote", array("id" => $getv['id'], "answer" => re($getv['sel'])));
}
}
$vote = show("menu/vote", array("titel" => re($get['titel']), "vid" => $get['id'], "results" => $results, "votebutton" => $votebutton, "stimmen" => $stimmen));
}
return empty($vote) ? '<center style="margin:2px 0">' . _vote_menu_no_vote . '</center>' : ($ajax ? $vote : '<div id="navVote">' . $vote . '</div>');
}
示例2: navi
function navi($kat)
{
global $db, $chkMe, $userid, $designpath;
if ($k = _fetch(db("SELECT `level` FROM " . $db['navi_kats'] . " WHERE `placeholder` = '" . up($kat) . "'"))) {
$intern = $chkMe >= 2 ? '' : " AND s1.`internal` = '0'";
$permissions = $kat == 'nav_admin' && admin_perms($userid) ? "" : $intern . " AND " . intval($chkMe) . " >= '" . intval($k['level']) . "'";
$qry = db("SELECT s1.* FROM " . $db['navi'] . " AS s1 LEFT JOIN " . $db['navi_kats'] . " AS s2 ON s1.kat = s2.placeholder\n WHERE s1.kat = '" . up($kat) . "' AND s1.`shown` = '1' " . $permissions . "\n ORDER BY s1.pos");
while ($get = _fetch($qry)) {
if ($get['type'] == 0) {
$link = '';
} elseif ($get['type'] == 1 || $get['type'] == 2 || $get['type'] == 3) {
$name = $get['wichtig'] == 1 ? '<span class="fontWichtig">' . navi_name(re($get['name'])) . '</span>' : navi_name(re($get['name']));
$target = $get['target'] == 1 ? '_blank' : '_self';
if (file_exists($designpath . '/menu/' . $get['kat'] . '.html')) {
$link = show("menu/" . $get['kat'] . "", array("target" => $target, "href" => re($get['url']), "title" => strip_tags($name), "css" => ucfirst(str_replace('nav_', '', re($get['kat']))), "link" => $name));
} else {
$link = show("menu/nav_link", array("target" => $target, "href" => re($get['url']), "title" => strip_tags($name), "css" => ucfirst(str_replace('nav_', '', re($get['kat']))), "link" => $name));
}
$table = strstr($link, '<tr>') ? true : false;
}
$navi .= $link;
}
}
return empty($navi) ? '' : ($table ? '<table class="navContent" cellspacing="0">' . $navi . '</table>' : $navi);
}
示例3: ftopics
function ftopics()
{
global $db, $maxftopics, $lftopics, $maxfposts, $allowHover;
$f = 0;
$qry = db("SELECT s1.*,s2.id AS subid FROM " . $db['f_threads'] . " s1, " . $db['f_skats'] . " s2, " . $db['f_kats'] . " s3\n WHERE s1.kid = s2.id AND s2.sid = s3.id ORDER BY s1.lp DESC LIMIT 100");
while ($get = _fetch($qry)) {
if ($f == $maxftopics) {
break;
}
if (fintern($get['kid'])) {
$lp = cnt($db['f_posts'], " WHERE sid = '" . $get['id'] . "'");
$pagenr = ceil($lp / $maxfposts);
if ($pagenr == 0) {
$page = 1;
} else {
$page = $pagenr;
}
if ($allowHover == 1) {
$info = 'onmouseover="DZCP.showInfo(\'<tr><td colspan=2 align=center padding=3 class=infoTop>' . jsconvert(re($get['topic'])) . '</td></tr><tr><td><b>' . _forum_posts . ':</b></td><td>' . $lp . '</td></tr><tr><td><b>' . _forum_lpost . ':</b></td><td>' . date("d.m.Y H:i", $get['lp']) . _uhr . '</td></tr>\')" onmouseout="DZCP.hideInfo()"';
}
$ftopics .= show("menu/forum_topics", array("id" => $get['id'], "pagenr" => $page, "p" => $lp + 1, "titel" => cut(re($get['topic']), $lftopics), "info" => $info, "kid" => $get['kid']));
$f++;
}
}
return empty($ftopics) ? '' : '<table class="navContent" cellspacing="0">' . $ftopics . '</table>';
}
示例4: fvote
function fvote($id, $ajax = false)
{
global $db, $balken_vote_menu, $prev;
if (!permission("votes")) {
$intern = ' AND intern = 0';
}
$qry = db("SELECT * FROM " . $db['votes'] . " WHERE id = '" . $id . "' " . $intern . "");
$get = _fetch($qry);
if (_rows($qry)) {
$qryv = db("SELECT * FROM " . $db['vote_results'] . " WHERE vid = '" . $get['id'] . "' ORDER BY id ASC");
while ($getv = _fetch($qryv)) {
$stimmen = sum($db['vote_results'], " WHERE vid = '" . $get['id'] . "'", "stimmen");
if ($stimmen != 0) {
if (ipcheck("vid_" . $get['id']) || isset($_COOKIE[$prev . "vid_" . $get['id']]) || $get['closed'] == 1) {
$percent = round($getv['stimmen'] / $stimmen * 100, 1);
$rawpercent = round($getv['stimmen'] / $stimmen * 100, 0);
$balken = show(_votes_balken, array("width" => $rawpercent));
$votebutton = "";
$results .= show("forum/vote_results", array("answer" => re($getv['sel']), "percent" => $percent, "stimmen" => $getv['stimmen'], "balken" => $balken));
} else {
$votebutton = '<input id="contentSubmitFVote" type="submit" value="' . _button_value_vote . '" class="voteSubmit" />';
$results .= show("forum/vote_vote", array("id" => $getv['id'], "answer" => re($getv['sel'])));
}
} else {
$votebutton = '<input id="contentSubmitFVote" type="submit" value="' . _button_value_vote . '" class="voteSubmit" />';
$results .= show("forum/vote_vote", array("id" => $getv['id'], "answer" => re($getv['sel'])));
}
}
$qryf = db("SELECT id,kid FROM " . $db['f_threads'] . " WHERE vote = '" . $get['id'] . "'");
$getf = _fetch($qryf);
$vote = show("forum/vote", array("titel" => re($get['titel']), "vid" => $get['id'], "fid" => $getf['id'], "kid" => $getf['kid'], "umfrage" => _forum_vote, "results" => $results, "votebutton" => $votebutton, "stimmen" => $stimmen));
}
return empty($vote) ? '' : ($ajax ? $vote : '<div id="navFVote">' . $vote . '</div>');
}
示例5: top_match
function top_match()
{
global $db, $allowHover, $llwars, $picformat, $sql_prefix;
$qry = db("SELECT s1.datum,s1.cid,s1.id,s1.bericht,s1.xonx,s1.punkte,s1.gpunkte,s1.squad_id,s2.icon,s2.name FROM " . $db['cw'] . " AS s1\n LEFT JOIN " . $db['squads'] . " AS s2 ON s1.squad_id = s2.id\n WHERE `top` = '1'\n ORDER BY RAND()");
if ($get = _fetch($qry)) {
//Clans Mod
$clandetailssql = db("SELECT clantag, gegner FROM " . $sql_prefix . "clans WHERE id LIKE " . $get['cid']);
$clans = _fetch($clandetailssql);
$squad = '_defaultlogo.jpg';
$gegner = '_defaultlogo.jpg';
foreach ($picformat as $end) {
if (file_exists(basePath . '/inc/images/clanwars/' . $get['cid'] . '_logo.' . $end)) {
$gegner = $get['cid'] . '_logo.' . $end;
}
if (file_exists(basePath . '/inc/images/squads/' . $get['squad_id'] . '_logo.' . $end)) {
$squad = $get['squad_id'] . '_logo.' . $end;
}
}
if ($allowHover == 1 || $allowHover == 2) {
$hover = 'onmouseover="DZCP.showInfo(\'<tr><td colspan=2 align=center padding=3 class=infoTop>' . jsconvert(re($get['name'])) . '<br/>vs.<br/> ' . jsconvert(re($clans['gegner'])) . '</td></tr><tr><td><b>' . _played_at . ':</b></td><td>' . date("d.m.Y H:i", $get['datum']) . _uhr . '</td></tr><tr><td><b>' . _cw_xonx . ':</b></td><td>' . jsconvert(re($get['xonx'])) . '</td></tr><tr><td><b>' . _result . ':</b></td><td>' . cw_result_nopic_raw($get['punkte'], $get['gpunkte']) . '</td></tr><tr><td><b>' . _comments_head . ':</b></td><td>' . cnt($db['cw_comments'], "WHERE cw = '" . $get['id'] . "'") . '</td></tr>\')" onmouseout="DZCP.hideInfo()"';
}
$topmatch .= show("menu/top_match", array("id" => $get['id'], "clantag" => re(cut($clans['clantag'], $llwars)), "team" => re(cut($get['name'], $llwars)), "game" => substr(strtoupper(str_replace('.' . $icon, '', re($get['icon']))), 0, 5), "id" => $get['id'], "gegner" => $gegner, "squad" => $squad, "hover" => $hover, "info" => $get['datum'] > time() ? date("d.m.Y", $get['datum']) : cw_result_nopic($get['punkte'], $get['gpunkte'])));
}
return empty($topmatch) ? '<center style="margin:3px 0">' . _no_top_match . '</center>' : '<table class="navContent" cellspacing="0">' . $topmatch . '</table>';
}
示例6: l_reg
function l_reg()
{
global $db, $llreg, $maxlreg;
$qry = db("SELECT id,nick,country,regdatum FROM " . $db['users'] . "\n ORDER BY regdatum DESC\n LIMIT " . $maxlreg . "");
while ($get = _fetch($qry)) {
$lreg .= show("menu/last_reg", array("nick" => re(cut($get['nick'], $llreg)), "country" => flag($get['country']), "reg" => date("d.m.", $get['regdatum']), "id" => $get['id']));
}
return empty($lreg) ? '' : '<table class="navContent" cellspacing="0">' . $lreg . '</table>';
}
示例7: rotationsbanner
function rotationsbanner()
{
global $db;
$qry = db("SELECT * FROM " . $db['sponsoren'] . "\n\t\t\t WHERE banner = 1 ORDER BY RAND() LIMIT 1");
while ($get = _fetch($qry)) {
$rotationbanner .= show(_sponsors_bannerlink, array("id" => $get['id'], "title" => htmlspecialchars(str_replace('http://', '', re($get['link']))), "banner" => empty($get['blink']) ? "../banner/sponsors/banner_" . $get['id'] . "." . $get['bend'] : re($get['blink'])));
}
return empty($rotationbanner) ? '' : $rotationbanner;
}
示例8: sponsors
function sponsors()
{
global $db;
$qry = db("SELECT * FROM " . $db['sponsoren'] . " WHERE box = 1 ORDER BY pos");
while ($get = _fetch($qry)) {
$banner = show(_sponsors_bannerlink, array("id" => $get['id'], "title" => htmlspecialchars(str_replace('http://', '', re($get['link']))), "banner" => empty($get['xlink']) ? "../banner/sponsors/box_" . $get['id'] . "." . $get['xend'] : re($get['xlink'])));
$sponsors .= show("menu/sponsors", array("banner" => $banner));
}
return empty($sponsors) ? '' : '<table class="navContent" cellspacing="0">' . $sponsors . '</table>';
}
示例9: testre
function testre($title, $expression, $target, $expected)
{
$result = re($expression, $target, $expected);
if ($result == $expected) {
echo "Test '{$title}' [{$expression}] - OK\n";
} else {
echo "Test '{$title}' [{$expression}] - FAILED\n";
echo "Expected: [" . print_r($expected, 1) . "]\n";
echo "Got: [" . print_r($result, 1) . "]\n";
echo "\n";
}
}
示例10: l_wars
function l_wars()
{
global $db, $maxlwars, $llwars, $allowHover;
$qry = db("SELECT s1.datum,s1.gegner,s1.id,s1.bericht,s1.xonx,s1.clantag,s1.punkte,s1.gpunkte,s1.squad_id,s2.icon,s2.name FROM " . $db['cw'] . " AS s1\n LEFT JOIN " . $db['squads'] . " AS s2 ON s1.squad_id = s2.id\n WHERE datum < " . time() . "\n ORDER BY datum DESC\n LIMIT " . $maxlwars . "");
while ($get = _fetch($qry)) {
if ($allowHover == 1 || $allowHover == 2) {
$info = 'onmouseover="DZCP.showInfo(\'<tr><td colspan=2 align=center padding=3 class=infoTop>' . jsconvert(re($get['name'])) . '<br/>vs.<br/> ' . jsconvert(re($get['gegner'])) . '</td></tr><tr><td><b>' . _played_at . ':</b></td><td>' . date("d.m.Y H:i", $get['datum']) . _uhr . '</td></tr><tr><td><b>' . _cw_xonx . ':</b></td><td>' . jsconvert(re($get['xonx'])) . '</td></tr><tr><td><b>' . _result . ':</b></td><td>' . cw_result_nopic_raw($get['punkte'], $get['gpunkte']) . '</td></tr><tr><td><b>' . _comments_head . ':</b></td><td>' . cnt($db['cw_comments'], "WHERE cw = '" . $get['id'] . "'") . '</td></tr>\')" onmouseout="DZCP.hideInfo()"';
}
$lwars .= show("menu/last_wars", array("id" => $get['id'], "clantag" => re(cut($get['clantag'], $llwars)), "icon" => re($get['icon']), "info" => $info, "result" => cw_result_pic($get['punkte'], $get['gpunkte'])));
}
return empty($lwars) ? '' : '<table class="navContent" cellspacing="0">' . $lwars . '</table>';
}
示例11: top_dl
function top_dl()
{
global $db, $maxtopdl, $ltopdl, $allowHover;
$qry = db("SELECT * FROM " . $db['downloads'] . " ORDER BY hits DESC\n LIMIT " . $maxtopdl . "");
while ($get = _fetch($qry)) {
if ($allowHover == 1) {
$getkat = _fetch(db("SELECT name FROM " . $db['dl_kat'] . " WHERE id = '" . $get['kat'] . "'"));
$info = 'onmouseover="DZCP.showInfo(\'<tr><td colspan=2 align=center padding=3 class=infoTop>' . jsconvert(re($get['download'])) . '</td></tr><tr><td><b>' . _datum . ':</b></td><td>' . date("d.m.Y H:i", $get['date']) . _uhr . '</td></tr><tr><td><b>' . _dl_dlkat . ':</b></td><td>' . jsconvert(re($getkat['name'])) . '</td></tr><tr><td><b>' . _hits . ':</b></td><td>' . $get['hits'] . '</td></tr>\')" onmouseout="DZCP.hideInfo()"';
}
$top_dl .= show("menu/top_dl", array("id" => $get['id'], "titel" => cut(re($get['download']), $ltopdl), "info" => $info, "hits" => $get['hits']));
}
return empty($top_dl) ? '' : '<table class="navContent" cellspacing="0">' . $top_dl . '</table>';
}
示例12: partners
function partners()
{
global $db;
$qry = db("SELECT * FROM " . $db['partners'] . " ORDER BY `textlink` ASC, `id` DESC");
while ($get = _fetch($qry)) {
if ($get['textlink'] == 1) {
$partners .= show("menu/partners_textlink", array("link" => $get['link'], "name" => re($get['banner'])));
} else {
$partners .= show("menu/partners", array("link" => re($get['link']), "title" => htmlspecialchars(str_replace('http://', '', re($get['link']))), "banner" => re($get['banner'])));
}
$table = strstr($partners, '<tr>') ? true : false;
}
return empty($partners) ? '' : ($table ? '<table class="navContent" cellspacing="0">' . $partners . '</table>' : $partners);
}
示例13: n_wars
function n_wars()
{
global $db, $maxnwars, $lnwars, $allowHover;
$qry = db("SELECT s1.id,s1.datum,s1.clantag,s1.maps,s1.gegner,s1.squad_id,s2.icon,s1.xonx,s2.name FROM " . $db['cw'] . " AS s1\n LEFT JOIN " . $db['squads'] . " AS s2 ON s1.squad_id = s2.id\n WHERE s1.datum > " . time() . "\n ORDER BY s1.datum\n LIMIT " . $maxnwars . "");
if (_rows($qry)) {
while ($get = _fetch($qry)) {
if ($allowHover == 1 || $allowHover == 2) {
$info = 'onmouseover="DZCP.showInfo(\'<tr><td colspan=2 align=center padding=3 class=infoTop>' . jsconvert(re($get['name'])) . '<br/>vs.<br /> ' . jsconvert(re($get['gegner'])) . '</td></tr><tr><td><b>' . _datum . ':</b></td><td>' . date("d.m.Y H:i", $get['datum']) . _uhr . '</td></tr><tr><td><b>' . _cw_xonx . ':</b></td><td>' . jsconvert(re($get['xonx'])) . '</td></tr><tr><td><b>' . _cw_maps . ':</b></td><td>' . jsconvert(re($get['maps'])) . '</td></tr><tr><td><b>' . _comments_head . ':</b></td><td>' . cnt($db['cw_comments'], "WHERE cw = '" . $get['id'] . "'") . '</td></tr>\')" onmouseout="DZCP.hideInfo()"';
}
$nwars .= show("menu/next_wars", array("id" => $get['id'], "clantag" => re(cut($get['clantag'], $lnwars)), "icon" => re($get['icon']), "info" => $info, "datum" => date("d.m.:", $get['datum'])));
}
}
return empty($nwars) ? '' : '<table class="navContent" cellspacing="0">' . $nwars . '</table>';
}
示例14: team
function team($tID = '')
{
global $db, $teamRow, $l_team;
//SQL
if (!empty($tID)) {
$where = "WHERE id = '" . intval($tID) . "' AND navi = 1";
} else {
$where = "WHERE navi = '1' ORDER BY RAND()";
}
$get = _fetch(db("SELECT * FROM " . $db['squads'] . " " . $where . ""));
//Members
$qrym = db("SELECT s1.squad,s2.id,s2.level,s2.nick,s2.status,s2.rlname,s2.bday,s4.position\n FROM " . $db['squaduser'] . " AS s1\n LEFT JOIN " . $db['users'] . " AS s2\n ON s2.id=s1.user\n LEFT JOIN " . $db['userpos'] . " AS s3\n ON s3.squad=s1.squad AND s3.user=s1.user\n LEFT JOIN " . $db['pos'] . " AS s4\n ON s4.id=s3.posi\n WHERE s1.squad='" . $get['id'] . "'\n AND s2.level != 0\n ORDER BY s4.pid");
$i = 1;
$cnt = 0;
while ($getm = _fetch($qrym)) {
unset($tr1, $tr2);
if ($i == 0 || $i == 1) {
$tr1 = "<tr>";
}
if ($i == $teamRow) {
$tr2 = "</tr>";
$i = 0;
}
$status = $getm['status'] == 1 || $getm['level'] == 1 ? _aktiv : _inaktiv;
$info = 'onmouseover="DZCP.showInfo(\'<tr><td colspan=2 align=center padding=3 class=infoTop>' . rawautor($getm['id']) . '</td></tr><tr><td width=80px><b>' . _posi . ':</b></td><td>' . getrank($getm['id'], $get['id']) . '</td></tr><tr><td><b>' . _status . ':</b></td><td>' . $status . '</td></tr><tr><td><b>' . _age . ':</b></td><td>' . getAge($getm['bday']) . '</td></tr><tr><td colspan=2 align=center>' . jsconvert(userpic($getm['id'])) . '</td></tr>\')" onmouseout="DZCP.hideInfo()"';
$member .= show("menu/team_show", array("pic" => userpic($getm['id'], 40, 50), "tr1" => $tr1, "tr2" => $tr2, "squad" => $get['id'], "info" => $info, "id" => $getm['id'], "width" => round(100 / $teamRow, 0)));
$i++;
$cnt++;
}
if (is_float($cnt / $teamRow)) {
for ($e = $i; $e <= $teamRow; $e++) {
$end .= '<td></td>';
}
$end = $end . "</tr>";
}
// Next / last ID
$all = cnt($db['squads'], "WHERE `navi` = '1'");
$next = _fetch(db("SELECT id FROM " . $db['squads'] . " WHERE `navi` = '1' AND `id` > '" . $get['id'] . "' ORDER BY `id` ASC LIMIT 1"));
if (empty($next)) {
$next = _fetch(db("SELECT id FROM " . $db['squads'] . " WHERE `navi` = '1' ORDER BY `id` ASC LIMIT 1"));
}
$last = _fetch(db("SELECT id FROM " . $db['squads'] . " WHERE `navi` = '1' AND `id` < '" . $get['id'] . "' ORDER BY `id` DESC LIMIT 1"));
if (empty($last)) {
$last = _fetch(db("SELECT id FROM " . $db['squads'] . " WHERE `navi` = '1' ORDER BY `id` DESC LIMIT 1"));
}
//Output
$team = show("menu/team", array("row" => $teamRow, "team" => re($get['name']), "id" => $get['id'], "next" => $next['id'], "last" => $last['id'], "br1" => $all <= 1 ? '<!--' : '', "br2" => $all <= 1 ? '-->' : '', "member" => $member, "end" => $end));
return '<div id="navTeam">' . $team . '</div>';
}
示例15: newsticker
function newsticker()
{
global $db, $allowHover;
if (!permission("intnews")) {
$int = "AND intern = 0";
}
$qry = db("SELECT id,titel,autor,datum,kat FROM " . $db['news'] . " WHERE public = '1'AND datum <= '" . time() . "' " . $int . " ORDER BY id DESC LIMIT 20");
while ($get = _fetch($qry)) {
if ($allowHover == 1) {
$getkat = _fetch(db("SELECT kategorie FROM " . $db['newskat'] . " WHERE id = '" . $get['kat'] . "'"));
$info = 'onmouseover="DZCP.showInfo(\'<tr><td colspan=2 align=center padding=3 class=infoTop>' . jsconvert(re($get['titel'])) . '</td></tr><tr><td><b>' . _datum . ':</b></td><td>' . date("d.m.Y H:i", $get['datum']) . _uhr . '</td></tr><tr><td><b>' . _autor . ':</b></td><td>' . rawautor($get['autor']) . '</td></tr><tr><td><b>' . _news_admin_kat . ':</b></td><td>' . jsconvert(re($getkat['kategorie'])) . '</td></tr><tr><td><b>' . _comments_head . ':</b></td><td>' . cnt($db['newscomments'], "WHERE news = '" . $get['id'] . "'") . '</td></tr>\')" onmouseout="DZCP.hideInfo()"';
}
$news .= '<a href="../news/?action=show&id=' . $get['id'] . '" ' . $info . '>' . re($get['titel']) . '</a> | ';
}
return show("menu/newsticker", array("news" => $news));
}