project fork

pull/1/head
Friendika 2011-09-25 01:59:14 -07:00
parent 6a9e22550d
commit 4846d114a8
140 changed files with 15 additions and 12015 deletions

14
LICENSE Normal file
View File

@ -0,0 +1,14 @@
Copyright (c) 2010, 2011 the Friendika Project
All rights reserved.
Redistribution and use in source and binary forms are permitted
provided that the above copyright notice and this paragraph are
duplicated in all such forms and that any documentation,
advertising materials, and other materials related to such
distribution and use acknowledge that the software was developed
by the Friendika Project. The name of the
University may not be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

86
README
View File

@ -1,86 +0,0 @@
*************
* Friendika *
*************
Friendika Communications Server
http://project.friendika.com
Friendika is a web application for managing social communications. Some
would call it a "social network" or "distributed social network". We think
both terms have been over-used, and don't adequately describe Friendika's
capabilities - though Friendika can also fill those roles.
At its essence, Friendika is a web application which can monitor various
information and social activity streams, and which also lets you participate
in online conversations with friends and associates, using a variety of network
protocols. These are combined into an overview of your various communications
and activities - regardless of network origin.
Friendika also manages your personal profiles and photo albums and lets
you securely present each of these to specific audiences. Your communications
can be either open and public, or closed and private. You can easily create
"groups" of contacts with which you can partition your conversations into
private social circles, and which cannot be seen outside the circle.
Friendika is decentralised. Any account on any Friendika server can connect
with any account on any other Friendika server. You can also connect to and
interact directly with friends on Facebook, Status.Net, and other federated
social web services (e.g. identi.ca, GNU-Social, etc.).
Outgoing communications can be directed to Friendika, existing accounts on
Facebook and Twitter, federated social web providers - or even delivered to
email contacts.
Incoming data streams aren't limited to traditional social networks.
They may include most any service which provides a syndication feed (both RSS
and Atom). This allows you to view communications from friends in other
diverse social networks - such as Diaspora, Google Buzz, and millions of
blogs, news services, and other websites. You can also import
contacts from (and write to) anybody that is accessible from your email
INBOX and view them in your social stream. Over time we will try to
build two-way bridges to other services so that you can freely
interact in both directions with anybody on an accessible network that
allows it.
Communications between Friendika servers are private and encrypted,
using military grade encryption - and require mutual identity provenance
before any data is exchanged. These same crypto mechanisms provide remote
password-less authentication; allowing you to post to profiles and view private
photo collections on other servers - without encountering any login and/or
authorisation dialogues when visiting these sites.
Friendika has no boundaries and no central ownership of the data generated
within the network. Anybody with a commodity PHP/MySQL web server or hosting
account can provide a server, and each individual server can then support
up to several thousand participating members - each with their own unique
communication and privacy needs. This allows Friendika to scale to global
levels and mimics the decentralised architecture of the web itself.
If you are creating a website which requires social interaction, Friendika
can also take the place of blog software, forum software and feed readers, and
also provide individualised communications and content management - or
simply be used as an alternative to traditional "monolithic" social networks.
Friendika is also free - in every sense of the word.
Choose freedom - join us.
Find out more about the project at http://project.friendika.com
*******************
Friendika Demo Site
*******************
http://demo.friendika.com
*******************
Friendika Downloads
*******************
http://github.com/friendika/friendika/tarball/master

View File

