Exemplo n.º 1
0
 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 = db_query($query);
     $ile2 = mysql_num_rows($wynik);
     if ($ile2 > 0) {
         $znalezione = array();
         while ($rek = mysql_fetch_assoc($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 = db_query($query);
             while ($rekord = mysql_fetch_assoc($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 = db_query($query2);
                     $if_found = mysql_fetch_row($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 = db_query($query2);
                         $if_found = mysql_fetch_row($wynik2);
                     }
                     $if_found = $if_found[0];
                 }
                 $query = "select username from user where user_id = " . $rekord['user_id'] . ";";
                 $wynik2 = db_query($query);
                 $wiersz = mysql_fetch_assoc($wynik2);
                 $query = "select " . $lang . " from cache_type where id = " . $rekord['type'] . ";";
                 $wynik2 = db_query($query);
                 $wiersz2 = mysql_fetch_row($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;
             }
         }
     }
 }
Exemplo n.º 2
0
         }
     }
     if (isset($_GET['skip_inactive'])) {
         if ($wiersz['status'] > 1) {
             continue;
         }
     }
     $rekord['user_id'] = $wiersz['user_id'];
     $rekord['name'] = $wiersz['name'];
     $rekord['status'] = $wiersz['status'];
     $rekord['score'] = score2ratingnum($wiersz['score']);
     $rekord['latitude'] = $wiersz['latitude'];
     $rekord['longitude'] = $wiersz['longitude'];
     $rekord['wp_oc'] = $wartosc;
     $rekord['N'] = cords($rekord['latitude']);
     $rekord['E'] = cords($rekord['longitude']);
     $rekord['distance'] = $dist;
     $rekord['kier'] = $kier;
     $rekord['if_found'] = $if_found;
     $query = "select username from user where user_id = '" . $rekord['user_id'] . "';";
     $wynik = XDb::xSql($query);
     $wiersz = XDb::xFetchArray($wynik);
     $rekord['username'] = $wiersz['username'];
     $znalezione[] = $rekord;
     $lista[] = $rekord['wp_oc'];
     $i++;
 }
 $url = $_SERVER['REQUEST_URI'];
 $tpl->assign('lista', $lista);
 stronicowanie($_GET['page'], 'viewcache', $znalezione, $i, $url);
 exit;
Exemplo n.º 3
0
 function find_news($start, $end)
 {
     global $lang;
     global $ile;
     global $url;
     global $tpl;
     global $znalezione;
     if (isset($_GET['nazwa'])) {
         $nazwa = XDb::xEscape($_GET['nazwa']);
         $query = "select votes,cache_id,name, status, score, latitude, longitude, wp_oc, user_id, type from caches where name like '%" . $nazwa . "%' and caches.status in ('1','2','3') order by name limit " . $start . "," . $end;
         $czykilka = 1;
         $url = "./find.php?nazwa=" . $nazwa;
     }
     if (isset($_GET['wp'])) {
         $wp = XDb::xEscape($_GET['wp']);
         $query = "select votes,cache_id,name, status, score, latitude, longitude, wp_oc, user_id, type from caches where wp_oc = '" . $wp . "' and caches.status in ('1','2','3') order by name limit " . $start . "," . $end;
         $czykilka = 0;
         $url = "./find.php?wp=" . $wp;
     }
     if (isset($_GET['owner'])) {
         $owner = XDb::xEscape($_GET['owner']);
         $query = "select votes,cache_id,name, status, score, latitude, longitude, wp_oc, user_id, type from caches where user_id = (select user_id from user where username ='******') and caches.status in ('1','2','3') order by name limit " . $start . "," . $end;
         $czykilka = 1;
         $url = "./find.php?owner=" . $owner;
     }
     if (isset($_GET['finder'])) {
         $finder = XDb::xEscape($_GET['finder']);
         $query = "select caches.votes,caches.cache_id,name, status, score, latitude, longitude, wp_oc, caches.user_id, caches.type from caches inner join cache_logs on caches.cache_id=cache_logs.cache_id where cache_logs.user_id = (select user.user_id from user where username ='******') and cache_logs.type = '1' and cache_logs.deleted=0 and caches.status in ('1','2','3') order by cache_logs.id desc limit " . $start . "," . $end;
         $czykilka = 1;
         $url = "./find.php?finder=" . $finder;
     }
     $wynik = XDb::xSql($query);
     $ilewyn = XDb::xNumRows($wynik);
     if ($czykilka == 0) {
         if ($ilewyn > 0) {
             global $address;
             $wiersz = XDb::xFetchArray($wynik);
             $adres = "./" . $address . ".php?wp=" . $wiersz['wp_oc'];
             header('Location: ' . $adres);
             exit;
         } else {
             $tpl->assign("error", "1");
         }
     }
     if ($czykilka == 1) {
         $znalezione = array();
         while ($rekord = XDb::xFetchArray($wynik)) {
             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);
             if ($rekord['votes'] > 3) {
                 $rekord['score'] = score2ratingnum($rekord['score']);
             } else {
                 $rekord['score'] = 5;
             }
             $rekord['username'] = $wiersz['username'];
             $rekord['if_found'] = $if_found;
             $rekord['N'] = cords($rekord['latitude']);
             $rekord['E'] = cords($rekord['longitude']);
             $rekord['typetext'] = $wiersz2[0];
             $znalezione[] = $rekord;
         }
     }
 }
Exemplo n.º 4
0
     $wynik3 = db_query($query3);
     $watched = mysql_fetch_row($wynik3);
     $watched = $watched[0];
     if (!empty($watched)) {
         $cache_info['watched'] = $watched;
     } else {
         $cache_info['watched'] = -1;
     }
 }
 $cache_info['cache_id'] = $caches['cache_id'];
 $cache_info['name'] = $caches['name'];
 $cache_info['short_desc'] = $cache_desc['short_desc'];
 $cache_info['longitude'] = number_format($caches['longitude'], 5);
 $cache_info['latitude'] = number_format($caches['latitude'], 5);
 $cache_info['N'] = cords($caches['latitude']);
 $cache_info['E'] = cords($caches['longitude']);
 $cache_info['type'] = $cache_type[0];
 $cache_info['size'] = $cache_size[0];
 $cache_info['status2'] = $caches['status'];
 $cache_info['status'] = $cache_status[0];
 $cache_info['hidden_date'] = date('j.m.Y', strtotime($caches['date_hidden']));
 $cache_info['wp_oc'] = $caches['wp_oc'];
 $cache_info['owner'] = $user[0];
 $cache_info['user_id'] = $caches['user_id'];
 $cache_info['founds'] = $caches['founds'];
 $cache_info['notfounds'] = $caches['notfounds'];
 $cache_info['notes'] = $caches['notes'];
 $cache_info['desc'] = html2desc($cache_desc['desc']);
 $cache_info['hint'] = html2hint($cache_desc['hint']);
 $cache_info['picturescount'] = $caches['picturescount'];
 $cache_info['topratings'] = $caches['topratings'];