Beispiel #1
0
?>

                    </pre>

                    <h3>Filter</h3>                    
                    <p>Our database can be searched by sending a <code>GET</code> request to <code><?php 
echo $baseurl;
?>
api/filter/</code> with filter commands as variables. Each request will return the number of trails returned as <code>countReturned</code> and the total number of trails matched by the query as <code>totalMatched</code>. Note, you must set <code>offset</code> and <code>count</code>. For example, <code>GET <?php 
echo $baseurl;
?>
api/filter/?by=city&city=Albuquerque&offset=0&count=6 </code> returns the following information in JSON:</p>
                    <pre>

	<?php 
$filterObj = new trails();
$filterResult = $filterObj->filterByLocation("city", "Albuquerque", 0, 6, "Array");
echo json_encode($filterResult, JSON_PRETTY_PRINT);
?>

                    </pre>
                    
                    <h3>Translations</h3>                    
                    <p>Notice that the JSON response for trail requests includes available translations under the key <code>translations</code>. In the request illustrated above, Spanish (es) is listed as an available translation. In order to retrieve this translation, we will send a <code>GET</code> request: <code>GET <?php 
echo $baseurl;
?>
api/translation/?id=2&lang=es</code></p>
                    <pre>

	<?php 
echo json_encode($GetTrail->getTranslation("es", "Array"), JSON_PRETTY_PRINT);
?>
about/api/
<?php 
echo $baseurl;
?>
user/login/
<?php 
echo $baseurl;
?>
user/create/account/
<?php 
echo $baseurl;
?>
user/filter/
<?php 
$allTrailObj = new trails();
$allTrails = $allTrailObj->getAll();
$count = $allTrails['totalMatched'];
$trails = $allTrails['trails'];
foreach ($trails as $id => $trail) {
    echo $trail['url'];
    ?>
 
<?php 
}
foreach ($cities as $id => $city) {
    echo $baseurl . "filter/?by=city&city=" . $city;
    ?>
 
<?php 
}
<?php

require "../db.php";
$page_type = "admin";
$reportObj = new trails();
$report = $reportObj->getReport("largeImgURL", "img/placeholder-lg.png");
$count = $report['totalMatched'];
$trails = $report['trails'];
$title = "Missing Hero Image Report - " . $count . " Total";
$special = "breadcrumb";
$breadcrumb = '<a href="' . $baseurl . 'admin/" class="green-text text-darken-3"><i class="fa fa-home"></i></a>';
$breadcrumb .= '&nbsp;&nbsp;<i class="fa fa-chevron-right grey-text text-darken-1" style="padding-top:1px;"></i>&nbsp;&nbsp;<a href="' . $baseurl . 'report/" class="green-text text-darken-3">Reports</a>&nbsp;&nbsp;<i class="fa fa-chevron-right grey-text text-darken-1" style="padding-top:1px;"></i>&nbsp;&nbsp;<a href="' . $baseurl . 'report/missing_img.php" class="green-text text-darken-3">Missing Images</a>';
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/>
  <title>Prescription Trails</title>

  <!-- CSS  -->
<?php 
require "/nfs/users/clind/public_html/prescriptiontrails.org/src/style_base.php";
?>
  

</head>
<body class="<?php 
echo $bodyclass;
?>
">
Beispiel #4
0
<?php

