forked from opencaching/opencaching-pl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
myroutes.php
85 lines (61 loc) · 5.4 KB
/
myroutes.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
/****************************************************************************
Unicode Reminder メモ
display all watches of this user
****************************************************************************/
//prepare the templates and include all neccessary
require_once('./lib/common.inc.php');
//Preprocessing
if ($error == false)
{
//user logged in?
if ($usr == false)
{
$target = urlencode(tpl_get_current_page());
tpl_redirect('login.php?target='.$target);
}
else
{
$tplname = 'myroutes';
$user_id = $usr['userid'];
$route_rs = sql("SELECT `route_id` ,`description` `desc`, `name`,`radius`,`length` FROM `routes` WHERE `user_id`=&1 ORDER BY `route_id` DESC",$user_id);
if (mysql_num_rows($route_rs) != 0)
{
$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>';
for ($i = 0; $i < mysql_num_rows($route_rs); $i++)
{
$routes_record = sql_fetch_array($route_rs);
$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(\'Do you want to remove this route?\');"><img style="vertical-align: middle;" src="tpl/stdstyle/images/log/16x16-trash.png" alt="" title='.tr('delete').' /></a></td></tr></table></div>';
}
$routes .= '';
tpl_set_var('content', $routes);
mysql_free_result($route_rs);
} 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>");}
}
}
//make the template and send it out
tpl_BuildTemplate();
?>