Example #1
0
    }
    return $data_line;
}
/***************
END FUNCTIONS
***************/
ini_set('user_agent', '[your app name here]');
//Strava says they like it if you use a user-agent name
//PHONY USER INPUTS
//these are where your user-provided data go.
$file_type = 'GPX';
$user_url = 'http://app.strava.com/rides/13969368';
//PARSING SUBMISSIONS, ASKING FOR API DATA
$target_array = get_target($user_url);
//CHECKING THE RESPONSE FROM STRAVA
check_response($target_array[stream], $target_array[id]);
//SELECTING THE DATA I WANT
$ride_data_array = loop_setup($file_type, $target_array);
//ASSEMBLING A HEADER FOR THE APPROPRIATE FILETYPE
$header = add_header($file_type, $ride_data_array);
//GETTING DATA FOR EACH POINT ON THE STRAVA TARGET
$stream_data = api_call($target_array[id], $target_array[stream]);
//SETTING INITIAL VALUES FOR THE LOOP
$trackpoints = '';
$start_epoch = gps_to_epoch($ride_data_array[ride_date]);
if ($target_array[object] === 'segment') {
    //segments have no time stamps
    $stop_at = count($stream_data->latlng) - 1;
} else {
    //stationary rides have no coordinates
    $stop_at = count($stream_data->time) - 1;
    # Is the user's response the correct birthplace?
    if ($response == $place) {
        print "That is correct!<br />\n";
        printf("%s was born in %s.<br />\n", htmlspecialchars($name), htmlspecialchars($place));
        print "Try the next question:<br /><br />\n";
        present_question($dbh);
    } else {
        printf("\"%s\" is not correct.  Please try again.<br /><br />\n", htmlspecialchars($response));
        $choices = explode("#", $choices);
        display_form($name, $place, $choices);
    }
}
#@ _CHECK_RESPONSE_
#@ _OUTLINE_PART_2_
$title = "U.S. President Quiz";
html_begin($title, $title);
$dbh = sampdb_connect();
#@ _TEST_RESPONSE_
$response = script_param("response");
if (is_null($response)) {
    # invoked for first time
    present_question($dbh);
} else {
    # user submitted response to form
    check_response($dbh);
}
#@ _TEST_RESPONSE_
$dbh = NULL;
# close connection
html_end();
#@ _OUTLINE_PART_2_
Example #3
0
$delContent = $client->getContentStream($obj_del->id);
echo "DEL CONTENT\n";
print $delContent . "\n";
print "\n";

echo "DELETEING " . $obj_del->properties['cmis:name'] . "\n";
$client->deleteObject($obj_del->id);
print "\n";

print "FOLDER AFTER DELETE\n=============================================\n";
$objs = $client->getChildren($my_new_folder->id);
check_response($client);
list_objs($objs);
print "=============================================\n\n";

$sub_folder = $client->createFolder($my_new_folder->id, "SUB_FOLDER");
$client->moveObject($obj_doc->id, $sub_folder->id, $my_new_folder->id);

print "FOLDER AFTER MOVE\n=============================================\n";
$objs = $client->getChildren($my_new_folder->id);
check_response($client);
list_objs($objs);
print "=============================================\n\n";

print "SUB-FOLDER AFTER MOVE\n=============================================\n";
$objs = $client->getChildren($sub_folder->id);
check_response($client);
list_objs($objs);
print "=============================================\n\n";