require "/nfs/users/clind/public_html/prescriptiontrails.org/admin/db.php";
require "PHPExcel.php";
$exportTrails = new trails();
$export = $exportTrails->getAllSheet();
$count = $export['totalMatched'];
$export = $export['trails'];
// Instantiate a new PHPExcel object
$objPHPExcel = new PHPExcel();
$objPHPExcel->getProperties()->setCreator("PT Webserver")->setLastModifiedBy("Jacob Mayfield")->setTitle("Prescription Trails Data Export")->setSubject("Prescription Trails Data Export")->setCategory("Data Dump");
// Set the active Excel worksheet to sheet 0
$objPHPExcel->setActiveSheetIndex(0);
// Initialise the Excel row number
$rowCount = 1;
// Iterate through each result from the SQL query in turn
// We fetch each database result row into $row in turn
foreach ($export as $id => $trail) {
    if ($trail['loopcount'] == 1) {
        $distance = $trail['loops'][1]['distance'];
        $steps = $trail['loops'][1]['steps'];
    } else {
        $looptext = $trail['loopcount'] . " loops";
        $distance = 0;
        $steps = 0;
        foreach ($trail['loops'] as $id => $details) {
            $distance = $trail['loops'][$id]['distance'] + $distance;
            $steps = $trail['loops'][$id]['steps'] + $steps;
        }
    }
    $objPHPExcel->getActiveSheet()->SetCellValue('A' . $rowCount, $trail['id']);
Beispiel #5
0
<?php

require "../../../admin/db.php";
require "../../../src/secure.php";
header('Content-Type: application/javascript');
?>
var SearchTrails = [
<?php 
$all = new trails();
$result = $all->getAll();
$count = $result['totalMatched'];
$trails = $result['trails'];
$return = array();
foreach ($trails as $id => $trail) {
    ?>
      {
        value: "<?php 
    echo $trail['name'];
    ?>
",
        label: "<?php 
    echo $trail['name'];
    ?>
",
        id: <?php 
    echo $trail['id'];
    ?>
,
      },
<?php 
}
Beispiel #6
0
                    $filtertext .= $_GET['grade'];
                }
                $term = $_GET['grade'];
                $filtertext .= " Trails";
                $filtertextsm = $filtertext;
                $filterObj = new trails();
                $filterResult = $filterObj->filterByLocation("grade", $_GET['grade'], 0, 18, "Array");
                $filterCount = $filterResult['countReturned'];
                $totalMatched = $filterResult['totalMatched'];
                $trails = $filterResult['trails'];
            }
            if ($_GET['by'] == "name") {
                $term = urldecode(filter_input(INPUT_GET, 'name', FILTER_SANITIZE_STRING));
                $filtertext = "'" . htmlspecialchars($term, ENT_COMPAT, 'UTF-8') . "'";
                $filtertextsm = $filtertext;
                $filterObj = new trails();
                $filterResult = $filterObj->filterByTerm($term, 0, 18, "Array");
                $filterCount = $filterResult['countReturned'];
                $totalMatched = $filterResult['totalMatched'];
                $trails = $filterResult['trails'];
            }
        }
        require "../src/nav.php";
        ?>
	<ul class="row collapsible white z-depth-2" style="margin-top:-50px; padding-top:0px; padding-bottom:30px;">
       <li>   
          <div class="collapsible-header" id="filterheader" style="margin-top:5px;"><div class="container"><div class="row" style="margin-bottom:0px;"><div class="col s12" style="text-align:center; margin-top:-4px;">&#x25BC;&nbsp;&nbsp;Filtering Options</div></div></div></div>
          <div class="collapsible-body"><div class="container"><div class="row" style="margin-bottom:0px;margin-top:5px;">
              <div class="input-field col s12 m4">
                <select id="filterCity">
                <option value="" disabled selected>Choose city</option>
Beispiel #7
0
        require "/nfs/users/clind/public_html/prescriptiontrails.org/src/nav.php";
        require "../filter/error.php";
        echo "</div>";
        require "/nfs/users/clind/public_html/prescriptiontrails.org/src/drawer.php";
        require "/nfs/users/clind/public_html/prescriptiontrails.org/src/js_base.php";
        exit;
    }
    $coords = array("lat" => $_GET['lat'], "lng" => $_GET['lng']);
    $filterObj = new trails();
    $filterResult = $filterObj->filterByLocation("coord", $coords, 0, 24, "Array");
    $filterCount = $filterResult['countReturned'];
    $totalMatched = $filterResult['totalMatched'];
    $trails = $filterResult['trails'];
    $showLocaiton = true;
} else {
    $allTrails = new trails();
    $result = $allTrails->getAll();
    $count = $result['totalMatched'];
    $trails = $result['trails'];
    $showLocaiton = false;
}
function limit_text($text, $limit)
{
    if (str_word_count($text, 0) > $limit) {
        $words = str_word_count($text, 2);
        $pos = array_keys($words);
        $text = substr($text, 0, $pos[$limit]) . '...';
    }
    return $text;
}
?>
Beispiel #8
0
    //Turn on output buffering, "ob_gzhandler" for the compressed page with gzip.
    echo '/* cached page - ' . date('l jS \\of F Y h:i:s A', filemtime($cache_file)) . ', Page : ' . $dynamic_url . ' */';
    readfile($cache_file);
    //read Cache file
    $output = ob_get_contents();
    ob_end_clean();
    header('Content-Type: application/javascript');
    echo $output;
    exit;
    //no need to proceed further, exit the flow.
}
//Turn on output buffering with gzip compression.
ob_start();
######## Your Website Content Starts Below #########
require "/nfs/users/clind/public_html/prescriptiontrails.org/admin/db.php";
$randomtrailObj = new trails();
$navTrails = $randomtrailObj->getAll();
$navTrails = $navTrails['trails'];
header('Content-Type: application/javascript');
ob_start();
?>
  map = new google.maps.Map(document.getElementById('map'), {
    center: {lat: 35.104912, lng: -106.629581},
    scrollwheel: false,
    zoom: 11
  });
  var infowindow = new google.maps.InfoWindow({
    content: "placeholder"
  });

