Esempio n. 1
0
        if (file_exists($flagfile)) {
            $desclanguageCountry = $opt['locale'][$desclanguage]['country'];
        }
    }
    $rCache['desclanguageCountries'][$desclanguage] = $desclanguageCountry;
}
$rCache['sizeName'] = labels::getLabelValue('cache_size', $rCache['size']);
$rCache['statusName'] = labels::getLabelValue('cache_status', $rCache['status']);
$rCache['typeName'] = labels::getLabelValue('cache_type', $rCache['type']);
$rCache['userhasfound'] = false;
if ($login->userid != 0) {
    $rCache['userhasfound'] = sql_value("SELECT COUNT(*) FROM `cache_logs` WHERE `cache_id`='&1' AND `user_id`='&2' AND `type` IN (1,7)", 0, $cacheid, $login->userid) > 0;
}
$tpl->assign('cache', $rCache);
$tpl->title = $rCache['wpoc'] . ' ' . $rCache['name'];
$coord = new coordinate($rCache['latitude'], $rCache['longitude']);
$tpl->assign('coordinates', $coord->getDecimalMinutes());
// podcasts
$rs = sql("SELECT `uuid`, `title`, `url` FROM `mp3` WHERE `object_id`='&1' ORDER BY date_created", $cacheid);
$tpl->assign_rs('podcasts', $rs);
sql_free_result($rs);
// pictures
$rs = sql("SELECT `id`, `uuid`, `url`, `title`, `thumb_url`, `spoiler`, `display` FROM `pictures` WHERE `object_type`=2 AND `object_id`='&1' AND `display`!=0 ORDER BY `date_created`", $cacheid);
$tpl->assign_rs('pictures', $rs);
sql_free_result($rs);
$tpl->assign('childWaypoints', getChildWaypoints($cacheid));
if ($login->userid != 0) {
    $cacheNotePresenter = new CacheNote_Presenter(new Http_Request(), new Language_Translator());
    $cacheNotePresenter->init(new CacheNote_Handler(), $login->userid, $cacheid);
    if (isset($_POST['submit_cache_note']) && $cacheNotePresenter->validate()) {
        $cacheNotePresenter->doSubmit();
Esempio n. 2
0
 *  Unicode Reminder メモ
 ***************************************************************************/
require __DIR__ . '/lib2/web.inc.php';
$tpl->name = 'coordinates';
$tpl->popup = true;
$lat_float = 0;
if (isset($_REQUEST['lat'])) {
    $lat_float += $_REQUEST['lat'];
}
$lon_float = 0;
if (isset($_REQUEST['lon'])) {
    $lon_float += $_REQUEST['lon'];
}
$cache_country = isset($_REQUEST['country']) ? $_REQUEST['country'] : false;
$cache_desclang = isset($_REQUEST['desclang']) ? $_REQUEST['desclang'] : false;
$coord = new coordinate($lat_float, $lon_float);
$tpl->assign('coordDeg', $coord->getDecimal());
$tpl->assign('coordDegMin', $coord->getDecimalMinutes());
$tpl->assign('coordDegMinSec', $coord->getDecimalMinutesSeconds());
$tpl->assign('coordUTM', $coord->getUTM());
$tpl->assign('coordGK', $coord->getGK());
$tpl->assign('coordRD', $coord->getRD());
$tpl->assign('showRD', $coord->nLat >= 45 && $coord->nLat <= 57 && $coord->nLon >= 0 && $coord->nLon <= 15);
$tpl->assign('coordQTH', $coord->getQTH());
$tpl->assign('coordSwissGrid', $coord->getSwissGrid());
// build priority list of W3W languages to display
// 1. current page locale
$w3w_langs = array();
if ($opt['locale'][$opt['template']['locale']]['what3words']) {
    $w3w_langs[] = $opt['template']['locale'];
}
 function setTplHistoryData($exclude_report_id)
 {
     global $opt, $tpl;
     // (other) reports for this cache
     $rs = sql("SELECT `cr`.`id`, `cr`.`date_created`, `cr`.`lastmodified`,\n\t\t                  `cr`.`userid`, `cr`.`adminid`,\n\t\t\t\t              `users`.`username` AS `usernick`,\n\t\t\t\t              `admins`.`username` AS `adminnick`,\n\t\t\t\t\t\t\t\t\t\t\tIFNULL(`tt`.`text`, `crs`.`name`) AS `status`,\n\t\t\t\t              IFNULL(`tt2`.`text`, `crr`.`name`) AS `reason`\n\t\t\t\t         FROM `cache_reports` AS `cr`\n\t\t\t\t    LEFT JOIN `cache_report_reasons` AS `crr` ON `cr`.`reason`=`crr`.`id`\n\t\t\t      LEFT JOIN `user` AS `users` ON `users`.`user_id`=`cr`.`userid`\n\t\t\t      LEFT JOIN `user` AS `admins` ON `admins`.`user_id`=`cr`.`adminid`\n\t\t\t      LEFT JOIN `cache_report_status` AS `crs` ON `cr`.`status`=`crs`.`id`\n\t\t\t      LEFT JOIN `sys_trans_text` AS `tt` ON `crs`.`trans_id`=`tt`.`trans_id` AND `tt`.`lang`='&2'\n\t\t\t      LEFT JOIN `sys_trans_text` AS `tt2` ON `crr`.`trans_id`=`tt2`.`trans_id` AND `tt2`.`lang`='&2'\n\t\t\t          WHERE `cr`.`cacheid`='&1' AND `cr`.`id`<>'&3'\n\t\t\t       ORDER BY `cr`.`status`,`cr`.`id` DESC", $this->getCacheId(), $opt['template']['locale'], $exclude_report_id);
     $tpl->assign_rs('reports', $rs);
     sql_free_result($rs);
     // user; deleted logs
     $rs = sql("SELECT * FROM `caches` WHERE `cache_id`='&1'", $this->getCacheId());
     $rCache = sql_fetch_array($rs);
     $tpl->assign('cache', $rCache);
     sql_free_result($rs);
     $tpl->assign('ownername', sql_value("SELECT `username` FROM `user` WHERE `user_id`='&1'", "", $rCache['user_id']));
     $tpl->assign('deleted_logs', $this->getLogsArray($this->getCacheId(), 0, 1000, true));
     // status changes
     $rs = sql("SELECT `csm`.`date_modified`,\n\t\t                  `csm`.`old_state` AS `old_status_id`,\n\t\t                  `csm`.`new_state` AS `new_status_id`,\n\t\t                  `user`.`username`,\n\t\t\t\t              `user`.`user_id`,\n\t\t                  IFNULL(`stt_old`.`text`,`cs_old`.`name`) AS `old_status`,\n\t\t                  IFNULL(`stt_new`.`text`,`cs_new`.`name`) AS `new_status`\n\t\t             FROM `cache_status_modified` `csm`\n\t           LEFT JOIN `cache_status` `cs_old` ON `cs_old`.`id`=`csm`.`old_state`\n\t\t\t\t\t\tLEFT JOIN `sys_trans_text` `stt_old` ON `stt_old`.`trans_id`=`cs_old`.`trans_id` AND `stt_old`.`lang`='&2'\n\t           LEFT JOIN `cache_status` `cs_new` ON `cs_new`.`id`=`csm`.`new_state`\n\t\t\t\t\t\tLEFT JOIN `sys_trans_text` `stt_new` ON `stt_new`.`trans_id`=`cs_new`.`trans_id` AND `stt_new`.`lang`='&2'\n\t\t\t\t\t\tLEFT JOIN `user` ON `user`.`user_id`=`csm`.`user_id`\n\t\t            WHERE `cache_id`='&1'\n\t\t         ORDER BY `date_modified` DESC", $this->getCacheId(), $opt['template']['locale']);
     $tpl->assign_rs('status_changes', $rs);
     sql_free_result($rs);
     // coordinate changes
     $rs = sql("SELECT `cc`.`date_created`, `cc`.`longitude`, `cc`.`latitude`,\n\t\t                  IFNULL(`admin`.`user_id`, `owner`.`user_id`) AS `user_id`,\n\t\t                  IFNULL(`admin`.`username`, `owner`.`username`) AS `username`\n\t\t             FROM `cache_coordinates` `cc`\n\t\t        LEFT JOIN `caches` ON `caches`.`cache_id`=`cc`.`cache_id`\n\t\t        LEFT JOIN `user` `owner` ON `owner`.`user_id`=`caches`.`user_id`\n\t\t        LEFT JOIN `user` `admin` ON `admin`.`user_id`=`cc`.`restored_by`\n\t\t            WHERE `cc`.`cache_id`='&1'\n\t\t         ORDER BY `cc`.`date_created` DESC", $this->getCacheId());
     $coords = array();
     while ($rCoord = sql_fetch_assoc($rs)) {
         $coord = new coordinate($rCoord['latitude'], $rCoord['longitude']);
         $coords[] = array('date' => $rCoord['date_created'], 'coord' => $coord->getDecimalMinutes(), 'user_id' => $rCoord['user_id'], 'username' => $rCoord['username']);
     }
     sql_free_result($rs);
     $tpl->assign('coordinates', $coords);
     // Adoptions
     $rs = sql("SELECT `cache_adoptions`.`date`,\n\t\t                  `cache_adoptions`.`from_user_id`,\n\t\t                  `cache_adoptions`.`to_user_id`,\n\t\t                  `from_user`.`username` AS `from_username`,\n\t\t                  `to_user`.`username` AS `to_username`\n\t\t             FROM `cache_adoptions`\n\t\t        LEFT JOIN `user` `from_user` ON `from_user`.`user_id`=`from_user_id`\n\t\t        LEFT JOIN `user` `to_user` ON `to_user`.`user_id`=`to_user_id`\n\t\t            WHERE `cache_id`='&1'\n\t\t         ORDER BY `cache_adoptions`.`date`, `cache_adoptions`.`id`", $this->getCacheId());
     $tpl->assign_rs('adoptions', $rs);
     sql_free_result($rs);
 }
Esempio n. 4
0
 /**
  * @group unit-tests
  * @covers       \coordinate::getDecimalMinutes
  * @dataProvider formatProvider
  *
  * @return void
  */
 public function testFormatConversions($lat, $lon, $expectedMin, $expectedMinSec)
 {
     $coord = new \coordinate($lat, $lon);
     self::assertEquals($expectedMin, $coord->getDecimalMinutes());
     self::assertEquals($expectedMinSec, $coord->getDecimalMinutesSeconds());
 }
Esempio n. 5
0
 $tpl->assign('step', 1);
 $tpl->assign('username', $_REQUEST['username']);
 $rs = sql("SELECT `user_id`, `username`, `is_active_flag` FROM `user` WHERE `username`='&1'", $_REQUEST['username']);
 $r = sql_fetch_assoc($rs);
 sql_free_result($rs);
 if ($r == false) {
     $tpl->assign('error', 'userunknown');
     $tpl->display();
 }
 $tpl->assign('username', $r['username']);
 // get cache set for this user
 $user_id = $r['user_id'];
 $rs = sql("SELECT\n            `cache_id`,\n            `wp_oc`,\n            `name`,\n            `latitude`,\n            `longitude`,\n            `status`,\n            LEFT(`listing_last_modified`,10) AS `last_modified`,\n            (SELECT COUNT(*) FROM `cache_logs` WHERE `cache_logs`.`cache_id`=`caches`.`cache_id`) AS `logs`\n        FROM `caches`\n        WHERE `user_id`='&1'\n        AND `status`!=5", $user_id);
 $caches = array();
 while ($rCache = sql_fetch_assoc($rs)) {
     $coord = new coordinate($rCache['latitude'], $rCache['longitude']);
     $rCache['coordinates'] = $coord->getDecimalMinutes();
     $rCache['data'] = get_archive_data(array($rCache['cache_id']));
     if (count($rCache['data'])) {
         $keys = array_keys($rCache['data']);
         $rCache['date'] = $keys[0];
     }
     $caches[] = $rCache;
 }
 sql_free_result($rs);
 if (count($caches) == 0) {
     $tpl->assign('error', 'nocaches');
 } else {
     // STEP 3: select caches to restore
     $tpl->assign('step', 3);
     $tpl->assign('aCaches', $caches);
Esempio n. 6
0
 *
 *  Unicode Reminder メモ
 ***************************************************************************/
require './lib2/web.inc.php';
require_once './lib2/logic/coordinate.class.php';
$tpl->name = 'coordinates';
$tpl->popup = true;
$lat_float = 0;
if (isset($_REQUEST['lat'])) {
    $lat_float += $_REQUEST['lat'];
}
$lon_float = 0;
if (isset($_REQUEST['lon'])) {
    $lon_float += $_REQUEST['lon'];
}
$coord = new coordinate($lat_float, $lon_float);
$tpl->assign('coordDeg', $coord->getDecimal());
$tpl->assign('coordDegMin', $coord->getDecimalMinutes());
$tpl->assign('coordDegMinSec', $coord->getDecimalMinutesSeconds());
$tpl->assign('coordUTM', $coord->getUTM());
$tpl->assign('coordGK', $coord->getGK());
$tpl->assign('coordQTH', $coord->getQTH());
$tpl->assign('coordSwissGrid', $coord->getSwissGrid());
// wp gesetzt?
$wp = isset($_REQUEST['wp']) ? $_REQUEST['wp'] : '';
if ($wp != '') {
    $rs = sql("SELECT `caches`.`name`, `user`.`username` FROM `caches` INNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id` INNER JOIN `user` ON `user`.`user_id`=`caches`.`user_id` WHERE `cache_status`.`allow_user_view`=1 AND `caches`.`wp_oc`='&1'", $wp);
    if ($r = sql_fetch_array($rs)) {
        $tpl->assign('owner', $r['username']);
        $tpl->assign('cachename', $r['name']);
    }
 public function testFormatConversions()
 {
     $coord = new coordinate(51.52775, -120.8972);
     $decimalMin = $coord->getDecimalMinutes();
     $this->assertEquals("N 51° 31.665'", $decimalMin['lat']);
     $this->assertEquals("W 120° 53.832'", $decimalMin['lon']);
     $decimalMinSec = $coord->getDecimalMinutesSeconds();
     $this->assertEquals("N 51° 31' 39''", $decimalMinSec['lat']);
     $this->assertEquals("W 120° 53' 49''", $decimalMinSec['lon']);
     $coord = new coordinate(-8.81687, 13.24057);
     $decimalMin = $coord->getDecimalMinutes();
     $this->assertEquals("S 08° 49.012'", $decimalMin['lat']);
     $this->assertEquals("E 013° 14.434'", $decimalMin['lon']);
     $decimalMinSec = $coord->getDecimalMinutesSeconds();
     $this->assertEquals("S 08° 49' 00''", $decimalMinSec['lat']);
     $this->assertEquals("E 013° 14' 26''", $decimalMinSec['lon']);
     $coord = new coordinate(52.67578, 6.773);
     $decimalMin = $coord->getDecimalMinutes();
     $this->assertEquals("N 52° 40.547'", $decimalMin['lat']);
     $this->assertEquals("E 006° 46.380'", $decimalMin['lon']);
     $decimalMinSec = $coord->getDecimalMinutesSeconds();
     $this->assertEquals("N 52° 40' 32''", $decimalMinSec['lat']);
     $this->assertEquals("E 006° 46' 22''", $decimalMinSec['lon']);
     $coord = new coordinate(60.63367, 4.81313);
     $decimalMin = $coord->getDecimalMinutes();
     $this->assertEquals("N 60° 38.020'", $decimalMin['lat']);
     $this->assertEquals("E 004° 48.788'", $decimalMin['lon']);
     $decimalMinSec = $coord->getDecimalMinutesSeconds();
     $this->assertEquals("N 60° 38' 01''", $decimalMinSec['lat']);
     $this->assertEquals("E 004° 48' 47''", $decimalMinSec['lon']);
 }
Esempio n. 8
0
function assignFromUser($user)
{
    global $tpl;
    $tpl->assign('username', $user->getUsername());
    $tpl->assign('email', $user->getEMail());
    $tpl->assign('firstName', $user->getFirstName());
    $tpl->assign('lastName', $user->getLastName());
    $tpl->assign('country', $user->getCountry());
    $tpl->assign('countryCode', $user->getCountryCode());
    $coords = new coordinate($user->getLatitude(), $user->getLongitude());
    $tpl->assign('coords', $coords->getDecimalMinutes());
    $tpl->assign('coordsDecimal', $coords->getFloat());
    $tpl->assign('notifyRadius', $user->getNotifyRadius());
    $tpl->assign('registeredSince', $user->getDateRegistered());
    $tpl->assign('usePMR', $user->getUsePMR());
    $tpl->assign('permanentLogin', $user->getPermanentLogin());
    $tpl->assign('noHTMLEditor', $user->getNoHTMLEditor());
}
Esempio n. 9
0
function assignFromUser($user)
{
    global $tpl;
    $tpl->assign('username', $user->getUsername());
    $tpl->assign('email', $user->getEMail());
    $tpl->assign('firstName', $user->getFirstName());
    $tpl->assign('lastName', $user->getLastName());
    $tpl->assign('country', $user->getCountry());
    $tpl->assign('countryCode', $user->getCountryCode());
    $coords = new coordinate($user->getLatitude(), $user->getLongitude());
    $tpl->assign('coords', $coords->getDecimalMinutes());
    $tpl->assign('coordsDecimal', $coords->getFloat());
    $tpl->assign('notifyRadius', $user->getNotifyRadius());
    $tpl->assign('notifyOconly', $user->getNotifyOconly());
    $oconly_helplink = helppagelink('oconly');
    $tpl->assign('oconly_helpstart', $oconly_helplink);
    $tpl->assign('oconly_helpend', $oconly_helplink != '' ? '</a>' : '');
    $tpl->assign('registeredSince', $user->getDateRegistered());
    $tpl->assign('accMailing', $user->getAccMailing());
    $tpl->assign('usePMR', $user->getUsePMR());
    $tpl->assign('permanentLogin', $user->getPermanentLogin());
    $tpl->assign('noHTMLEditor', $user->getNoHTMLEditor());
    $tpl->assign('sendUsermailAddress', $user->getUsermailSendAddress());
}
Esempio n. 10
0
}
foreach ($classes as $class => $methods) {
    $pass &= class_exists($class);
    echo pass_fail('Class ' . $class . ' exists' . PHP_EOL, $pass);
    foreach ($methods as $method) {
        $pass &= method_exists($class, $method);
        echo pass_fail('----- ' . $class . '->' . $method . '() exists' . PHP_EOL, $pass);
    }
    echo PHP_EOL;
}
if (!$pass) {
    die('Extension elements don\'t work :(' . PHP_EOL);
}
$coordinate_1 = new coordinate(52.3033, -0.79195, 1);
$coordinate_2 = new coordinate(52.296616666666665, -0.6392833333333333, 3);
$coordinate_3 = new coordinate(52.19661, -0.62928333, 3, 19);
$set = new coordinate_set(2);
$set->set($coordinate_1);
$set->set($coordinate_2);
$tests = ['52.3033' => $coordinate_1->lat(), '-0.79195' => $coordinate_1->lng(), '1' => $coordinate_1->ele(), '094.023977' => $coordinate_1->get_bearing_to($coordinate_2), '10.407709313555' => $coordinate_1->get_distance_to($coordinate_2), '10.441137' => $coordinate_1->get_distance_to($coordinate_2, true), '52.3033' => $set->first()->lat(), '-0.6392833333333333' => $set->last()->lng(), '19' => $coordinate_3->timestamp()];
foreach ($tests as $key => $value) {
    echo pass_fail(sprintf('----> (%010.6f) = %010.6f', $key, $value), round($key, 6) == round($value, 6)) . PHP_EOL;
}
echo 'Loop test: ' . PHP_EOL;
for ($i = 0; $i < $set->count(); $i++) {
    echo $i . ': ' . $set->get($i)->gridref() . PHP_EOL;
}
echo pass("Looping successful");
echo PHP_EOL;
score_track('igc/1/test.igc', ['OD: 014.50 -> 140,346,642,771,813,', 'OR: 007.88 -> 352,642,771, // GPSDUMP INVALID', 'TR: 009.23 -> 257,345,441,257,']);
// score_track('igc/2/test.igc', [
Esempio n. 11
0
 *
 *  Unicode Reminder メモ
 ***************************************************************************/
require './lib2/web.inc.php';
require_once './lib2/logic/coordinate.class.php';
$tpl->name = 'coordinates';
$tpl->popup = true;
$lat_float = 0;
if (isset($_REQUEST['lat'])) {
    $lat_float += $_REQUEST['lat'];
}
$lon_float = 0;
if (isset($_REQUEST['lon'])) {
    $lon_float += $_REQUEST['lon'];
}
$coord = new coordinate($lat_float, $lon_float);
$tpl->assign('coordDeg', $coord->getDecimal());
$tpl->assign('coordDegMin', $coord->getDecimalMinutes());
$tpl->assign('coordDegMinSec', $coord->getDecimalMinutesSeconds());
$tpl->assign('coordUTM', $coord->getUTM());
$tpl->assign('coordGK', $coord->getGK());
$tpl->assign('coordRD', $coord->getRD());
$tpl->assign('showRD', $coord->nLat >= 45 && $coord->nLat <= 57 && $coord->nLon >= 0 && $coord->nLon <= 15);
$tpl->assign('coordQTH', $coord->getQTH());
$tpl->assign('coordSwissGrid', $coord->getSwissGrid());
$tpl->assign('coordW3Wde', $coord->getW3W('de'));
$tpl->assign('coordW3Wen', $coord->getW3W('en'));
// wp gesetzt?
$wp = isset($_REQUEST['wp']) ? $_REQUEST['wp'] : '';
if ($wp != '') {
    $rs = sql("SELECT `caches`.`name`, `user`.`username` FROM `caches` INNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id` INNER JOIN `user` ON `user`.`user_id`=`caches`.`user_id` WHERE `cache_status`.`allow_user_view`=1 AND `caches`.`wp_oc`='&1'", $wp);