Example #1
0
<?php

require_once "{$TKTDIR}xactlog.php";
$action = postvalue("action", getvalue("action", "login"));
$errlist = "";
$presentform = 0;
dbconnect();
$x = new XactLog();
switch ($action) {
    /* Login / Register - prompt for info */
    case "login":
        $presentform = 1;
        $firstnm = "";
        $lastnm = "";
        $phonenbr = "";
        $usernm = "";
        $usernm2 = "";
        $passwd = "";
        $passwd2 = "";
        loginprompt(false);
        break;
        /* Login phase 2 - check usernm and passwd, login if match */
    /* Login phase 2 - check usernm and passwd, login if match */
    case "Log In":
        $usernm = postvalue("usernm", "");
        $passwd = postvalue("passwd", "");
        $pwcheck = dbgetsingleton("SELECT (PASSWORD('{$passwd}') = passwd) pwcheck " . "  FROM user " . "  WHERE usernm = '{$usernm}'", "pwcheck");
        if ($pwcheck) {
            h1("Login successful");
            $user = new User();
            $user->loadByUserNm($usernm);
Example #2
0
<?php

require_once "../settings2.php";
require_once "{$TKTDIR}user.php";
session_start();
require_once '../include.php';
require_once "{$TKTDIR}functions.php";
require_once "{$TKTDIR}database.php";
require_once "DynHtmlPage2.php";
require_once "DynHtmlBlock.php";
$pageName = "Report - Membership";
$debug = 0;
$season = getvalue("season", NULL);
DynHtmlPage::docHeader($pageName);
DynHtmlPage::header();
echo "<div class='colmask leftmenu'>\n";
dbconnect();
# Report logic
if (User::isAdmin()) {
    $where = "WHERE 1";
    if ($season) {
        $where .= " AND m.season = '{$season}'";
    }
    $sql = "SELECT m.season, m.joindt, u.userix, u.firstnm, u.lastnm, u.usernm, u.member, u.admin " . "  FROM `membership` m JOIN `user` u ON m.userix = u.userix " . "  {$where} " . "  ORDER BY m.season, u.lastnm, u.firstnm ";
    $result = mysql_query($sql) or die("Error during select. " . mysql_error());
    if (!$season) {
        echo "<h2>Membership Report</h2>";
    } else {
        echo "<h2>Membership Report for {$season}</h2>";
    }
    echo "<p>Only the users marked as \"Currently Member\" can register at \"member price\" in the registration system.</p>\n";
Example #3
0
        } else {
            printf("<strong>Non-member reservations: \$%.2f</strong> (members pay only \$%.2f)\n", $guestprice, $mbrprice);
        }
    } else {
        printf("<strong>Reservations: \$%.2f</strong>\n", $guestprice);
    }
}
$user = User::getSession();
$usernm = $user ? $user->usernm : "";
$userix = $user ? $user->userix : "";
$member = $user ? $user->member : false;
loginprompt();
dbconnect();
$showOld = getvalue("showOld", 0);
$showInactive = getvalue("showInactive", 0);
$eventMask = getvalue("eventMask", 0);
/* Event table */
echo "<h1>Event Status";
if ($usernm) {
    echo " - {$usernm}";
}
echo "</h1>\n";
if (!$user) {
    warning("Since you are not logged in non-member prices are shown.<br/>");
    warning("You must <a href='login.php'>log in</a> to register for events.<br/>");
}
#	if (! $member) warning("NOTE: Non-member prices shown.<br/>");
#	if ($user) echo "<h4>Logged in.</h4>";
#	else echo "<h4>Not logged in.</h4>";
if ($eventMask) {
    echo "<h4>This is a filtered listing. <a href='eventstatus.php'>Click here</a> to see all available events.</h4>";
require_once "{$TKTDIR}user.php";
session_start();
require_once '../include.php';
require_once "{$TKTDIR}functions.php";
require_once "{$TKTDIR}database.php";
require_once "DynHtmlPage2.php";
require_once "DynHtmlBlock.php";
$pageName = "Report - Event Registration";
$debug = 0;
DynHtmlPage::docHeader($pageName);
DynHtmlPage::header();
echo "<div class='colmask leftmenu'>\n";
dbconnect();
# Report logic
if (User::isAdmin()) {
    $eventix = getvalue("eventix", 0);
    $totadm = 0.0;
    dbconnect();
    # Heading section
    $sql = "SELECT e.* FROM event e WHERE e.eventix = {$eventix}";
    $result = mysql_query($sql) or die("Error during select. " . mysql_error());
    $row = mysql_fetch_object($result);
    echo "<h3>Event {$row->eventix} - {$row->eventnm} - {$row->eventdt}</h3>\n";
    echo "<table width='100%'><tr><td style='width: 33%;'>\n";
    printf("<table style='border: solid 1px black; width: 100%%;'><tr><td>%s</td></tr></table>\n", $row->description);
    $fmt = "<tr><td>%s</td><td>%s</td></tr>\n";
    echo "</td><td style='width: 33%'>\n";
    echo "<table style='border: solid 1px black; width: 100%;'>\n";
    printf($fmt, "Volunteer Call Time", $row->calltm);
    printf($fmt, "Advertised Start Time", $row->advstarttm);
    printf($fmt, "Ice Time Start", $row->icetm);
Example #5
0
<?php

require_once "{$TKTDIR}functions.php";
require_once "{$TKTDIR}database.php";
require_once "{$TKTDIR}bargraph.php";
$user = User::getSession();
$usernm = $user ? $user->usernm : "";
$userix = $user ? $user->userix : "";
$member = $user ? $user->member : false;
loginprompt();
dbconnect();
$showold = getvalue("showold", 0);
/* Event table */
echo "<h1>Event Status";
if ($usernm) {
    echo " - {$usernm}";
}
echo "</h1>\n";
if (!$member) {
    warning("If you are a member you must not be logged in.");
}
/* Event query */
$sql = "SELECT eventix, eventnm, eventdt, capacity, mbrprice, guestprice\n" . "  FROM event e \n" . "  WHERE active " . ($showold ? "" : "AND eventdt >= CURDATE() ") . "\n" . "  ORDER BY eventdt";
if ($debug > 1) {
    dispsql($sql);
}
$res = mysql_query($sql) or die("Error during event select. " . mysql_error());
echo "<form action='eventorder.php' method='post'>\n";
if ($userix) {
    echo "<input type='submit' name='action' value='Submit Order'>\n";
}
Example #6
0
function _do($log)
{
    global $form;
    // 라인개수
    $lines = getvalue($form['lines'], $_SESSION['log_lines'], 30);
    if (!$lines) {
        $lines = 30;
    }
    $search = $form['search'];
    if ($search) {
        // 콤마가 포함되면 콤마로 나누어서 egrep 으로 처리
        $items = preg_split("/,/", $search);
        $len = count($items);
        if ($len > 1) {
            $tmp = array();
            foreach ($items as $k) {
                $tmp[] = trim($k);
            }
            $find = join("|", $tmp);
            $cmd = "egrep \"{$find}\" {$log} | tail -n {$lines}";
        } else {
            $cmd = "grep {$search} {$log} | tail -n {$lines}";
        }
    } else {
        $cmd = "tail -n {$lines}  {$log}";
    }
    $t1 = microtime(true);
    _exec($cmd, $output);
    //dd($output);
    $t2 = microtime(true);
    $diff = sprintf("%10.3f", $t2 - $t1);
    print <<<EOS
<div class='title'>
{$log} (elapsed {$diff})
</div>
EOS;
    // reverse order
    if ($form['reod']) {
        $output = array_reverse($output);
    }
    // 최근 몇초까지의 로그만 출력함
    $latest = getvalue($form['latest'], $_SESSION['log_latest'], 'unlimited');
    _process($output, $mode, $latest);
}
Example #7
0
function delete_user($id)
{
    $conf = configurations();
    $con = new Mongo();
    $db = $con->{$conf}['base']->{$conf}['user'];
    trigger_error($id);
    if (getvalue(check_user(array('_id' => new MongoID($id))), 0) !== false) {
        try {
            $db->remove(array('_id' => new MongoID($id)), array('safe' => true));
        } catch (MongoCursorException $e) {
            return array(false, "Remove failed " . $e->getMessage());
        }
        $list_users = list_users(array(null));
        return user_page_display($_SESSION['db_data']['user'], $_SESSION['db_data']['lvl'], 'listusers', $list_users);
    }
}
Example #8
0
<?php

require_once "{$TKTDIR}xactlog.php";
require_once "{$TKTDIR}order.php";
loginprompt(false);
$x = new XactLog();
$user = User::getSession();
$usernm = $user ? $user->usernm : "";
$userix = $user ? $user->userix : "";
$action = postvalue("action", getvalue("action"), "none");
$orderix = postvalue("orderix");
switch ($action) {
    /* *************************************************************************************************************************** */
    /* Submit Order: this is the first screen a user lands on when they submit an order from "eventstatus" */
    /* It shows the proposed order along with amounts and allows the user to either Confirm or Cancel */
    /* *************************************************************************************************************************** */
    case 'Submit Order':
        echo "<form action='eventorder.php' method='post'>\n";
        $memstatus = $user->member ? "Member" : "Non-Member";
        echo "<h1>Event Order Confirmation - {$usernm} - {$memstatus}</h1>\n";
        echo "<br/>\n";
        echo "<table>";
        echo "<tr>\n";
        echo "<th width=16%>Event</th>";
        echo "<th width=16%>Date</th>";
        echo "<th width=16%>Activity</th>";
        echo "<th width=16%>Quantity</th>";
        echo "<th width=16%>Price</th>";
        echo "<th width=16%>Ext. Price</th>";
        echo "</tr>\n";
        $ix = 0;
Example #9
0
<?php

require_once "../settings2.php";
require_once "{$TKTDIR}user.php";
session_start();
require_once '../include.php';
require_once "{$TKTDIR}functions.php";
require_once "{$TKTDIR}database.php";
require_once "DynHtmlPage2.php";
require_once "DynHtmlBlock.php";
$pageName = "Reports";
$debug = 0;
$year = getvalue("year", 0);
DynHtmlPage::docHeader($pageName);
DynHtmlPage::header();
echo "<div class='colmask leftmenu'>\n";
loginprompt();
dbconnect();
# Report menu logic
if (User::isAdmin()) {
    echo "<ul>\n";
    echo "<li><a href='report.orderByUser.php'>Orders by User</a></li>\n";
    $currseason = dbgetsingleton("SELECT season currseason FROM season WHERE startdt = (SELECT MAX(startdt) FROM season)", "currseason");
    echo "<li><a href='report.membership.php?season={$currseason}'>Membership ({$currseason})</a></li>\n";
    echo "<li>Event Registration\n";
    echo "<ul>\n";
    if ($year == 0) {
        $sql = "SELECT eventix, eventnm, eventdt \n\t\t\t\t\tFROM event \n\t\t\t\t\tWHERE eventdt > CURRENT_DATE - INTERVAL 7 DAY \n\t\t\t\t\tORDER BY eventdt, advstarttm";
    } else {
        $sql = "SELECT eventix, eventnm, eventdt \n\t\t\t\t\tFROM event \n\t\t\t\t\tWHERE YEAR(eventdt) = {$year}\n\t\t\t\t\tORDER BY eventdt, advstarttm";
    }
Example #10
0
	<input type="submit" value="Search">
</form>
*/
function stripBBCode($text_to_search)
{
    $pattern = '|[[\\/\\!]*?[^\\[\\]]*?]|si';
    $replace = '';
    return preg_replace($pattern, $replace, $text_to_search);
}
//data_dump($_GET, false, "Post data:");
// Fetch and sanitize values:
$type = getValue($_GET['type']);
if ($type !== false) {
    $type = (int) $type;
}
$text = getvalue($_GET['text']);
$textTitleSql = "";
$textPostSql = "";
$textAuthorSql = "";
if ($text !== false) {
    $text = explode(' ', $text);
    for ($i = 0; $i < count($text); $i++) {
        if ($i != count($text) - 1) {
            $textTitleSql .= "`title` LIKE '%" . $text[$i] . "%' AND ";
            $textPostSql .= "`text` LIKE '%" . $text[$i] . "%' AND ";
            $textAuthorSql .= "`player_name` LIKE '%" . $text[$i] . "%' AND ";
        } else {
            $textTitleSql .= "`title` LIKE '%" . $text[$i] . "%'";
            $textPostSql .= "`text` LIKE '%" . $text[$i] . "%'";
            $textAuthorSql .= "`player_name` LIKE '%" . $text[$i] . "%'";
        }
Example #11
0
function _listview()
{
    global $form;
    ## {{
    print <<<EOS
<table border='0'>
<form name='form' method='get' action='{$self}'>
<tr>

<td>
<input type='hidden' name='mode' value='{$mode}'>
<input type='submit' value='OK' style="width:50;height:50;">
</td>

<td>
EOS;
    if ($form['ckrf']) {
        $ck = ' checked';
    } else {
        $ck = '';
    }
    print <<<EOS
<span class='label'>Refresh</span>
<input type='checkbox' name='ckrf' id='ckrf'{$ck} onclick='_clk_reload()'><label for='ckrf'>automatic</label>
EOS;
    $v = $form['rftime'];
    $sel = array();
    if (!$v) {
        $v = 5;
    }
    $sel[$v] = ' selected';
    print <<<EOS
<select name='rftime' onchange='_change_rftime()'>
<option value='2'{$sel['2']}>2 seconds</option>
<option value='5'{$sel['5']}>5 seconds</option>
<option value='10'{$sel['10']}>10 seconds</option>
<option value='30'{$sel['30']}>30 seconds</option>
<option value='60'{$sel['60']}>60 seconds</option>
</select>
<span id='spanTimer'></span>
EOS;
    print "<br>";
    $sd = getvalue($form['sd'], $_SESSION['metajob_sd'], date('Y-m-d'));
    $ed = getvalue($form['ed'], $_SESSION['metajob_ed'], date('Y-m-d'));
    $_SESSION['metajob_sd'] = $sd;
    $_SESSION['metajob_ed'] = $ed;
    print <<<EOS
<span class='label'>Start Date</span>
<input name="sd" value="{$sd}" size="12" class='a' onkeypress='keypress_text()'{$dis}><a href="javascript:void(0)" onclick="if(self.gfPop)gfPop.fStartPop(document.form.sd,document.form.ed);return false;" ><img class="PopcalTrigger" align="absmiddle" src="/dbmon/utl/DateRange/calbtn.gif" width="34" height="22" border="0" alt=""></a>
~
<input name="ed" value="{$ed}" size="12" class='a' onkeypress='keypress_text()'{$dis}><a href="javascript:void(0)" onclick="if(self.gfPop)gfPop.fEndPop(document.form.sd,document.form.ed);return false;" ><img class="PopcalTrigger" align="absmiddle" src="/dbmon/utl/DateRange/calbtn.gif" width="34" height="22" border="0" alt=""></a>
<iframe width=132 height=142 name="gToday:contrast:agenda.js" id="gToday:contrast:agenda.js" src="/dbmon/utl/DateRange/ipopeng.htm" scrolling="no" frameborder="0" style="visibility:visible; z-index:999; position:absolute; top:-500px; left:-500px;">
</iframe>
EOS;
    print <<<EOS
</td>


</tr>
</form>
</table>
EOS;
    global $page_title;
    print <<<EOS
<script>
  var timer = 5;
  var form = document.form;
  var span = document.getElementById('spanTimer');
  var stoptimer = 0;

function _reload() {
  if (!form.ckrf.checked) return;
  form.submit();
  //document.location.reload();
}
function _countdown() {
  if (stoptimer) {
     setTimeout("_countdown()", 1000);
     return;
  }
  if (!form.ckrf.checked) return;
  var str = "" + timer + " sec";
  parent.top.document.title = "{$page_title} (" + str + ")";
  span.innerHTML = str;
  timer--;
  if (timer <= 0) _reload();
  setTimeout("_countdown()", 1000);
}
function _change_rftime() {
  var interval = parseInt(form.rftime.value);
  timer = interval;
}
function _clk_reload() {
  setTimeout("_countdown()", 1000);
}
function _onload() {
  setTimeout("_countdown()", 1000);
  var interval = parseInt(form.rftime.value);
  timer = interval;
}

if (window.addEventListener) {
  window.addEventListener("load", _onload, false);
} else if (document.attachEvent) {
  window.attachEvent("onload", _onload);
}
</script>
EOS;
    ## }}
    $select_items = "MJ.*, U.userid, U.service_Infra_id, A.name appname";
    $sql_join = " LEFT JOIN User U ON MJ.user_id=U.id" . " LEFT JOIN application A ON MJ.app_id=A.id";
    $w = array('1');
    $sd = $form['sd'];
    $ed = $form['ed'];
    $w[] = "DATE(MJ.startTimestamp) >= '{$sd}'";
    $w[] = "DATE(MJ.startTimestamp) <= '{$ed}'";
    $sql_where = join(" AND ", $w);
    $sql_order = " ORDER BY MJ.startTimestamp DESC";
    $qry = "SELECT {$select_items} FROM metajob MJ {$sql_join} WHERE {$sql_where} {$sql_order}";
    //dd($qry);
    $ret = db_query($qry);
    $hi = "#,id,status,user,appname,startTime,updateTime,elapsed,num,total,subjobs,results";
    table_head($hi);
    // 변수명#옵션
    // 옵션 _:일반변수, L:왼쪽정렬 R:오른쪽정렬 C:가운데정렬
    $tdk = "id#_,status,userid,appname,startTimestamp,lastUpdateTime,elapsed#_,num,total,subjobs#_,results#_";
    $items = preg_split("/,/", $tdk);
    $cnt = 0;
    while ($row = mysql_fetch_assoc($ret)) {
        $cnt++;
        //dd($row);
        $id = $row['id'];
        $var['id'] = span_link($id, "_view_md('{$id}')");
        $var['subjobs'] = span_link('subjobs', "_list_subjobs('{$id}')");
        $var['results'] = span_link('results', "_list_results('{$id}')");
        $s = $row['startTimestamp'];
        $e = $row['lastUpdateTime'];
        $var['elapsed'] = diff_time($e, $s);
        $fields = array();
        $fields[] = array($cnt, '');
        _push($fields, $items, $row, $var);
        print "<tr>";
        for ($i = 0; $i < count($fields); $i++) {
            list($str, $attr) = $fields[$i];
            table_data_text($str, $attr, $nowrap = 1);
        }
        print "</tr>";
    }
    $script = <<<EOS
function _view_md(mjid) {
  var url = "{$env['self']}?mode=view&mjid="+mjid;
  wopen(url,1000,1000,1,1);
  //document.location.href = url;
}
function _list_subjobs(id) {
  var url = "subjob.php?mode=view&id="+id;
  document.location.href = url;
}
function _list_results(mjid) {
  var url = "result.php?mode=view&mjid="+mjid;
  document.location.href = url;
}
EOS;
    table_close($script);
}
Example #12
0
function translateArticlelist($template)
{
    global $pagesize, $picwidth, $picheight;
    //如果指定页大小,则用用户参数填充$pagesize
    //匹配自定义文章列表标签正则
    $flag = "/【articlelist(\\([\\d\\w]*,\\d*,\\d*,\\d*,\\d*,\\d*,\\d*,\\d*\\))】([\\s\\S]*?)【\\/articlelist】/";
    preg_match_all($flag, $template, $matches, PREG_SET_ORDER);
    //替换所有articlelist标签
    $html = $template;
    //echo $template;
    foreach ($matches as $matche) {
        //得到需要循环的部分
        $str = $matche[2];
        //得到标签参数参数
        $parameter = substr($matche[1], 1, strlen($matche[1]) - 2);
        $parameter = split(',', $parameter);
        $columnid = $parameter[0];
        $articlenum = $parameter[1];
        $titlelen = $parameter[2];
        $ifpage = $parameter[3];
        $timetype = $parameter[4];
        //echo $timetype;
        $sorttype = $parameter[5];
        //缩略图的宽和高
        $picwidth = $parameter[6];
        $picheight = $parameter[7];
        $ifshowpic = "";
        if ($picwidth != null && $picheight != null && $picheight != 0 && $picheight != 0) {
            $ifshowpic = "picurl<>'' and picurl is not NULL and";
        }
        //定义排序方式的字串
        if ($sorttype == "0") {
            //id降序
            $sortstr = "order by id desc";
        } else {
            $sortstr = "order by id asc";
        }
        //如果参数columnid的值为thiscolumn则替换为当前栏目id
        if ($columnid == "columnid" || $columnid == "") {
            $columnid = $_GET["columnid"];
        }
        //栏目子栏目串
        $childColumnString = "";
        getchildcolumnid($columnid, $childColumnString);
        //得到url参数
        $oldpagesize = $pagesize;
        $pagesize = $articlenum;
        $currentpage = $_GET["currentpage"] == NULL || $_GET["currentpage"] <= 0 ? 1 : $_GET["currentpage"];
        //根据参数从数据库取得数据
        if ($ifpage == "1") {
            $articlesql = "select *,left(title,{$titlelen}) as title from I_article where " . $ifshowpic . " columnid in ({$childColumnString}) and ifpass=1 " . $sortstr . " limit " . ($currentpage - 1) * $pagesize . ",{$pagesize}";
        } else {
            $articlesql = "select *,left(title,{$titlelen}) as title from I_article where " . $ifshowpic . " columnid in ({$childColumnString}) and ifpass=1  " . $sortstr . " limit 0,{$articlenum}";
        }
        //echo $articlesql;
        $result = getresult($articlesql);
        //匹配循环部分的标签
        $tag_flag = "/【#[\\s\\S]*?】/";
        preg_match_all($tag_flag, $str, $data_tag, PREG_SET_ORDER);
        $tag_index = null;
        //记录标签循环部分每中标签出现的次数,如果出现第二次,则视为要显示两列数据,依次类推...
        //将要输出的html代码;
        $temphtml = "";
        while ($row = getresultArray($result)) {
            $str = $matche[2];
            foreach ($data_tag as $temp) {
                //$tempindex = 0;
                for (;;) {
                    if ($tag_index[$temp[0]] < 1) {
                        //初始化一篇文章数据
                        initarticledata($row);
                        //替换标签
                        $str = replace_once($temp[0], $str, getvalue($temp[0], $timetype));
                        //当前匹配标签计数器加1
                        if (isset($tag_index[$temp[0]])) {
                            $tag_index[$temp[0]]++;
                        } else {
                            $tag_index[$temp[0]] = 1;
                        }
                        break;
                    } else {
                        //取新文章数据
                        $row = getresultArray($result);
                        //第二次出现的标签都会引发取得新数据,故产生错误
                        //初始化数据
                        initarticledata($row);
                        //当前匹配标签计数器加1
                        $tag_index = NULL;
                    }
                }
            }
            $tag_index = NULL;
            $temphtml .= $str;
        }
        if (trim($temphtml) == "") {
            $html = str_replace($matche[0], gettext_r("haveNot") . gettext_r("article"), $html);
        } else {
            $html = str_replace($matche[0], $temphtml, $html);
        }
        //echo "||".$ifpage;
        if ($ifpage == 0) {
            $pagesize = $oldpagesize;
        }
    }
    return $html;
}
Example #13
0
function translateSearchlist($template)
{
    global $pagesize;
    //如果指定页大小,则用用户参数填充$pagesize
    //匹配自定义文章列表标签正则
    $flag = "/【searchlist(\\(\\d*,\\d*,\\d*,\\d*\\))】([\\s\\S]*?)【\\/searchlist】/";
    preg_match_all($flag, $template, $matches, PREG_SET_ORDER);
    //替换所有articlelist标签
    $html = $template;
    //echo $template;
    foreach ($matches as $matche) {
        //得到需要循环的部分
        $str = $matche[2];
        //得到标签参数参数
        $parameter = substr($matche[1], 1, strlen($matche[1]) - 2);
        $parameter = split(',', $parameter);
        $articlenum = $parameter[0];
        $titlelen = $parameter[1];
        $timetype = $parameter[2];
        $sorttype = $parameter[3];
        //定义排序方式的字串
        if ($sorttype == "0") {
            //id降序
            $sortstr = "order by id desc";
        } else {
            $sortstr = "order by id asc";
        }
        //得到url参数
        $pagesize = $articlenum;
        //($_GET["pagesize"]==NULL || $_GET["pagesize"]<=0)?10:$_GET["pagesize"];
        $currentpage = $_GET["currentpage"] == NULL || $_GET["currentpage"] <= 0 ? 1 : $_GET["currentpage"];
        //根据参数从数据库取得数据
        $searchSql = "select *,left(title,{$titlelen}) as title from I_article where ifpass=1";
        if ($_GET["title"] != NULL && $_GET["title"] != "") {
            $searchSql .= " and title like '%" . $_GET["title"] . "%'";
        }
        if ($_GET["columnid"] != NULL && $_GET["columnid"] > 0) {
            $sdef_fields = getresult("select * from I_field where columnid=" . getChanelidByColumnid($_GET["columnid"]));
            while ($row = getresultarray($sdef_fields)) {
                if ($_GET[$row["fieldname"]] == NULL || $_GET[$row["fieldname"]] == "") {
                    continue;
                }
                if ($row["datatype"] == "double") {
                    $searchSql .= " and " . $row["fieldname"] . " " . $_GET[$row["fieldname"] . "ctype"] . $_GET[$row["fieldname"]];
                    //echo $_GET[$row["fieldname"]."ctype"]."测试";
                } else {
                    $searchSql .= " and " . $row["fieldname"] . " like '" . $_GET[$row["fieldname"]] . "'";
                }
            }
            //在所有子栏目中搜索
            $childcolumnStr = "";
            getchildcolumnid($_GET["columnid"], $childcolumnStr);
            $searchSql .= " and columnid in (" . $childcolumnStr . ")";
            //echo "Iron".$searchSql;
        }
        $searchSql .= " " . $sortstr . " limit " . ($currentpage - 1) * $pagesize . ",{$pagesize}";
        //echo $searchSql;
        $result = getresult($searchSql);
        //匹配循环部分的标签
        $tag_flag = "/【#[\\s\\S]*?】/";
        preg_match_all($tag_flag, $str, $data_tag, PREG_SET_ORDER);
        $tag_index = null;
        //记录标签循环部分每中标签出现的次数,如果出现第二次,则视为要显示两列数据,依次类推...
        //将要输出的html代码;
        $temphtml = "";
        while ($row = getresultArray($result)) {
            $str = $matche[2];
            foreach ($data_tag as $temp) {
                //$tempindex = 0;
                for (;;) {
                    if ($tag_index[$temp[0]] < 1) {
                        //初始化一篇文章数据
                        initarticledata($row);
                        //替换标签
                        $str = replace_once($temp[0], $str, getvalue($temp[0], $timetype));
                        //当前匹配标签计数器加1
                        if (isset($tag_index[$temp[0]])) {
                            $tag_index[$temp[0]]++;
                        } else {
                            $tag_index[$temp[0]] = 1;
                        }
                        break;
                    } else {
                        //取新文章数据
                        $row = getresultArray($result);
                        //第二次出现的标签都会引发取得新数据,故产生错误
                        //初始化数据
                        initarticledata($row);
                        //当前匹配标签计数器加1
                        $tag_index = NULL;
                    }
                }
            }
            $tag_index = NULL;
            $temphtml .= $str;
        }
        //echo $matche[0]."<br>";//.$temphtml;
        if (trim($temphtml) == "") {
            $html = str_replace($matche[0], gettext_r("haveNot") . gettext_r("search") . gettext_r("result"), $html);
        } else {
            $html = str_replace($matche[0], $temphtml, $html);
        }
    }
    //显示搜索表单
    $html = str_replace("【#searchform】", getsearchform(), $html);
    //显示分页
    $html = str_replace("【#showpage】", getsearchPage($pagesize), $html);
    return $html;
}
Example #14
0
function html5_admin_bug($lang, $mod = null)
{
    $conf = configurations();
    global $text_cont;
    $id = myfilter($_GET['id'], '_id');
    if (is_array($mod)) {
        return redirect($lang, '?action=' . $mod[0] . $mod[1] . '&mod=' . $mod[2]);
    }
    $content = html5_user_bug($lang, $mod);
    $status = getvalue(explode('">', getvalue(explode('<span class="status ', $content), 1)), 0);
    $content = explode('<span class="status ', $content);
    $content[1] = getvalue(explode($status . '</span>', $content[1]), 1);
    $html_var = '<form action="?action=editbug&id=' . $id . '" method="post"><select name="status">';
    foreach ($conf['bugs'] as $key => $value) {
        foreach ($value as $svalue) {
            if ($status === $svalue) {
                $def = 'selected="selected"';
            } else {
                $def = null;
            }
            $html_var .= '<option value="' . $svalue . '" ' . $def . '>' . $key . '/' . $svalue . '</option>';
        }
    }
    $html_var .= '</select><input type="submit" value="' . $text_cont[18][$lang] . '"  /></form>';
    return $content[0] . $html_var . $content[1];
}