<?php 
<?php

require "/nfs/users/clind/public_html/prescriptiontrails.org/admin/db.php";
require "/nfs/users/clind/public_html/prescriptiontrails.org/trail/Html2Text.php";
$allTrailObj = new trails();
$allTrails = $allTrailObj->getAllPrint();
$count = $allTrails['totalMatched'];
$trails = $allTrails['trails'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <title>Prescription Trails</title>

  <!-- CSS  -->
<?php 
require "/nfs/users/clind/public_html/prescriptiontrails.org/src/style_base.php";
?>
<style>
/* -------------------------------------------------------------- 
  
 Hartija Css Print  Framework
   * Version:   1.0 
	 
-------------------------------------------------------------- */

body { 
width:100% !important;
margin:0 !important;
padding:0 !important;
Beispiel #10
0
require "admin/db.php";
function shuffle_assoc($list)
{
    if (!is_array($list)) {
        return $list;
    }
    $keys = array_keys($list);
    shuffle($keys);
    $random = array();
    foreach ($keys as $key) {
        $random[$key] = $list[$key];
    }
    return $random;
}
$randomtrailObj = new trails();
$randomtrails = $randomtrailObj->getRand();
$count = $randomtrails['totalMatched'];
$trails = $randomtrails['trails'];
$trails = shuffle_assoc($trails);
$ids = array_keys($trails);
$trails_master = $trails;
$trails = array_slice($trails_master, 0, 12);
$trails_next = array_slice($trails_master, 12, 6);
$trails_last = array_slice($trails_master, 18, 6);
ob_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
Beispiel #11
0
    if ($_GET['by'] == "city" || $_GET['by'] == "zip" || $_GET['by'] == "grade" || $_GET['by'] == "name") {
        if ($_GET['by'] == "city") {
            $search = $_GET['city'];
            if (in_array($_GET['city'], $cities)) {
                $filterObj = new trails();
                $filterResult = $filterObj->filterByLocation("city", filter_input(INPUT_GET, 'city', FILTER_SANITIZE_STRING), intval($_GET['offset']), intval($_GET['count']), "JSON");
            } else {
                $response = array("status" => "error", "type" => "INVALID_CITY", "message" => "City not recognized. " . htmlspecialchars($_GET['city']) . " is not in our system. Filter can be used by city, zip, grade, name, or location. See " . $baseurl . "api/");
                echo json_encode($response);
                exit;
            }
        }
        if ($_GET['by'] == "zip") {
            $filterObj = new trails();
            $filterResult = $filterObj->filterByLocation("zip", intval($_GET['zip']), intval($_GET['offset']), intval($_GET['count']), "JSON");
        }
        if ($_GET['by'] == "grade") {
            $filterObj = new trails();
            $filterResult = $filterObj->filterByLocation("grade", intval($_GET['grade']), intval($_GET['offset']), intval($_GET['count']), "JSON");
        }
        if ($_GET['by'] == "name") {
            $term = urldecode(filter_input(INPUT_GET, 'name', FILTER_SANITIZE_STRING));
            $filterObj = new trails();
            $filterResult = $filterObj->filterByTerm($term, intval($_GET['offset']), intval($_GET['count']), "JSON");
        }
    }
    echo $filterResult;
} else {
    $response = array("status" => "error", "type" => "INVALID_REQUEST", "message" => "Request not recognized. Filter can be used by city, zip, grade, name, or location. See " . $baseurl . "api/");
    echo json_encode($response);
}