@ -1,186 +0,0 @@
Friendika Addon/Plugin development
This is an early specification and hook details may be subject to change.
Please see the sample addon 'randplace' for a working example of using these features.
You must register plugins with the system in the .htconfig.php file.
$a->config['system']['addon'] = 'plugin1name, plugin2name, another_name';
Plugin names cannot contain spaces and are used as filenames.
Register your plugin hooks during installation.
register_hook($hookname, $file, $function);
$hookname is a string and corresponds to a known Friendika hook
$file is a pathname relative to the top-level Friendika directory.
This *should* be 'addon/plugin_name/plugin_name.php' in most cases.
$function is a string and is the name of the function which will be executed
when the hook is called.
Your hook functions will be called with at least one and possibly two arguments
function myhook_function(&$a, &$b) {
}
If you wish to make changes to the calling data, you must declare them as
reference variables (with '&') during function declaration.
$a is the Friendika 'App' class - which contains a wealth of information
about the current state of Friendika, such as which module has been called,
configuration info, the page contents at the point the hook was invoked, profile
and user information, etc. It is recommeded you call this '$a' to match its usage
elsewhere.
$b can be called anything you like. This is information which is specific to the hook
currently being processed, and generally contains information that is being immediately
processed or acted on that you can use, display, or alter. Remember to declare it with
'&' if you wish to alter it.
Current hooks:
'authenticate' - called when a user attempts to login.
$b is an array
'username' => the supplied username
'password' => the supplied password
'authenticated' => set this to non-zero to authenticate the user.
'user_record' => successful authentication must also return a valid user record from the database
'logged_in' - called after a user has successfully logged in.
$b contains the $a->user array
'display_item' - called when formatting a post for display.
$b is an array
'item' => The item (array) details pulled from the database
'output' => the (string) HTML representation of this item prior to adding it
to the page
'post_local' - called when a status post or comment is entered on the local system
$b is the item array of the information to be stored in the database
{Please note: body contents are bbcode - not HTML)
'post_local_end' - called when a local status post or comment has been stored on the local system
$b is the item array of the information which has just been stored in the database
{Please note: body contents are bbcode - not HTML)
'post_remote' - called when receiving a post from another source. This may also be used
to post local activity or system generated messages.
$b is the item array of information to be stored in the database and the item
body is bbcode.
'settings_form' - called when generating the HTML for the user Settings page
$b is the (string) HTML of the settings page before the final '</form>' tag.
'settings_post' - called when the Settings pages are submitted.
$b is the $_POST array
'plugin_settings' - called when generating the HTML for the addon settings page
$b is the (string) HTML of the addon settings page before the final '</form>' tag.
'plugin_settings_post' - called when the Addon Settings pages are submitted.
$b is the $_POST array
'profile_post' - called when posting a profile page.
$b is the $_POST array
'profile_edit' - called prior to output of profile edit page
$b is array
'profile' => profile (array) record from the database
'entry' => the (string) HTML of the generated entry
'profile_advanced' - called when the HTML is generated for the 'Advanced profile',
corresponding to the 'Profile' tab within a person's profile page.
$b is the (string) HTML representation of the generated profile
'directory_item' - called from the Directory page when formatting an item for display
$b is an array
'contact' => contact (array) record for the person from the database
'entry' => the (string) HTML of the generated entry
'profile_sidebar_enter' - called prior to generating the sidebar "short" profile for a page
$b is (array) the person's profile array
'profile_sidebar' - called when generating the sidebar "short" profile for a page
$b is an array
'profile' => profile (array) record for the person from the database
'entry' => the (string) HTML of the generated entry
'contact_block_end' - called when formatting the block of contacts/friends on a
profile sidebar has completed
$b is an array
'contacts' => contact array of entries
'output' => the (string) generated HTML of the contact block
'bbcode' - called during conversion of bbcode to html
$b is (string) converted text
'html2bbcode' - called during conversion of html to bbcode (e.g. remote message posting)
$b is (string) converted text
'page_header' - called after building the page navigation section
$b is (string) HTML of nav region
'personal_xrd' - called prior to output of personal XRD file.
$b is an array
'user' => the user record for the person
'xml' => the complete XML to be output
'home_content' - called prior to output home page content, shown to unlogged users
$b is (string) HTML of section region
'contact_edit' - called when editing contact details on an individual from the Contacts page
$b is (array)
'contact' => contact record (array) of target contact
'output' => the (string) generated HTML of the contact edit page
'contact_edit_post' - called when posting the contact edit page
$b is the $_POST array
'init_1' - called just after DB has been opened and before session start
$b is not used or passed
'page_end' - called after HTML content functions have completed
$b is (string) HTML of content div
'jot_plugin' - add tools to jot toolbar
$b is (string) HTML for tool icon
*** = subject to change
Not yet documented:
'atom_feed' ***
'atom_feed_end' ***
'parse_atom' ***
'atom_author' ***
'atom_entry' ***
'parse_link' ***

View File

