Merge remote-tracking branch 'upstream/develop' into 1501-better-ostatus

This commit is contained in:
Michael Vogel 2015-01-21 01:30:09 +01:00
commit 1f23d691f3
18 changed files with 291 additions and 69 deletions

View File

@ -59,7 +59,7 @@ After your first login, please visit the 'Settings' page from the top menu bar a
**Getting Started**
A ['Tips for New Members'](newmember) link will show up on your home page for two weeks to provide some important Getting Started information.
A ['Tips for New Members'](newmember) link will show up on your network and home pages for two weeks to provide some important Getting Started information.
**Retrieving Personal Data**

View File

@ -11,21 +11,3 @@ If you're a technical user, or your site doesn't have a support page, you'll nee
Try to provide as much information as you can about the bug, including the **full** text of any error messages or notices, and any steps required to replicate the problem in as much detail as possible. It's generally better to provide too much information than not enough.
<a href="http://www.chiark.greenend.org.uk/~sgtatham/bugs.html">See this article</a> to learn more about submitting **good** bug reports.
**Bug Sponsorship**
If you find a bug, and it is caused by a problem in main branch (ie, is not specific to our site), you may sponsor it.
The bug/issue database allows you to sponsor issues. This provides an incentive for developers to work on your issue. This isn't necessary - we don't like bugs and will try to fix them. This has more importance for future development projects and feature requests.
Bug sponsorship works on the honour system. If you agree to pay $10 to fix a bug, when the fix has been checked in and verified you should send a paypal payment to the developer assigned to the bug. Don't ever think you can get away with not paying a developer for work performed. Some of these guys could hack into your credit card account if you make them mad.
At the present time, one has to be approved as a "developer" to be able to assign themselves to a sponsored bug. This requires the developer to have some history fixing Friendica bugs. This is for everybody's assurance that the bug fix will work well with Friendica. If you wish to become approved as a developer, work on and check in some non-sponsored issues or your own projects and we will move you up the ladder.
If you truly feel you have the solution to a sponsored bug but aren't an approved developer, you risk a sponsored developer assigning the bug to themselves before you check it in, but if they haven't done so - include a short note with your pull request. Assuming that it meets our code standards, we'll see that you get credit.
If you sponsor a project at greater than a $50 level, you may be requested by the developer for payment up front before work has begun (typically half). Again this is on the honour system - and is mostly to avoid payment issues and disagreements later. You should also expect to see some progress updates or demonstrations if the work takes more than a week or two. If the work is not completed within a reasonable time (as decided by those involved), you are entitled to get your money back.
Friendica is not involved in these transactions. It is purely a personal agreement between sponsors and developers. If there are any issues, the parties will need to work it out between themselves. We're just providing some guidelines to help avoid potential problems.

View File

