本文整理汇总了PHP中Utils\Database\XDb::xFetchArray方法的典型用法代码示例。如果您正苦于以下问题:PHP XDb::xFetchArray方法的具体用法?PHP XDb::xFetchArray怎么用?PHP XDb::xFetchArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils\Database\XDb
的用法示例。
在下文中一共展示了XDb::xFetchArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isGeokretInCache
function isGeokretInCache($cacheid)
{
$res = XDb::xSql("SELECT wp_oc, wp_gc, wp_nc, wp_ge, wp_tc\n FROM caches WHERE cache_id = ? LIMIT 1", $cacheid);
$cache_record = XDb::xFetchArray($res);
// get cache waypoint
$cache_wp = '';
if ($cache_record['wp_oc'] != '') {
$cache_wp = $cache_record['wp_oc'];
} else {
if ($cache_record['wp_gc'] != '') {
$cache_wp = $cache_record['wp_gc'];
} else {
if ($cache_record['wp_nc'] != '') {
$cache_wp = $cache_record['wp_nc'];
} else {
if ($cache_record['wp_ge'] != '') {
$cache_wp = $cache_record['wp_ge'];
} else {
if ($cache_record['wp_tc'] != '') {
$cache_wp = $cache_record['wp_tc'];
}
}
}
}
}
$gkNum = XDb::xMultiVariableQueryValue("SELECT COUNT(*) FROM gk_item\n WHERE id IN (\n SELECT id FROM gk_item_waypoint\n WHERE wp = :1\n )\n AND stateid<>1 AND stateid<>4\n AND stateid <>5 AND typeid<>2", 0, $cache_wp);
if ($gkNum == 0) {
return 0;
} else {
return 1;
}
}
示例2: get_cache_size_from_database
function get_cache_size_from_database()
{
$cache_size = array();
$resp = XDb::xSql("SELECT * FROM cache_size ORDER BY id ASC");
while ($row = XDb::xFetchArray($resp)) {
$cache_size[] = $row;
}
return $cache_size;
}
示例3: online_user
function online_user()
{
// add check users id who want to by username hidden
$rs = XDb::xSql("SELECT `user_id` FROM `sys_sessions`\n WHERE user_id!=1 AND `sys_sessions`.last_login >(NOW()-INTERVAL 10 MINUTE)\n GROUP BY `user_id`");
$online_users = array();
while ($r = XDb::xFetchArray($rs)) {
$online_users[] = $r['user_id'];
}
return $online_users;
}
示例4: find_news
function find_news($start, $end)
{
global $tpl;
global $lang;
global $znalezione;
$wp = XDb::xEscape($_GET['wp']);
$query = "select id,type,user_id,date,text,deleted from cache_logs where cache_id = (select cache_id from caches where wp_oc = '" . $wp . "') order by date desc limit " . $start . "," . $end;
$wynik = XDb::xSql($query);
$query = "select name,cache_id from caches where cache_id = (select cache_id from caches where wp_oc = '" . $wp . "');";
$wynik2 = XDb::xSql($query);
$caches = XDb::xFetchArray($wynik2);
$tpl->assign("name", $caches['name']);
// detailed cache access logging
global $enable_cache_access_logs;
if (@$enable_cache_access_logs) {
$dbc = OcDb::instance();
$cache_id = $caches['cache_id'];
$user_id = @$_SESSION['user_id'] > 0 ? $_SESSION['user_id'] : null;
$access_log = @$_SESSION['CACHE_ACCESS_LOG_VL_' . $user_id];
if ($access_log === null) {
$_SESSION['CACHE_ACCESS_LOG_VL_' . $user_id] = array();
$access_log = $_SESSION['CACHE_ACCESS_LOG_VL_' . $user_id];
}
if (@$access_log[$cache_id] !== true) {
$dbc->multiVariableQuery('INSERT INTO CACHE_ACCESS_LOGS
(event_date, cache_id, user_id, source, event, ip_addr, user_agent, forwarded_for)
VALUES
(NOW(), :1, :2, \'M\', \'view_logs\', :3, :4, :5)', $cache_id, $user_id, $_SERVER['REMOTE_ADDR'], $_SERVER['HTTP_USER_AGENT'], $_SERVER['HTTP_X_FORWARDED_FOR']);
$access_log[$cache_id] = true;
$_SESSION['CACHE_ACCESS_LOG_VL_' . $user_id] = $access_log;
}
}
$znalezione = array();
while ($logs = XDb::xFetchArray($wynik)) {
if ($logs['deleted'] == 0) {
$query = "select username from user where user_id = '" . $logs['user_id'] . "';";
$wynik3 = XDb::xSql($query);
$user = XDb::xFetchArray($wynik3);
$logs2['id'] = $logs['id'];
$logs2['user_id'] = $logs['user_id'];
$logs2['newtype'] = $logs['type'];
$logs2['newdate'] = date('j.m.Y', strtotime($logs['date']));
$logs2['username'] = $user[0];
$logs2['newtext'] = html2log($logs['text']);
$znalezione[] = $logs2;
}
}
$tpl->assign("wp_oc", $wp);
$tpl->assign("logs", $znalezione);
}
示例5: getDBFilter
function getDBFilter($userid)
{
$filter = "11111111110111110134100000000000";
// default filter
$query = XDb::xSql("SELECT * from map_settings_v2 WHERE `user_id`= ? ", $userid);
while ($row = XDb::xFetchArray($query)) {
$filter = '';
foreach ($row as $k => $v) {
if ($k != 'user_id') {
$filter .= $v;
}
}
}
return $filter;
}
示例6: find_news
function find_news($start, $end)
{
global $tpl;
$query = "SELECT id,date_posted,content FROM `news` order by id desc limit " . $start . "," . $end;
$wynik = XDb::xSql($query);
$ile = XDb::xNumRows($wynik);
$znalezione = array();
while ($odp2 = XDb::xFetchArray($wynik)) {
$odp['date_posted'] = $odp2['date_posted'];
//$odp['content']=strip_tags($odp2['content'],'<b></b><p></p><a></a><br><br/>');
$odp['content'] = html2desc($odp2['content']);
$znalezione[] = $odp;
}
$tpl->assign('news', $znalezione);
return $ile;
}
示例7: array
function find_news($start, $end)
{
global $lang;
global $ile;
global $url;
global $znalezione;
$query = "select cache_id from cache_watches where user_id=" . $_SESSION['user_id'] . " limit " . $start . "," . $end;
$wynik = XDb::xSql($query);
$ile2 = XDb::xNumRows($wynik);
if ($ile2 > 0) {
$znalezione = array();
while ($rek = XDb::xFetchArray($wynik)) {
$query = "select status,cache_id,name, score, latitude, longitude, wp_oc, user_id, type from caches where cache_id=" . $rek['cache_id'] . " order by name";
$wynik2 = XDb::xSql($query);
while ($rekord = XDb::xFetchArray($wynik2)) {
if (isset($_SESSION['user_id'])) {
$query2 = "select 1 from cache_logs where user_id = '" . $_SESSION['user_id'] . "' and type = '1' and deleted='0' and cache_id ='" . $rekord['cache_id'] . "';";
$wynik2 = XDb::xSql($query2);
$if_found = XDb::xFetchArray($wynik2);
if ($if_found[0] != '1') {
$query2 = "select 2 from cache_logs where user_id = '" . $_SESSION['user_id'] . "' and type = '2' and deleted='0' and cache_id ='" . $rekord['cache_id'] . "';";
$wynik2 = XDb::xSql($query2);
$if_found = XDb::xFetchArray($wynik2);
}
$if_found = $if_found[0];
}
$query = "select username from user where user_id = " . $rekord['user_id'] . ";";
$wynik2 = XDb::xSql($query);
$wiersz = XDb::xFetchArray($wynik2);
$query = "select " . $lang . " from cache_type where id = " . $rekord['type'] . ";";
$wynik2 = XDb::xSql($query);
$wiersz2 = XDb::xFetchArray($wynik2);
$rekord['if_found'] = $if_found;
$rekord['username'] = $wiersz['username'];
$rekord['N'] = cords($rekord['latitude']);
$rekord['E'] = cords($rekord['longitude']);
$rekord['typetext'] = $wiersz2[0];
$znalezione[] = $rekord;
}
}
}
}
示例8: genStatPieUrl
function genStatPieUrl()
{
$startDate = mktime(0, 0, 0, 1, 1, 2006);
global $lang;
if (checkField('cache_type', $lang)) {
$lang_db = XDb::xEscape($lang);
} else {
$lang_db = "en";
}
// Get data
$rsTypes = XDb::xSql("SELECT COUNT(`caches`.`type`) `count`, `cache_type`.`{$lang_db}` AS `type`, `cache_type`.`color`\n FROM `caches` INNER JOIN `cache_type` ON (`caches`.`type`=`cache_type`.`id`)\n WHERE `status`=1\n GROUP BY `caches`.`type`\n ORDER BY `count` DESC");
$yData = array();
$xData = array();
$colors = array();
$url = "http://chart.apis.google.com/chart?chs=550x200&chd=t:";
$sum = 0;
while ($rTypes = XDb::xFetchArray($rsTypes)) {
$yData[] = ' (' . $rTypes['count'] . ') ' . $rTypes['type'];
$xData[] = $rTypes['count'];
$colors[] = substr($rTypes['color'], 1);
$sum += $rTypes['count'];
}
XDb::xFreeResults($rsTypes);
foreach ($xData as $count) {
$url .= normTo100($count, $sum) . ",";
}
$url = substr($url, 0, -1);
$url .= "&cht=p3&chl=";
foreach ($yData as $label) {
$url .= urlencode($label) . "|";
}
$url = substr($url, 0, -1);
$url .= "&chco=";
foreach ($colors as $color) {
$url .= urlencode($color) . ",";
}
return $url = substr($url, 0, -1);
}
示例9: PasswordManager
function try_login($user, $password, $remember)
{
$this->pClear();
$query = "select user_id,username from user where username = '" . XDb::xEscape($user) . "';";
$wynik = XDb::xSql($query);
$wiersz = XDb::xFetchArray($wynik);
$user_id = $wiersz['user_id'];
if ($user_id) {
/* User exists. Is the password correct? */
$pm = new PasswordManager($user_id);
if (!$pm->verify($password)) {
$user_id = null;
}
}
if (!empty($user_id)) {
$_SESSION['username'] = $wiersz['username'];
$_SESSION['user_id'] = $user_id;
$query = "SELECT now() as now, uuid() as uuid";
$wynik = XDb::xSql($query);
$rekord = XDb::xFetchArray($wynik);
$dzis = $rekord['now'];
$uuid = $rekord['uuid'];
$query = "update user set last_login_mobile = '" . $dzis . "' where user_id='" . $user_id . "';";
XDb::xSql($query);
$this->userid = $user_id;
$this->username = $user;
$this->lastlogin = $dzis;
$this->sessionid = $uuid;
$this->verified = true;
if ($remember == 1) {
$this->pStoreCookie();
}
$query = "update user set uuid_mobile ='" . $uuid . "', last_login_mobile='" . $dzis . "' where user_id='" . $user_id . "';";
XDb::xSql($query);
}
return;
}
示例10: getDBFilter
/**
* Reads user map settings from the DB
* @param int $user_id - user identifier
*/
function getDBFilter($user_id)
{
global $MIN_SCORE, $MAX_SCORE, $powerTrailModuleSwitchOn;
// defined in settings.inc/php
$filter = array("h_u" => 1, "h_t" => 1, "h_m" => 1, "h_v" => 1, "h_w" => 1, "h_e" => 1, "h_q" => 1, "h_o" => 1, "h_owncache" => 1, "h_ignored" => 0, "h_own" => 1, "h_found" => 1, "h_noattempt" => 1, "h_nogeokret" => 1, "h_avail" => 0, "h_temp_unavail" => 1, "map_type" => 1, "h_arch" => 0, "be_ftf" => 0, "powertrail_only" => 0, "min_score" => $MIN_SCORE, "max_score" => $MAX_SCORE, "h_noscore" => 1);
// default filter
$query = XDb::xSql("SELECT * FROM map_settings WHERE `user_id`= ? LIMIT 1", $user_id);
while ($row = XDb::xFetchArray($query)) {
$filter["h_u"] = $row['unknown'];
$filter["h_t"] = $row['traditional'];
$filter["h_m"] = $row['multicache'];
$filter["h_v"] = $row['virtual'];
$filter["h_w"] = $row['webcam'];
$filter["h_e"] = $row['event'];
$filter["h_q"] = $row['quiz'];
$filter["h_o"] = $row['mobile'];
$filter["h_owncache"] = $row['owncache'];
$filter["h_ignored"] = $row['ignored'];
$filter["h_own"] = $row['own'];
$filter["h_found"] = $row['found'];
$filter["h_noattempt"] = $row['notyetfound'];
$filter["h_nogeokret"] = $row['geokret'];
$filter["h_avail"] = $row['active'];
$filter["h_temp_unavail"] = $row['notactive'];
$filter["map_type"] = $row['maptype'];
$filter["h_arch"] = $row['archived'];
$filter["be_ftf"] = $row['be_ftf'];
if ($powerTrailModuleSwitchOn) {
$filter["powertrail_only"] = $row['powertrail_only'];
}
$filter["min_score"] = $row['min_score'];
$filter["max_score"] = $row['max_score'];
$filter["h_noscore"] = $row['noscore'];
}
return $filter;
}
示例11: event_notify_new_cache
function event_notify_new_cache($cache_id)
{
global $rootpath;
//prepare the templates and include all neccessary
require_once $rootpath . 'lib/search.inc.php';
$rs = XDb::xSql('SELECT `caches`.`latitude`, `caches`.`longitude`
FROM `caches`
WHERE `caches`.`cache_id`= ? ', $cache_id);
$r = XDb::xFetchArray($rs);
$latFrom = $r['latitude'];
$lonFrom = $r['longitude'];
XDb::xFreeResults($rs);
$distanceMultiplier = 1;
// TODO: Seeking pre-select `user`. `latitude` like with max_lon / min_lon / max_lat / min_lat
XDb::xSql('INSERT INTO `notify_waiting` (`id`, `cache_id`, `user_id`, `type`)
SELECT NULL, ' . XDb::xEscape($cache_id) . ', `user`.`user_id`, ' . NOTIFY_NEW_CACHES . '
FROM `user`
WHERE NOT ISNULL(`user`.`latitude`)
AND NOT ISNULL(`user`.`longitude`)
AND `user`.`notify_radius` > 0
AND (acos(cos((90- ? ) * 3.14159 / 180) * cos((90-`user`.`latitude`) * 3.14159 / 180) +
sin((90-?) * 3.14159 / 180) * sin((90-`user`.`latitude`) * 3.14159 / 180) * cos(( ? -`user`.`longitude`) *
3.14159 / 180)) * 6370 * ?) <= `user`.`notify_radius`', $latFrom, $latFrom, $lonFrom, $distanceMultiplier);
}
示例12: isset
if (!$userid) {
$message = $message_user_not_found;
}
$send_emailaddress = isset($_REQUEST['send_emailaddress']) ? $_REQUEST['send_emailaddress'] : 0;
// get sender data
$resp = XDb::xSql("SELECT `username`, `email` FROM `user` WHERE `user_id`= ? LIMIT 1", $usr['userid']);
if ($row = XDb::xFetchArray($resp)) {
$from_username = $row['username'];
$from_email = $row['email'];
} else {
$message = $message_title_internal;
}
// get reciver data
if (!$message) {
$resp = XDb::xSql("SELECT `username`, `email` FROM `user` WHERE `user_id`= ? ", $userid);
if ($row = XDb::xFetchArray($resp)) {
$to_username = $row['username'];
$to_email = $row['email'];
} else {
$message = $message_title_internal;
}
}
// got messsage via url to display?
$message = isset($_REQUEST['message']) ? $_REQUEST['message'] : '';
$subject = "";
$text = "";
if (!$message) {
if (isset($_POST['submit'])) {
// store
$subject = isset($_REQUEST['subject']) ? stripslashes($_REQUEST['subject']) : '';
$text = isset($_REQUEST['text']) ? stripslashes($_REQUEST['text']) : '';
示例13: isset
}
if (isset($_POST['delete'])) {
$route_id = $_POST['routeid'];
$remove = 1;
}
if (isset($_POST['routeid'])) {
$route_id = $_POST['routeid'];
}
$tplname = 'myroutes_edit';
$user_id = $usr['userid'];
if (isset($_POST['back'])) {
tpl_redirect('myroutes.php');
exit;
}
$route_rs = XDb::xSql("SELECT `user_id`,`name`, `description`, `radius`\n FROM `routes`\n WHERE `route_id`= ? AND `user_id`= ?", $route_id, $user_id);
$record = XDb::xFetchArray($route_rs);
tpl_set_var('routes_name', $record['name']);
$rname = isset($_POST['name']) ? $_POST['name'] : '';
$rdesc = isset($_POST['desc']) ? $_POST['desc'] : '';
$rradius = isset($_POST['radius']) ? $_POST['radius'] : '';
tpl_set_var('cachemap_header', '<script src="//maps.googleapis.com/maps/api/js?libraries=geometry&sensor=false&language=' . $lang . '" type="text/javascript"></script>');
if ($record['user_id'] == $usr['userid']) {
if ($remove == 1) {
//remove
XDb::xSql("DELETE FROM `routes` WHERE `route_id`= ? AND `user_id`= ? ", $route_id, $user_id);
XDb::xSql("DELETE FROM `route_points` WHERE `route_id`= ? ", $route_id);
tpl_redirect('myroutes.php');
exit;
}
}
// start submit
示例14: while
<?php
use Utils\Database\XDb;
//prepare the templates and include all neccessary
require_once './lib/common.inc.php';
//Preprocessing
if ($error == false) {
//get the news
$tplname = 'news';
$newscontent = '';
require $stylepath . '/news.inc.php';
$rsNewsTopics = XDb::xSql('SELECT `name`, `id` FROM `news_topics` ORDER BY `id` ASC');
while ($rNewsTopics = XDb::xFetchArray($rsNewsTopics)) {
$rsNews = XDb::xSql("SELECT `date_posted`, `content` FROM `news`\n WHERE `topic`= ? AND `display`=1\n ORDER BY `date_posted` DESC LIMIT 0, 20", $rNewsTopics['id']);
while ($rNews = XDb::xFetchArray($rsNews)) {
$thisnewscontent = $tpl_newstopic_without_topic;
$thisnewscontent = mb_ereg_replace('{date}', date('d-m-Y', strtotime($rNews['date_posted'])), $thisnewscontent);
$thisnewscontent = mb_ereg_replace('{message}', $rNews['content'], $thisnewscontent);
$newscontent .= $thisnewscontent . "\n";
}
XDb::xFreeResults($rsNews);
}
XDb::xFreeResults($rsNewsTopics);
//$newscontent .= "</table>";
tpl_set_var('list_of_news', $newscontent);
}
//make the template and send it out
tpl_BuildTemplate();
示例15: tr
$route_rs = XDb::xSql("SELECT `route_id` ,`description` `desc`, `name`,`radius`,`length`\n FROM `routes` WHERE `user_id`= ?\n ORDER BY `route_id` DESC", $user_id);
if ($routes_record = XDb::xFetchArray($route_rs)) {
$routes .= '<div class="headitems">';
$routes .= '<div style="width:80px;" class="myr">' . tr('route_name') . '</div><div class="ver"> </div><div style="width:295px;" class="myr"> ' . tr('route_desc') . '</div><div class="ver"> </div><div style="width:60px;" class="myr"> ' . tr('radius') . '</div><div class="ver"> </div><div style="width:60px;" class="myr"> ' . tr('length') . '</div><div class="ver"> </div><div style="width:70px;" class="myr"> ' . tr('caches') . '</div><div class="ver"> </div><div style="width:50px;" class="myr">' . tr('edit') . '</div><div class="ver"> </div><div style="width:20px;" class="myr"> ' . tr('delete') . '</div></div>';
do {
$desc = $routes_record['desc'];
if ($desc != '') {
require_once $rootpath . 'lib/class.inputfilter.php';
$myFilter = new InputFilter($allowedtags, $allowedattr, 0, 0, 1);
$desc = $myFilter->process($desc);
}
$routes .= '<div class="listitems">';
// $routes .= '<div style="margin-left:5px;width:75px;" class="myr">'.$routes_record['name']. '</div><div class="ver35"> </div><div style="width:295px;" class="myr">'.nl2br($desc).'</div><div class="ver35"> </div><div style="width:60px;text-align:center;" class="myr">'.$routes_record['radius']. ' km</div><div class="ver35"> </div><div style="width:60px;text-align:center;" class="myr">'.round($routes_record['length'],0). ' km</div><div class="ver35"> </div><div style="width:70px;float:left;text-align:center;"><a class="links" href="myroutes_search.php?routeid='.$routes_record['route_id'].'"><img src="tpl/stdstyle/images/action/16x16-search.png" alt="" title="Search caches along route" /></a></div><div class="ver35"> </div><div style="width:50px;float:left;text-align:center;"><a class="links" href="myroutes_edit.php?routeid='.$routes_record['route_id'].'"><img src="images/actions/edit-16.png" alt="" title="Edit route" /></a></div><div class="ver35"> </div><div style="width:20px;float:left;text-align:center;"><a class="links" href="myroutes_edit.php?routeid='.$routes_record['route_id'].'&delete" onclick="return confirm(\'Czy chcesz usunąć tę trase?\');"><img src="tpl/stdstyle/images/log/16x16-trash.png" alt="" title="Usuń" /></a></div></div>';
$routes .= '<table border="0" class="myr"><tr><td style="margin-left:3px;width:75px;" class="myr">' . $routes_record['name'] . '</td><td width="2" style="border-right:solid thin #7fa2ca"></td>
<td style="width:297px;" class="myr">' . nl2br($desc) . '</td><td width="2" style="border-right:solid thin #7fa2ca"></td>
<td style="width:65px;" class="myr">' . $routes_record['radius'] . ' km</td><td width="2" style="border-right:solid thin #7fa2ca"></td>
<td style="width:62px;" class="myr">' . $routes_record['length'] . ' km</td><td width="2" style="border-right:solid thin #7fa2ca"></td>
<td style="width:73px;" class="myr"><a class="links" href="myroutes_search.php?routeid=' . $routes_record['route_id'] . '"><img src="tpl/stdstyle/images/action/16x16-search.png" alt="" title=' . tr("search_caches_along_route") . ' /></a></td><td width="2" style="border-right:solid thin #7fa2ca"></td>
<td style="width:53px;" class="myr"><a class="links" href="myroutes_edit.php?routeid=' . $routes_record['route_id'] . '"><img src="images/actions/edit-16.png" alt="" title=' . tr('edit_route') . ' /></a></td><td width="2" style="border-right:solid thin #7fa2ca"></td>
<td style="width:23px;" class="myr"><a class="links" href="myroutes_edit.php?routeid=' . $routes_record['route_id'] . '&delete" onclick="return confirm(\'' . tr("confirm_remove_route") . '\');"><img style="vertical-align: middle;" src="tpl/stdstyle/images/log/16x16-trash.png" alt="" title=' . tr('delete') . ' /></a></td></tr></table></div>';
} while ($routes_record = XDb::xFetchArray($route_rs));
$routes .= '';
tpl_set_var('content', $routes);
} else {
tpl_set_var('content', "<div class=\"listitems\"><br/><center><span style=\"font-size:140%;font-weight:bold \"> " . tr('no_routes') . "</span><br/><br/></center></div>");
}
XDb::xFreeResults($route_rs);
}
}
//make the template and send it out
tpl_BuildTemplate();