@ -1,363 +0,0 @@
<?php
/**
* Name: Calculator App
* Description: Simple Calculator Application
* Version: 1.0
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
*/
function calc_install() {
register_hook('app_menu', 'addon/calc/calc.php', 'calc_app_menu');
}
function calc_uninstall() {
unregister_hook('app_menu', 'addon/calc/calc.php', 'calc_app_menu');
}
function calc_app_menu($a,&$b) {
$b['app_menu'] .= '<div class="app-title"><a href="calc">Calculator</a></div>';
}
function calc_module() {}
function calc_init($a) {
$x = <<< EOT
<script language="JavaScript">
/**************************************
* www.FemaleNerd.com *
**************************************/
// Declare global variables
var displayText = ""
var num1
var num2
var operatorType
// Write to display
function addDisplay(n){
id = document.getElementById("display");
id.value = ""
displayText += n
id.value = displayText
}
// Addition
function addNumbers() {
if (displayText == "") {
displayText = result
}
num1 = parseFloat(displayText)
operatorType = "add"
displayText = ""
}
// Subtraction
function subtractNumbers() {
if (displayText == "") {
displayText = result
}
num1 = parseFloat(displayText)
operatorType = "subtract"
displayText = ""
}
// Multiplication
function multiplyNumbers() {
if (displayText == "") {
displayText = result
}
num1 = parseFloat(displayText)
operatorType = "multiply"
displayText = ""
}
// Division
function divideNumbers() {
if (displayText == "") {
displayText = result
}
num1 = parseFloat(displayText)
operatorType = "divide"
displayText = ""
}
// Sine
function sin() {
id = document.getElementById("display");
if (displayText == "") {
num1 = result
}
else {
num1 = parseFloat(displayText)
}
if (num1 != "") {
result = Math.sin(num1)
id.value = result
displayText = ""
}
else {
alert("Please write the number first")
}
}
// Cosine
function cos() {
id = document.getElementById("display");
if (displayText == "") {
num1 = result
}
else {
num1 = parseFloat(displayText)
}
if (num1 != "") {
result = Math.cos(num1)
id.value = result
displayText = ""
}
else {
alert("Please write the number first")
}
}
// ArcSine
function arcSin() {
id = document.getElementById("display");
if (displayText == "") {
num1 = result
}
else {
num1 = parseFloat(displayText)
}
if (num1 != "") {
result = Math.asin(num1)
id.value = result
displayText = ""
}
else {
alert("Please write the number first")
}
}
// ArcCosine
function arcCos() {
id = document.getElementById("display");
if (displayText == "") {
num1 = result
}
else {
num1 = parseFloat(displayText)
}
if (num1 != "") {
result = Math.acos(num1)
id.value = result
displayText = ""
}
else {
alert("Please write the number first")
}
}
// Square root
function sqrt() {
id = document.getElementById("display");
if (displayText == "") {
num1 = result
}
else {
num1 = parseFloat(displayText)
}
if (num1 != "") {
result = Math.sqrt(num1)
id.value = result
displayText = ""
}
else {
alert("Please write the number first")
}
}
// Square number (number to the power of two)
function square() {
id = document.getElementById("display");
if (displayText == "") {
num1 = result
}
else {
num1 = parseFloat(displayText)
}
if (num1 != "") {
result = num1 * num1
id.value = result
displayText = ""
}
else {
alert("Please write the number first")
}
}
// Convert degrees to radians
function degToRad() {
id = document.getElementById("display");
if (displayText == "") {
num1 = result
}
else {
num1 = parseFloat(displayText)
}
if (num1 != "") {
result = num1 * Math.PI / 180
id.value = result
displayText = ""
}
else {
alert("Please write the number first")
}
}
// Convert radians to degrees
function radToDeg() {
id = document.getElementById("display");
if (displayText == "") {
num1 = result
}
else {
num1 = parseFloat(displayText)
}
if (num1 != "") {
result = num1 * 180 / Math.PI
id.value = result
displayText = ""
}
else {
alert("Please write the number first")
}
}
// Calculations
function calculate() {
id = document.getElementById("display");
if (displayText != "") {
num2 = parseFloat(displayText)
// Calc: Addition
if (operatorType == "add") {
result = num1 + num2
id.value = result
}
// Calc: Subtraction
if (operatorType == "subtract") {
result = num1 - num2
id.value = result
}
// Calc: Multiplication
if (operatorType == "multiply") {
result = num1 * num2
id.value = result
}
// Calc: Division
if (operatorType == "divide") {
result = num1 / num2
id.value = result
}
displayText = ""
}
else {
id.value = "Oops! Error!"
}
}
// Clear the display
function clearDisplay() {
id = document.getElementById("display");
displayText = ""
id.value = ""
}
</script>
EOT;
$a->page['htmlhead'] .= $x;
}
function calc_content($app) {
$o = '';
$o .= <<< EOT
<h3>Calculator</h3>
<br /><br />
<table>
<tbody><tr><td>
<table bgcolor="#af9999" border="1">
<tbody><tr><td>
<table border="1" cellpadding="2" cellspacing="2">
<form name="calc">
<!--
<TR><TD VALIGN=top colspan=6 ALIGN="center"> <H2>Calculator</H2> </TD>
-->
<tbody><tr>
<td colspan="5"><input size="22" id="display" name="display" type="text"></td>
</tr><tr align="left" valign="middle">
<td><input name="one" value="&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;" onclick="addDisplay(1)" type="button"></td>
<td><input name="two" value="&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;" onclick="addDisplay(2)" type="button"></td>
<td><input name="three" value="&nbsp;&nbsp;3&nbsp;&nbsp;&nbsp;" onclick="addDisplay(3)" type="button"></td>
<td><input name="plus" value="&nbsp;&nbsp;+&nbsp;&nbsp;&nbsp;" onclick="addNumbers()" type="button"></td>
</tr><tr align="left" valign="middle">
<td><input name="four" value="&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;" onclick="addDisplay(4)" type="button"></td>
<td><input name="five" value="&nbsp;&nbsp;5&nbsp;&nbsp;&nbsp;" onclick="addDisplay(5)" type="button"></td>
<td><input name="six" value="&nbsp;&nbsp;6&nbsp;&nbsp;&nbsp;" onclick="addDisplay(6)" type="button"></td>
<td><input name="minus" value="&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;" onclick="subtractNumbers()" type="button"></td>
</tr><tr align="left" valign="middle">
<td><input name="seven" value="&nbsp;&nbsp;7&nbsp;&nbsp;&nbsp;" onclick="addDisplay(7)" type="button"></td>
<td><input name="eight" value="&nbsp;&nbsp;8&nbsp;&nbsp;&nbsp;" onclick="addDisplay(8)" type="button"></td>
<td><input name="nine" value="&nbsp;&nbsp;9&nbsp;&nbsp;&nbsp;" onclick="addDisplay(9)" type="button"></td>
<td><input name="multiplication" value="&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;" onclick="multiplyNumbers()" type="button"></td>
</tr><tr align="left" valign="middle">
<td><input name="zero" value="&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;" onclick="addDisplay(0)" type="button"></td>
<td><input name="pi" value="&nbsp;Pi&nbsp;&nbsp;" onclick="addDisplay(Math.PI)" type="button"> </td>
<td><input name="dot" value="&nbsp;&nbsp;&nbsp;.&nbsp;&nbsp;&nbsp;" onclick='addDisplay(".")' type="button"></td>
<td><input name="division" value="&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;" onclick="divideNumbers()" type="button"></td>
</tr><tr align="left" valign="middle">
<td><input name="sqareroot" value="sqrt" onclick="sqrt()" type="button"></td>
<td><input name="squarex" value=" x^2" onclick="square()" type="button"></td>
<td><input name="deg-rad" value="d2r&nbsp;" onclick="degToRad()" type="button"></td>
<td><input name="rad-deg" value="r2d&nbsp;" onclick="radToDeg()" type="button"></td>
</tr><tr align="left" valign="middle">
<td><input name="sine" value="&nbsp;sin&nbsp;" onclick="sin()" type="button"></td>
<td><input name="arcsine" value="asin" onclick="arcSin()" type="button"></td>
<td><input name="cosine" value="cos" onclick="cos()" type="button"></td>
<td><input name="arccosine" value="acs" onclick="arcCos()" type="button"></td>
</tr><tr align="left" valign="middle">
<td colspan="2"><input name="clear" value="&nbsp;&nbsp;Clear&nbsp;&nbsp;" onclick="clearDisplay()" type="button"></td>
<td colspan="3"><input name="enter" value="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" onclick="calculate()" type="button"></td>
</tr></tbody></table>
</form>
<!--
<TD VALIGN=top>
<B>NOTE:</B> All sine and cosine calculations are
<br>done in radians. Remember to convert first
<br>if using degrees.
</TD>
-->
</td></tr></tbody></table>
</td></tr></tbody></table>
EOT;
return $o;
}