@ -24,13 +24,5 @@ Please pull in any changes from the project repository and merge them with your
Also - **test your changes**. Don't assume that a simple fix won't break something else. If possible get an experienced Friendica developer to review the code.
**Vagrant**
[Vagrant](https://www.vagrantup.com/) is a virtualization solution for developers. No need to setup up a webserver etc. before actually starting. Vagrant creates a virtual machine (an Ubuntu 12.04) for you that you can just run inside VirtualBox and start to work directly on Friendica. What you need to do:
1. Install VirtualBox and vagrant.
2. git clone Friendica (note the Vagrantfile inside).
3. Run vagrant up, have some patience.
4. Run vagrant ssh to log into the virtual machine.
5. It depends on the network setup of your host and virtual box guest how you reach the friendica web interface of the VM.
Check out how to work with [our Vagrant](help/Vagrant) to save a lot of setup time!

View File

@ -37,8 +37,10 @@ Friendica Documentation and Resources
* [Where to get started?](help/Developers-Intro)
* [Help on Github](help/Github)
* [Help on Vagrant](help/Vagrant)
* [How to translate Friendica](help/translations)
* [Bugs and Issues](help/Bugs-and-Issues)
* [Smarty 3 Templates](help/smarty3-templates)
**External Resources**

23
doc/Vagrant.md Normal file
View File

@ -0,0 +1,23 @@
Vagrant for Friendica Developers
===================
* [Home](help)
[Vagrant](https://www.vagrantup.com/) is a virtualization solution for developers. No need to setup up a webserver, database etc. before actually starting. Vagrant creates a virtual machine (an Ubuntu 12.04) for you that you can just run inside VirtualBox and start to work directly on Friendica. What you need to do:
1. Install VirtualBox and vagrant.
2. Git clone your Friendica repository. Inside, you'll find a "Vagrantfile" and some scripts in the utils folder.
3. Run "vagrant up" from inside the friendica clone. Be patient: When it runs for the first time, it downloads an Ubuntu Server image.
4. Run "vagrant ssh" to log into the virtual machine to log in to the VM.
5. Open 192.168.22.10 in a browser to finish the Friendica installation. The mysql database is called "friendica", the mysql user and password both are "root".
6. Work on Friendica's code in your git clone on your machine (not in the VM).
7. Check the changes in your browser in the VM. Debug via the "vagrant ssh" login.
8. Commit and push your changes directly back to Github.
If you want to stop vagrant after finishing your work, run the following command
$> vagrant halt
in the development directory.
For further documentation of vagrant, please see [the vagrant*docs*](https://docs.vagrantup.com/v2/).

173
doc/snarty3-templates.md Normal file
View File

@ -0,0 +1,173 @@
Friendica Templating Documentation
==================================
* [Home](help)
Friendica uses [Smarty 3](http://www.smarty.net/) as PHP templating engine. The main templates are found in
/view/templates
theme authors may overwrite the default templates by putting a files with the same name into the
/view/themes/$themename/templates
directory.
Templates that are only used by addons shall be placed in the
/addon/$addonname/templates
directory.
To render a template use the function *get_markup_template* to load the template and *replace_macros* to replace the macros/variables in the just loaded template file.
$tpl = get_markup_template('install_settings.tpl');
$o .= replace_macros($tpl, array( ... ));
the array consists of an association of an identifier and the value for that identifier, i.e.
'$title' => $install_title,
where the value may as well be an array by its own.
Form Templates
--------------
To guarantee a consistent look and feel for input forms, i.e. in the settings sections, there are templates for the basic form fields. They are initialized with an array of data, depending on the tyle of the field.
All of these take an array for holding the values, i.e. for an one line text input field, which is required and should be used to type email addesses use something along
'$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.'), 'required', '', 'email'),
To evaluate the input value, you can then use the $_POST array, more precisely the $_POST['adminemail'] variable.
Listed below are the template file names, the general purpose of the template and their field parameters.
### field_checkbox.tpl
A checkbox. If the checkbox is checked its value is **1**. Field parameter:
0. Name of the checkbox,
1. Label for the checkbox,
2. State checked? if true then the checkbox will be marked as checked,
3. Help text for the checkbox.
### field_combobox.tpl
A combobox, combining a pull down selection and a textual input field. Field parameter:
0. Name of the combobox,
1. Label for the combobox,
2. Current value of the variable,
3. Help text for the combobox,
4. Array holding the possible values for the textual input,
5. Array holding the possible values for the pull down selection.
### field_custom.tpl
A customizeable template to include a custom element in the form with the usual surroundings, Field parameter:
0. Name of the field,
1. Label for the field,
2. the field,
3. Help text for the field.
### field_input.tpl
A single line input field for textual input. Field parameter:
0. Name of the field,
1. Label for the input box,
2. Current value of the variable,
3. Help text for the input box,
4. if set to "required" modern browser will check that this input box is filled when submitting the form,
5. if set to "autofocus" modern browser will put the cursur into this box once the page is loaded,
6. if set to "email" or "url" modern browser will check that the filled in value corresponds to an email address or URL.
### field_intcheckbox.tpl
A checkbox (see above) but you can define the value of it. Field parameter:
0. Name of the checkbox,
1. Label for the checkbox,
2. State checked? if true then the checkbox will be marked as checked,
3. Value of the checkbox,
4. Help text for the checkbox.
### field_openid.tpl
An input box (see above) but prepared for special CSS styling for openID input. Field parameter:
0. Name of the field,
1. Label for the input box,
2. Current value of the variable,
3. Help text for the input field.
### field_password.tpl
A single line input field (see above) for textual input. The characters typed in will not be shown by the browser. Field parameter:
0. Name of the field,
1. Label for the field,
2. Value for the field, e.g. the old password,
3. Help text for the input field,
4. if set to "required" modern browser will check that this field is filled out,
5. if set to "autofocus" modern browser will put the cursor automatically into this input field.
### field_radio.tpl
A radio button. Field parameter:
0. Name of the radio button,
1. Label for the radio button,
2. Current value of the variable,
3. Help text for the button,
4. if set, the radio button will be checked.
### field_richtext.tpl
A multi-line input field for *rich* textual content. Field parameter:
0. Name of the input field,
1. Label for the input box,
2. Current text for the box,
3. Help text for the input box.
### field_select.tpl
A drop down selection box. Field parameter:
0. Name of the field,
1. Label of the selection box,
2. Current selected value,
3. Help text for the selection box,
4. Array holding the possible values of the selection drop down.
### field_select_raw.tpl
A drop down selection box (see above) but you have to prepare the values yourself. Field parameter:
0. Name of the field,
1. Label of the selection box,
2. Current selected value,
3. Help text for the selection box,
4. Possible values of the selection drop down.
### field_textarea.tpl
A multi-line input field for (plain) textual content. Field parameter:
0. Name of the input field,
1. Label for the input box,
2. Current text for the box,
3. Help text for the input box.
### field_yesno.tpl
A button that has two states *yes* or *no*. Field parameter:
0. Name of the input field,
1. Label for the button,
2. Current value,
3. Help text for the button
4. if set to an array of two values, these two will be used, otherwise "off" and "on".

View File

@ -20,13 +20,18 @@ class Emailer {
call_hooks('emailer_send_prepare', $params);
$email_textonly = False;
if (x($params,"uid")) {
$email_textonly = get_pconfig($params['uid'], "system", "email_textonly");
}
$fromName = email_header_encode(html_entity_decode($params['fromName'],ENT_QUOTES,'UTF-8'),'UTF-8');
$messageSubject = email_header_encode(html_entity_decode($params['messageSubject'],ENT_QUOTES,'UTF-8'),'UTF-8');
// generate a mime boundary
$mimeBoundary =rand(0,9)."-"
.rand(10000000000,9999999999)."-"
.rand(10000000000,9999999999)."=:"
.rand(10000000000,99999999999)."-"
.rand(10000000000,99999999999)."=:"
.rand(10000,99999);
// generate a multipart/alternative message header
@ -44,11 +49,16 @@ class Emailer {
"--" . $mimeBoundary . "\n" . // plain text section
"Content-Type: text/plain; charset=UTF-8\n" .
"Content-Transfer-Encoding: base64\n\n" .
$textBody . "\n" .
$textBody . "\n";
if (!$email_textonly && !is_null($htmlBody)){
$multipartMessageBody .=
"--" . $mimeBoundary . "\n" . // text/html section
"Content-Type: text/html; charset=UTF-8\n" .
"Content-Transfer-Encoding: base64\n\n" .
$htmlBody . "\n" .
$htmlBody . "\n";
}
$multipartMessageBody .=
"--" . $mimeBoundary . "--\n"; // message ending
// send the message
@ -58,6 +68,7 @@ class Emailer {
'body' => $multipartMessageBody,
'headers' => $messageHeader
);
echo "<pre>"; var_dump($hookdata); killme();
call_hooks("emailer_send", $hookdata);
$res = mail(
$hookdata['to'], // send to address

View File

@ -96,13 +96,36 @@
}
$user = $_SERVER['PHP_AUTH_USER'];
$encrypted = hash('whirlpool',trim($_SERVER['PHP_AUTH_PW']));
$password = $_SERVER['PHP_AUTH_PW'];
$encrypted = hash('whirlpool',trim($password));
/**
* next code from mod/auth.php. needs better solution
*/
$record = null;
$addon_auth = array(
'username' => trim($user),
'password' => trim($password),
'authenticated' => 0,
'user_record' => null
);
/**
*
* A plugin indicates successful login by setting 'authenticated' to non-zero value and returning a user record
* Plugins should never set 'authenticated' except to indicate success - as hooks may be chained
* and later plugins should not interfere with an earlier one that succeeded.
*
*/
call_hooks('authenticate', $addon_auth);
if(($addon_auth['authenticated']) && (count($addon_auth['user_record']))) {
$record = $addon_auth['user_record'];
}
else {
// process normal login request
$r = q("SELECT * FROM `user` WHERE ( `email` = '%s' OR `nickname` = '%s' )
@ -111,9 +134,11 @@
dbesc(trim($user)),
dbesc($encrypted)
);
if(count($r)){
if(count($r))
$record = $r[0];
} else {
}
if((! $record) || (! count($record))) {
logger('API_login failure: ' . print_r($_SERVER,true), LOGGER_DEBUG);
header('WWW-Authenticate: Basic realm="Friendica"');
header('HTTP/1.0 401 Unauthorized');

View File

@ -231,11 +231,11 @@ function install_content(&$a) {
'$status' => $wizard_status,
'$dbhost' => array('dbhost', t('Database Server Name'), $dbhost, ''),
'$dbuser' => array('dbuser', t('Database Login Name'), $dbuser, ''),
'$dbpass' => array('dbpass', t('Database Login Password'), $dbpass, ''),
'$dbdata' => array('dbdata', t('Database Name'), $dbdata, ''),
'$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.')),
'$dbhost' => array('dbhost', t('Database Server Name'), $dbhost, '', 'required'),
'$dbuser' => array('dbuser', t('Database Login Name'), $dbuser, '', 'required', 'autofocus'),
'$dbpass' => array('dbpass', t('Database Login Password'), $dbpass, '', 'required'),
'$dbdata' => array('dbdata', t('Database Name'), $dbdata, '', 'required'),
'$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.'), 'required', 'autofocus', 'email'),
@ -274,7 +274,7 @@ function install_content(&$a) {
'$dbdata' => $dbdata,
'$phpath' => $phpath,
'$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.')),
'$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.'), 'required', 'autofocus', 'email'),
'$timezone' => field_timezone('timezone', t('Please select a default timezone for your website'), $timezone, ''),

