<?php use Utils\Database\XDb; use lib\Objects\User\User; use Utils\Email\Email; //prepare the templates and include all neccessary if (!isset($rootpath)) { $rootpath = ''; } require_once './lib/common.inc.php'; //Preprocessing if ($error == false) { $db = XDb::instance(); $description = ""; //user logged in? if ($usr == false) { $target = urlencode(tpl_get_current_page()); tpl_redirect('login.php?target=' . $target); } else { tpl_set_var('desc_updated', ''); tpl_set_var('displayGeoPathSection', displayGeoPatchSection('table')); if (isset($_POST['description'])) { $q = "UPDATE user SET description = :1 WHERE user_id=:2"; $db->multiVariableQuery($q, strip_tags($_POST['description']), (int) $usr['userid']); tpl_set_var('desc_updated', "<font color='green'>" . tr('desc_updated') . "</font>"); } if (isset($_POST['submit']) && isset($_POST['bulletin'])) { $q = "UPDATE user SET get_bulletin = :1 WHERE user_id = :2 "; $db->multiVariableQuery($q, $_POST['bulletin'], $usr['userid']); } $q = "SELECT description, get_bulletin FROM user WHERE user_id = :1 LIMIT 1";
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 .= ' <tr> <td><a class="links" href="viewcache.php?wp=' . $dane_keszynek['wp_oc'] . '">' . $dane_keszynek['wp_oc'] . '</a></td> <td><a class="links" href="' . $OpensprawdzaczSetup->scriptname . '?op_keszynki=' . $dane_keszynek['wp_oc'] . '"> ' . $dane_keszynek['name'] . '</a> </td> <td><a href="viewcache.php?wp=' . $dane_keszynek['wp_oc'] . '"><img src="tpl/stdstyle/images/' . $dane_keszynek['icon_small'] . '" /></a></td> <td align="center">' . $status[$dane_keszynek['status']] . '</td> <td><a href="viewprofile.php?userid=' . $dane_keszynek['user_id'] . '">' . $dane_keszynek['username'] . '</td> <td align="center">' . $dane_keszynek['proby'] . '</td> <td align="center">' . $dane_keszynek['sukcesy'] . '</td> </tr>'; } } $tabelka_keszynek .= ' <tr><td colspan="7"><img src="tpl/stdstyle/images/blue/dot_blue.png" height="1" width="100%"/></td></tr><tr> <td><img src="/tpl/stdstyle/images/misc/16x16-info.png" /></td> <td>' . tr('os_f00') . ': </td> <td>' . $ile_keszynek . '</td> <td align="center"> ' . $status[1] . '<br />' . $status[2] . ' </td> <td> (' . tr('log_type_available') . ')<br /> (' . tr('temp_unavailables') . ') </td> <td align="center">' . $proby . '</td> <td align="center">' . $trafienia . '</td> </tr> </table>'; $tabelka_keszynek .= '<br /><p align="center">' . $paginacja . '</p>'; tpl_set_var("sekcja_1_start", ''); tpl_set_var("sekcja_1_stop", ''); tpl_set_var("sekcja_2_start", '<!--'); tpl_set_var("sekcja_2_stop", '-->'); tpl_set_var("sekcja_3_start", '<!--'); tpl_set_var("sekcja_3_stop", '-->'); tpl_set_var("sekcja_4_start", '<!--'); tpl_set_var("sekcja_4_stop", '-->'); tpl_set_var("sekcja_formularz_opensprawdzacza_start", '<!--'); tpl_set_var("sekcja_formularz_opensprawdzacza_stop", ''); tpl_set_var("formularz", $formularz); tpl_set_var("keszynki", $tabelka_keszynek); $this->endzik(); } }