View File

@ -1,283 +0,0 @@
<?php
// +----------------------------------------------------------------------+
// | PHP version 4.0 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Stanislav Okhvat <stanis@ngs.ru> |
// | Co-authored by : CVH, Chris Hansel <chris@cpi-service.com> |
// +----------------------------------------------------------------------+
//
// $Id: UnitConvertor.php,v 1.00 2002/02/20 11:40:00 stasokhvat Exp $
/**
* UnitConvertor is able to convert between different units and currencies.
*
* @author Stanislav Okhvat <stanis@sibfair.nsk.su, stanis@ngs.ru>
* @version $Id: UnitConvertor.php,v 1.00 2002/03/01 17:00:00 stasokhvat Exp $
* @package UnitConvertor
* @access public
* @history 01.03.2002 Implemented the code for regular and offset-based
* conversions
*
* 13.12.2004
* By Chris Hansel (CVH): changed getConvSpecs in order to have it look up
* intermediary conversions (also see comments in check_key).
*
* Intermediary conversions are useful when no conversion ratio is specified
* between two units when we calculate between the two. For example, we want
* to convert between Fahrenheit and Kelvin, and we have only
* specified how to convert Centigrade<->Fahrenheit and
* Centigrade<->Kelvin. While a direct (Fahrenheit->Kelvin) or
* reverse (Kelvin->Fahrenheit) lookups fail, looking for an intermediary
* unit linking the two (Centigrade) helps us do the conversion.
*
* 13.12.2004
* Chris Hansel (CVH): $to_array argument of addConversion method can now
* contain units as 'unit1/unit2/unit3', when all units stand for the same
* thing. See examples in unitconv.php
*/
class UnitConvertor
{
/**
* Stores conversion ratios.
*
* @var array
* @access private
*/
var $conversion_table = array();
/**
* Decimal point character (default is "." - American - set in constructor).
*
* @var string
* @access private
*/
var $decimal_point;
/**
* Thousands separator (default is "," - American - set in constructor).
*
* @var string
* @access private
*/
var $thousand_separator;
/**
* For future use
*
* @var array
* @access private
*/
var $bases = array();
/**
* Constructor. Initializes the UnitConvertor object with the most important
* properties.
*
* @param string decimal point character
* @param string thousand separator character
* @return void
* @access public
*/
function UnitConvertor($dec_point = '.', $thousand_sep = ',')
{
$this->decimal_point = $dec_point;
$this->thousand_separator = $thousand_sep;
} // end func UnitConvertor
/**
* Adds a conversion ratio to the conversion table.
*
* @param string the name of unit from which to convert
* @param array array(
* "pound"=>array("ratio"=>'', "offset"=>'')
* )
* "pound" - name of unit to set conversion ration to
* "ratio" - 'double' conversion ratio which, when
* multiplied by the number of $from_unit units produces
* the result
* "offset" - an offset from 0 which will be added to
* the result when converting (needed for temperature
* conversions and defaults to 0).
* @return boolean true if successful, false otherwise
* @access public
*/
function addConversion($from_unit, $to_array)
{
if (!isset($this->conversion_table[$from_unit])) {
while(list($key, $val) = each($to_array))
{
if (strstr($key, '/'))
{
$to_units = explode('/', $key);
foreach ($to_units as $to_unit)
{
$this->bases[$from_unit][] = $to_unit;
if (!is_array($val))
{
$this->conversion_table[$from_unit."_".$to_unit] = array("ratio"=>$val, "offset"=>0);
}
else
{
$this->conversion_table[$from_unit."_".$to_unit] =
array(
"ratio"=>$val['ratio'],
"offset"=>(isset($val['offset']) ? $val['offset'] : 0)
);
}
}
}
else
{
$this->bases[$from_unit][] = $key;
if (!is_array($val))
{
$this->conversion_table[$from_unit."_".$key] = array("ratio"=>$val, "offset"=>0);
}
else
{
$this->conversion_table[$from_unit."_".$key] =
array(
"ratio"=>$val['ratio'],
"offset"=>(isset($val['offset']) ? $val['offset'] : 0)
);
}
}
}
return true;
}
return false;
} // end func addConversion
/**
* Converts from one unit to another using specified precision.
*
* @param double value to convert
* @param string name of the source unit from which to convert
* @param string name of the target unit to which we are converting
* @param integer double precision of the end result
* @return void
* @access public
*/
function convert($value, $from_unit, $to_unit, $precision)
{
if ($this->getConvSpecs($from_unit, $to_unit, $value, $converted ))
{
return number_format($converted , (int)$precision, $this->decimal_point, $this->thousand_separator);
} else {
return false;
}
} // end func
/**
* CVH : changed this Function getConvSpecs in order to have it look up
* intermediary Conversions from the
* "base" unit being that one that has the highest hierarchical order in one
* "logical" Conversion_Array
* when taking $conv->addConversion('km',
* array('meter'=>1000, 'dmeter'=>10000, 'centimeter'=>100000,
* 'millimeter'=>1000000, 'mile'=>0.62137, 'naut.mile'=>0.53996,
* 'inch(es)/zoll'=>39370, 'ft/foot/feet'=>3280.8, 'yd/yard'=>1093.6));
* "km" would be the logical base unit for all units of dinstance, thus,
* if the function fails to find a direct or reverse conversion in the table
* it is only logical to suspect that if there is a chance
* converting the value it only is via the "base" unit, and so
* there is not even a need for a recursive search keeping the perfomance
* acceptable and the ressource small...
*
* CVH check_key checks for a key in the Conversiontable and returns a value
*/
function check_key( $key) {
if ( array_key_exists ($key,$this->conversion_table)) {
if (! empty($this->conversion_table[$key])) {
return $this->conversion_table[$key];
}
}
return false;
}
/**
* Key function. Finds the conversion ratio and offset from one unit to another.
*
* @param string name of the source unit from which to convert
* @param string name of the target unit to which we are converting
* @param double conversion ratio found. Returned by reference.
* @param double offset which needs to be added (or subtracted, if negative)
* to the result to convert correctly.
* For temperature or some scientific conversions,
* i.e. Fahrenheit -> Celcius
* @return boolean true if ratio and offset are found for the supplied
* units, false otherwise
* @access private
*/
function getConvSpecs($from_unit, $to_unit, $value, &$converted)
{
$key = $from_unit."_".$to_unit;
$revkey = $to_unit."_".$from_unit;
$found = false;
if ($ct_arr = $this->check_key($key)) {
// Conversion Specs found directly
$ratio = (double)$ct_arr['ratio'];
$offset = $ct_arr['offset'];
$converted = (double)(($value * $ratio)+ $offset);
return true;
} // not found in direct order, try reverse order
elseif ($ct_arr = $this->check_key($revkey)) {
$ratio = (double)(1/$ct_arr['ratio']);
$offset = -$ct_arr['offset'];
$converted = (double)(($value + $offset) * $ratio);
return true;
} // not found test for intermediary conversion
else {
// return ratio = 1 if keyparts match
if ($key == $revkey) {
$ratio = 1;
$offset = 0;
$converted = $value;
return true;
}
// otherwise search intermediary
reset($this->conversion_table);
while (list($convk, $i1_value) = each($this->conversion_table)) {
// split the key into parts
$keyparts = preg_split("/_/",$convk);
// return ratio = 1 if keyparts match
// Now test if either part matches the from or to unit
if ($keyparts[1] == $to_unit && ($i2_value = $this->check_key($keyparts[0]."_".$from_unit))) {
// an intermediary $keyparts[0] was found
// now let us put things together intermediary 1 and 2
$converted = (double)(((($value - $i2_value['offset']) / $i2_value['ratio']) * $i1_value['ratio'])+ $i1_value['offset']);
$found = true;
} elseif ($keyparts[1] == $from_unit && ($i2_value = $this->check_key($keyparts[0]."_".$to_unit))) {
// an intermediary $keyparts[0] was found
// now let us put things together intermediary 2 and 1
$converted = (double)(((($value - $i1_value['offset']) / $i1_value['ratio']) + $i2_value['offset']) * $i2_value['ratio']);
$found = true;
}
}
return $found;
}
} // end func getConvSpecs
} // end class UnitConvertor
?>