View File

@ -369,7 +369,7 @@ function network_content(&$a, $update = 0) {
if(feature_enabled(local_user(),'personal_tab')) {
$tabs[] = array(
'label' => t('Personal'),
'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&conv=1',
'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&conv=1',
'sel' => $conv_active,
'title' => t('Posts that mention or involve you'),
);
@ -387,7 +387,7 @@ function network_content(&$a, $update = 0) {
if(feature_enabled(local_user(),'link_tab')) {
$tabs[] = array(
'label' => t('Shared Links'),
'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&bmark=1',
'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&bmark=1',
'sel'=>$bookmarked_active,
'title'=> t('Interesting Links'),
);
@ -396,7 +396,7 @@ function network_content(&$a, $update = 0) {
if(feature_enabled(local_user(),'star_posts')) {
$tabs[] = array(
'label' => t('Starred'),
'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&star=1',
'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&star=1',
'sel'=>$starred_active,
'title' => t('Favourite Posts'),
);

View File

@ -395,6 +395,8 @@ function settings_post(&$a) {
$post_joingroup = (($_POST['post_joingroup'] == 1) ? 1: 0);
$post_profilechange = (($_POST['post_profilechange'] == 1) ? 1: 0);
$email_textonly = (($_POST['email_textonly'] == 1) ? 1 : 0);
$notify = 0;
if(x($_POST,'notify1'))
@ -495,6 +497,7 @@ function settings_post(&$a) {
set_pconfig(local_user(),'system','post_joingroup', $post_joingroup);
set_pconfig(local_user(),'system','post_profilechange', $post_profilechange);
set_pconfig(local_user(),'system','email_textonly', $email_textonly);
if($page_flags == PAGE_PRVGROUP) {
$hidewall = 1;
@ -1179,6 +1182,9 @@ function settings_content(&$a) {
'$notify7' => array('notify7', t('You are tagged in a post'), ($notify & NOTIFY_TAGSELF), NOTIFY_TAGSELF, ''),
'$notify8' => array('notify8', t('You are poked/prodded/etc. in a post'), ($notify & NOTIFY_POKE), NOTIFY_POKE, ''),
'$email_textonly' => array('email_textonly', t('Text-only notification emails'),
get_pconfig(local_user(),'system','email_textonly'),
t('Send text only notification emails, without the html part')),
'$h_advn' => t('Advanced Account/Page Type Settings'),
'$h_descadvn' => t('Change the behaviour of this account for special situations'),

View File

@ -28,6 +28,8 @@ sudo openssl x509 -req -days 365 -in "$SSL_DIR/xip.io.csr" -signkey "$SSL_DIR/xi
#Install apache2
echo ">>> Installing Apache2 webserver"
# The package python-software-properties provides add-apt-repository on Ubuntu Precise Server
sudo apt-get install python-software-properties
sudo add-apt-repository -y ppa:ondrej/apache2
sudo apt-key update
sudo apt-get update

View File

@ -1,6 +1,6 @@
<div class='field input' id='wrapper_{{$field.0}}'>
<label for='id_{{$field.0}}'>{{$field.1}}</label>
<input name='{{$field.0}}' id='id_{{$field.0}}' value="{{$field.2}}">
<input{{if $field.6 eq 'email'}} type='email'{{elseif $field.6 eq 'url'}} type='url'{{/if}} name='{{$field.0}}' id='id_{{$field.0}}' value="{{$field.2}}"{{if $field.4 eq 'required'}} required{{/if}}{{if $field.5 eq 'autofocus'}} autofocus{{/if}}>
<span class='field_help'>{{$field.3}}</span>
</div>

View File

@ -1,6 +1,6 @@
<div class='field password' id='wrapper_{{$field.0}}'>
<label for='id_{{$field.0}}'>{{$field.1}}</label>
<input type='password' name='{{$field.0}}' id='id_{{$field.0}}' value="{{$field.2}}">
<input type='password' name='{{$field.0}}' id='id_{{$field.0}}' value="{{$field.2}}"{{if $field.4 eq 'required'}} required{{/if}}{{if $field.5 eq 'autofocus'}} autofocus{{/if}}>
<span class='field_help'>{{$field.3}}</span>
</div>

View File

@ -131,7 +131,7 @@
<div id="profile-edit-homepage-wrapper" >
<label id="profile-edit-homepage-label" for="profile-edit-homepage" >{{$lbl_homepage}} </label>
<input type="text" size="32" name="homepage" id="profile-edit-homepage" value="{{$homepage}}" />
<input type="url" size="32" name="homepage" id="profile-edit-homepage" value="{{$homepage}}" />
</div>
<div id="profile-edit-homepage-end"></div>

View File

@ -133,6 +133,8 @@
{{include file="field_intcheckbox.tpl" field=$notify8}}
</div>
{{include file="field_checkbox.tpl" field=$email_textonly}}
</div>
<div class="settings-submit-wrapper" >

View File

@ -133,6 +133,8 @@
{{include file="field_intcheckbox.tpl" field=$notify8}}
</div>
{{include file="field_checkbox.tpl" field=$email_textonly}}
</div>
<div class="settings-submit-wrapper" >

View File

@ -129,6 +129,8 @@
{{include file="field_intcheckbox.tpl" field=$notify8}}
</div>
{{include file="field_checkbox.tpl" field=$email_textonly}}
</div>
<div class="settings-submit-wrapper" >