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); }
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); }
$show_all_countries = 0; } } if ($show_all_countries == 1) { $rs2 = XDb::xSql("SELECT `" . XDb::xEscape($lang_db) . "`, `list_default_" . XDb::xEscape($lang_db) . "`, `short`, `sort_" . XDb::xEscape($lang_db) . "` FROM `countries` ORDER BY `sort_" . XDb::xEscape($lang_db) . '` ASC', $lang_db); } else { $rs2 = XDb::xSql("SELECT `" . XDb::xEscape($lang_db) . "`, `list_default_" . XDb::xEscape($lang_db) . "`, `short`, `sort_" . XDb::xEscape($lang_db) . "` FROM `countries` WHERE `list_default_" . XDb::xEscape($lang_db) . "`=1 ORDER BY `sort_" . XDb::xEscape($lang_db) . '` ASC', $lang_db); } while ($record2 = XDb::xFetchArray($rs2)) { if ($record2['short'] == $country) { $stmp .= '<option value="' . $record2['short'] . '" selected="selected">' . htmlspecialchars($record2[$lang_db], ENT_COMPAT, 'UTF-8') . "</option>\n"; } else { $stmp .= '<option value="' . $record2['short'] . '">' . htmlspecialchars($record2[$lang_db], ENT_COMPAT, 'UTF-8') . "</option>\n"; } } XDb::xFreeResults($rs2); tpl_set_var('countrylist', $stmp); unset($stmp); tpl_set_var('show_all_countries', $show_all_countries); if ($show_all_countries == 0) { tpl_set_var('allcountriesbutton', '<input type="submit" class="formbuttons" name="submit_all_countries" value="' . $allcountries . '" />'); } else { tpl_set_var('allcountriesbutton', ''); } } } //build useroptions $user_options = ''; if ($using_permantent_login == 1) { $user_options .= $using_permantent_login_message . '<br />'; }
function savequery($queryid, $queryname, $saveas, $submit, $saveas_queryid) { global $usr, $tplname; global $error_empty_name, $nosaveastext, $saveastext, $error_queryname_exists; $displayform = $submit == false; $error_no_name = false; $error_duplicate_name = false; // ok ... checken, ob die query uns gehört und dann speichern $rs = XDb::xSql("SELECT `user_id` FROM `queries` WHERE `id`= ? AND (`user_id`=0 OR `user_id`= ? )", $queryid, $usr['userid']); if (false == XDb::xFetchArray($rs)) { echo 'fatal error: query not found or permission denied'; exit; } XDb::xFreeResults($rs); if ($saveas == false) { if ($displayform == false && $queryname == '') { $displayform = true; $error_no_name = true; } else { // prüfen ob name bereits vorhanden $r['c'] = XDb::xMultiVariableQueryValue("SELECT COUNT(*) `c` FROM `queries`\n WHERE `user_id`= :1 AND `name`= :2 ", 0, $usr['userid'], $queryname); if ($r['c'] > 0) { $displayform = true; $error_duplicate_name = true; } } } else { if ($saveas_queryid == 0) { $displayform = true; } else { // prüfen ob saveas_queryid existiert und uns gehört $rs = XDb::xSql("SELECT `user_id` FROM `queries` WHERE `id`= ? AND (`user_id`=0 OR `user_id`= ? )", $saveas_queryid, $usr['userid']); if (false === XDb::xFetchArray($rs)) { echo 'fatal error: saveas_query not found or permission denied'; exit; } XDb::xFreeResults($rs); } } if ($displayform == true) { // abfrageform für name $tplname = 'savequery'; if ($error_no_name == true) { tpl_set_var('nameerror', $error_empty_name); } else { if ($error_duplicate_name == true) { tpl_set_var('nameerror', $error_queryname_exists); } else { tpl_set_var('nameerror', ''); } } tpl_set_var('queryname', htmlspecialchars($queryname, ENT_COMPAT, 'UTF-8')); tpl_set_var('queryid', htmlspecialchars($queryid, ENT_COMPAT, 'UTF-8')); // oldqueries auslesen $options = ''; $rs = XDb::xSql("SELECT `id`, `name` FROM `queries` WHERE `user_id`= ? ORDER BY `name` ASC", $usr['userid']); if (!($r = XDb::xFetchArray($rs))) { tpl_set_var('selecttext', $nosaveastext); tpl_set_var('oldqueries', ''); } else { tpl_set_var('selecttext', $saveastext); do { if ($r['id'] == $queryid) { $options .= '<option value="' . $r['id'] . '" selected="selected">' . htmlspecialchars($r['name'], ENT_COMPAT, 'UTF-8') . '</option>' . "\n"; } else { $options .= '<option value="' . $r['id'] . '">' . htmlspecialchars($r['name'], ENT_COMPAT, 'UTF-8') . '</option>' . "\n"; } } while ($r = XDb::xFetchArray($rs)); XDb::xFreeResults($rs); tpl_set_var('oldqueries', $options); } tpl_BuildTemplate(); exit; } $r['options'] = XDb::xMultiVariableQueryValue("SELECT `options` FROM `queries` WHERE `id`= :1 LIMIT 1", 0, $queryid); // ok, speichern if ($saveas == true) { XDb::xSql("UPDATE `queries` SET `options`= ?, `last_queried`=NOW() WHERE `id`= ? ", $r['options'], $saveas_queryid); } else { XDb::xSql("INSERT INTO `queries` (`user_id`, `last_queried`, `name`, `uuid`, `options`)\n VALUES ( ?, NOW(), ?, ?, ?)", $usr['userid'], $queryname, create_uuid(), $r['options']); } tpl_redirect('query.php?action=view'); }
} if ($rLogs['year'] . '-' . $rLogs['month'] . '-' . $rLogs['day'] == date('Y-n-j', $date)) { $logsCount += $rLogs['count']; } $yDataCaches[] = $cachesCount; $yDataLogs[] = $logsCount; if (date('j', $date) == 1) { $tickPositions[] = $date; $tickLabels[] = strftime('%G', $date); } $xDate[] = $date; $days++; $date = mktime(0, 0, 0, 5, 1 + $days, 2006); } XDb::xFreeResults($rsCaches); XDb::xFreeResults($rsLogs); // // Titel, Footer, Legende und Hintergrund // $stat = tr('oc_stat'); $graph->title->SetFont(FF_GEORGIA, FS_NORMAL, 14); $graph->title->Set($stat); $graph->title->SetMargin(12); $graph->footer->center->Set(tr('graph_statistics_01') . date('d:m:Y H:i:s')); $graph->footer->center->SetFont(FF_ARIAL, FS_NORMAL, 7); $graph->footer->center->SetColor('darkgray'); $graph->legend->SetLayout(LEGEND_HOR); $graph->legend->Pos(0.5, 0.96, "center", "bottom"); $graph->legend->SetLineWeight(8); $graph->img->SetMargin(45, 60, 50, 70); $graph->SetFrame(false);
$y[] = $ry['count']; $x[] = $ry['type']; } } XDb::xFreeResults($rsCreateCachesYear); } if ($tit == "cf") { $rsCachesFindYear = XDb::xSql("SELECT COUNT(`caches`.`type`) `count`, `cache_type`.`{$lang_db}` AS `type`\n FROM `cache_logs`, caches INNER JOIN `cache_type` ON (`caches`.`type`=`cache_type`.`id`)\n WHERE cache_logs.`deleted`=0 AND cache_logs.user_id=? AND cache_logs.`type`='1' AND cache_logs.`cache_id` = caches.cache_id\n GROUP BY `caches`.`type`\n ORDER BY `count` DESC", $user_id); if ($rsCachesFindYear !== false) { $xtitle = ""; while ($rfy = XDb::xFetchArray($rsCachesFindYear)) { $y[] = $rfy['count']; $x[] = $rfy['type']; } } XDb::xFreeResults($rsCachesFindYear); } // A new pie graph $graph = new PieGraph(500, 300, "auto"); $graph->SetScale('textint'); $type = tr("by_cachetype"); // Title setup $graph->title->Set($type); $graph->title->SetFont(FF_ARIAL, FS_NORMAL); // Setup the pie plot $p1 = new PiePlot($y); $p1->SetTheme("earth"); $p1->value->SetFormat("%d"); $p1->SetLabelType(PIE_VALUE_ABS); // Adjust size and position of plot $p1->SetSize(0.35);
function ftsearch_refresh_cache_logs($id) { $rs = XDb::xSql("SELECT `cache_id`, `text`, `last_modified`\n FROM `cache_logs`\n WHERE `id`= ?\n AND `cache_logs`.`deleted` = ? ", $id, 0); if ($r = XDb::xFetchArray($rs)) { $r['text'] = ftsearch_strip_html($r['text']); ftsearch_set_entries(1, $id, $r['cache_id'], $r['text'], $r['last_modified']); } XDb::xFreeResults($rs); }
/** * This function prepares message to text watcher about new log entry * @param unknown $user_id * @param unknown $log_id */ function process_log_watch($user_id, $log_id) { global $absolute_server_URI; $rsLog = XDb::xSql("SELECT cache_logs.cache_id cache_id, cache_logs.text text, cache_logs.text_html text_html,\n cache_logs.date logdate, user.username username, user.hidden_count ch, user.founds_count cf,\n user.notfounds_count cn, caches.wp_oc wp,caches.name cachename, cache_logs.type type,\n IF(ISNULL(`cache_rating`.`cache_id`), 0, 1) AS `recommended`\n FROM `cache_logs`\n LEFT JOIN `cache_rating` ON `cache_logs`.`cache_id`=`cache_rating`.`cache_id`\n AND `cache_logs`.`user_id`=`cache_rating`.`user_id`, `user`, `caches`\n WHERE `cache_logs`.`deleted`=0 AND (cache_logs.user_id = user.user_id)\n AND (cache_logs.cache_id = caches.cache_id)\n AND (cache_logs.id = ?)\n LIMIT 1", $log_id); $rLog = XDb::xFetchArray($rsLog); XDb::xFreeResults($rsLog); $logtypeParams = getLogtypeParams($rLog['type']); if (isset($logtypeParams['username'])) { $rLog['username'] = $logtypeParams['username']; } if ($rLog['recommended'] != 0 && $rLog['type'] == 1) { $recommended = ' + ' . tr('recommendation'); } else { $recommended = ''; } $watchtext = file_get_contents(dirname(__FILE__) . '/item.email.html'); $logtext = $rLog['text']; $logtext = preg_replace("/<img[^>]+\\>/i", "", $logtext); $watchtext = mb_ereg_replace('{date}', date('Y-m-d H:i', strtotime($rLog['logdate'])), $watchtext); $watchtext = mb_ereg_replace('{wp}', $rLog['wp'], $watchtext); $watchtext = mb_ereg_replace('{text}', $logtext, $watchtext); $watchtext = mb_ereg_replace('{user}', $rLog['username'], $watchtext); $watchtext = mb_ereg_replace('{logtype}', $logtypeParams['logtype'] . $recommended, $watchtext); $watchtext = mb_ereg_replace('{cachename}', $rLog['cachename'], $watchtext); $watchtext = mb_ereg_replace('{logtypeColor}', $logtypeParams['logtypeColor'], $watchtext); $watchtext = mb_ereg_replace('{runwatch02}', tr('runwatch02'), $watchtext); $watchtext = mb_ereg_replace('{absolute_server_URI}', $absolute_server_URI, $watchtext); $watchtext = mb_ereg_replace('{userActivity}', $userActivity, $watchtext); XDb::xSql("INSERT IGNORE INTO watches_waiting (`user_id`, `object_id`, `object_type`, `date_added`, `watchtext`, `watchtype`)\n VALUES (?, ?, 1, NOW(), ?, 2)", $user_id, $log_id, $watchtext); }
} else { $x[] = tr("not_found"); $y[] = '0'; } $rsCSC = XDb::xSql("SELECT COUNT(`cache_logs`.`type`) `count`, `log_types`.`{$lang_db}` AS `type`\n FROM `cache_logs` INNER JOIN `log_types` ON (`cache_logs`.`type`=`log_types`.`id`)\n WHERE type=3 AND cache_logs.deleted=0 AND cache_logs.cache_id= ?\n GROUP BY `cache_logs`.`type`\n ORDER BY `log_types`.`pl` ASC", $cache_id); if ($rsCSC !== false) { $xtitle = ""; $ry = XDb::xFetchArray($rsCSC); $y[] = $ry['count']; $x[] = $ry['type']; } else { $x[] = tr("comment"); } XDb::xFreeResults($rsCSF); XDb::xFreeResults($rsCSNF); XDb::xFreeResults($rsCSC); // A new pie graph $graph = new PieGraph(400, 200, "auto"); $graph->SetScale('textint'); $logtype = tr("by_logtype"); // Title setup $graph->title->Set($logtype); $graph->title->SetFont(FF_ARIAL, FS_NORMAL); // Setup the pie plot $p1 = new PiePlot($y); $p1->SetTheme("earth"); $p1->value->SetFormat("%d"); $p1->SetLabelType(PIE_VALUE_ABS); $p1->SetSliceColors(array('chartreuse3', 'chocolate2', 'wheat1')); // Adjust size and position of plot $p1->SetSize(0.35);
while ($ry2 = XDb::xFetchArray($rscaches)) { $y2[] = $ry2['count']; $x2[] = $ry2['username']; } while ($ry3 = XDb::xFetchArray($rsreportsM)) { $y3[] = $ry3['count']; $x3[] = $ry3['month']; } while ($ry4 = XDb::xFetchArray($rscachesM)) { $y4[] = $ry4['count']; $x4[] = $ry4['month']; } XDb::xFreeResults($rsreportsM); XDb::xFreeResults($rsreports); XDb::xFreeResults($rscaches); XDb::xFreeResults($rscachesM); // Create the graph. These two calls are always required $graph = new Graph(740, 200, 'auto'); $graph->SetScale('textint', 0, max($y) + max($y) * 0.2, 0, 0); // Add a drop shadow $graph->SetShadow(); // Adjust the margin a bit to make more room for titles $graph->SetMargin(50, 30, 30, 40); // Create a bar pot $bplot = new BarPlot($y); // Adjust fill color $bplot->SetFillColor('steelblue2'); $graph->Add($bplot); // Setup the titles $descibe = iconv('UTF-8', 'ASCII//TRANSLIT', tr("octeam_stat_problems")); $graph->title->Set($descibe);
$mnu_siteid = 'start'; } $stat_menu = array('title' => 'Statictics', 'menustring' => 'Statistics', 'siteid' => 'statlisting', 'visible' => false, 'filename' => 'ustatsg2.php?userid=' . $user_id, 'submenu' => array(array('title' => tr('generla_stat'), 'menustring' => tr('general_stat'), 'visible' => true, 'filename' => 'viewprofile.php?userid=' . $user_id, 'newwindow' => false, 'siteid' => 'general_stat', 'icon' => 'images/actions/stat'), array('title' => tr('graph_created'), 'menustring' => tr('graph_created'), 'visible' => true, 'filename' => 'ustatsg1.php?userid=' . $user_id, 'newwindow' => false, 'siteid' => 'createstat', 'icon' => 'images/actions/stat'))); $content = ""; $rsGeneralStat = XDb::xSql("SELECT hidden_count, founds_count, log_notes_count, notfounds_count, username\n FROM `user` WHERE user_id= ? LIMIT 1", $user_id); $user_record = XDb::xFetchArray($rsGeneralStat); tpl_set_var('username', $user_record['username']); if ($user_record['founds_count'] == 0) { $content .= '<p> </p><p> </p><div class="content2-container bg-blue02"><p class="content-title-noshade-size1"> <img src="tpl/stdstyle/images/blue/logs.png" class="icon32" alt="Caches Find" title="Caches Find" /> ' . tr("graph_find") . '</p></div><br /><br /><p> <b>' . tr("there_is_no_caches_found") . '</b></p>'; } else { // calculate diif days between date of register on OC to current date $ddays = XDb::xMultiVariableQueryValue("SELECT TO_DAYS( NOW() ) - TO_DAYS(`date_created`) `diff` FROM `user` WHERE user_id= :1 LIMIT 1 ", 0, $user_id); $rsGeneralStat = XDb::xSql("SELECT YEAR(`date_created`) usertime,hidden_count, founds_count, log_notes_count, username\n FROM `user` WHERE user_id= ? LIMIT 1", $user_id); if ($rsGeneralStat !== false) { $user_record = XDb::xFetchArray($rsGeneralStat); XDb::xFreeResults($rsGeneralStat); tpl_set_var('username', $user_record['username']); } $content .= '<p> </p><p> </p><div class="content2-container bg-blue02"><p class="content-title-noshade-size1"> <img src="tpl/stdstyle/images/blue/logs.png" class="icon32" alt="Caches Find" title="Caches Find" /> ' . tr("graph_find") . '</p></div><br />'; $content .= '<p><img src="graphs/PieGraphustat.php?userid=' . $user_id . '&t=cf" border="0" alt="" width="500" height="300" /></p>'; $year = date("Y"); $content .= '<p><img src="graphs/BarGraphustat.php?userid=' . $user_id . '&t=cfm' . $year . '" border="0" alt="" width="500" height="200" /></p>'; if ($user_record['usertime'] != $year) { $yearr = $year - 1; $content .= '<p><img src="graphs/BarGraphustat.php?userid=' . $user_id . '&t=cfm' . $yearr . '" border="0" alt="" width="500" height="200" /></p>'; } $content .= '<p><img src="graphs/BarGraphustat.php?userid=' . $user_id . '&t=cfy" border="0" alt="" width="500" height="200" /></p>'; } // Parameter $jpeg_qualitaet = 80; $fontfile = "./lib/fonts/arial.ttf";
$thisline = mb_ereg_replace('{log_picture_onclick}', "alert('" . $spoiler_disable_msg . "'); return false;", $thisline); $thisline = mb_ereg_replace('{link}', 'index.php', $thisline); $thisline = mb_ereg_replace('{longdesc}', 'index.php', $thisline); } else { $thisline = mb_ereg_replace('{log_picture_onclick}', "enlarge(this)", $thisline); $thisline = mb_ereg_replace('{link}', $pic_record['url'], $thisline); $thisline = mb_ereg_replace('{longdesc}', str_replace("uploads", "uploads", $pic_record['url']), $thisline); } $thisline = mb_ereg_replace('{imgsrc}', 'thumbs.php?uuid=' . urlencode($pic_record['uuid']), $thisline); if ($pic_record['title'] == "") { $title = "link"; } else { $title = htmlspecialchars($pic_record['title'], ENT_COMPAT, 'UTF-8'); } $thisline = mb_ereg_replace('{title}', "<a class=links href=viewlogs.php?logid=" . $pic_record['object_id'] . ">" . $title . "</a>", $thisline); $logpicturelines .= $thisline; } while ($pic_record = XDb::xFetchArray($rspictures)); } XDb::xFreeResults($rspictures); $tmplog = $logpicturelines; $logs = "{$tmplog}\n"; tpl_set_var('logpictures', $logs); } else { //display search page // redirection tpl_redirect('viewcache.php?cacheid=' . urlencode($cache_id)); exit; } } //make the template and send it out tpl_BuildTemplate();
if ($record_logs['encrypt'] == 1 && ($record_logs['cache_owner'] == $usr['userid'] || $record_logs['luser_id'] == $usr['userid'])) { $logtext .= "<img src=\\'/tpl/stdstyle/images/free_icons/lock_open.png\\' alt=\\`\\` /><br/>"; } $data_text = common::cleanupText(str_replace("\r\n", " ", $record_logs['log_text'])); $data_text = str_replace("\n", " ", $data_text); if ($record_logs['encrypt'] == 1 && $record_logs['cache_owner'] != $usr['userid'] && $record_logs['luser_id'] != $usr['userid']) { //crypt the log ROT13, but keep HTML-Tags and Entities $data_text = str_rot13_html($data_text); } else { $logtext .= "<br/>"; } $logtext .= $data_text; $tmp_log = mb_ereg_replace('{logtext}', $logtext, $tmp_log); $content .= "\n" . $tmp_log; } XDb::xFreeResults($rs_logs); $content .= '</ul></div><br />'; } } // ----------------- begin owner section ---------------------------------- if ($user_id == $usr['userid'] || $usr['admin']) { $rscheck = XDb::xMultiVariableQueryValue("SELECT count(*) FROM caches\n WHERE (status = 4 OR status = 5 OR status = 6) AND `user_id`= :1", 0, $user_id); if ($rscheck != 0) { $content .= '<br /><div class="content-title-noshade box-blue">'; } //get not published caches DATE_FORMAT(`caches`.`date_activate`,'%d-%m-%Y'), $geocachesNotPublished = $user->getGeocachesNotPublished(); if ($geocachesNotPublished->count() > 0) { $content .= '<p><span class="content-title-noshade txt-blue08">' . tr('not_yet_published') . ':</span></p><br /><div><ul style="margin: -0.9em 0px 0.9em 0px; padding: 0px 0px 0px 10px; list-style-type: none; line-height: 1.2em; font-size: 115%;">'; foreach ($geocachesNotPublished as $geocache) { $content .= "\n" . buildGeocacheHtml($geocache, $cache_notpublished_line);
<?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();
) AS `t`', 0); $rsfCR = XDb::xSql("SELECT COUNT(*) `count`, `cache_location`.`adm3` region, `cache_location`.`code3` code_region\n FROM `cache_location`\n INNER JOIN cache_logs ON cache_location.cache_id=cache_logs.cache_id\n WHERE `cache_location`.`code1`='PL'\n AND (cache_logs.type='1' OR cache_logs.type='2')\n AND cache_logs.deleted='0'\n GROUP BY `cache_location`.`code3`\n ORDER BY count DESC"); echo '<table width="97%"><tr><td align="center"><center><b> ' . tr('Stats_t7_01') . '</b> <br /><br /> ' . tr('Stats_t7_02') . ':<b> '; echo $fCt["count"]; echo ' </b><br />' . tr('Stats_t7_03') . ':<b> '; echo $r['users']; echo '</b><br /><br />(' . tr('Stats_t7_04') . ')</center></td></tr></table><br><table border="1" bgcolor="white" width="97%">' . "\n"; echo ' <tr class="bgcolor2"> <td width="20%"> <center><b>' . tr('Stats_t7_05') . '</b></center> </td> <td align="right"> <b>' . tr('Stats_t7_06') . '</b> </td> </tr><tr><td height="2"></td></tr>'; while ($line = XDb::xFetchArray($rsfCR)) { echo '<tr class="bgcolor2"> <td align="right"> <b>' . $line["count"] . '</b> </td> <td align="right"> <b><a class=links href=articles.php?page=s10®ion=' . $line['code_region'] . '>' . $line['region'] . '</a></b> </td>'; } echo '</table>' . "\n"; XDb::xFreeResults($rsfCR); $result = ob_get_clean(); apc_store($cache_key, $result, 86400); } print $result;
if (!isset($rootpath)) { $rootpath = './'; } //include template handling require_once $rootpath . 'lib/common.inc.php'; setlocale(LC_TIME, 'pl_PL.UTF-8'); echo '<center><table width="97%" border="0"><tr><td align="center"><center><b>{{Stats_s3a_01}}<br/><b>'; echo '<br /><br />({{Stats_s3a_02}})</center></td></tr></table><br><table border="1" bgcolor="white" width="30%">' . "\n"; echo ' <tr class="bgcolor2"> <td align="right"> <b>{{Stats_s3a_03}}:</b> </td> </tr><tr><td height="2"></td></tr>'; $rs = XDb::xSql("SELECT `code`, `name` FROM `nuts_codes`\n WHERE (" . $config['provinceNutsCondition'] . ") ORDER BY `name` ASC"); while ($record = XDb::xFetchArray($rs)) { echo '<tr class="bgcolor2"> <td align="right"> <b><a class=links href=articles.php?page=s11®ion=' . $record[code] . '>' . $record[name] . '</a></b> </td>'; } echo '</table>' . "\n"; XDb::xFreeResults($rs); ?> </td></tr> </table> <script type="text/javascript"> TimeTrack("END", "S11a"); </script>
echo '<tr><td align="center"><img src="images/tops-formula.png" border="0" alt="Formula" /></td></tr></table></center>'; echo '<table border="0" cellspacing="2" cellpadding="1" style="margin-left: 10px;line-high: 1.6em; font-size: 12px;" width="97%"><tr><td> </td><td><strong>' . tr('index_06') . '</strong></td><td><img src="images/rating-star.png" border="0" alt="" /></td><td><img src="tpl/stdstyle/images/log/16x16-found.png" class="icon16" alt="" /></td><td><strong>Cache</strong></td><td><strong>' . tr('user') . '</strong></td></tr><tr><td colspan="6"><hr></hr></td></tr>'; XDb::xSql("CREATE TEMPORARY TABLE topFounds (`cache_id` INT(11) PRIMARY KEY, `founds` INT(11))\n SELECT `caches`.`cache_id`,\n COUNT(`cache_logs`.`cache_id`) `founds`\n FROM `caches`\n LEFT JOIN `cache_logs` ON `caches`.`cache_id`=`cache_logs`.`cache_id`\n AND `cache_logs`.`type`=1\n AND `cache_logs`.`deleted`=0\n GROUP BY `caches`.`cache_id`"); XDb::xSql("UPDATE `topFounds` SET `founds`=0 WHERE ISNULL(`founds`)"); XDb::xSql("CREATE TEMPORARY TABLE topRatings (`cache_id` INT(11) PRIMARY KEY, `ratings` INT(11))\n SELECT `cache_rating`.`cache_id`, COUNT(`cache_rating`.`cache_id`) AS `ratings`\n FROM `cache_rating`\n INNER JOIN `caches` ON `cache_rating`.`cache_id`=`caches`.`cache_id`\n WHERE `cache_rating`.`user_id`!=`caches`.`user_id`\n GROUP BY `cache_rating`.`cache_id`"); XDb::xSql("CREATE TEMPORARY TABLE topResult (`idx` INT(11), `cache_id` INT(11) PRIMARY KEY, `ratings` INT(11), `founds` INT(11))\n SELECT (`topRatings`.`ratings`+1)*(topRatings.`ratings`+1)/(IFNULL(`topFounds`.`founds`,0)/10+1)*100 AS `idx`,\n `topFounds`.`cache_id`, `topRatings`.`ratings`, `topFounds`.`founds`\n FROM `topFounds`\n INNER JOIN `topRatings` ON `topFounds`.`cache_id`=`topRatings`.`cache_id`\n INNER JOIN `caches` ON `topFounds`.`cache_id`=`caches`.`cache_id`\n ORDER BY `idx` DESC"); if (10 < XDb::xSimpleQueryValue("SELECT COUNT(*) FROM `topResult`", 0)) { $min_idx = XDb::xSimpleQueryValue("SELECT `idx` FROM `topResult` ORDER BY `idx` DESC LIMIT 99999, 1", 0); XDb::xSql("DELETE FROM `topResult` WHERE `idx`< ? ", $min_idx); } $rsCaches = XDb::xSql("SELECT `topResult`.`idx`, `topResult`.`ratings`, `caches`.`founds`,\n `topResult`.`founds` AS `foundAfterRating`, `topResult`.`cache_id`,\n `caches`.`name`, `caches`.`wp_oc` AS `wpoc`, `user`.`username`,\n `user`.`user_id` AS `userid`\n FROM `topResult`\n INNER JOIN `caches` ON `topResult`.`cache_id`=`caches`.`cache_id`\n INNER JOIN `user` ON `caches`.`user_id`=`user`.`user_id`\n WHERE `topResult`.`cache_id` = `caches`.`cache_id`\n AND `caches`.`type` <> 6\n AND `caches`.`status` = 1\n ORDER BY `idx` DESC"); $items = array(); while ($rCaches = XDb::xFetchArray($rsCaches)) { $widthB = round(100 * ($rCaches['idx'] / 200) / 1, 0); $line = '<tr><td> </td><td><span class="content-title-noshade txt-blue08" >{index}</span></td><td><span class="content-title-noshade txt-green10">{rating}</span></td><td><span class="content-title-noshade txt-green10">{fbr}</span></td><td><a class="links" href="viewcache.php?cacheid={cacheid}" target="_blank">{name}</a></td><td><a class="links" href="viewprofile.php?userid={userid}" target="_blank">{username}</a></td></tr>'; $line = str_replace('{index}', $rCaches['idx'], $line); $line = str_replace('{rating}', $rCaches['ratings'], $line); $line = str_replace('{fbr}', $rCaches['founds'], $line); $line = str_replace('{far}', $rCaches['foundAfterRating'], $line); $line = str_replace('{username}', $rCaches['username'], $line); $line = str_replace('{widthB}', $widthB, $line); $line = str_replace('{userid}', $rCaches['userid'], $line); $line = str_replace('{cacheid}', $rCaches['cache_id'], $line); $line = str_replace('{name}', $rCaches['name'], $line); echo $line; } XDb::xFreeResults($rsCaches); XDb::xSql('DROP TEMPORARY TABLE topFounds'); XDb::xSql('DROP TEMPORARY TABLE topRatings'); XDb::xSql('DROP TEMPORARY TABLE topResult'); echo '<tr><td colspan="6"><hr></hr></td></tr></table>';
<?php /** * This script publishes the cache if its activation_date was set */ use Utils\Database\XDb; use lib\Objects\GeoCache\GeoCache; $rootpath = '../../'; require_once $rootpath . 'lib/ClassPathDictionary.php'; require_once $rootpath . 'lib/eventhandler.inc.php'; require_once $rootpath . 'lib/consts.inc.php'; require_once $rootpath . 'lib/settings.inc.php'; $rsPublish = XDb::xSql("SELECT `cache_id`, `user_id`\n FROM `caches`\n WHERE `status` = 5\n AND `date_activate` != 0\n AND `date_activate` <= NOW()"); while ($rPublish = XDb::xFetchArray($rsPublish)) { $userid = $rPublish['user_id']; $cacheid = $rPublish['cache_id']; // update cache status to active XDb::xSql("UPDATE `caches` SET `status`=1, `date_activate`=NULL, `last_modified`=NOW() WHERE `cache_id`= ? ", $cacheid); // send events GeoCache::touchCache($cacheid); event_new_cache($userid); event_notify_new_cache($cacheid); } XDb::xFreeResults($rsPublish);
} $remove_commit = 0; if (isset($_REQUEST['commit'])) { $remove_commit = $_REQUEST['commit']; } //user logged in? if ($usr == false) { $target = urlencode(tpl_get_current_page()); tpl_redirect('login.php?target=' . $target); } else { $cache_rs = XDb::xSql("SELECT `user_id`, `name` FROM `caches` WHERE `cache_id`= ? LIMIT 1", $cache_id); if ($cache_record = XDb::xFetchArray($cache_rs)) { if ($cache_record['user_id'] == $usr['userid'] || $usr['admin']) { $desc_rs = XDb::xSql("SELECT `id`, `uuid` FROM `cache_desc` WHERE `cache_id`= ? AND `language`= ? LIMIT 1", $cache_id, $desclang); if ($desc_record = XDb::xFetchArray($desc_rs)) { XDb::xFreeResults($desc_rs); require $stylepath . '/removedesc.inc.php'; if ($remove_commit == 1) { //add to removed_objects XDb::xSql("INSERT INTO `removed_objects` (`id`, `localID`, `uuid`, `type`, `removed_date`, `node`)\n VALUES ('', ?, ?, '3', NOW(), ?)", $desc_record['id'], $desc_record['uuid'], $oc_nodeid); //remove it from cache_desc XDb::xSql("DELETE FROM `cache_desc` WHERE `cache_id`= ? AND `language`= ? LIMIT 1", $cache_id, $desclang); // update cache-record, including last modification date GeoCache::setCacheDefaultDescLang($cache_id); tpl_redirect('editcache.php?cacheid=' . urlencode($cache_id)); exit; } else { //commit the removement $tplname = 'removedesc'; tpl_set_var('desclang_name', db_LanguageFromShort($desclang)); tpl_set_var('cachename', htmlspecialchars($cache_record['name'], ENT_COMPAT, 'UTF-8'));
$uLon = XDb::xSimpleQueryValue("SELECT `user`.`longitude` FROM `user` WHERE `user_id`='" . XDb::xEscape($usr['userid']) . "'", 0); if (($uLat == NULL || $uLat == 0) && ($uLon == NULL || $uLon == 0)) { tpl_set_var('mapzoom', 6); tpl_set_var('mapcenterLat', $main_page_map_center_lat); tpl_set_var('mapcenterLon', $main_page_map_center_lon); } else { tpl_set_var('mapzoom', 11); tpl_set_var('mapcenterLat', $uLat); tpl_set_var('mapcenterLon', $uLon); } $rscp = XDb::xSql("SELECT `user`.`latitude` `latitude`,`user`.`longitude` `longitude`,`user`.`username` `username`,\n `user`.`user_id` `userid` FROM `user`\n WHERE `user`.`guru`!=0\n AND (\n user.user_id IN (\n SELECT cache_logs.user_id FROM cache_logs\n WHERE `cache_logs`.`type`=1 AND `cache_logs`.`date_created`>DATE_ADD(NOW(), INTERVAL -90 DAY)\n )\n OR user.user_id IN (\n SELECT caches.user_id FROM caches\n WHERE (`caches`.`status`=1 OR `caches`.`status`=2 OR `caches`.`status`=3)\n AND `caches`.`date_created`>DATE_ADD(NOW(), INTERVAL -90 DAY)\n )\n )\n AND `user`.`longitude` IS NOT NULL\n AND `user`.`latitude` IS NOT NULL GROUP BY user.username"); $point = ""; $nrows = 0; while ($record = XDb::xFetchArray($rscp)) { $nrows++; $username = $record['username']; $y = $record['longitude']; $x = $record['latitude']; $nrec = XDb::xSql("SELECT COUNT('cache_id') as ncaches, SUM(topratings) as nrecom\n FROM caches WHERE `caches`.`type` <> 6 AND caches.status<>4\n AND caches.status<>5\n AND caches.status<>6\n AND `caches`.`user_id`= ? ", $record['userid']); $nr = XDb::xFetchArray($nrec); $point .= "addMarker(" . $x . "," . $y . "," . $record['userid'] . ",'" . $username . "'," . $nr['nrecom'] . ");\n"; } tpl_set_var('nguides', $nrows); tpl_set_var('points', $point); XDb::xFreeResults($rscp); /* SET YOUR MAP CODE HERE */ tpl_set_var('cachemap_header', '<script src="//maps.googleapis.com/maps/api/js?sensor=false&language=' . $lang . '" type="text/javascript"></script>'); } } tpl_set_var('serverURL', $absolute_server_URI); tpl_BuildTemplate();
tpl_set_var("ni_ma_takiego_kesza", tr(ni_ma_takiego_kesza)); tpl_set_var("sekcja_2_start", '<!--'); tpl_set_var("sekcja_2_stop", '-->'); tpl_set_var("sekcja_5_start", ''); tpl_set_var("sekcja_5_stop", ''); $Opensprawdzacz->endzik(); } $cache_id = $record['cache_id']; tpl_set_var("wp_oc", $Opensprawdzacz->cache_wp); tpl_set_var("ikonka_keszyny", '<img src="tpl/stdstyle/images/' . $record['icon_large'] . '" />'); tpl_set_var("cacheid", $record['cache_id']); tpl_set_var("ofner", $record['username']); tpl_set_var("cachename", $record['name']); tpl_set_var("id_uzyszkodnika", $record['user_id']); Xdb::xFreeResults($rs); $wp_rs = XDb::xSql("SELECT `waypoints`.`wp_id`,\n `waypoints`.`type`,\n `waypoints`.`longitude`,\n `waypoints`.`latitude`,\n `waypoints`.`status`,\n `waypoints`.`type`,\n `waypoints`.`opensprawdzacz`\n FROM `waypoints`\n WHERE `cache_id`= ? AND `type` = 3 ", $cache_id); $wp_record = XDb::xFetchArray($wp_rs); if ($wp_record['type'] == 3 && $wp_record['opensprawdzacz'] == 1) { tpl_set_var("sekcja_formularz_opensprawdzacza_start", ''); tpl_set_var("sekcja_formularz_opensprawdzacza_stop", ''); tpl_set_var("okienka", ''); } else { tpl_set_var("okienka", tr('os_nie_ma_w_os')); tpl_set_var("sekcja_formularz_opensprawdzacza_start", '<!--'); tpl_set_var("sekcja_formularz_opensprawdzacza_stop", '-->'); } } XDb::xFreeResults($wp_rs); } // budujemy kod html ktory zostaje wsylany do przegladraki $Opensprawdzacz->endzik();
function outputXmlSessionFile($sessionid, $filenr, $bOcXmlTag, $bDocType, $bXmlDecl, $ziptype) { XDb::xSql('UPDATE xmlsession SET last_use=NOW() WHERE id= ? ', $sessionid); /* begin calculate which records to transfer */ $rs = XDb::xSql('SELECT `users`, `caches`, `cachedescs`, `cachelogs`, `pictures`, `removedobjects` FROM `xmlsession` WHERE `id`= ? AND `cleaned`=0', $sessionid); if (!($rRecordsCount = XDb::xFetchArray($rs))) { die('invalid sessionid'); } XDb::xFreeResults($rs); $startat = ($filenr - 1) * 500; if ($startat < 0 || $startat > $rRecordsCount['users'] + $rRecordsCount['caches'] + $rRecordsCount['cachedescs'] + $rRecordsCount['cachelogs'] + $rRecordsCount['pictures'] + $rRecordsCount['removedobjects'] - 1) { die('filenr out of range'); } $recordnr[0] = 0; $recordnr[1] = $rRecordsCount['users']; $recordnr[2] = $recordnr[1] + $rRecordsCount['caches']; $recordnr[3] = $recordnr[2] + $rRecordsCount['cachedescs']; $recordnr[4] = $recordnr[3] + $rRecordsCount['cachelogs']; $recordnr[5] = $recordnr[4] + $rRecordsCount['pictures']; $recordnr[6] = $recordnr[5] + $rRecordsCount['removedobjects']; if ($recordnr[6] > $startat + 500) { $endat = $startat + 500; } else { $endat = $recordnr[6] - $startat; } for ($i = 0; $i < 6; $i++) { if ($startat >= $recordnr[$i] && $startat + 500 < $recordnr[$i + 1]) { if ($recordnr[$i + 1] - $startat > 500) { $limits[$i] = array('start' => $startat - $recordnr[$i], 'count' => 500); } else { $limits[$i] = array('start' => $startat - $recordnr[$i], 'count' => $recordnr[$i + 1] - $startat); } //$limits[$i] = array('start' => 'a', 'count' => 'a'); } else { if ($startat >= $recordnr[$i] && $startat < $recordnr[$i + 1]) { $limits[$i] = array('start' => $startat - $recordnr[$i], 'count' => $recordnr[$i + 1] - $startat); //$limits[$i] = array('start' => 'b', 'count' => 'b'); } else { if ($startat + 500 >= $recordnr[$i] && $startat + 500 < $recordnr[$i + 1]) { if ($startat + 500 < $recordnr[$i + 1]) { $limits[$i] = array('start' => 0, 'count' => 500 - $recordnr[$i] + $startat); } else { $limits[$i] = array('start' => 0, 'count' => $recordnr[$i + 1] - $recordnr[$i]); } if ($limits[$i]['count'] < 0) { $limits[$i]['count'] = 0; } //$limits[$i] = array('start' => 'c', 'count' => 'c'); } else { if ($startat < $recordnr[$i] && $startat + 500 >= $recordnr[$i + 1]) { $limits[$i] = array('start' => 0, 'count' => $recordnr[$i + 1] - $recordnr[$i]); } else { $limits[$i] = array('start' => '0', 'count' => '0'); } } } } } /* end calculate which records to transfer */ XDb::xSql('CREATE TEMPORARY TABLE `tmpxml_users` (`id` int(11), PRIMARY KEY (`id`)) SELECT `object_id` `id` FROM `xmlsession_data` WHERE `session_id`= ? AND `object_type`=4 LIMIT ' . $limits[0]['start'] . ',' . $limits[0]['count'], $sessionid); XDb::xSql('CREATE TEMPORARY TABLE `tmpxml_caches` (`id` int(11), PRIMARY KEY (`id`)) SELECT `object_id` `id` FROM `xmlsession_data` WHERE `session_id`= ? AND `object_type`=2 LIMIT ' . $limits[1]['start'] . ',' . $limits[1]['count'], $sessionid); XDb::xSql('CREATE TEMPORARY TABLE `tmpxml_cachedescs` (`id` int(11), PRIMARY KEY (`id`)) SELECT `object_id` `id` FROM `xmlsession_data` WHERE `session_id`= ? AND `object_type`=3 LIMIT ' . $limits[2]['start'] . ',' . $limits[2]['count'], $sessionid); XDb::xSql('CREATE TEMPORARY TABLE `tmpxml_cachelogs` (`id` int(11), PRIMARY KEY (`id`)) SELECT `object_id` `id` FROM `xmlsession_data` WHERE `session_id`= ? AND `object_type`=1 LIMIT ' . $limits[3]['start'] . ',' . $limits[3]['count'], $sessionid); XDb::xSql('CREATE TEMPORARY TABLE `tmpxml_pictures` (`id` int(11), PRIMARY KEY (`id`)) SELECT `object_id` `id` FROM `xmlsession_data` WHERE `session_id`= ? AND `object_type`=6 LIMIT ' . $limits[4]['start'] . ',' . $limits[4]['count'], $sessionid); XDb::xSql('CREATE TEMPORARY TABLE `tmpxml_removedobjects` (`id` int(11), PRIMARY KEY (`id`)) SELECT `object_id` `id` FROM `xmlsession_data` WHERE `session_id`= ? AND `object_type`=7 LIMIT ' . $limits[5]['start'] . ',' . $limits[5]['count'], $sessionid); outputXmlFile($sessionid, $filenr, $bXmlDecl, $bOcXmlTag, $bDocType, $ziptype); }
if ($rCount['count'] == 1) { $s = $dbcSearch->simpleQuery('SELECT `caches`.`wp_oc` `wp_oc` FROM `zipcontent`, `caches` WHERE `zipcontent`.`cache_id`=`caches`.`cache_id` LIMIT 1'); $rName = $dbcSearch->dbResultFetchOneRowOnly($s); $sFilebasename = $rName['wp_oc']; } else { if ($options['searchtype'] == 'bywatched') { $sFilebasename = 'watched_caches'; } elseif ($options['searchtype'] == 'bylist') { $sFilebasename = 'cache_list'; } elseif ($options['searchtype'] == 'bypt') { $sFilebasename = $options['gpxPtFileName']; } else { $rsName = XDb::xSql('SELECT `queries`.`name` `name` FROM `queries` WHERE `queries`.`id`= ? LIMIT 1', $options['queryid']); $rName = XDb::xFetchArray($rsName); XDb::xFreeResults($rsName); if (isset($rName['name']) && $rName['name'] != '') { $sFilebasename = trim($rName['name']); $sFilebasename = str_replace(" ", "_", $sFilebasename); } else { $sFilebasename = 'ocpl' . $options['queryid']; } } } // ======================================= // I don't know what code above doing (it's horrible and I don't have enough time to analyze this code), // so I just modify existing piece of code from other output search.*.inc.php file. // == Limak (28.01.2012) == $okapi_max_caches = get_max_caches_per_call(); //zippart param in request is used for split ZIP files if (!isset($_REQUEST['zippart'])) {
} elseif ($log_type == 3) { $user_record['log_notes_count']++; if ($founds <= 1) { $top_cache = 0; } } XDb::xSql("UPDATE `user` SET `founds_count`=?, `notfounds_count`=?, `log_notes_count`=?\n WHERE `user_id`= ?", $user_record['founds_count'], $user_record['notfounds_count'], $user_record['log_notes_count'], $log_record['user_id']); unset($user_record); //call eventhandler require_once $rootpath . 'lib/eventhandler.inc.php'; event_change_log_type($log_record['cache_id'], $log_record['user_id'] + 0); } //update cache-stat if type or log_date changed $cache_rs = XDb::xSql("SELECT `founds`, `notfounds`, `notes` FROM `caches` WHERE `cache_id`=?", $log_record['cache_id']); $cache_record = XDb::xFetchArray($cache_rs); XDb::xFreeResults($cache_rs); if ($log_record['logtype'] != $log_type) { if ($log_record['logtype'] == 1 || $log_record['logtype'] == 7) { $cache_record['founds']--; } elseif ($log_record['logtype'] == 2 || $log_record['logtype'] == 8) { $cache_record['notfounds']--; } elseif ($log_record['logtype'] == 3) { $cache_record['notes']--; } // falls eines der felder NULL $cache_record['founds'] = $cache_record['founds'] + 0; $cache_record['notfounds'] = $cache_record['notfounds'] + 0; $cache_record['notes'] = $cache_record['notes'] + 0; if ($log_type == 1 || $log_type == 7) { $cache_record['founds']++; } elseif ($log_type == 2 || $log_type == 8) {
function viewcache_getfullsizedpicturestable($cacheid, $viewtext = true, $spoiler_only = false, $picturescount) { global $thumb_max_width; global $thumb_max_height; $nCol = 0; if ($spoiler_only) { $spoiler_only = 'spoiler=1 AND'; } else { $spoiler_only = ""; } $rs = XDb::xSql('SELECT uuid, title, url, spoiler FROM pictures WHERE ' . $spoiler_only . ' object_id = ? AND object_type=2 AND display=1 ORDER BY date_created', $cacheid); while ($r = XDb::xFetchArray($rs)) { $retval .= '<div style="display: block; float: left; margin: 3px;">'; if ($viewtext) { $retval .= '<div style=""><p>' . $r['title'] . '</p></div>'; } $retval .= '<img style="max-width: 600px;" src="' . $r['url'] . '" alt="' . $r['title'] . '" title="' . $r['title'] . '" />'; $retval .= '</div>'; } XDb::xFreeResults($rs); return $retval; }
<?php use Utils\Database\XDb; //prepare the templates and include all neccessary global $dateFormat; $rootpath = '../'; require_once $rootpath . 'lib/common.inc.php'; //Preprocessing if ($error == false) { //get the news $perpage = 20; header('Content-type: application/xml; charset="utf-8"'); $content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rss version=\"2.0\">\n<channel>\n<title>{$short_sitename} - " . tr('rss_04') . "</title>\n<ttl>60</ttl><link>{$absolute_server_URI}/news.php</link>\n <description><![CDATA[" . tr('rss_12') . " {$site_name}]]></description><image>\n <title>{$short_sitename} - " . tr('rss_04') . "</title>\n <url>{$absolute_server_URI}/images/oc.png</url>\n <link>{$absolute_server_URI}/news.php</link><width>100</width><height>28</height></image>\n"; $rsNews = XDb::xSql('SELECT `date_posted`, `content` FROM `news` WHERE `topic`=2 AND `display`=1 ORDER BY `date_posted` DESC LIMIT ' . $perpage); while ($rNews = XDb::xFetchArray($rsNews)) { $thisline = "<item>\n<title>{date}</title>\n<description>{message}</description>\n<link>{$absolute_server_URI}/news.php</link>\n</item>\n"; $thisline = str_replace('{date}', date($dateFormat, strtotime($rNews['date_posted'])), $thisline); $thisline = str_replace('{message}', htmlspecialchars($rNews['content']), $thisline); $content .= $thisline . "\n"; } XDb::xFreeResults($rsNews); $content .= "</channel>\n</rss>\n"; echo $content; }
} } XDb::xFreeResults($rsCachesFindMonth1); for ($i = 1; $i < 13; $i++) { $month = $i; $rsCachesFindMonth2 = XDb::xSql("SELECT COUNT(*) `count`, YEAR(`date`) `year`, MONTH(`date`) `month` FROM `cache_logs`\n WHERE type=2 AND cache_logs.deleted='0' AND cache_id=? AND YEAR(`date`)=? AND MONTH(`date`)=?\n GROUP BY MONTH(`date`) , YEAR(`date`)\n ORDER BY YEAR(`date`) ASC, MONTH(`date`) ASC", $cache_id, $year, $month); if ($rsCachesFindMonth2 !== false) { $rfm = XDb::xFetchArray($rsCachesFindMonth2); $y2[] = $rfm['count']; $x2[] = $rfm['month']; } else { $y2[] = $i; $x2[] = 0; } } XDb::xFreeResults($rsCachesFindMonth2); } setlocale(LC_ALL, 'pl_PL.utf8'); $dateLocale = new DateLocale(); // Create the graph. These two calls are always required $graph = new Graph(400, 200); $graph->SetScale("textlin"); $graph->SetShadow(); $graph->img->SetMargin(50, 30, 30, 55); // Create the bar plots $b1plot = new BarPlot($y1); $b1plot->SetFillColor("chartreuse3"); $b2plot = new BarPlot($y2); $b2plot->SetFillColor("chocolate2"); // Set the legends for the plots $fn = tr('found');
$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();
tpl_set_var('lat_min_float', $lat_min_float); tpl_set_var('lon_float', sprintf('%0.5f', $lon_float)); tpl_set_var('lon_dir', $lon_dir); tpl_set_var('lon_deg_int', $lon_deg_int); tpl_set_var('lon_min_int', $lon_min_int); tpl_set_var('lon_sec_float', $lon_sec_float); tpl_set_var('lon_min_float', $lon_min_float); $sCode = ''; $rsLayers = XDb::xSql("SELECT `level`, `code`, AsText(`shape`) AS `geometry` FROM `nuts_layer`\n WHERE WITHIN(GeomFromText( ? ), `shape`) ORDER BY `level` DESC", 'POINT(' . $lon . ' ' . $lat . ')'); while ($rLayers = XDb::xFetchArray($rsLayers)) { if (gis::ptInLineRing($rLayers['geometry'], 'POINT(' . $lon . ' ' . $lat . ')')) { $sCode = $rLayers['code']; break; } } XDb::xFreeResults($rsLayers); if ($sCode != '') { $adm1 = null; $code1 = null; $adm2 = null; $code2 = null; $adm3 = null; $code3 = null; $adm4 = null; $code4 = null; if (mb_strlen($sCode) > 5) { $sCode = mb_substr($sCode, 0, 5); } if (mb_strlen($sCode) == 5) { $code4 = $sCode; $adm4 = XDb::xMultiVariableQueryValue("SELECT `name` FROM `nuts_codes` WHERE `code`=:1", 0, $sCode);
function getPictures($cacheid, $picturescount) { global $thumb_max_width; global $thumb_max_height; $rs = XDb::xSql('SELECT uuid, title, url, spoiler FROM pictures WHERE object_id= ? AND object_type=2 AND display=1 ORDER BY date_created', $cacheid); if (!isset($retval)) { $retval = ''; } while ($r = XDb::xFetchArray($rs)) { $retval .= '<img src="' . $r['url'] . '"><br>' . cleanup_text($r['title']) . '<br>'; } XDb::xFreeResults($rs); return $retval; }