View File

@ -1,228 +0,0 @@
<?php
/**
* Name: Converter App
* Description: Unit converter application
* Version: 1.0
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
*/
function convert_install() {
register_hook('app_menu', 'addon/convert/convert.php', 'convert_app_menu');
}
function convert_uninstall() {
unregister_hook('app_menu', 'addon/convert/convert.php', 'convert_app_menu');
}
function convert_app_menu($a,&$b) {
$b['app_menu'] .= '<div class="app-title"><a href="convert">Units Conversion</a></div>';
}
function convert_module() {}
function convert_content($app) {
include("UnitConvertor.php");
class TP_Converter extends UnitConvertor {
function TP_Converter($lang = "en")
{
if ($lang != 'en' ) {
$dec_point = '.'; $thousand_sep = "'";
} else {
$dec_point = '.'; $thousand_sep = ",";
}
$this->UnitConvertor($dec_point , $thousand_sep );
} // end func UnitConvertor
function find_base_unit($from,$to) {
while (list($skey,$sval) = each($this->bases)) {
if ($skey == $from || $to == $skey || in_array($to,$sval) || in_array($from,$sval)) {
return $skey;
}
}
return false;
}
function getTable($value, $from_unit, $to_unit, $precision) {
if ($base_unit = $this->find_base_unit($from_unit,$to_unit)) {
// A baseunit was found now lets convert from -> $base_unit
$cell ['value'] = $this->convert($value, $from_unit, $base_unit, $precision)." ".$base_unit;
$cell ['class'] = ($base_unit == $from_unit || $base_unit == $to_unit) ? "framedred": "";
$cells[] = $cell;
// We now have the base unit and value now lets produce the table;
while (list($key,$val) = each($this->bases[$base_unit])) {
$cell ['value'] = $this->convert($value, $from_unit, $val, $precision)." ".$val;
$cell ['class'] = ($val == $from_unit || $val == $to_unit) ? "framedred": "";
$cells[] = $cell;
}
$cc = count($cells);
$string = "<table class=\"framed grayish\" border=\"1\" cellpadding=\"5\" width=\"80%\" align=\"center\"><tr>";
$string .= "<td rowspan=\"$cc\" align=\"center\">$value $from_unit</td>";
$i=0;
foreach ($cells as $cell) {
if ($i==0) {
$string .= "<td class=\"".$cell['class']."\">".$cell['value']."</td>";
$i++;
} else {
$string .= "</tr><tr><td class=\"".$cell['class']."\">".$cell['value']."</td>";
}
}
$string .= "</tr></table>";
return $string;
}
}
}
$conv = new TP_Converter('en');
$conversions = array(
'Temperature'=>array('base' =>'Celsius',
'conv'=>array(
'Fahrenheit'=>array('ratio'=>1.8, 'offset'=>32),
'Kelvin'=>array('ratio'=>1, 'offset'=>273),
'Reaumur'=>0.8
)
),
'Weight' => array('base' =>'kg',
'conv'=>array(
'g'=>1000,
'mg'=>1000000,
't'=>0.001,
'grain'=>15432,
'oz'=>35.274,
'lb'=>2.2046,
'cwt(UK)' => 0.019684,
'cwt(US)' => 0.022046,
'ton (US)' => 0.0011023,
'ton (UK)' => 0.0009842
)
),
'Distance' => array('base' =>'km',
'conv'=>array(
'm'=>1000,
'dm'=>10000,
'cm'=>100000,
'mm'=>1000000,
'mile'=>0.62137,
'naut.mile'=>0.53996,
'inch(es)'=>39370,
'ft'=>3280.8,
'yd'=>1093.6,
'furlong'=>4.970969537898672,
'fathom'=>546.8066491688539
)
),
'Area' => array('base' =>'km 2',
'conv'=>array(
'ha'=>100,
'acre'=>247.105,
'm 2'=>pow(1000,2),
'dm 2'=>pow(10000,2),
'cm 2'=>pow(100000,2),
'mm 2'=>pow(1000000,2),
'mile 2'=>pow(0.62137,2),
'naut.miles 2'=>pow(0.53996,2),
'in 2'=>pow(39370,2),
'ft 2'=>pow(3280.8,2),
'yd 2'=>pow(1093.6,2),
)
),
'Volume' => array('base' =>'m 3',
'conv'=>array(
'in 3'=>61023.6,
'ft 3'=>35.315,
'cm 3'=>pow(10,6),
'dm 3'=>1000,
'litre'=>1000,
'hl'=>10,
'yd 3'=>1.30795,
'gal(US)'=>264.172,
'gal(UK)'=>219.969,
'pint' => 2113.376,
'quart' => 1056.688,
'cup' => 4266.753,
'fl oz' => 33814.02,
'tablespoon' => 67628.04,
'teaspoon' => 202884.1,
'pt (UK)'=>1000/0.56826,
'barrel petroleum'=>1000/158.99,
'Register Tons'=>2.832,
'Ocean Tons'=>1.1327
)
),
'Speed' =>array('base' =>'kmph',
'conv'=>array(
'mps'=>0.0001726031,
'milesph'=>0.62137,
'knots'=>0.53996,
'mach STP'=>0.0008380431,
'c (warp)'=>9.265669e-10
)
)
);
while (list($key,$val) = each($conversions)) {
$conv->addConversion($val['base'], $val['conv']);
$list[$key][] = $val['base'];
while (list($ukey,$uval) = each($val['conv'])) {
$list[$key][] = $ukey;
}
}
$o .= '<h3>Unit Conversions</h3>';
if (isset($_POST['from_unit']) && isset($_POST['value'])) {
$_POST['value'] = $_POST['value'] + 0;
$o .= ($conv->getTable($_POST['value'], $_POST['from_unit'], $_POST['to_unit'], 5))."</p>";
} else {
$o .= "<p>Select:</p>";
}
if(isset($_POST['value']))
$value = $_POST['value'];
else
$value = '';
$o .= '<form action="convert" method="post" name="conversion">';
$o .= '<input name="value" type="text" id="value" value="' . $value . '" size="10" maxlength="10" />';
$o .= '<select name="from_unit" size="12">';
reset($list);
while(list($key,$val) = each($list)) {
$o .= "\n\t<optgroup label=\"$key\">";
while(list($ukey,$uval) = each($val)) {
$selected = (($uval == $_POST['from_unit']) ? ' selected="selected" ' : '');
$o .= "\n\t\t<option value=\"$uval\" $selected >$uval</option>";
}
$o .= "\n\t</optgroup>";
}
$o .= '</select>';
$o .= '<input type="submit" name="Submit" value="Submit" /></form>';
return $o;
}

