corrade-http-templates

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 79  →  ?path2? @ 80
/maleFemale/README.txt
@@ -0,0 +1,31 @@
-:[ About ]:-
 
This template records the male-to-female ratio on a simulator by using
Corrade [1] and querying the visual parameters of avatars in range.
 
-:[ Requirements ]:-
 
* A modern browser: Chome, Opera, Firefox, Safari...
* A webserver.
* PHP version 5 and beyond.
* the PHP gd extension (libgd).
* the PHP curl extension.
* PHP composer.
-:[ Setup ]:-
 
1.) Run the following command inside the directory:
 
composer require was/utilities:dev-trunk
 
in order to install all the requirements.
2.) Edit the settings in each PHP file to match the Corrade
settings.
3.) Enable the Corrade permissions for your configured group:
* interact
4.) Place the all the files in a directory on your webserver.
5.) Navigate using a browser to maleFemale.html and enjoy.
 
-:[ References ]:-
 
[1] Corrade - http://grimore.org/secondlife/scripted_agents/corrade
/maleFemale/composer.json
@@ -0,0 +1,9 @@
{
"repositories": [{
"type": "composer",
"url": "https://satis.grimore.org"
}],
"require": {
"was/utilities": "dev-trunk"
}
}
/maleFemale/composer.lock
@@ -0,0 +1,42 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "88cc596af12877df24911e220bc2ae74",
"packages": [
{
"name": "was/utilities",
"version": "dev-trunk",
"source": {
"type": "svn",
"url": "https://svn.grimore.org/was.php",
"reference": "/trunk/@11"
},
"type": "library",
"license": [
"GNU GPLv3"
],
"authors": [
{
"name": "Wizardry and Steamworks",
"email": "office@grimore.org"
}
],
"description": "Wizardry and Steamworks Utilities and Tools",
"time": "2022-03-11T21:35:58+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"was/utilities": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
"plugin-api-version": "2.0.0"
}
/maleFemale/getMaleFemale.php
@@ -18,60 +18,9 @@
## INTERNALS ##
###########################################################################
 
###########################################################################
## Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 ##
###########################################################################
function atomized_get_contents($file) {
$fp = fopen($file, "r+");
$ct = '';
if (flock($fp, LOCK_SH)) {
if (filesize($file)) {
$ct = fread($fp, filesize($file));
}
flock($fp, LOCK_UN);
}
fclose($fp);
return $ct;
}
require_once('vendor/was/utilities/src/formats/csv/csv.php');
require_once('vendor/was/utilities/src/IO/IO.php');
 
///////////////////////////////////////////////////////////////////////////
// Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 //
///////////////////////////////////////////////////////////////////////////
function wasCSVToArray($csv) {
$l = array();
$s = array();
$m = "";
for ($i = 0; $i < strlen($csv); ++$i) {
switch ($csv{$i}) {
case ',':
if (sizeof($s) == 0 || !current($s) == '"') {
array_push($l, $m);
$m = "";
break;
}
$m .= $csv{$i};
continue;
case '"':
if ($i + 1 < strlen($csv) && $csv{$i} == $csv{$i + 1}) {
$m .= $csv{$i};
++$i;
break;
}
if (sizeof($s) == 0|| !current($s) == $csv[$i]) {
array_push($s, $csv{$i});
continue;
}
array_pop($s);
break;
default:
$m .= $csv{$i};
break;
}
}
array_push($l, $m);
return $l;
}
 
$f = 0;
$m = 0;
 
@@ -101,5 +50,3 @@
"Female" => $f
)
);
 
?>
/maleFemale/installAvatars.php
@@ -22,24 +22,9 @@
###########################################################################
## INTERNALS ##
###########################################################################
 
require_once('vendor/was/utilities/src/formats/kvp/kvp.php');
###########################################################################
## Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 ##
###########################################################################
function wasKeyValueGet($key, $data) {
return array_reduce(
explode(
"&",
$data
),
function($o, $p) {
$x = explode("=", $p);
return array_shift($x) != $o ? $o : array_shift($x);
},
$key
);
}
# This constructs the command as an array of key-value pairs.
$params = array(
'command' => 'notify',
@@ -93,5 +78,3 @@
echo 'The following error was encountered while attempting to install the avatars notification: '.$error;
break;
}
?>
/maleFemale/maleFemale.html
@@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Measuring Male-To-Female Ratio on a Simulator</title>
 
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<style type="text/css">
${demo.css}
</style>
/maleFemale/storeMaleFemale.php
@@ -30,118 +30,10 @@
## INTERNALS ##
###########################################################################
 
###########################################################################
## Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 ##
###########################################################################
function wasKeyValueGet($key, $data) {
return array_reduce(
explode(
"&",
$data
),
function($o, $p) {
$x = explode("=", $p);
return array_shift($x) != $o ? $o : array_shift($x);
},
$key
);
}
require_once('vendor/was/utilities/src/formats/kvp/kvp.php');
require_once('vendor/was/utilities/src/IO/IO.php');
require_once('vendor/was/utilities/src/formats/csv/csv.php');
 
###########################################################################
## Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 ##
###########################################################################
function atomized_put_contents($file, $data) {
$fp = fopen($file, "w+");
if (flock($fp, LOCK_EX)) {
fwrite($fp, $data);
fflush($fp);
flock($fp, LOCK_UN);
}
fclose($fp);
}
 
###########################################################################
## Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 ##
###########################################################################
function atomized_get_contents($file) {
$fp = fopen($file, "r+");
$ct = '';
if (flock($fp, LOCK_SH)) {
if (filesize($file)) {
$ct = fread($fp, filesize($file));
}
flock($fp, LOCK_UN);
}
fclose($fp);
return $ct;
}
 
///////////////////////////////////////////////////////////////////////////
// Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 //
///////////////////////////////////////////////////////////////////////////
function wasCSVToArray($csv) {
$l = array();
$s = array();
$m = "";
for ($i = 0; $i < strlen($csv); ++$i) {
switch ($csv{$i}) {
case ',':
if (sizeof($s) == 0 || !current($s) == '"') {
array_push($l, $m);
$m = "";
break;
}
$m .= $csv{$i};
continue;
case '"':
if ($i + 1 < strlen($csv) && $csv{$i} == $csv{$i + 1}) {
$m .= $csv{$i};
++$i;
break;
}
if (sizeof($s) == 0|| !current($s) == $csv[$i]) {
array_push($s, $csv{$i});
continue;
}
array_pop($s);
break;
default:
$m .= $csv{$i};
break;
}
}
array_push($l, $m);
return $l;
}
 
///////////////////////////////////////////////////////////////////////////
// Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 //
///////////////////////////////////////////////////////////////////////////
function wasArrayToCSV($a) {
return implode(
',',
array_map(
function($o) {
$o = str_replace('"', '""', $o);
switch(
(strpos($o, ' ') !== FALSE) ||
(strpos($o, '"') !== FALSE) ||
(strpos($o, ',') !== FALSE) ||
(strpos($o, '\r') !== FALSE) ||
(strpos($o, '\n') !== FALSE)
)
{
case TRUE:
return '"' . $o . '"';
default:
return $o;
}
},
$a
)
);
}
 
$visitors = array();
if(file_exists($VISITOR_FILE)) {
$visitors = explode(
@@ -241,6 +133,3 @@
$visitors
)
);
 
 
?>