本文整理汇总了PHP中Utils\Database\XDb::xEscape方法的典型用法代码示例。如果您正苦于以下问题:PHP XDb::xEscape方法的具体用法?PHP XDb::xEscape怎么用?PHP XDb::xEscape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils\Database\XDb
的用法示例。
在下文中一共展示了XDb::xEscape方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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;
}
示例4: 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);
}
示例5: xmlentities
$thislog = str_replace('{username}', xmlentities($rLog['username']), $thislog);
$thislog = str_replace('{finder_id}', xmlentities($rLog['userid']), $thislog);
if (isset($gpxLogType[$rLog['type']])) {
$logtype = $gpxLogType[$rLog['type']];
} else {
$logtype = $gpxLogType[0];
}
$thislog = str_replace('{type}', $logtype, $thislog);
$thislog = str_replace('{text}', cleanup_text($rLog['text']), $thislog);
$logentries .= $thislog . "\n";
}
$thisline = str_replace('{logs}', $logentries, $thisline);
// Travel Bug GeoKrety
$waypoint = $r['waypoint'];
$geokrety = '';
$geokret_query = XDb::xSql("SELECT gk_item.id AS id, gk_item.name AS name\n FROM gk_item, gk_item_waypoint\n WHERE gk_item.id = gk_item_waypoint.id\n AND gk_item_waypoint.wp = '" . XDb::xEscape($waypoint) . "'\n AND gk_item.stateid<>1 AND gk_item.stateid<>4\n AND gk_item.stateid <>5 AND gk_item.typeid<>2");
while ($geokret = XDb::xFetchArray($geokret_query)) {
$thisGeoKret = $gpxGeoKrety;
$gk_wp = strtoupper(dechex($geokret['id']));
while (mb_strlen($gk_wp) < 4) {
$gk_wp = '0' . $gk_wp;
}
$gkWP = 'GK' . mb_strtoupper($gk_wp);
$thisGeoKret = str_replace('{geokret_id}', xmlentities($geokret['id']), $thisGeoKret);
$thisGeoKret = str_replace('{geokret_ref}', $gkWP, $thisGeoKret);
$thisGeoKret = str_replace('{geokret_name}', xmlentities($geokret['name']), $thisGeoKret);
$geokrety .= $thisGeoKret;
// . "\n";
}
$thisline = str_replace('{geokrety}', $geokrety, $thisline);
// Waypoints
示例6: DisplayAllOpensprawdzaczCaches
public function DisplayAllOpensprawdzaczCaches($OpensprawdzaczSetup, $opt)
{
/**
* Displays initial form for cache waypoint (OPXXXX) input
*
* and
*
* display list of caches in Opensprawdzacz.
*/
/**
* if isset $_GET['op_keszynki'] means that user entered cache OP, and want search for this
* cache through Opensprawdzacz.
* This part get cache waypoint from url, check if cache owner allow specified cahe for check by
* OpenSprawdzacz
*
*/
if (isset($_GET['op_keszynki'])) {
$this->cache_wp = XDb::xEscape($_GET['op_keszynki']);
$this->cache_wp = strtoupper($this->cache_wp);
} else {
$formularz = '
<form action="' . $OpensprawdzaczSetup->scriptname . '" method="get">
' . tr('os_podaj_waypoint') . ':
<input type="text" name="op_keszynki" maxlength="6"/>
<button type="submit" name="przeslanie_waypointa" value="' . tr('submit') . '" style="font-size:14px;width:160px"><b>' . tr('submit') . '</b></button>
</form>
';
if (isset($_GET['sort'])) {
$sort_tmp = XDb::xEscape($_GET['sort']);
switch ($sort_tmp) {
case 'autor':
$sortowanie = '`user`.`username`';
break;
case 'nazwa':
$sortowanie = '`caches`.`name`';
break;
case 'wpt':
$sortowanie = '`caches`.`wp_oc`';
break;
case 'szczaly':
$sortowanie = '`opensprawdzacz`.`proby`';
break;
case 'sukcesy':
$sortowanie = '`opensprawdzacz`.`sukcesy`';
break;
default:
$sortowanie = '`caches`.`name`';
break;
}
} else {
$sortowanie = '`caches`.`name`';
}
$zapytajka = "\n\n SELECT `waypoints`.`cache_id`,\n `waypoints`.`type`,\n `waypoints`.`stage`,\n `waypoints`.`desc`,\n `caches`.`name`,\n `caches`.`wp_oc`,\n `caches`.`user_id`,\n `caches`.`type`,\n `caches`.`status`,\n `user`.`username`,\n `cache_type`.`sort`,\n `cache_type`.`icon_small`,\n `opensprawdzacz`.`proby`,\n `opensprawdzacz`.`sukcesy`\n FROM `waypoints`\n LEFT JOIN `opensprawdzacz`\n ON `waypoints`.`cache_id` = `opensprawdzacz`.`cache_id`,\n `caches`, `user`, `cache_type`\n WHERE `waypoints`.`opensprawdzacz` = 1\n AND `waypoints`.`type` = 3\n AND `caches`.`type` = `cache_type`.`id`\n AND `caches`.`user_id` = `user`.`user_id`\n AND `waypoints`.`cache_id` = `caches`.`cache_id`\n ORDER BY {$sortowanie}\n LIMIT 0, 1000\n\n ";
$status = array('1' => '<img src="tpl/stdstyle/images/log/16x16-found.png" border="0" alt="Gotowa do szukania">', '2' => '<img src="tpl/stdstyle/images/log/16x16-temporary.png" border="0" alt="Tymczasowo niedost�pna">', '3' => '<img src="tpl/stdstyle/images/log/16x16-dnf.png" border="0" alt="zarchiwizowana">', '4' => '<img src="tpl/stdstyle/images/log/16x16-temporary.png" border="0" alt="Ukryta do czasu weryfikacji">', '5' => '<img src="tpl/stdstyle/images/log/16x16-temporary.png" border="0" alt="jeszcze niedost�pna">', '6' => '<img src="tpl/stdstyle/images/log/16x16-dnf.png" border="0" alt="Zablokowana przez COG">');
$conn = XDb::instance();
$conn->query('SET CHARSET utf8');
$keszynki_opensprawdzacza = $conn->query($zapytajka)->fetchAll();
$ile_keszynek = count($keszynki_opensprawdzacza);
$pag = new Pagination();
// $dane = array("hej","dupa","laska", "scierwo");
$numbers = $pag->Paginate($keszynki_opensprawdzacza, $OpensprawdzaczSetup->caches_on_page);
$result = $pag->fetchResult();
/*
foreach ($result as $r)
{
echo "<div>aa$r</div>";
}
*/
$paginacja = ' ';
if (isset($_GET["sort"])) {
$sort = '&sort=' . $_GET["sort"];
} else {
$sort = '';
}
if (isset($_GET["page"])) {
$tPage = XDb::xEscape($_GET["page"]);
} else {
$tPage = 1;
}
if ($tPage > 1) {
$paginacja .= '<a href="' . $OpensprawdzaczSetup->scriptname . '?page=' . ($num - 1) . $sort . '">[<' . tr('os_f02') . ']</a> ';
}
foreach ($numbers as $num) {
if ($num == $tPage) {
$paginacja .= '<b>[' . $num . ']</b>';
} else {
$paginacja .= '<a href="' . $OpensprawdzaczSetup->scriptname . '?page=' . $num . $sort . '">[' . $num . ']</a> ';
}
}
if ($tPage < count($numbers)) {
$paginacja .= '<a href="' . $OpensprawdzaczSetup->scriptname . '?page=' . ($tPage + 1) . $sort . '">[' . tr('os_f01') . ' >]</a> ';
}
$tabelka_keszynek = '';
$proby = 0;
$trafienia = 0;
foreach ($result as $dane_keszynek) {
$proby = $proby + $dane_keszynek['proby'];
$trafienia = $trafienia + $dane_keszynek['sukcesy'];
if ($dane_keszynek['status'] == 1 || $dane_keszynek['status'] == 2) {
$tabelka_keszynek .= '
//.........这里部分代码省略.........
示例7: check_wp
function check_wp($wpts)
{
foreach ($wpts as &$wp) {
if (!preg_match("/^O((\\d)|([A-Z])){5}\$/", $wp)) {
return false;
}
}
return true;
}
if (isset($_GET['wp']) && !empty($_GET['wp']) && isset($_GET['output']) && !empty($_GET['output'])) {
if (!$show_coords) {
header('Location: ./viewcache.php?wp=' . $_GET['wp']);
exit;
}
$wpts = explode("|", XDb::xEscape($_GET['wp']));
$output = XDb::xEscape($_GET['output']);
if (preg_match("/^((gpx)|(gpxgc)|(loc)|(wpt)|(uam)){1}\$/", $output)) {
if (check_wp($wpts)) {
$znalezione = array();
$i = 0;
foreach ($wpts as &$wp) {
$query = "select difficulty,terrain,size,status,user_id,type,cache_id,date_hidden,name,latitude,longitude from caches where wp_oc='" . $wp . "'";
//print $query;
$wynik = XDb::xSql($query);
$wiersz = XDb::xFetchArray($wynik);
$query = "select user_id,username from user where user_id=" . $wiersz['user_id'];
$wynik = XDb::xSql($query);
$wiersz2 = XDb::xFetchArray($wynik);
$query = "select en from cache_type where id=" . $wiersz['type'];
$wynik = XDb::xSql($query);
$wiersz3 = XDb::xFetchArray($wynik);
示例8: values
<?php
use Utils\Database\XDb;
require_once "./lib/common.inc.php";
if (isset($_SESSION['user_id'])) {
if (isset($_GET['wp']) && !empty($_GET['wp'])) {
$wp = XDb::xEscape($_GET['wp']);
$query = "select cache_id from caches where wp_oc = '" . $wp . "'";
$wynik = XDb::xSql($query);
$wiersz = XDb::xFetchArray($wynik);
$wiersz = $wiersz[0];
if (!empty($wiersz)) {
$query = "insert into cache_watches (cache_id,user_id) values ('" . $wiersz . "','" . $_SESSION['user_id'] . "')";
$wynik = XDb::xSql($query);
header('Location: ./viewcache.php?wp=' . $wp);
exit;
}
}
}
header('Location: ./index.php');
示例9: ON
`PowerTrail`.`id` AS PT_ID,
`PowerTrail`.`name` AS PT_name,
`PowerTrail`.`type` As PT_type,
`PowerTrail`.`image` AS PT_image
FROM `caches`
LEFT JOIN `powerTrail_caches` ON `caches`.`cache_id` = `powerTrail_caches`.`cacheId`
LEFT JOIN `PowerTrail` ON (
`PowerTrail`.`id` = `powerTrail_caches`.`PowerTrailId` AND `PowerTrail`.`status` = 1),
`user`, `cache_type`, `cache_rating`
WHERE `caches`.`user_id`=`user`.`user_id`
AND `cache_rating`.`cache_id`=`caches`.`cache_id`
AND `caches`.`status`=1 AND `caches`.`type` <> 6
AND `caches`.`type`=`cache_type`.`id`
GROUP BY `user`.`user_id`, `user`.`username`, `caches`.`cache_id`, `caches`.`name`, `cache_type`.`icon_large`
ORDER BY `anzahl` DESC, `caches`.`name` ASC
LIMIT ' . XDb::xEscape($startat) . ',' . XDb::xEscape($perpage));
$tr_myn_click_to_view_cache = tr('myn_click_to_view_cache');
$cacheline = '<tr><td> </td><td><span class="content-title-noshade txt-blue08" >{rating_absolute}</span></td><td>{GPicon}</td><td><a class="links" href="viewcache.php?cacheid={cacheid}"><img src="{cacheicon}" class="icon16" alt="' . $tr_myn_click_to_view_cache . '" title="' . $tr_myn_click_to_view_cache . '" /></a></td><td><strong><a class="links" href="viewcache.php?cacheid={cacheid}">{cachename}</a></strong></td><td><strong><a class="links" href="viewprofile.php?userid={userid}">{username}</a></strong></td></tr>';
if (XDb::xNumRows($rs) == 0) {
$file_content = '<tr><td colspan="5"><strong>' . tr('recommendation_rating_none') . '</strong></td></tr>';
} else {
//powertrail vel geopath variables
$pt_cache_intro_tr = tr('pt_cache');
$pt_icon_title_tr = tr('pt139');
$file_content = '';
$rows = 0;
while ($record = XDb::xFetchArray($rs)) {
$rows++;
//$cacheicon = 'tpl/stdstyle/images/'.getSmallCacheIcon($record['icon_large']);
$thisline = $cacheline;
$thisline = mb_ereg_replace('{cacheid}', urlencode($record['cache_id']), $thisline);
示例10: while
tpl_set_var('lastcaches', $no_hiddens);
} else {
$caches = '';
while ($record_logs = XDb::xFetchArray($rs_caches)) {
$tmp_cache = $cache_line;
$tmp_cache = mb_ereg_replace('{cacheimage}', icon_cache_status($record_logs['status'], $record_logs['cache_status_text']), $tmp_cache);
$tmp_cache = mb_ereg_replace('{cachestatus}', htmlspecialchars($record_logs['cache_status_text'], ENT_COMPAT, 'UTF-8'), $tmp_cache);
$tmp_cache = mb_ereg_replace('{cacheid}', htmlspecialchars(urlencode($record_logs['cache_id']), ENT_COMPAT, 'UTF-8'), $tmp_cache);
$tmp_cache = mb_ereg_replace('{date}', fixPlMonth(strftime($dateformat, strtotime($record_logs['date_hidden']))), $tmp_cache);
$tmp_cache = mb_ereg_replace('{cachename}', htmlspecialchars($record_logs['name'], ENT_COMPAT, 'UTF-8'), $tmp_cache);
$caches .= "\n" . $tmp_cache;
}
tpl_set_var('lastcaches', $caches);
}
//get not published caches
$rs_caches = XDb::xSql("\n SELECT `caches`.`cache_id`, `caches`.`name`,\n `caches`.`date_hidden`, `caches`.`date_activate`,\n `caches`.`status`,\n `cache_status`.`" . XDb::xEscape($lang_db) . "` AS `cache_status_text`\n FROM `caches`, `cache_status`\n WHERE `user_id`= ?\n AND `cache_status`.`id`=`caches`.`status`\n AND `caches`.`status` = 5\n ORDER BY `date_activate` DESC,\n `caches`.`date_created` DESC ", $usr['userid']);
if (XDb::xNumRows($rs_caches) == 0) {
tpl_set_var('notpublishedcaches', $no_notpublished);
} else {
$caches = '';
while ($record_caches = XDb::xFetchArray($rs_caches)) {
$tmp_cache = $cache_notpublished_line;
$tmp_cache = mb_ereg_replace('{cacheimage}', icon_cache_status($record_caches['status'], $record_caches['cache_status_text']), $tmp_cache);
$tmp_cache = mb_ereg_replace('{cachestatus}', htmlspecialchars($record_caches['cache_status_text'], ENT_COMPAT, 'UTF-8'), $tmp_cache);
$tmp_cache = mb_ereg_replace('{cacheid}', htmlspecialchars(urlencode($record_caches['cache_id']), ENT_COMPAT, 'UTF-8'), $tmp_cache);
if (is_null($record_caches['date_activate'])) {
$tmp_cache = mb_ereg_replace('{date}', $no_time_set, $tmp_cache);
} else {
$tmp_cache = mb_ereg_replace('{date}', fixPlMonth(strftime($datetimeformat, strtotime($record_caches['date_activate']))), $tmp_cache);
}
$tmp_cache = mb_ereg_replace('{cachename}', htmlspecialchars($record_caches['name'], ENT_COMPAT, 'UTF-8'), $tmp_cache);
示例11: rgb
}
.bgcolorM1 {background-color: rgb(170,187,182);}
</style>
<?php
$dane = array();
if (isset($_SESSION['log_cache_multi_filteredData'])) {
$dane = $_SESSION['log_cache_multi_filteredData'];
$cacheIdList = array();
foreach ($dane as $k => $v) {
$cacheIdList[] = $v['cache_id'];
}
// dociagam info o ostatniej aktywnosci dla kazdej skrzynki
if (count($cacheIdList) > 0) {
$rs = XDb::xSql("SELECT c.* FROM\n (\n SELECT cache_id, MAX(date) date FROM `cache_logs`\n WHERE user_id= ? AND cache_id IN (" . XDb::xEscape(implode(',', $cacheIdList)) . ")\n GROUP BY cache_id\n ) as x INNER JOIN `cache_logs` as c ON c.cache_id = x.cache_id\n AND c.date = x.date", $usr['userid']);
while ($record = XDb::xFetchArray($rs)) {
foreach ($dane as $k => $v) {
if ($v['cache_id'] == $record['cache_id']) {
$v['got_last_activity'] = true;
$v['last_date'] = substr($record['date'], 0, strlen($record['date']) - 3);
$v['last_status'] = $record['type'];
$dane[$k] = $v;
}
}
}
//while
}
foreach ($dane as $k => $v) {
?>
<form method="POST" name="logCacheForm" action="log.php?cacheid=<?php
示例12: addslashes
tpl_set_var('bulletin', "");
if (isset($_POST['bulletin']) && $_POST['bulletin'] != "" && $_SESSION['submitted'] != true) {
// podgląd
$bulletin = addslashes($_POST['bulletin']);
$_SESSION['bulletin'] = $bulletin;
tpl_set_var('bulletin', stripslashes(nl2br($bulletin)));
$tplname = 'admin_bulletin_preview';
tpl_BuildTemplate();
} else {
if (isset($_POST['bulletin_final']) && $_POST['bulletin_final'] != "" && $_SESSION['submitted'] != true) {
// wysłanie
$email_headers = "Content-Type: text/plain; charset=utf-8\r\n";
$email_headers .= "From: " . $site_name . " <" . $mail_rr . ">\r\n";
$email_headers .= "Reply-To: " . $mail_rr . "\r\n";
$bulletin = $_SESSION['bulletin'];
$q = "INSERT INTO bulletins (content, user_id)\n VALUES ('" . XDb::xEscape($bulletin) . "', " . XDb::xEscape(intval($usr['userid'])) . ")";
XDb::xQuery($q);
$tr_newsletter_removal = tr('newsletter_removal');
$bulletin .= "\r\n\r\n" . $tr_newsletter_removal . " " . $absolute_server_URI . "myprofile.php?action=change.";
//get emails
$q = "SELECT `email` FROM `user` WHERE `is_active_flag`=1 AND get_bulletin=1 AND rules_confirmed=1";
$rs = XDb::xQuery($q);
$tr_newsletter = $short_sitename . " " . tr('newsletter');
while ($email = XDb::xFetchArray($rs)) {
mb_send_mail($email['email'], $tr_newsletter . " " . date("Y-m-d"), stripslashes($bulletin), $email_headers);
}
$_SESSION['submitted'] = true;
tpl_set_var('bulletin', stripslashes($_SESSION['bulletin']));
unset($_SESSION['bulletin']);
$tplname = 'admin_bulletin_sent';
tpl_BuildTemplate();
示例13: OR
$q_where[] = '((`caches`.`score` BETWEEN \'' . XDb::xEscape($options['cachevote_1']) . '\' AND \'' . XDb::xEscape($options['cachevote_2']) . '\' AND `caches`.`votes` > 3) OR (`caches`.`votes` < 4))';
}
}
if (!isset($options['cachedifficulty_1']) && !isset($options['cachedifficulty_2'])) {
$options['cachedifficulty_1'] = '';
$options['cachedifficulty_2'] = '';
}
if ($options['cachedifficulty_1'] != '' && $options['cachedifficulty_2'] != '' && ($options['cachedifficulty_1'] != '1' || $options['cachedifficulty_2'] != '5')) {
$q_where[] = '`caches`.`difficulty` BETWEEN \'' . XDb::xEscape($options['cachedifficulty_1'] * 2) . '\' AND \'' . XDb::xEscape($options['cachedifficulty_2'] * 2) . '\'';
}
if (!isset($options['cacheterrain_1']) && !isset($options['cacheterrain_2'])) {
$options['cacheterrain_1'] = '';
$options['cacheterrain_2'] = '';
}
if ($options['cacheterrain_1'] != '' && $options['cacheterrain_2'] != '' && ($options['cacheterrain_1'] != '1' || $options['cacheterrain_2'] != '5')) {
$q_where[] = '`caches`.`terrain` BETWEEN \'' . XDb::xEscape($options['cacheterrain_1'] * 2) . '\' AND \'' . XDb::xEscape($options['cacheterrain_2'] * 2) . '\'';
}
if ($options['cacherating'] > 0) {
$q_where[] = '`caches`.`topratings` >= \'' . $options['cacherating'] . '\'';
}
// show only published caches
// HIDDEN_FOR_APPROVAL
$q_where[] = '`caches`.`status` != 4';
// NOT_YET_AVAILABLE
$q_where[] = '`caches`.`status` != 5';
// BLOCKED
$q_where[] = '`caches`.`status` != 6';
// search byname
$q_select[] = '`caches`.`cache_id` `cache_id`';
$q_from[] = '`caches`';
//do the search
示例14: isset
<?php
use Utils\Database\XDb;
//prepare the templates and include all neccessary
require_once './lib/common.inc.php';
//Preprocessing
if ($error == false) {
$target = isset($_REQUEST['target']) ? $_REQUEST['target'] : 'myignores.php';
$cache_id = isset($_REQUEST['cacheid']) ? $_REQUEST['cacheid'] : '';
if ($usr['userid']) {
//remove watch
XDb::xSql('DELETE FROM cache_ignore
WHERE cache_id=\'' . XDb::xEscape($cache_id) . '\'
AND user_id=\'' . XDb::xEscape($usr['userid']) . '\'');
//remove from caches
$rs = XDb::xSql('SELECT ignorer_count FROM caches
WHERE cache_id=\'' . XDb::xEscape($cache_id) . '\'');
if (XDb::xNumRows($rs) > 0) {
$record = XDb::xFetchArray($rs);
XDb::xSql('UPDATE caches SET ignorer_count=\'' . ($record['ignorer_count'] - 1) . '\'
WHERE cache_id=\'' . XDb::xEscape($cache_id) . '\'');
//remove from user
$rs = XDb::xSql('SELECT cache_ignores FROM user WHERE user_id=\'' . XDb::xEscape($usr['userid']) . '\'');
$record = XDb::xFetchArray($rs);
XDb::xSql('UPDATE user SET cache_ignores=\'' . ($record['cache_ignores'] - 1) . '\'
WHERE user_id=\'' . XDb::xEscape($usr['userid']) . '\'');
}
}
tpl_redirect($target);
}
tpl_BuildTemplate();
示例15: GetRegions
$region = new GetRegions();
$regiony = $region->GetRegion($wspolrzedneNS, $wspolrzedneWE);
XDb::xSql("UPDATE `cache_location` SET adm1 = ?, adm3 = ?, code1= ?, code3= ? WHERE cache_id = ? ", $regiony['adm1'], $regiony['adm3'], $regiony['code1'], $regiony['code3'], $cache_id);
}
}
// mobilne by Łza - koniec
//inc cache stat and "last found"
$rs = XDb::xSql("SELECT `founds`, `notfounds`, `notes`, `last_found` FROM `caches`\n WHERE `cache_id`= ? ", $cache_id);
$record = XDb::xFetchArray($rs);
$last_found = '';
if ($log_type == 1 || $log_type == 7) {
$dlog_date = mktime($log_date_hour, $log_date_min, 0, $log_date_month, $log_date_day, $log_date_year);
if ($record['last_found'] == NULL) {
$last_found = ', `last_found`=\'' . XDb::xEscape(date('Y-m-d H:i:s', $dlog_date)) . '\'';
} elseif (strtotime($record['last_found']) < $dlog_date) {
$last_found = ', `last_found`=\'' . XDb::xEscape(date('Y-m-d H:i:s', $dlog_date)) . '\'';
}
}
if ($log_type == 1 || $log_type == 2 || $log_type == 3 || $log_type == 7 || $log_type == 8) {
recalculateCacheStats($cache_id, $cache_type, $last_found);
}
//inc user stat
$rs = XDb::xSql("SELECT `log_notes_count`, `founds_count`, `notfounds_count` FROM `user`\n WHERE `user_id`= ? ", $usr['userid']);
$record = XDb::xFetchArray($rs);
if ($log_type == 1 || $log_type == 7) {
XDb::xSql("UPDATE `user` SET founds_count=founds_count+1 WHERE `user_id`= ? ", $usr['userid']);
} elseif ($log_type == 2) {
XDb::xSql("UPDATE `user` SET notfounds_count=notfounds_count+1 WHERE `user_id`= ? ", $usr['userid']);
} elseif ($log_type == 3) {
XDb::xSql("UPDATE `user` SET log_notes_count=log_notes_count+1 WHERE `user_id`= ? ", $usr['userid']);
}