View File

@ -1,39 +0,0 @@
Installing the Friendika/Facebook connector
1. register an API key for your site from developer.facebook.com
a. We'd be very happy if you include "Friendika" in the application name
to increase name recognition. The Friendika icons are also present
in the images directory and may be uploaded as a Facebook app icon.
Use images/friendika-16.jpg for the Icon and images/friendika-128.jpg for the Logo.
b. The url should be your site URL with a trailing slash.
You may use http://portal.friendika.com/privacy as the privacy policy
URL unless your site has different requirements, and
http://portal.friendika.com as the Terms of Service URL unless
you have different requirements. (Friendika is a software application
and does not require Terms of Service, though your installation of it might).
c. Set the following values in your .htconfig.php file
$a->config['facebook']['appid'] = 'xxxxxxxxxxx';
$a->config['facebook']['appsecret'] = 'xxxxxxxxxxxxxxx';
Replace with the settings Facebook gives you.
d. Navigate to Set Web->Site URL & Domain -> Website Settings. Set Site URL
to yoursubdomain.yourdomain.com. Set Site Domain to your yourdomain.com.
2. Enable the facebook plugin by including it in .htconfig.php - e.g.
$a->config['system']['addon'] = 'plugin1,plugin2,facebook';
3. Visit the Facebook Settings section of the "Settings->Plugin Settings" page.
and click 'Install Facebook Connector'.
4. This will ask you to login to Facebook and grant permission to the
plugin to do its stuff. Allow it to do so.
5. You're done. To turn it off visit the Plugin Settings page again and
'Remove Facebook posting'.
Vidoes and embeds will not be posted if there is no other content. Links
and images will be converted to a format suitable for the Facebook API and
long posts truncated - with a link to view the full post.
Facebook contacts will not be able to view private photos, as they are not able to
authenticate to your site to establish identity. We will address this
in a future release.
Info: please make sure that you understand all aspects due to Friendika's
default licence which is: Creative Commons Attribution 3.0 (further info:
http://creativecommons.org/licenses/by/3.0/ )

View File

@ -1,13 +0,0 @@
#facebook-enable-wrapper {
margin-top: 20px;
}
#facebook-disable-wrapper {
margin-top: 20px;
}
#facebook-post-default-form input {
margin-top: 20px;
margin-right: 20px;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +0,0 @@
.fortunate {
margin-top: 25px;
margin-left: 100px;
margin-bottom: 25px;
color: #000088;
font-size: 14px;
}

View File

@ -1,27 +0,0 @@
<?php
/**
* Name: Fortunate
* Description: Add a random fortune cookie at the bottom of every pages.
* Version: 1.0
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
*/
function fortunate_install() {
register_hook('page_end', 'addon/fortunate/fortunate.php', 'fortunate_fetch');
}
function fortunate_uninstall() {
unregister_hook('page_end', 'addon/fortunate/fortunate.php', 'fortunate_fetch');
}
function fortunate_fetch($a,&$b) {
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'
. $a->get_baseurl() . '/addon/fortunate/fortunate.css' . '" media="all" />' . "\r\n";
$s = fetch_url('http://fortunemod.com/cookie.php?numlines=2&equal=1&rand=' . mt_rand());
$b .= '<div class="fortunate">' . $s . '</div>';
}

View File

@ -1,27 +0,0 @@
Impressum Plugin for Friendika
Author: Tobias Diekershoff
tobias.diekershoff@gmx.net
License: 3-clause BSD license (same as Friendika)
About
This plugin adds an Impressum block to the /friendika page with informations
about the page operator/owner and how to contact you in case of any questions.
In the notes and postal fields you can use HTML tags for formatting.
Configuration:
For configuration you can set the following variables in the .htconfig file
* $a->config['impressum']['owner'] this is the Name of the Operator
* $a->config['impressum']['ownerprofile'] this is an optional Friendika account
where the above owner name will link to
* $a->config['impressum']['email'] a contact email address (optional)
will be displayed slightly obfuscated
as name(at)example(dot)com
* $a->config['impressum']['postal'] should contain a postal address where
you can be reached at (optional)
* $a->config['impressum']['notes'] additional informations that should
be displayed in the Impressum block

View File

@ -1,6 +0,0 @@
{{ inc field_input.tpl with $field=$owner }}{{ endinc }}
{{ inc field_input.tpl with $field=$ownerprofile }}{{ endinc }}
{{ inc field_input.tpl with $field=$postal }}{{ endinc }}
{{ inc field_input.tpl with $field=$notes }}{{ endinc }}
{{ inc field_input.tpl with $field=$email }}{{ endinc }}
<div class="submit"><input type="submit" name="page_site" value="$submit" /></div>

View File

@ -1,76 +0,0 @@
<?php
/**
* Name: Impressum
* Description: Plugin to add contact information to the about page (/friendika)
* Version: 1.0
* Author: Tobias Diekershoff <https://diekershoff.homeunix.net/friendika/profile/tobias>
* License: 3-clause BSD license
*/
function impressum_install() {
register_hook('about_hook', 'addon/impressum/impressum.php', 'impressum_show');
logger("installed impressum plugin");
}
function impressum_uninstall() {
unregister_hook('about_hook', 'addon/impressum/impressum.php', 'impressum_show');
logger("uninstalled impressum plugin");
}
function obfuscate_email ($s) {
$s = str_replace('@','(at)',$s);
$s = str_replace('.','(dot)',$s);
return $s;
}
function impressum_show($a,&$b) {
$b .= '<h3>'.t('Impressum').'</h3>';
$owner = get_config('impressum', 'owner');
$owner_profile = get_config('impressum','ownerprofile');
$postal = get_config('impressum', 'postal');
$notes = get_config('impressum', 'notes');
$email = obfuscate_email( get_config('impressum','email') );
if (strlen($owner)) {
if (strlen($owner_profile)) {
$tmp = '<a href="'.$owner_profile.'">'.$owner.'</a>';
} else {
$tmp = $owner;
}
if (strlen($email)) {
$b .= '<p><strong>'.t('Site Owner').'</strong>: '. $tmp .'<br /><strong>'.t('Email Address').'</strong>: '.$email.'</p>';
} else {
$b .= '<p><strong>'.t('Site Owner').'</strong>: '. $tmp .'</p>';
}
if (strlen($postal)) {
$b .= '<p><strong>'.t('Postal Address').'</strong><br />'. $postal .'</p>';
}
if (strlen($notes)) {
$b .= '<p>'.$notes.'</p>';
}
} else {
$b .= '<p>'.t('The impressum addon needs to be configured!<br />Please add at least the <tt>owner</tt> variable to your config file. For other variables please refer to the README file of the addon.').'</p>';
}
}
function impressum_plugin_admin_post (&$a) {
$owner = ((x($_POST, 'owner')) ? notags(trim($_POST['owner'])) : '');
$ownerprofile = ((x($_POST, 'ownerprofile')) ? notags(trim($_POST['ownerprofile'])) : '');
$postal = ((x($_POST, 'postal')) ? (trim($_POST['postal'])) : '');
$notes = ((x($_POST, 'notes')) ? (trim($_POST['notes'])) : '');
$email = ((x($_POST, 'email')) ? notags(trim($_POST['email'])) : '');
set_config('impressum','owner',$owner);
set_config('impressum','ownerprofile',$ownerprofile);
set_config('impressum','postal',$postal);
set_config('impressum','email',$email);
set_config('impressum','notes',$notes);
info( t('Settings updated.'). EOL );
}
function impressum_plugin_admin (&$a, &$o) {
$t = file_get_contents( dirname(__file__). "/admin.tpl" );
$o = replace_macros($t, array(
'$submit' => t('Submit'),
'$owner' => array('owner', t('Site Owner'), get_config('impressum','owner'), ''),
'$ownerprofile' => array('ownerprofile', t('Site Owners Profile'), get_config('impressum','ownerprofile'), ''),
'$postal' => array('postal', t('Postal Address'), get_config('impressum','postal'), ''),
'$notes' => array('notes', t('Notes'), get_config('impressum','notes'), ''),
'$email' => array('email', t('Email Address'), get_config('impressum','email'), ''),
));
}

View File

@ -1,38 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="fileuploader.css" rel="stylesheet" type="text/css">
<style>
body {font-size:13px; font-family:arial, sans-serif; width:700px; margin:100px auto;}
</style>
</head>
<body>
<p><a href="http://github.com/valums/file-uploader">Back to project page</a></p>
<p>To upload a file, click on the button below. Drag-and-drop is supported in FF, Chrome.</p>
<p>Progress-bar is supported in FF3.6+, Chrome6+, Safari4+</p>
<div id="file-uploader-demo1">
<noscript>
<p>Please enable JavaScript to use file uploader.</p>
<!-- or put a simple form for upload here -->
</noscript>
</div>
<script src="fileuploader.js" type="text/javascript"></script>
<script>
function createUploader(){
var uploader = new qq.FileUploader({
element: document.getElementById('file-uploader-demo1'),
action: 'do-nothing.htm',
debug: true
});
}
// in your app create uploader as soon as the DOM is ready
// don't wait for the window to load
window.onload = createUploader;
</script>
</body>
</html>

View File

@ -1 +0,0 @@
{success:true}

View File

@ -1,31 +0,0 @@
.qq-uploader { position:relative; width: 100%;}
.qq-upload-button {
display:block; /* or inline-block */
width: 105px; padding: 7px 0; text-align:center;
background:#880000; border-bottom:1px solid #ddd;color:#fff;
}
.qq-upload-button-hover {background:#cc0000;}
.qq-upload-button-focus {outline:1px dotted black;}
.qq-upload-drop-area {
position:absolute; top:0; left:0; width:100%; height:100%; min-height: 70px; z-index:2;
background:#FF9797; text-align:center;
}
.qq-upload-drop-area span {
display:block; position:absolute; top: 50%; width:100%; margin-top:-8px; font-size:16px;
}
.qq-upload-drop-area-active {background:#FF7171;}
.qq-upload-list {margin:15px 35px; padding:0; list-style:disc;}
.qq-upload-list li { margin:0; padding:0; line-height:15px; font-size:12px;}
.qq-upload-file, .qq-upload-spinner, .qq-upload-size, .qq-upload-cancel, .qq-upload-failed-text {
margin-right: 7px;
}
.qq-upload-file {}
.qq-upload-spinner {display:inline-block; background: url("loading.gif"); width:15px; height:15px; vertical-align:text-bottom;}
.qq-upload-size,.qq-upload-cancel {font-size:11px;}
.qq-upload-failed-text {display:none;}
.qq-upload-fail .qq-upload-failed-text {display:inline;}

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -1,339 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.