Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Michael Vogel 2015-02-24 10:22:42 +01:00
commit 5c0b550f38
149 changed files with 39565 additions and 37785 deletions

4
.gitignore vendored
View file

@ -34,7 +34,11 @@ report/
#ignore cache folders #ignore cache folders
/privacy_image_cache/ /privacy_image_cache/
/photo/ /photo/
/proxy/
nbproject nbproject
#ignore vagrant dir #ignore vagrant dir
.vagrant/ .vagrant/
#ignore local folder
/local/

View file

@ -1,3 +1,37 @@
Version 3.3.3
More separation between php and html in photo album (issue #1258) (rabuzarus)
Enhanced community page shows public posts from public contacts of public profiles (annando)
Support for IndieAuth/Web-sign-in (hauke)
New hooks "emailer_send_prepare" and "emailer_send" (fabrixxm)
New hook "oembed_fetch_url" (annando)
Add un/ignore function to quattro theme (tobiasd)
Enhanced POCO data (annando)
Use HTML5 features to validate inputs in install wizard and in some settings fields (tobiasd)
Option to receive text-only notification emails (fabrixxm)
Better OStatus support (annando)
Share-it button support (annando)
More reliable reshare from Diaspora (annando)
Load more images via proxy (annando)
util/typo.php uses "php -l" insead of "eval()" to validate code (fabrixxm)
Use $_SERVER array in cli script instead of $argv/$argc (issue #1218) (annando)
Updated vagrant setup script (silke)
API: support to star/unstar items (fabrixxm)
API: attachments for better AndStatus support (annando)
Fix missing spaces in photo URLs (issue #920) (annando)
Fix avatar for "remote-self" items (annando)
Fix encodings issues with scrape functionality (annando)
Fix site info scraping when URL points to big file (annando)
Fix tools for translations (ddorian1)
Fix API login via LDAP (issue #1286) (fabrixxm)
Fix to link URL in tabs, pager (issues #1341, #1190) (ddorian1)
Fix poke activities translation (fabrixxm)
Fix html escaping in templates (fabrixxm)
Fix Friendica contacts shown as Diaspora contacts via Poco (annando)
Fix shared contacts wrong linking (issue #1388) (annando)
Fix email validation (ddorian1)
Better documentation for developers (silke)
Version 3.3.2 Version 3.3.2
Set default value for all not-null fields (fixes SQL warinigs) (annando) Set default value for all not-null fields (fixes SQL warinigs) (annando)

View file

@ -16,9 +16,9 @@ require_once('include/dbstructure.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_CODENAME', 'Ginger'); define ( 'FRIENDICA_CODENAME', 'Ginger');
define ( 'FRIENDICA_VERSION', '3.3.2' ); define ( 'FRIENDICA_VERSION', '3.3.3' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1175 ); define ( 'DB_UPDATE_VERSION', 1178 );
define ( 'EOL', "<br />\r\n" ); define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
@ -435,7 +435,7 @@ if(! class_exists('App')) {
function __construct() { function __construct() {
global $default_timezone, $argv, $argc; global $default_timezone;
$hostname = ""; $hostname = "";
@ -504,9 +504,9 @@ if(! class_exists('App')) {
if ($hostname != "") if ($hostname != "")
$this->hostname = $hostname; $this->hostname = $hostname;
if (is_array($argv) && $argc>1 && substr(end($argv), 0, 4)=="http" ) { if (is_array($_SERVER["argv"]) && $_SERVER["argc"]>1 && substr(end($_SERVER["argv"]), 0, 4)=="http" ) {
$this->set_baseurl(array_pop($argv) ); $this->set_baseurl(array_pop($_SERVER["argv"]) );
$argc --; $_SERVER["argc"] --;
} }
#set_include_path("include/$this->hostname" . PATH_SEPARATOR . get_include_path()); #set_include_path("include/$this->hostname" . PATH_SEPARATOR . get_include_path());
@ -1649,8 +1649,10 @@ if(! function_exists('profile_sidebar')) {
$homepage = ((x($profile,'homepage') == 1) ? t('Homepage:') : False); $homepage = ((x($profile,'homepage') == 1) ? t('Homepage:') : False);
$about = ((x($profile,'about') == 1) ? t('About:') : False);
if(($profile['hidewall'] || $block) && (! local_user()) && (! remote_user())) { if(($profile['hidewall'] || $block) && (! local_user()) && (! remote_user())) {
$location = $pdesc = $gender = $marital = $homepage = False; $location = $pdesc = $gender = $marital = $homepage = $about = False;
} }
$firstname = ((strpos($profile['name'],' ')) $firstname = ((strpos($profile['name'],' '))
@ -1695,6 +1697,7 @@ if(! function_exists('profile_sidebar')) {
'$pdesc' => $pdesc, '$pdesc' => $pdesc,
'$marital' => $marital, '$marital' => $marital,
'$homepage' => $homepage, '$homepage' => $homepage,
'$about' => $about,
'$network' => t('Network:'), '$network' => t('Network:'),
'$diaspora' => $diaspora, '$diaspora' => $diaspora,
'$contact_block' => $contact_block, '$contact_block' => $contact_block,
@ -2071,7 +2074,7 @@ if(! function_exists('load_contact_links')) {
if(! $uid || x($a->contacts,'empty')) if(! $uid || x($a->contacts,'empty'))
return; return;
$r = q("SELECT `id`,`network`,`url`,`thumb` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 ", $r = q("SELECT `id`,`network`,`url`,`thumb` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `thumb` != ''",
intval($uid) intval($uid)
); );
if(count($r)) { if(count($r)) {

View file

@ -59,7 +59,7 @@ After your first login, please visit the 'Settings' page from the top menu bar a
**Getting Started** **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** **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. 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. <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. 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** Check out how to work with [our Vagrant](help/Vagrant) to save a lot of setup time!
[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.

View file

@ -37,8 +37,10 @@ Friendica Documentation and Resources
* [Where to get started?](help/Developers-Intro) * [Where to get started?](help/Developers-Intro)
* [Help on Github](help/Github) * [Help on Github](help/Github)
* [Help on Vagrant](help/Vagrant)
* [How to translate Friendica](help/translations) * [How to translate Friendica](help/translations)
* [Bugs and Issues](help/Bugs-and-Issues) * [Bugs and Issues](help/Bugs-and-Issues)
* [Smarty 3 Templates](help/smarty3-templates)
**External Resources** **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); 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'); $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'); $messageSubject = email_header_encode(html_entity_decode($params['messageSubject'],ENT_QUOTES,'UTF-8'),'UTF-8');
// generate a mime boundary // generate a mime boundary
$mimeBoundary =rand(0,9)."-" $mimeBoundary =rand(0,9)."-"
.rand(10000000000,9999999999)."-" .rand(10000000000,99999999999)."-"
.rand(10000000000,9999999999)."=:" .rand(10000000000,99999999999)."=:"
.rand(10000,99999); .rand(10000,99999);
// generate a multipart/alternative message header // generate a multipart/alternative message header
@ -44,11 +49,16 @@ class Emailer {
"--" . $mimeBoundary . "\n" . // plain text section "--" . $mimeBoundary . "\n" . // plain text section
"Content-Type: text/plain; charset=UTF-8\n" . "Content-Type: text/plain; charset=UTF-8\n" .
"Content-Transfer-Encoding: base64\n\n" . "Content-Transfer-Encoding: base64\n\n" .
$textBody . "\n" . $textBody . "\n";
"--" . $mimeBoundary . "\n" . // text/html section
"Content-Type: text/html; charset=UTF-8\n" . if (!$email_textonly && !is_null($params['htmlVersion'])){
"Content-Transfer-Encoding: base64\n\n" . $multipartMessageBody .=
$htmlBody . "\n" . "--" . $mimeBoundary . "\n" . // text/html section
"Content-Type: text/html; charset=UTF-8\n" .
"Content-Transfer-Encoding: base64\n\n" .
$htmlBody . "\n";
}
$multipartMessageBody .=
"--" . $mimeBoundary . "--\n"; // message ending "--" . $mimeBoundary . "--\n"; // message ending
// send the message // send the message
@ -58,6 +68,7 @@ class Emailer {
'body' => $multipartMessageBody, 'body' => $multipartMessageBody,
'headers' => $messageHeader 'headers' => $messageHeader
); );
//echo "<pre>"; var_dump($hookdata); killme();
call_hooks("emailer_send", $hookdata); call_hooks("emailer_send", $hookdata);
$res = mail( $res = mail(
$hookdata['to'], // send to address $hookdata['to'], // send to address

View file

@ -343,6 +343,12 @@ function probe_url($url, $mode = PROBE_NORMAL) {
if(! $url) if(! $url)
return $result; return $result;
$result = Cache::get("probe_url:".$mode.":".$url);
if (!is_null($result)) {
$result = unserialize($result);
return $result;
}
$network = null; $network = null;
$diaspora = false; $diaspora = false;
$diaspora_base = ''; $diaspora_base = '';
@ -350,6 +356,23 @@ function probe_url($url, $mode = PROBE_NORMAL) {
$diaspora_key = ''; $diaspora_key = '';
$has_lrdd = false; $has_lrdd = false;
$email_conversant = false; $email_conversant = false;
$connectornetworks = false;
$appnet = false;
if (strpos($url,'twitter.com')) {
$connectornetworks = true;
$network = NETWORK_TWITTER;
}
if (strpos($url,'www.facebook.com')) {
$connectornetworks = true;
$network = NETWORK_FACEBOOK;
}
if (strpos($url,'alpha.app.net')) {
$appnet = true;
$network = NETWORK_APPNET;
}
// Twitter is deactivated since twitter closed its old API // Twitter is deactivated since twitter closed its old API
//$twitter = ((strpos($url,'twitter.com') !== false) ? true : false); //$twitter = ((strpos($url,'twitter.com') !== false) ? true : false);
@ -357,7 +380,7 @@ function probe_url($url, $mode = PROBE_NORMAL) {
$at_addr = ((strpos($url,'@') !== false) ? true : false); $at_addr = ((strpos($url,'@') !== false) ? true : false);
if((! $twitter) && (! $lastfm)) { if((!$appnet) && (!$lastfm) && !$connectornetworks) {
if(strpos($url,'mailto:') !== false && $at_addr) { if(strpos($url,'mailto:') !== false && $at_addr) {
$url = str_replace('mailto:','',$url); $url = str_replace('mailto:','',$url);
@ -401,6 +424,9 @@ function probe_url($url, $mode = PROBE_NORMAL) {
$pubkey = $diaspora_key; $pubkey = $diaspora_key;
$diaspora = true; $diaspora = true;
} }
if($link['@attributes']['rel'] === 'http://ostatus.org/schema/1.0/subscribe') {
$diaspora = false;
}
} }
// Status.Net can have more than one profile URL. We need to match the profile URL // Status.Net can have more than one profile URL. We need to match the profile URL
@ -597,13 +623,16 @@ function probe_url($url, $mode = PROBE_NORMAL) {
// Will leave it to others to figure out how to grab the avatar, which is on the $url page in the open graph meta links // Will leave it to others to figure out how to grab the avatar, which is on the $url page in the open graph meta links
} }
if($twitter || ! $poll) if($appnet || ! $poll)
$check_feed = true; $check_feed = true;
if((! isset($vcard)) || (! x($vcard,'fn')) || (! $profile)) if((! isset($vcard)) || (! x($vcard,'fn')) || (! $profile))
$check_feed = true; $check_feed = true;
if(($at_addr) && (! count($links))) if(($at_addr) && (! count($links)))
$check_feed = false; $check_feed = false;
if ($connectornetworks)
$check_feed = false;
if($check_feed) { if($check_feed) {
$feedret = scrape_feed(($poll) ? $poll : $url); $feedret = scrape_feed(($poll) ? $poll : $url);
@ -750,5 +779,16 @@ function probe_url($url, $mode = PROBE_NORMAL) {
logger('probe_url: ' . print_r($result,true), LOGGER_DEBUG); logger('probe_url: ' . print_r($result,true), LOGGER_DEBUG);
// Trying if it maybe a diaspora account
if ($result['network'] == NETWORK_FEED) {
require_once('include/bbcode.php');
$address = GetProfileUsername($url, "", true);
$result2 = probe_url($address, $mode);
if ($result2['network'] != "")
$result = $result2;
}
Cache::set("probe_url:".$mode.":".$url,serialize($result));
return $result; return $result;
} }

View file

@ -2,13 +2,14 @@
require_once("include/contact_selectors.php"); require_once("include/contact_selectors.php");
require_once("include/features.php"); require_once("include/features.php");
require_once("mod/proxy.php");
/** /**
* *
*/ */
/** /**
* @package acl_selectors * @package acl_selectors
*/ */
function group_select($selname,$selclass,$preselected = false,$size = 4) { function group_select($selname,$selclass,$preselected = false,$size = 4) {
@ -35,11 +36,12 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) {
$selected = " selected=\"selected\" "; $selected = " selected=\"selected\" ";
else else
$selected = ''; $selected = '';
$trimmed = mb_substr($rr['name'],0,12); $trimmed = mb_substr($rr['name'],0,12);
$o .= "<option value=\"{$rr['id']}\" $selected title=\"{$rr['name']}\" >$trimmed</option>\r\n"; $o .= "<option value=\"{$rr['id']}\" $selected title=\"{$rr['name']}\" >$trimmed</option>\r\n";
} }
} }
$o .= "</select>\r\n"; $o .= "</select>\r\n";
@ -89,13 +91,13 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
$networks = array('dfrn','mail','dspr'); $networks = array('dfrn','mail','dspr');
else else
$networks = array('dfrn','face','mail','dspr','stat'); $networks = array('dfrn','face','mail','dspr','stat');
break; break;
default: default:
break; break;
} }
} }
} }
$x = array('options' => $options, 'size' => $size, 'single' => $single, 'mutual' => $mutual, 'exclude' => $exclude, 'networks' => $networks); $x = array('options' => $options, 'size' => $size, 'single' => $single, 'mutual' => $mutual, 'exclude' => $exclude, 'networks' => $networks);
call_hooks('contact_select_options', $x); call_hooks('contact_select_options', $x);
@ -117,15 +119,15 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
$str_nets = implode(',',$x['networks']); $str_nets = implode(',',$x['networks']);
$sql_extra .= " AND `network` IN ( $str_nets ) "; $sql_extra .= " AND `network` IN ( $str_nets ) ";
} }
$tabindex = (x($options, 'tabindex') ? "tabindex=\"" . $options["tabindex"] . "\"" : ""); $tabindex = (x($options, 'tabindex') ? "tabindex=\"" . $options["tabindex"] . "\"" : "");
if($x['single']) if($x['single'])
$o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"" . $x['size'] . "\" $tabindex >\r\n"; $o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"" . $x['size'] . "\" $tabindex >\r\n";
else else
$o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"" . $x['size'] . "$\" $tabindex >\r\n"; $o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"" . $x['size'] . "$\" $tabindex >\r\n";
$r = q("SELECT `id`, `name`, `url`, `network` FROM `contact` $r = q("SELECT `id`, `name`, `url`, `network` FROM `contact`
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != '' WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != ''
$sql_extra $sql_extra
ORDER BY `name` ASC ", ORDER BY `name` ASC ",
@ -150,7 +152,7 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
$o .= "<option value=\"{$rr['id']}\" $selected title=\"{$rr['name']}|{$rr['url']}\" >$trimmed</option>\r\n"; $o .= "<option value=\"{$rr['id']}\" $selected title=\"{$rr['name']}|{$rr['url']}\" >$trimmed</option>\r\n";
} }
} }
$o .= "</select>\r\n"; $o .= "</select>\r\n";
@ -164,6 +166,8 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
function contact_select($selname, $selclass, $preselected = false, $size = 4, $privmail = false, $celeb = false, $privatenet = false, $tabindex = null) { function contact_select($selname, $selclass, $preselected = false, $size = 4, $privmail = false, $celeb = false, $privatenet = false, $tabindex = null) {
require_once("include/bbcode.php");
$a = get_app(); $a = get_app();
$o = ''; $o = '';
@ -180,7 +184,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
if($privmail) { if($privmail) {
$sql_extra .= " AND `network` IN ( 'dfrn', 'dspr' ) "; $sql_extra .= " AND `network` IN ( 'dfrn', 'dspr' ) ";
} }
elseif($privatenet) { elseif($privatenet) {
$sql_extra .= " AND `network` IN ( 'dfrn', 'mail', 'face', 'dspr' ) "; $sql_extra .= " AND `network` IN ( 'dfrn', 'mail', 'face', 'dspr' ) ";
} }
@ -188,10 +192,10 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
if($privmail) if($privmail)
$o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"$size\" $tabindex >\r\n"; $o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"$size\" $tabindex >\r\n";
else else
$o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\" $tabindex >\r\n"; $o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\" $tabindex >\r\n";
$r = q("SELECT `id`, `name`, `url`, `network` FROM `contact` $r = q("SELECT `id`, `name`, `url`, `network` FROM `contact`
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != '' WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != ''
$sql_extra $sql_extra
ORDER BY `name` ASC ", ORDER BY `name` ASC ",
@ -212,11 +216,14 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
else else
$selected = ''; $selected = '';
$trimmed = mb_substr($rr['name'],0,20); if($privmail)
$trimmed = GetProfileUsername($rr['url'], $rr['name'], false);
else
$trimmed = mb_substr($rr['name'],0,20);
$o .= "<option value=\"{$rr['id']}\" $selected title=\"{$rr['name']}|{$rr['url']}\" >$trimmed</option>\r\n"; $o .= "<option value=\"{$rr['id']}\" $selected title=\"{$rr['name']}|{$rr['url']}\" >$trimmed</option>\r\n";
} }
} }
$o .= "</select>\r\n"; $o .= "</select>\r\n";
@ -239,7 +246,7 @@ function prune_deadguys($arr) {
$r = q("select id from contact where id in ( " . $str . ") and blocked = 0 and pending = 0 and archive = 0 "); $r = q("select id from contact where id in ( " . $str . ") and blocked = 0 and pending = 0 and archive = 0 ");
if($r) { if($r) {
$ret = array(); $ret = array();
foreach($r as $rr) foreach($r as $rr)
$ret[] = intval($rr['id']); $ret[] = intval($rr['id']);
return $ret; return $ret;
} }
@ -251,7 +258,7 @@ function get_acl_permissions($user = null) {
$allow_cid = $allow_gid = $deny_cid = $deny_gid = false; $allow_cid = $allow_gid = $deny_cid = $deny_gid = false;
if(is_array($user)) { if(is_array($user)) {
$allow_cid = ((strlen($user['allow_cid'])) $allow_cid = ((strlen($user['allow_cid']))
? explode('><', $user['allow_cid']) : array() ); ? explode('><', $user['allow_cid']) : array() );
$allow_gid = ((strlen($user['allow_gid'])) $allow_gid = ((strlen($user['allow_gid']))
? explode('><', $user['allow_gid']) : array() ); ? explode('><', $user['allow_gid']) : array() );
@ -411,21 +418,21 @@ function acl_lookup(&$a, $out_type = 'json') {
} }
if ($type=='' || $type=='c'){ if ($type=='' || $type=='c'){
$r = q("SELECT COUNT(*) AS c FROM `contact` $r = q("SELECT COUNT(*) AS c FROM `contact`
WHERE `uid` = %d AND `self` = 0 WHERE `uid` = %d AND `self` = 0
AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0
AND `notify` != '' $sql_extra2" , AND `notify` != '' $sql_extra2" ,
intval(local_user()) intval(local_user())
); );
$contact_count = (int)$r[0]['c']; $contact_count = (int)$r[0]['c'];
} }
elseif ($type == 'm') { elseif ($type == 'm') {
// autocomplete for Private Messages // autocomplete for Private Messages
$r = q("SELECT COUNT(*) AS c FROM `contact` $r = q("SELECT COUNT(*) AS c FROM `contact`
WHERE `uid` = %d AND `self` = 0 WHERE `uid` = %d AND `self` = 0
AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0
AND `network` IN ('%s','%s','%s') $sql_extra2" , AND `network` IN ('%s','%s','%s') $sql_extra2" ,
intval(local_user()), intval(local_user()),
dbesc(NETWORK_DFRN), dbesc(NETWORK_DFRN),
@ -439,8 +446,8 @@ function acl_lookup(&$a, $out_type = 'json') {
// autocomplete for Contacts // autocomplete for Contacts
$r = q("SELECT COUNT(*) AS c FROM `contact` $r = q("SELECT COUNT(*) AS c FROM `contact`
WHERE `uid` = %d AND `self` = 0 WHERE `uid` = %d AND `self` = 0
AND `pending` = 0 $sql_extra2" , AND `pending` = 0 $sql_extra2" ,
intval(local_user()) intval(local_user())
); );
@ -449,22 +456,22 @@ function acl_lookup(&$a, $out_type = 'json') {
} else { } else {
$contact_count = 0; $contact_count = 0;
} }
$tot = $group_count+$contact_count; $tot = $group_count+$contact_count;
$groups = array(); $groups = array();
$contacts = array(); $contacts = array();
if ($type=='' || $type=='g'){ if ($type=='' || $type=='g'){
$r = q("SELECT `group`.`id`, `group`.`name`, GROUP_CONCAT(DISTINCT `group_member`.`contact-id` SEPARATOR ',') as uids $r = q("SELECT `group`.`id`, `group`.`name`, GROUP_CONCAT(DISTINCT `group_member`.`contact-id` SEPARATOR ',') as uids
FROM `group`,`group_member` FROM `group`,`group_member`
WHERE `group`.`deleted` = 0 AND `group`.`uid` = %d WHERE `group`.`deleted` = 0 AND `group`.`uid` = %d
AND `group_member`.`gid`=`group`.`id` AND `group_member`.`gid`=`group`.`id`
$sql_extra $sql_extra
GROUP BY `group`.`id` GROUP BY `group`.`id`
ORDER BY `group`.`name` ORDER BY `group`.`name`
LIMIT %d,%d", LIMIT %d,%d",
intval(local_user()), intval(local_user()),
intval($start), intval($start),
@ -472,7 +479,7 @@ function acl_lookup(&$a, $out_type = 'json') {
); );
foreach($r as $g){ foreach($r as $g){
// logger('acl: group: ' . $g['name'] . ' members: ' . $g['uids']); // logger('acl: group: ' . $g['name'] . ' members: ' . $g['uids']);
$groups[] = array( $groups[] = array(
"type" => "g", "type" => "g",
"photo" => "images/twopeople.png", "photo" => "images/twopeople.png",
@ -484,10 +491,10 @@ function acl_lookup(&$a, $out_type = 'json') {
); );
} }
} }
if ($type=='' || $type=='c'){ if ($type=='' || $type=='c'){
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, forum FROM `contact` $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, forum FROM `contact`
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != '' WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != ''
$sql_extra2 $sql_extra2
ORDER BY `name` ASC ", ORDER BY `name` ASC ",
@ -495,7 +502,7 @@ function acl_lookup(&$a, $out_type = 'json') {
); );
} }
elseif($type == 'm') { elseif($type == 'm') {
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag` FROM `contact` $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag` FROM `contact`
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0
AND `network` IN ('%s','%s','%s') AND `network` IN ('%s','%s','%s')
$sql_extra2 $sql_extra2
@ -507,7 +514,7 @@ function acl_lookup(&$a, $out_type = 'json') {
); );
} }
elseif($type == 'a') { elseif($type == 'a') {
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag` FROM `contact` $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag` FROM `contact`
WHERE `uid` = %d AND `pending` = 0 WHERE `uid` = %d AND `pending` = 0
$sql_extra2 $sql_extra2
ORDER BY `name` ASC ", ORDER BY `name` ASC ",
@ -527,7 +534,7 @@ function acl_lookup(&$a, $out_type = 'json') {
$x['data'] = array(); $x['data'] = array();
if(count($r)) { if(count($r)) {
foreach($r as $g) { foreach($r as $g) {
$x['photos'][] = $g['micro']; $x['photos'][] = proxy_url($g['micro']);
$x['links'][] = $g['url']; $x['links'][] = $g['url'];
$x['suggestions'][] = $g['name']; $x['suggestions'][] = $g['name'];
$x['data'][] = intval($g['id']); $x['data'][] = intval($g['id']);
@ -541,7 +548,7 @@ function acl_lookup(&$a, $out_type = 'json') {
foreach($r as $g){ foreach($r as $g){
$contacts[] = array( $contacts[] = array(
"type" => "c", "type" => "c",
"photo" => $g['micro'], "photo" => proxy_url($g['micro']),
"name" => $g['name'], "name" => $g['name'],
"id" => intval($g['id']), "id" => intval($g['id']),
"network" => $g['network'], "network" => $g['network'],
@ -549,28 +556,28 @@ function acl_lookup(&$a, $out_type = 'json') {
"nick" => ($g['attag']) ? $g['attag'] : $g['nick'], "nick" => ($g['attag']) ? $g['attag'] : $g['nick'],
"forum" => $g['forum'] "forum" => $g['forum']
); );
} }
} }
$items = array_merge($groups, $contacts); $items = array_merge($groups, $contacts);
if ($conv_id) { if ($conv_id) {
/* if $conv_id is set, get unknow contacts in thread */ /* if $conv_id is set, get unknow contacts in thread */
/* but first get know contacts url to filter them out */ /* but first get know contacts url to filter them out */
function _contact_link($i){ return dbesc($i['link']); } function _contact_link($i){ return dbesc($i['link']); }
$known_contacts = array_map(_contact_link, $contacts); $known_contacts = array_map(_contact_link, $contacts);
$unknow_contacts=array(); $unknow_contacts=array();
$r = q("select $r = q("select
`author-avatar`,`author-name`,`author-link` `author-avatar`,`author-name`,`author-link`
from item where parent=%d from item where parent=%d
and ( and (
`author-name` LIKE '%%%s%%' OR `author-name` LIKE '%%%s%%' OR
`author-link` LIKE '%%%s%%' `author-link` LIKE '%%%s%%'
) and ) and
`author-link` NOT IN ('%s') `author-link` NOT IN ('%s')
GROUP BY `author-link` GROUP BY `author-link`
ORDER BY `author-name` ASC ORDER BY `author-name` ASC
", ",
intval($conv_id), intval($conv_id),
dbesc($search), dbesc($search),
dbesc($search), dbesc($search),
@ -586,7 +593,7 @@ function acl_lookup(&$a, $out_type = 'json') {
// /nickname // /nickname
$unknow_contacts[] = array( $unknow_contacts[] = array(
"type" => "c", "type" => "c",
"photo" => $row['author-avatar'], "photo" => proxy_url($row['author-avatar']),
"name" => $row['author-name'], "name" => $row['author-name'],
"id" => '', "id" => '',
"network" => "unknown", "network" => "unknown",
@ -611,14 +618,14 @@ function acl_lookup(&$a, $out_type = 'json') {
); );
return $o; return $o;
} }
$o = array( $o = array(
'tot' => $tot, 'tot' => $tot,
'start' => $start, 'start' => $start,
'count' => $count, 'count' => $count,
'items' => $items, 'items' => $items,
); );
echo json_encode($o); echo json_encode($o);
killme(); killme();

View file

@ -96,24 +96,49 @@
} }
$user = $_SERVER['PHP_AUTH_USER']; $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 * next code from mod/auth.php. needs better solution
*/ */
$record = null;
// process normal login request $addon_auth = array(
'username' => trim($user),
$r = q("SELECT * FROM `user` WHERE ( `email` = '%s' OR `nickname` = '%s' ) 'password' => trim($password),
AND `password` = '%s' AND `blocked` = 0 AND `account_expired` = 0 AND `account_removed` = 0 AND `verified` = 1 LIMIT 1", 'authenticated' => 0,
dbesc(trim($user)), 'user_record' => null
dbesc(trim($user)),
dbesc($encrypted)
); );
if(count($r)){
$record = $r[0]; /**
} else { *
* 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' )
AND `password` = '%s' AND `blocked` = 0 AND `account_expired` = 0 AND `account_removed` = 0 AND `verified` = 1 LIMIT 1",
dbesc(trim($user)),
dbesc(trim($user)),
dbesc($encrypted)
);
if(count($r))
$record = $r[0];
}
if((! $record) || (! count($record))) {
logger('API_login failure: ' . print_r($_SERVER,true), LOGGER_DEBUG); logger('API_login failure: ' . print_r($_SERVER,true), LOGGER_DEBUG);
header('WWW-Authenticate: Basic realm="Friendica"'); header('WWW-Authenticate: Basic realm="Friendica"');
header('HTTP/1.0 401 Unauthorized'); header('HTTP/1.0 401 Unauthorized');
@ -1618,7 +1643,8 @@
$user_info = api_get_user($a); $user_info = api_get_user($a);
$ret = api_format_items($item,$user_info)[0]; $rets = api_format_items($item,$user_info);
$ret = $rets[0];
$data = array('$status' => $ret); $data = array('$status' => $ret);
switch($type){ switch($type){
@ -2042,7 +2068,7 @@
$ret = Array(); $ret = Array();
foreach($r as $item) { foreach($r as $item) {
api_share_as_retweet($a, api_user(), $item); api_share_as_retweet($item);
localize_item($item); localize_item($item);
$status_user = api_item_get_user($a,$item); $status_user = api_item_get_user($a,$item);
@ -2594,7 +2620,7 @@
function api_share_as_retweet($a, $uid, &$item) { function api_share_as_retweet(&$item) {
$body = trim($item["body"]); $body = trim($item["body"]);
// Skip if it isn't a pure repeated messages // Skip if it isn't a pure repeated messages
@ -2638,6 +2664,15 @@ function api_share_as_retweet($a, $uid, &$item) {
if ($matches[1] != "") if ($matches[1] != "")
$avatar = $matches[1]; $avatar = $matches[1];
$link = "";
preg_match("/link='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "")
$link = $matches[1];
preg_match('/link="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "")
$link = $matches[1];
$shared_body = preg_replace("/\[share(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism","$2",$body); $shared_body = preg_replace("/\[share(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism","$2",$body);
if (($shared_body == "") OR ($profile == "") OR ($author == "") OR ($avatar == "")) if (($shared_body == "") OR ($profile == "") OR ($author == "") OR ($avatar == ""))
@ -2647,6 +2682,7 @@ function api_share_as_retweet($a, $uid, &$item) {
$item["author-name"] = $author; $item["author-name"] = $author;
$item["author-link"] = $profile; $item["author-link"] = $profile;
$item["author-avatar"] = $avatar; $item["author-avatar"] = $avatar;
$item["plink"] = $link;
return(true); return(true);

View file

@ -41,7 +41,9 @@ function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
if ($matches[1] != "") if ($matches[1] != "")
$title = $matches[1]; $title = $matches[1];
$title = htmlentities($title, ENT_QUOTES, 'UTF-8', false); //$title = htmlentities($title, ENT_QUOTES, 'UTF-8', false);
$title = bbcode(html_entity_decode($title), false, false, true);
$title = str_replace(array("[", "]"), array("&#91;", "&#93;"), $title);
$image = ""; $image = "";
if ($type != "video") { if ($type != "video") {
@ -617,6 +619,17 @@ function GetProfileUsername($profile, $username, $compact = false, $getnetwork =
return($username." (".$diaspora.")"); return($username." (".$diaspora.")");
} }
$red = preg_replace("=https?://(.*)/channel/(.*)=ism", "$2@$1", $profile);
if ($red != $profile) {
if ($getnetwork)
// red is identified as Diaspora - friendica can't connect directly to it
return(NETWORK_DIASPORA);
elseif ($compact)
return($red);
else
return($username." (".$red.")");
}
$StatusnetHost = preg_replace("=https?://(.*)/user/(.*)=ism", "$1", $profile); $StatusnetHost = preg_replace("=https?://(.*)/user/(.*)=ism", "$1", $profile);
if ($StatusnetHost != $profile) { if ($StatusnetHost != $profile) {
$StatusnetUser = preg_replace("=https?://(.*)/user/(.*)=ism", "$2", $profile); $StatusnetUser = preg_replace("=https?://(.*)/user/(.*)=ism", "$2", $profile);
@ -695,7 +708,7 @@ function bb_RemovePictureLinks($match) {
} }
function bb_expand_links($match) { function bb_expand_links($match) {
if (stristr($match[2], $match[3]) OR ($match[2] == $match[3])) if (($match[3] == "") OR ($match[2] == $match[3]) OR stristr($match[2], $match[3]))
return ($match[1]."[url]".$match[2]."[/url]"); return ($match[1]."[url]".$match[2]."[/url]");
else else
return ($match[1].$match[3]." [url]".$match[2]."[/url]"); return ($match[1].$match[3]." [url]".$match[2]."[/url]");
@ -1171,6 +1184,6 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
$a->save_timestamp($stamp1, "parser"); $a->save_timestamp($stamp1, "parser");
return $Text; return trim($Text);
} }
?> ?>

View file

@ -203,12 +203,11 @@ function localize_item(&$item){
// we can't have a translation string with three positions but no distinguishable text // we can't have a translation string with three positions but no distinguishable text
// So here is the translate string. // So here is the translate string.
$txt = t('%1$s poked %2$s'); $txt = t('%1$s poked %2$s');
// now translate the verb // now translate the verb
$poked_t = trim(sprintf($txt, "",""));
$txt = str_replace( t('poked'), t($verb), $txt); $txt = str_replace( $poked_t, t($verb), $txt);
// then do the sprintf on the translation string // then do the sprintf on the translation string
@ -1102,16 +1101,16 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
'$shortsetloc' => t('set location'), '$shortsetloc' => t('set location'),
'$noloc' => t('Clear browser location'), '$noloc' => t('Clear browser location'),
'$shortnoloc' => t('clear location'), '$shortnoloc' => t('clear location'),
'$title' => "", '$title' => $x['title'],
'$placeholdertitle' => t('Set title'), '$placeholdertitle' => t('Set title'),
'$category' => "", '$category' => $x['category'],
'$placeholdercategory' => (feature_enabled(local_user(),'categories') ? t('Categories (comma-separated list)') : ''), '$placeholdercategory' => (feature_enabled(local_user(),'categories') ? t('Categories (comma-separated list)') : ''),
'$wait' => t('Please wait'), '$wait' => t('Please wait'),
'$permset' => t('Permission settings'), '$permset' => t('Permission settings'),
'$shortpermset' => t('permissions'), '$shortpermset' => t('permissions'),
'$ptyp' => (($notes_cid) ? 'note' : 'wall'), '$ptyp' => (($notes_cid) ? 'note' : 'wall'),
'$content' => '', '$content' => $x['content'],
'$post_id' => '', '$post_id' => $x['post_id'],
'$baseurl' => $a->get_baseurl(true), '$baseurl' => $a->get_baseurl(true),
'$defloc' => $x['default_location'], '$defloc' => $x['default_location'],
'$visitor' => $x['visitor'], '$visitor' => $x['visitor'],

View file

@ -66,6 +66,6 @@ function cronhooks_run(&$argv, &$argc){
} }
if (array_search(__file__,get_included_files())===0){ if (array_search(__file__,get_included_files())===0){
cronhooks_run($argv,$argc); cronhooks_run($_SERVER["argv"],$_SERVER["argc"]);
killme(); killme();
} }

View file

@ -413,6 +413,10 @@ function db_definition() {
"network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"about" => array("type" => "text", "not null" => "1"),
"keywords" => array("type" => "text", "not null" => "1"),
"gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
"attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"photo" => array("type" => "text", "not null" => "1"), "photo" => array("type" => "text", "not null" => "1"),
"thumb" => array("type" => "text", "not null" => "1"), "thumb" => array("type" => "text", "not null" => "1"),
@ -616,6 +620,12 @@ function db_definition() {
"nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"updated" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
"location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"about" => array("type" => "text", "not null" => "1"),
"keywords" => array("type" => "text", "not null" => "1"),
"gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
"network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
@ -823,6 +833,7 @@ function db_definition() {
"id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"), "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
"name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""), "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
"locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"created" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
@ -1247,6 +1258,8 @@ function db_definition() {
"nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"about" => array("type" => "text", "not null" => "1"),
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
@ -1339,6 +1352,6 @@ function dbstructure_run(&$argv, &$argc) {
} }
if (array_search(__file__,get_included_files())===0){ if (array_search(__file__,get_included_files())===0){
dbstructure_run($argv,$argc); dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);
killme(); killme();
} }

View file

@ -8,7 +8,7 @@ function dbupdate_run(&$argv, &$argc) {
if(is_null($a)){ if(is_null($a)){
$a = new App; $a = new App;
} }
if(is_null($db)) { if(is_null($db)) {
@include(".htconfig.php"); @include(".htconfig.php");
require_once("include/dba.php"); require_once("include/dba.php");
@ -23,7 +23,6 @@ function dbupdate_run(&$argv, &$argc) {
} }
if (array_search(__file__,get_included_files())===0){ if (array_search(__file__,get_included_files())===0){
dbupdate_run($argv,$argc); dbupdate_run($_SERVER["argv"],$_SERVER["argc"]);
killme(); killme();
} }

View file

@ -565,6 +565,6 @@ function delivery_run(&$argv, &$argc){
} }
if (array_search(__file__,get_included_files())===0){ if (array_search(__file__,get_included_files())===0){
delivery_run($argv,$argc); delivery_run($_SERVER["argv"],$_SERVER["argc"]);
killme(); killme();
} }

View file

@ -908,6 +908,110 @@ function diaspora_post($importer,$xml,$msg) {
} }
function diaspora_fetch_message($guid, $server, $level = 0) {
if ($level > 5)
return false;
$a = get_app();
// This will not work if the server is not a Diaspora server
$source_url = $server.'/p/'.$guid.'.xml';
$x = fetch_url($source_url);
if(!$x)
return false;
$x = str_replace(array('<activity_streams-photo>','</activity_streams-photo>'),array('<asphoto>','</asphoto>'),$x);
$source_xml = parse_xml_string($x,false);
$item = array();
$item["app"] = 'Diaspora';
$item["guid"] = $guid;
$body = "";
if ($source_xml->post->status_message->created_at)
$item["created"] = unxmlify($source_xml->post->status_message->created_at);
if ($source_xml->post->status_message->provider_display_name)
$item["app"] = unxmlify($source_xml->post->status_message->provider_display_name);
if ($source_xml->post->status_message->diaspora_handle)
$item["author"] = unxmlify($source_xml->post->status_message->diaspora_handle);
if ($source_xml->post->status_message->guid)
$item["guid"] = unxmlify($source_xml->post->status_message->guid);
$item["private"] = (unxmlify($source_xml->post->status_message->public) == 'false');
if(strlen($source_xml->post->asphoto->objectId) && ($source_xml->post->asphoto->objectId != 0) && ($source_xml->post->asphoto->image_url)) {
$body = '[url=' . notags(unxmlify($source_xml->post->asphoto->image_url)) . '][img]' . notags(unxmlify($source_xml->post->asphoto->objectId)) . '[/img][/url]' . "\n";
$body = scale_external_images($body,false);
} elseif($source_xml->post->asphoto->image_url) {
$body = '[img]' . notags(unxmlify($source_xml->post->asphoto->image_url)) . '[/img]' . "\n";
$body = scale_external_images($body);
} elseif($source_xml->post->status_message) {
$body = diaspora2bb($source_xml->post->status_message->raw_message);
// Checking for embedded pictures
if($source_xml->post->status_message->photo->remote_photo_path AND
$source_xml->post->status_message->photo->remote_photo_name) {
$remote_photo_path = notags(unxmlify($source_xml->post->status_message->photo->remote_photo_path));
$remote_photo_name = notags(unxmlify($source_xml->post->status_message->photo->remote_photo_name));
$body = '[img]'.$remote_photo_path.$remote_photo_name.'[/img]'."\n".$body;
logger('embedded picture link found: '.$body, LOGGER_DEBUG);
}
$body = scale_external_images($body);
// Add OEmbed and other information to the body
$body = add_page_info_to_body($body, false, true);
} elseif($source_xml->post->reshare) {
// Reshare of a reshare
return diaspora_fetch_message($source_xml->post->reshare->root_guid, $server, ++$level);
} else {
// Maybe it is a reshare of a photo that will be delivered at a later time (testing)
logger('no content found: '.print_r($source_xml,true));
$body = "";
}
if ($body == "")
return false;
$item["tag"] = '';
$tags = get_tags($body);
if(count($tags)) {
foreach($tags as $tag) {
if(strpos($tag,'#') === 0) {
if(strpos($tag,'[url='))
continue;
// don't link tags that are already embedded in links
if(preg_match('/\[(.*?)' . preg_quote($tag,'/') . '(.*?)\]/',$body))
continue;
if(preg_match('/\[(.*?)\]\((.*?)' . preg_quote($tag,'/') . '(.*?)\)/',$body))
continue;
$basetag = str_replace('_',' ',substr($tag,1));
$body = str_replace($tag,'#[url=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/url]',$body);
if(strlen($item["tag"]))
$item["tag"] .= ',';
$item["tag"] .= '#[url=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/url]';
continue;
}
}
}
$item["body"] = $body;
return $item;
}
function diaspora_reshare($importer,$xml,$msg) { function diaspora_reshare($importer,$xml,$msg) {
logger('diaspora_reshare: init: ' . print_r($xml,true)); logger('diaspora_reshare: init: ' . print_r($xml,true));
@ -945,70 +1049,65 @@ function diaspora_reshare($importer,$xml,$msg) {
$orig_author = notags(unxmlify($xml->root_diaspora_id)); $orig_author = notags(unxmlify($xml->root_diaspora_id));
$orig_guid = notags(unxmlify($xml->root_guid)); $orig_guid = notags(unxmlify($xml->root_guid));
$source_url = 'https://' . substr($orig_author,strpos($orig_author,'@')+1) . '/p/' . $orig_guid . '.xml'; $create_original_post = false;
$orig_url = 'https://'.substr($orig_author,strpos($orig_author,'@')+1).'/posts/'.$orig_guid;
$x = fetch_url($source_url); // Do we already have this item?
if(! $x) $r = q("SELECT `body`, `tag`, `app`, `author-link`, `plink` FROM `item` WHERE `guid` = '%s' AND `visible` AND NOT `deleted` AND `body` != '' LIMIT 1",
$x = fetch_url(str_replace('https://','http://',$source_url)); dbesc($orig_guid),
if(! $x) { dbesc(NETWORK_DIASPORA)
logger('diaspora_reshare: unable to fetch source url ' . $source_url); );
return; if(count($r)) {
logger('reshared message '.orig_guid." reshared by ".$guid.' already exists on system: '.$orig_url);
// Maybe it is already a reshared item?
// Then refetch the content, since there can be many side effects with reshared posts from other networks or reshares from reshares
require_once('include/api.php');
if (api_share_as_retweet($r[0]))
$r = array();
else
$orig_url = $a->get_baseurl().'/display/'.$orig_guid;
} }
logger('diaspora_reshare: source: ' . $x);
$x = str_replace(array('<activity_streams-photo>','</activity_streams-photo>'),array('<asphoto>','</asphoto>'),$x); if (!count($r)) {
$source_xml = parse_xml_string($x,false); $body = "";
$str_tags = "";
$app = "";
if(strlen($source_xml->post->asphoto->objectId) && ($source_xml->post->asphoto->objectId != 0) && ($source_xml->post->asphoto->image_url)) { $orig_url = 'https://'.substr($orig_author,strpos($orig_author,'@')+1).'/posts/'.$orig_guid;
$body = '[url=' . notags(unxmlify($source_xml->post->asphoto->image_url)) . '][img]' . notags(unxmlify($source_xml->post->asphoto->objectId)) . '[/img][/url]' . "\n";
$body = scale_external_images($body,false);
}
elseif($source_xml->post->asphoto->image_url) {
$body = '[img]' . notags(unxmlify($source_xml->post->asphoto->image_url)) . '[/img]' . "\n";
$body = scale_external_images($body);
}
elseif($source_xml->post->status_message) {
$body = diaspora2bb($source_xml->post->status_message->raw_message);
// Checking for embedded pictures $server = 'https://'.substr($orig_author,strpos($orig_author,'@')+1);
if($source_xml->post->status_message->photo->remote_photo_path AND logger('1st try: reshared message '.$orig_guid." reshared by ".$guid.' will be fetched from original server: '.$server);
$source_xml->post->status_message->photo->remote_photo_name) { $item = diaspora_fetch_message($orig_guid, $server);
$remote_photo_path = notags(unxmlify($source_xml->post->status_message->photo->remote_photo_path)); if (!$item) {
$remote_photo_name = notags(unxmlify($source_xml->post->status_message->photo->remote_photo_name)); $server = 'https://'.substr($diaspora_handle,strpos($diaspora_handle,'@')+1);
logger('2nd try: reshared message '.$orig_guid." reshared by ".$guid." will be fetched from sharer's server: ".$server);
$body = '[img]'.$remote_photo_path.$remote_photo_name.'[/img]'."\n".$body; $item = diaspora_fetch_message($orig_guid, $server);
}
logger('diaspora_reshare: embedded picture link found: '.$body, LOGGER_DEBUG); if (!$item) {
$server = 'http://'.substr($orig_author,strpos($orig_author,'@')+1);
logger('3rd try: reshared message '.$orig_guid." reshared by ".$guid.' will be fetched from original server: '.$server);
$item = diaspora_fetch_message($orig_guid, $server);
}
if (!$item) {
$server = 'http://'.substr($diaspora_handle,strpos($diaspora_handle,'@')+1);
logger('4th try: reshared message '.$orig_guid." reshared by ".$guid." will be fetched from sharer's server: ".$server);
$item = diaspora_fetch_message($orig_guid, $server);
} }
$body = scale_external_images($body); if ($item) {
$body = $item["body"];
// Add OEmbed and other information to the body $str_tags = $item["tag"];
$body = add_page_info_to_body($body, false, true); $app = $item["app"];
$orig_created = $item["created"];
$orig_author = $item["author"];
$orig_guid = $item["guid"];
//$create_original_post = ($body != "");
}
} }
else {
// Maybe it is a reshare of a photo that will be delivered at a later time (testing)
logger('diaspora_reshare: no reshare content found: ' . print_r($source_xml,true));
$body = "";
//return;
}
//if(! $body) {
// logger('diaspora_reshare: empty body: source= ' . $x);
// return;
//}
$person = find_diaspora_person_by_handle($orig_author); $person = find_diaspora_person_by_handle($orig_author);
/*if(is_array($person) && x($person,'name') && x($person,'url'))
$details = '[url=' . $person['url'] . ']' . $person['name'] . '[/url]';
else
$details = $orig_author;
$prefix = html_entity_decode("&#x2672; ", ENT_QUOTES, 'UTF-8') . $details . "\n";*/
// allocate a guid on our system - we aren't fixing any collisions. // allocate a guid on our system - we aren't fixing any collisions.
// we're ignoring them // we're ignoring them
@ -1026,34 +1125,6 @@ function diaspora_reshare($importer,$xml,$msg) {
$datarray = array(); $datarray = array();
$str_tags = '';
$tags = get_tags($body);
if(count($tags)) {
foreach($tags as $tag) {
if(strpos($tag,'#') === 0) {
if(strpos($tag,'[url='))
continue;
// don't link tags that are already embedded in links
if(preg_match('/\[(.*?)' . preg_quote($tag,'/') . '(.*?)\]/',$body))
continue;
if(preg_match('/\[(.*?)\]\((.*?)' . preg_quote($tag,'/') . '(.*?)\)/',$body))
continue;
$basetag = str_replace('_',' ',substr($tag,1));
$body = str_replace($tag,'#[url=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/url]',$body);
if(strlen($str_tags))
$str_tags .= ',';
$str_tags .= '#[url=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/url]';
continue;
}
}
}
$plink = 'https://'.substr($diaspora_handle,strpos($diaspora_handle,'@')+1).'/posts/'.$guid; $plink = 'https://'.substr($diaspora_handle,strpos($diaspora_handle,'@')+1).'/posts/'.$guid;
$datarray['uid'] = $importer['uid']; $datarray['uid'] = $importer['uid'];
@ -1087,19 +1158,37 @@ function diaspora_reshare($importer,$xml,$msg) {
} }
$datarray['tag'] = $str_tags; $datarray['tag'] = $str_tags;
$datarray['app'] = 'Diaspora'; $datarray['app'] = $app;
// if empty content it might be a photo that hasn't arrived yet. If a photo arrives, we'll make it visible. (testing) // if empty content it might be a photo that hasn't arrived yet. If a photo arrives, we'll make it visible. (testing)
$datarray['visible'] = ((strlen($body)) ? 1 : 0); $datarray['visible'] = ((strlen($body)) ? 1 : 0);
$message_id = item_store($datarray); // Store the original item of a reshare
// Deactivated by now. Items without a matching contact can't be shown via "mod/display.php" by now.
if ($create_original_post) {
$datarray2 = $datarray;
//if($message_id) { $datarray2['uid'] = 0;
// q("update item set plink = '%s' where id = %d", $datarray2['contact-id'] = 0;
// dbesc($a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id), $datarray2['guid'] = $orig_guid;
// intval($message_id) $datarray2['uri'] = $datarray2['parent-uri'] = $orig_author.':'.$orig_guid;
// ); $datarray2['changed'] = $datarray2['created'] = $datarray2['edited'] = datetime_convert('UTC','UTC',$orig_created);
//} $datarray2['plink'] = 'https://'.substr($orig_author,strpos($orig_author,'@')+1).'/posts/'.$orig_guid;
$datarray2['author-name'] = $person['name'];
$datarray2['author-link'] = $person['url'];
$datarray2['author-avatar'] = ((x($person,'thumb')) ? $person['thumb'] : $person['photo']);
$datarray2['owner-name'] = $datarray2['author-name'];
$datarray2['owner-link'] = $datarray2['author-link'];
$datarray2['owner-avatar'] = $datarray2['author-avatar'];
$datarray2['body'] = $body;
$message_id = item_store($datarray2);
logger("Store original item ".$orig_guid." under message id ".$message_id);
}
$message_id = item_store($datarray);
return; return;
@ -2028,7 +2117,7 @@ function diaspora_retraction($importer,$xml) {
dbesc(datetime_convert()), dbesc(datetime_convert()),
intval($r[0]['id']) intval($r[0]['id'])
); );
delete_thread($r[0]['id']); delete_thread($r[0]['id'], $r[0]['parent-uri']);
} }
} }
} }
@ -2101,7 +2190,7 @@ function diaspora_signed_retraction($importer,$xml,$msg) {
dbesc(datetime_convert()), dbesc(datetime_convert()),
intval($r[0]['id']) intval($r[0]['id'])
); );
delete_thread($r[0]['id']); delete_thread($r[0]['id'], $r[0]['parent-uri']);
// Now check if the retraction needs to be relayed by us // Now check if the retraction needs to be relayed by us
// //
@ -2161,14 +2250,27 @@ function diaspora_profile($importer,$xml,$msg) {
$name = unxmlify($xml->first_name) . ((strlen($xml->last_name)) ? ' ' . unxmlify($xml->last_name) : ''); $name = unxmlify($xml->first_name) . ((strlen($xml->last_name)) ? ' ' . unxmlify($xml->last_name) : '');
$image_url = unxmlify($xml->image_url); $image_url = unxmlify($xml->image_url);
$birthday = unxmlify($xml->birthday); $birthday = unxmlify($xml->birthday);
$location = diaspora2bb(unxmlify($xml->location));
$about = diaspora2bb(unxmlify($xml->bio));
$gender = unxmlify($xml->gender);
$tags = unxmlify($xml->tag_string);
$tags = explode("#", $tags);
$keywords = array();
foreach ($tags as $tag) {
$tag = trim(strtolower($tag));
if ($tag != "")
$keywords[] = $tag;
}
$keywords = implode(", ", $keywords);
$handle_parts = explode("@", $diaspora_handle); $handle_parts = explode("@", $diaspora_handle);
if($name === '') { if($name === '') {
$name = $handle_parts[0]; $name = $handle_parts[0];
} }
if( preg_match("|^https?://|", $image_url) === 0) { if( preg_match("|^https?://|", $image_url) === 0) {
$image_url = "http://" . $handle_parts[1] . $image_url; $image_url = "http://" . $handle_parts[1] . $image_url;
} }
@ -2182,8 +2284,8 @@ function diaspora_profile($importer,$xml,$msg) {
require_once('include/Photo.php'); require_once('include/Photo.php');
$images = import_profile_photo($image_url,$importer['uid'],$contact['id']); $images = import_profile_photo($image_url,$importer['uid'],$contact['id']);
// Generic birthday. We don't know the timezone. The year is irrelevant. // Generic birthday. We don't know the timezone. The year is irrelevant.
$birthday = str_replace('1000','1901',$birthday); $birthday = str_replace('1000','1901',$birthday);
@ -2196,9 +2298,9 @@ function diaspora_profile($importer,$xml,$msg) {
$birthday = $contact['bd']; $birthday = $contact['bd'];
// TODO: update name on item['author-name'] if the name changed. See consume_feed() // TODO: update name on item['author-name'] if the name changed. See consume_feed()
// Not doing this currently because D* protocol is scheduled for revision soon. // Not doing this currently because D* protocol is scheduled for revision soon.
$r = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s', `avatar-date` = '%s' , `bd` = '%s' WHERE `id` = %d AND `uid` = %d", $r = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s', `avatar-date` = '%s' , `bd` = '%s', `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `id` = %d AND `uid` = %d",
dbesc($name), dbesc($name),
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc($images[0]), dbesc($images[0]),
@ -2206,9 +2308,34 @@ function diaspora_profile($importer,$xml,$msg) {
dbesc($images[2]), dbesc($images[2]),
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc($birthday), dbesc($birthday),
dbesc($location),
dbesc($about),
dbesc($keywords),
dbesc($gender),
intval($contact['id']), intval($contact['id']),
intval($importer['uid']) intval($importer['uid'])
); );
if (unxmlify($xml->searchable) == "true") {
require_once('include/socgraph.php');
poco_check($contact['url'], $name, NETWORK_DIASPORA, $images[0], $about, $location, $gender, $keywords, "",
datetime_convert(), $contact['id'], $importer['uid']);
}
$profileurl = "";
$author = q("SELECT * FROM `unique_contacts` WHERE `url`='%s' LIMIT 1",
dbesc(normalise_link($contact['url'])));
if (count($author) == 0) {
q("INSERT INTO `unique_contacts` (`url`, `name`, `avatar`, `location`, `about`) VALUES ('%s', '%s', '%s', '%s', '%s')",
dbesc(normalise_link($contact['url'])), dbesc($name), dbesc($location), dbesc($about), dbesc($images[0]));
$author = q("SELECT id FROM unique_contacts WHERE url='%s' LIMIT 1",
dbesc(normalise_link($contact['url'])));
} else if (normalise_link($contact['url']).$name.$location.$about != normalise_link($author[0]["url"]).$author[0]["name"].$author[0]["location"].$author[0]["about"]) {
q("UPDATE unique_contacts SET name = '%s', avatar = '%s', `location` = '%s', `about` = '%s' WHERE url = '%s'",
dbesc($name), dbesc($images[0]), dbesc($location), dbesc($about), dbesc(normalise_link($contact['url'])));
}
/* if($r) { /* if($r) {
if($oldphotos) { if($oldphotos) {

View file

@ -46,6 +46,6 @@ function directory_run(&$argv, &$argc){
} }
if (array_search(__file__,get_included_files())===0){ if (array_search(__file__,get_included_files())===0){
directory_run($argv,$argc); directory_run($_SERVER["argv"],$_SERVER["argc"]);
killme(); killme();
} }

View file

@ -45,6 +45,6 @@ function dsprphotoq_run($argv, $argc){
if (array_search(__file__,get_included_files())===0){ if (array_search(__file__,get_included_files())===0){
dsprphotoq_run($argv,$argc); dsprphotoq_run($_SERVER["argv"],$_SERVER["argc"]);
killme(); killme();
} }

View file

@ -55,6 +55,6 @@ function expire_run(&$argv, &$argc){
} }
if (array_search(__file__,get_included_files())===0){ if (array_search(__file__,get_included_files())===0){
expire_run($argv,$argc); expire_run($_SERVER["argv"],$_SERVER["argc"]);
killme(); killme();
} }

View file

@ -37,7 +37,7 @@ function new_contact($uid,$url,$interactive = false) {
call_hooks('follow', $arr); call_hooks('follow', $arr);
if(x($arr['contact'],'name')) if(x($arr['contact'],'name'))
$ret = $arr['contact']; $ret = $arr['contact'];
else else
$ret = probe_url($url); $ret = probe_url($url);
@ -73,7 +73,7 @@ function new_contact($uid,$url,$interactive = false) {
// do we have enough information? // do we have enough information?
if(! ((x($ret,'name')) && (x($ret,'poll')) && ((x($ret,'url')) || (x($ret,'addr'))))) { if(! ((x($ret,'name')) && (x($ret,'poll')) && ((x($ret,'url')) || (x($ret,'addr'))))) {
$result['message'] .= t('The profile address specified does not provide adequate information.') . EOL; $result['message'] .= t('The profile address specified does not provide adequate information.') . EOL;
if(! x($ret,'poll')) if(! x($ret,'poll'))
@ -120,12 +120,12 @@ function new_contact($uid,$url,$interactive = false) {
// the poll url is more reliable than the profile url, as we may have // the poll url is more reliable than the profile url, as we may have
// indirect links or webfinger links // indirect links or webfinger links
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `poll` = '%s' LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `poll` = '%s' AND `network` = '%s' LIMIT 1",
intval($uid), intval($uid),
dbesc($ret['poll']) dbesc($ret['poll']),
dbesc($ret['network'])
); );
if(count($r)) { if(count($r)) {
// update contact // update contact
if($r[0]['rel'] == CONTACT_IS_FOLLOWER || ($network === NETWORK_DIASPORA && $r[0]['rel'] == CONTACT_IS_SHARING)) { if($r[0]['rel'] == CONTACT_IS_FOLLOWER || ($network === NETWORK_DIASPORA && $r[0]['rel'] == CONTACT_IS_SHARING)) {
@ -169,10 +169,10 @@ function new_contact($uid,$url,$interactive = false) {
if($ret['network'] === NETWORK_DIASPORA) if($ret['network'] === NETWORK_DIASPORA)
$new_relation = CONTACT_IS_FOLLOWER; $new_relation = CONTACT_IS_FOLLOWER;
// create contact record // create contact record
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `batch`, `notify`, `poll`, `poco`, `name`, `nick`, `photo`, `network`, `pubkey`, `rel`, `priority`, $r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `batch`, `notify`, `poll`, `poco`, `name`, `nick`, `network`, `pubkey`, `rel`, `priority`,
`writable`, `hidden`, `blocked`, `readonly`, `pending`, `subhub` ) `writable`, `hidden`, `blocked`, `readonly`, `pending`, `subhub` )
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, 0, 0, 0, %d ) ", VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, 0, 0, 0, %d ) ",
intval($uid), intval($uid),
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc($ret['url']), dbesc($ret['url']),
@ -185,7 +185,6 @@ function new_contact($uid,$url,$interactive = false) {
dbesc($ret['poco']), dbesc($ret['poco']),
dbesc($ret['name']), dbesc($ret['name']),
dbesc($ret['nick']), dbesc($ret['nick']),
dbesc($ret['photo']),
dbesc($ret['network']), dbesc($ret['network']),
dbesc($ret['pubkey']), dbesc($ret['pubkey']),
intval($new_relation), intval($new_relation),
@ -196,8 +195,9 @@ function new_contact($uid,$url,$interactive = false) {
); );
} }
$r = q("SELECT * FROM `contact` WHERE `url` = '%s' AND `uid` = %d LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `url` = '%s' AND `network` = '%s' AND `uid` = %d LIMIT 1",
dbesc($ret['url']), dbesc($ret['url']),
dbesc($ret['network']),
intval($uid) intval($uid)
); );
@ -228,8 +228,7 @@ function new_contact($uid,$url,$interactive = false) {
`name-date` = '%s', `name-date` = '%s',
`uri-date` = '%s', `uri-date` = '%s',
`avatar-date` = '%s' `avatar-date` = '%s'
WHERE `id` = %d WHERE `id` = %d",
",
dbesc($photos[0]), dbesc($photos[0]),
dbesc($photos[1]), dbesc($photos[1]),
dbesc($photos[2]), dbesc($photos[2]),

View file

@ -63,6 +63,6 @@ function gprobe_run(&$argv, &$argc){
} }
if (array_search(__file__,get_included_files())===0){ if (array_search(__file__,get_included_files())===0){
gprobe_run($argv,$argc); gprobe_run($_SERVER["argv"],$_SERVER["argc"]);
killme(); killme();
} }

View file

@ -76,13 +76,14 @@ function node2bbcodesub(&$doc, $oldnode, $attributes, $startbb, $endbb)
return($replace); return($replace);
} }
if(!function_exists('deletenode')) {
function deletenode(&$doc, $node) function deletenode(&$doc, $node)
{ {
$xpath = new DomXPath($doc); $xpath = new DomXPath($doc);
$list = $xpath->query("//".$node); $list = $xpath->query("//".$node);
foreach ($list as $child) foreach ($list as $child)
$child->parentNode->removeChild($child); $child->parentNode->removeChild($child);
} }}
function html2bbcode($message) function html2bbcode($message)
{ {

View file

@ -11,6 +11,7 @@ require_once('include/text.php');
require_once('include/email.php'); require_once('include/email.php');
require_once('include/ostatus_conversation.php'); require_once('include/ostatus_conversation.php');
require_once('include/threads.php'); require_once('include/threads.php');
require_once('include/socgraph.php');
function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0) { function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0) {
@ -881,6 +882,7 @@ function get_atom_elements($feed, $item, $contact = array()) {
$preview = $attachment->link; $preview = $attachment->link;
$res["body"] = $res["title"].add_page_info($res['plink'], false, $preview, ($contact['fetch_further_information'] == 2), $contact['ffi_keyword_blacklist']); $res["body"] = $res["title"].add_page_info($res['plink'], false, $preview, ($contact['fetch_further_information'] == 2), $contact['ffi_keyword_blacklist']);
$res["tag"] = add_page_keywords($res['plink'], false, $preview, ($contact['fetch_further_information'] == 2), $contact['ffi_keyword_blacklist']);
$res["title"] = ""; $res["title"] = "";
$res["object-type"] = ACTIVITY_OBJ_BOOKMARK; $res["object-type"] = ACTIVITY_OBJ_BOOKMARK;
unset($res["attach"]); unset($res["attach"]);
@ -945,7 +947,7 @@ function add_page_info_data($data) {
return("\n[class=type-".$data["type"]."]".$text."[/class]".$hashtags); return("\n[class=type-".$data["type"]."]".$text."[/class]".$hashtags);
} }
function add_page_info($url, $no_photos = false, $photo = "", $keywords = false, $keyword_blacklist = "") { function query_page_info($url, $no_photos = false, $photo = "", $keywords = false, $keyword_blacklist = "") {
require_once("mod/parse_url.php"); require_once("mod/parse_url.php");
$data = Cache::get("parse_url:".$url); $data = Cache::get("parse_url:".$url);
@ -958,7 +960,7 @@ function add_page_info($url, $no_photos = false, $photo = "", $keywords = false,
if ($photo != "") if ($photo != "")
$data["images"][0]["src"] = $photo; $data["images"][0]["src"] = $photo;
logger('add_page_info: fetch page info for '.$url.' '.print_r($data, true), LOGGER_DEBUG); logger('fetch page info for '.$url.' '.print_r($data, true), LOGGER_DEBUG);
if (!$keywords AND isset($data["keywords"])) if (!$keywords AND isset($data["keywords"]))
unset($data["keywords"]); unset($data["keywords"]);
@ -973,6 +975,32 @@ function add_page_info($url, $no_photos = false, $photo = "", $keywords = false,
} }
} }
return($data);
}
function add_page_keywords($url, $no_photos = false, $photo = "", $keywords = false, $keyword_blacklist = "") {
$data = query_page_info($url, $no_photos, $photo, $keywords, $keyword_blacklist);
$tags = "";
if (isset($data["keywords"]) AND count($data["keywords"])) {
$a = get_app();
foreach ($data["keywords"] AS $keyword) {
$hashtag = str_replace(array(" ", "+", "/", ".", "#", "'"),
array("","", "", "", "", ""), $keyword);
if ($tags != "")
$tags .= ",";
$tags .= "#[url=".$a->get_baseurl()."/search?tag=".rawurlencode($hashtag)."]".$hashtag."[/url]";
}
}
return($tags);
}
function add_page_info($url, $no_photos = false, $photo = "", $keywords = false, $keyword_blacklist = "") {
$data = query_page_info($url, $no_photos, $photo, $keywords, $keyword_blacklist);
$text = add_page_info_data($data); $text = add_page_info_data($data);
return($text); return($text);
@ -1322,6 +1350,9 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
return 0; return 0;
} }
// Store the unescaped version
$unescaped = $arr;
dbesc_array($arr); dbesc_array($arr);
logger('item_store: ' . print_r($arr,true), LOGGER_DATA); logger('item_store: ' . print_r($arr,true), LOGGER_DATA);
@ -1332,10 +1363,12 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
. implode("', '", array_values($arr)) . implode("', '", array_values($arr))
. "')" ); . "')" );
// find the item we just created // And restore it
$arr = $unescaped;
// find the item we just created
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d ORDER BY `id` ASC ", $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d ORDER BY `id` ASC ",
$arr['uri'], // already dbesc'd dbesc($arr['uri']),
intval($arr['uid']) intval($arr['uid'])
); );
@ -1343,6 +1376,26 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
$current_post = $r[0]['id']; $current_post = $r[0]['id'];
logger('item_store: created item ' . $current_post); logger('item_store: created item ' . $current_post);
// Add every contact to the global contact table
// Contacts from the statusnet connector are also added since you could add them in OStatus as well.
if (!$arr['private'] AND in_array($arr["network"],
array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, NETWORK_STATUSNET, ""))) {
poco_check($arr["author-link"], $arr["author-name"], $arr["network"], $arr["author-avatar"], "", "", "", "", "", $arr["received"], $arr["contact-id"], $arr["uid"]);
// Maybe its a body with a shared item? Then extract a global contact from it.
poco_contact_from_body($arr["body"], $arr["received"], $arr["contact-id"], $arr["uid"]);
}
// Set "success_update" to the date of the last time we heard from this contact
// This can be used to filter for inactive contacts and poco.
// Only do this for public postings to avoid privacy problems, since poco data is public.
// Don't set this value if it isn't from the owner (could be an author that we don't know)
if (!$arr['private'] AND (($arr["author-link"] === $arr["owner-link"]) OR ($arr["parent-uri"] === $arr["uri"])))
q("UPDATE `contact` SET `success_update` = '%s' WHERE `id` = %d",
dbesc($arr['received']),
intval($arr['contact-id'])
);
// Only check for notifications on start posts // Only check for notifications on start posts
if ($arr['parent-uri'] === $arr['uri']) { if ($arr['parent-uri'] === $arr['uri']) {
add_thread($r[0]['id']); add_thread($r[0]['id']);
@ -1393,7 +1446,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
if(count($r) > 1) { if(count($r) > 1) {
logger('item_store: duplicated post occurred. Removing duplicates.'); logger('item_store: duplicated post occurred. Removing duplicates.');
q("DELETE FROM `item` WHERE `uri` = '%s' AND `uid` = %d AND `id` != %d ", q("DELETE FROM `item` WHERE `uri` = '%s' AND `uid` = %d AND `id` != %d ",
$arr['uri'], dbesc($arr['uri']),
intval($arr['uid']), intval($arr['uid']),
intval($current_post) intval($current_post)
); );
@ -2668,14 +2721,14 @@ function item_is_remote_self($contact, &$datarray) {
$datarray2 = $datarray; $datarray2 = $datarray;
logger('remote-self start - Contact '.$contact['url'].' - '.$contact['remote_self'].' Item '.print_r($datarray, true), LOGGER_DEBUG); logger('remote-self start - Contact '.$contact['url'].' - '.$contact['remote_self'].' Item '.print_r($datarray, true), LOGGER_DEBUG);
if ($contact['remote_self'] == 2) { if ($contact['remote_self'] == 2) {
$r = q("SELECT `id`,`url`,`name`,`photo`,`network` FROM `contact` WHERE `uid` = %d AND `self`", $r = q("SELECT `id`,`url`,`name`,`thumb` FROM `contact` WHERE `uid` = %d AND `self`",
intval($contact['uid'])); intval($contact['uid']));
if (count($r)) { if (count($r)) {
$datarray['contact-id'] = $r[0]["id"]; $datarray['contact-id'] = $r[0]["id"];
$datarray['owner-name'] = $r[0]["name"]; $datarray['owner-name'] = $r[0]["name"];
$datarray['owner-link'] = $r[0]["url"]; $datarray['owner-link'] = $r[0]["url"];
$datarray['owner-avatar'] = $r[0]["avatar"]; $datarray['owner-avatar'] = $r[0]["thumb"];
$datarray['author-name'] = $datarray['owner-name']; $datarray['author-name'] = $datarray['owner-name'];
$datarray['author-link'] = $datarray['owner-link']; $datarray['author-link'] = $datarray['owner-link'];
@ -4054,6 +4107,7 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) {
else else
$body = $item['body']; $body = $item['body'];
$o = "\r\n\r\n<entry>\r\n"; $o = "\r\n\r\n<entry>\r\n";
if(is_array($author)) if(is_array($author))
@ -4068,13 +4122,22 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) {
$o .= '<thr:in-reply-to ref="' . xmlify($parent_item) . '" type="text/html" href="' . xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['parent']) . '" />' . "\r\n"; $o .= '<thr:in-reply-to ref="' . xmlify($parent_item) . '" type="text/html" href="' . xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['parent']) . '" />' . "\r\n";
} }
$htmlbody = $body;
if ($item['title'] != "")
$htmlbody = "[b]".$item['title']."[/b]\n\n".$htmlbody;
$htmlbody = bbcode(bb_remove_share_information($htmlbody), false, false, 7);
$o .= '<id>' . xmlify($item['uri']) . '</id>' . "\r\n"; $o .= '<id>' . xmlify($item['uri']) . '</id>' . "\r\n";
$o .= '<title>' . xmlify($item['title']) . '</title>' . "\r\n"; $o .= '<title>' . xmlify($item['title']) . '</title>' . "\r\n";
$o .= '<published>' . xmlify(datetime_convert('UTC','UTC',$item['created'] . '+00:00',ATOM_TIME)) . '</published>' . "\r\n"; $o .= '<published>' . xmlify(datetime_convert('UTC','UTC',$item['created'] . '+00:00',ATOM_TIME)) . '</published>' . "\r\n";
$o .= '<updated>' . xmlify(datetime_convert('UTC','UTC',$item['edited'] . '+00:00',ATOM_TIME)) . '</updated>' . "\r\n"; $o .= '<updated>' . xmlify(datetime_convert('UTC','UTC',$item['edited'] . '+00:00',ATOM_TIME)) . '</updated>' . "\r\n";
$o .= '<dfrn:env>' . base64url_encode($body, true) . '</dfrn:env>' . "\r\n"; $o .= '<dfrn:env>' . base64url_encode($body, true) . '</dfrn:env>' . "\r\n";
$o .= '<content type="' . $type . '" >' . xmlify((($type === 'html') ? bbcode($body) : $body)) . '</content>' . "\r\n"; $o .= '<content type="' . $type . '" >' . xmlify((($type === 'html') ? $htmlbody : $body)) . '</content>' . "\r\n";
$o .= '<link rel="alternate" type="text/html" href="' . xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']) . '" />' . "\r\n"; $o .= '<link rel="alternate" type="text/html" href="' . xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']) . '" />' . "\r\n";
if($comment) if($comment)
$o .= '<dfrn:comment-allow>' . intval($item['last-child']) . '</dfrn:comment-allow>' . "\r\n"; $o .= '<dfrn:comment-allow>' . intval($item['last-child']) . '</dfrn:comment-allow>' . "\r\n";
@ -4492,7 +4555,7 @@ function drop_item($id,$interactive = true) {
); );
create_tags_from_item($item['id']); create_tags_from_item($item['id']);
create_files_from_item($item['id']); create_files_from_item($item['id']);
delete_thread($item['id']); delete_thread($item['id'], $item['parent-uri']);
// clean up categories and tags so they don't end up as orphans // clean up categories and tags so they don't end up as orphans

View file

@ -11,20 +11,22 @@ function lock_function($fn_name, $block = true, $wait_sec = 2, $timeout = 30) {
$start = time(); $start = time();
do { do {
q("LOCK TABLE locks WRITE"); q("LOCK TABLE `locks` WRITE");
$r = q("SELECT locked FROM locks WHERE name = '%s' LIMIT 1", $r = q("SELECT `locked`, `created` FROM `locks` WHERE `name` = '%s' LIMIT 1",
dbesc($fn_name) dbesc($fn_name)
); );
if((count($r)) && (! $r[0]['locked'])) { if((count($r)) AND (!$r[0]['locked'] OR (strtotime($r[0]['created']) < time() - 3600))) {
q("UPDATE locks SET locked = 1 WHERE name = '%s'", q("UPDATE `locks` SET `locked` = 1, `created` = '%s' WHERE `name` = '%s'",
dbesc(datetime_convert()),
dbesc($fn_name) dbesc($fn_name)
); );
$got_lock = true; $got_lock = true;
} }
elseif(! $r) { // the Boolean value for count($r) should be equivalent to the Boolean value of $r elseif(! $r) { // the Boolean value for count($r) should be equivalent to the Boolean value of $r
q("INSERT INTO locks ( name, locked ) VALUES ( '%s', 1 )", q("INSERT INTO `locks` (`name`, `created`, `locked`) VALUES ('%s', '%s', 1)",
dbesc($fn_name) dbesc($fn_name),
dbesc(datetime_convert())
); );
$got_lock = true; $got_lock = true;
} }
@ -37,7 +39,7 @@ function lock_function($fn_name, $block = true, $wait_sec = 2, $timeout = 30) {
} while(($block) && (! $got_lock) && ((time() - $start) < $timeout)); } while(($block) && (! $got_lock) && ((time() - $start) < $timeout));
logger('lock_function: function ' . $fn_name . ' with blocking = ' . $block . ' got_lock = ' . $got_lock . ' time = ' . (time() - $start), LOGGER_DEBUG); logger('lock_function: function ' . $fn_name . ' with blocking = ' . $block . ' got_lock = ' . $got_lock . ' time = ' . (time() - $start), LOGGER_DEBUG);
return $got_lock; return $got_lock;
}} }}
@ -65,7 +67,7 @@ function block_on_function_lock($fn_name, $wait_sec = 2, $timeout = 30) {
if(! function_exists('unlock_function')) { if(! function_exists('unlock_function')) {
function unlock_function($fn_name) { function unlock_function($fn_name) {
$r = q("UPDATE locks SET locked = 0 WHERE name = '%s'", $r = q("UPDATE `locks` SET `locked` = 0, `created` = '0000-00-00 00:00:00' WHERE `name` = '%s'",
dbesc($fn_name) dbesc($fn_name)
); );

View file

@ -651,7 +651,7 @@ function validate_email($addr) {
return false; return false;
$h = substr($addr,strpos($addr,'@') + 1); $h = substr($addr,strpos($addr,'@') + 1);
if(($h) && (dns_get_record($h, DNS_A + DNS_CNAME + DNS_PTR + DNS_MX) || filter_var($h['host'], FILTER_VALIDATE_IP) )) { if(($h) && (dns_get_record($h, DNS_A + DNS_CNAME + DNS_PTR + DNS_MX) || filter_var($h, FILTER_VALIDATE_IP) )) {
return true; return true;
} }
return false; return false;
@ -1159,13 +1159,8 @@ function original_url($url, $depth=1, $fetchbody = false) {
$siteinfo = array(); $siteinfo = array();
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
if ($fetchbody)
curl_setopt($ch, CURLOPT_NOBODY, 0);
else
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent()); curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent());
@ -1183,16 +1178,33 @@ function original_url($url, $depth=1, $fetchbody = false) {
return(original_url($curl_info['location'], ++$depth, $fetchbody)); return(original_url($curl_info['location'], ++$depth, $fetchbody));
} }
$pos = strpos($header, "\r\n\r\n"); // Check for redirects in the meta elements of the body if there are no redirects in the header.
if (!$fetchbody)
return(original_url($url, ++$depth, true));
if ($pos) // if the file is too large then exit
$body = trim(substr($header, $pos)); if ($curl_info["download_content_length"] > 1000000)
else return($url);
$body = $header;
// if it isn't a HTML file then exit
if (($curl_info["content_type"] != "") AND !strstr(strtolower($curl_info["content_type"]),"html"))
return($url);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_NOBODY, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent());
$body = curl_exec($ch);
curl_close($ch);
if (trim($body) == "") if (trim($body) == "")
return(original_url($url, ++$depth, true)); return($url);
// Check for redirect in meta elements
$doc = new DOMDocument(); $doc = new DOMDocument();
@$doc->loadHTML($body); @$doc->loadHTML($body);

View file

@ -5,16 +5,16 @@ require_once('include/html2plain.php');
/* /*
* This file was at one time responsible for doing all deliveries, but this caused * This file was at one time responsible for doing all deliveries, but this caused
* big problems on shared hosting systems, where the process might get killed by the * big problems on shared hosting systems, where the process might get killed by the
* hosting provider and nothing would get delivered. * hosting provider and nothing would get delivered.
* It now only delivers one message under certain cases, and invokes a queued * It now only delivers one message under certain cases, and invokes a queued
* delivery mechanism (include/deliver.php) to deliver individual contacts at * delivery mechanism (include/deliver.php) to deliver individual contacts at
* controlled intervals. * controlled intervals.
* This has a much better chance of surviving random processes getting killed * This has a much better chance of surviving random processes getting killed
* by the hosting provider. * by the hosting provider.
* A lot of this code is duplicated in include/deliver.php until we have time to go back * A lot of this code is duplicated in include/deliver.php until we have time to go back
* and re-structure the delivery procedure based on the obstacles that have been thrown at * and re-structure the delivery procedure based on the obstacles that have been thrown at
* us by hosting providers. * us by hosting providers.
*/ */
/* /*
@ -50,12 +50,12 @@ function notifier_run(&$argv, &$argc){
if(is_null($a)){ if(is_null($a)){
$a = new App; $a = new App;
} }
if(is_null($db)) { if(is_null($db)) {
@include(".htconfig.php"); @include(".htconfig.php");
require_once("include/dba.php"); require_once("include/dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data); $db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data); unset($db_host, $db_user, $db_pass, $db_data);
} }
require_once("include/session.php"); require_once("include/session.php");
@ -90,7 +90,7 @@ function notifier_run(&$argv, &$argc){
$expire = false; $expire = false;
$mail = false; $mail = false;
$fsuggest = false; $fsuggest = false;
$relocate = false; $relocate = false;
$top_level = false; $top_level = false;
$recipients = array(); $recipients = array();
$url_recipients = array(); $url_recipients = array();
@ -135,8 +135,7 @@ function notifier_run(&$argv, &$argc){
$uid = $suggest[0]['uid']; $uid = $suggest[0]['uid'];
$recipients[] = $suggest[0]['cid']; $recipients[] = $suggest[0]['cid'];
$item = $suggest[0]; $item = $suggest[0];
} } elseif($cmd === 'removeme') {
elseif($cmd === 'removeme') {
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval($item_id)); $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval($item_id));
if (! $r) if (! $r)
return; return;
@ -156,13 +155,11 @@ function notifier_run(&$argv, &$argc){
terminate_friendship($user, $self, $contact); terminate_friendship($user, $self, $contact);
} }
return; return;
} } elseif($cmd === 'relocate') {
elseif($cmd === 'relocate') { $normal_mode = false;
$normal_mode = false;
$relocate = true; $relocate = true;
$uid = $item_id; $uid = $item_id;
} } else {
else {
// find ancestors // find ancestors
$r = q("SELECT * FROM `item` WHERE `id` = %d and visible = 1 and moderated = 0 LIMIT 1", $r = q("SELECT * FROM `item` WHERE `id` = %d and visible = 1 and moderated = 0 LIMIT 1",
intval($item_id) intval($item_id)
@ -204,10 +201,10 @@ function notifier_run(&$argv, &$argc){
} }
$r = q("SELECT `contact`.*, `user`.`pubkey` AS `upubkey`, `user`.`prvkey` AS `uprvkey`, $r = q("SELECT `contact`.*, `user`.`pubkey` AS `upubkey`, `user`.`prvkey` AS `uprvkey`,
`user`.`timezone`, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`, `user`.`timezone`, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`,
`user`.`page-flags`, `user`.`prvnets` `user`.`page-flags`, `user`.`prvnets`
FROM `contact` INNER JOIN `user` ON `user`.`uid` = `contact`.`uid` FROM `contact` INNER JOIN `user` ON `user`.`uid` = `contact`.`uid`
WHERE `contact`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1", WHERE `contact`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1",
intval($uid) intval($uid)
); );
@ -295,8 +292,28 @@ function notifier_run(&$argv, &$argc){
$followup = true; $followup = true;
$public_message = false; // not public $public_message = false; // not public
$conversant_str = dbesc($parent['contact-id']); $conversant_str = dbesc($parent['contact-id']);
} $recipients = array($parent['contact-id']);
else {
if ($parent['network'] == NETWORK_OSTATUS) {
// Check if the recipient isn't in your contact list
$r = q("SELECT `url` FROM `contact` WHERE `id` = %d", $parent['contact-id']);
if (count($r)) {
$url_recipients = array();
$thrparent = q("SELECT `author-link` FROM `item` WHERE `uri` = '%s'", dbesc($target_item["thr-parent"]));
if (count($thrparent) AND (normalise_link($r[0]["url"]) != normalise_link($thrparent[0]["author-link"]))) {
require_once("include/Scrape.php");
$probed_contact = probe_url($thrparent[0]["author-link"]);
if ($probed_contact["notify"] != "") {
logger('scrape data for slapper: '.print_r($probed_contact, true));
$url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
}
}
}
logger("url_recipients".print_r($url_recipients,true));
}
} else {
$followup = false; $followup = false;
// don't send deletions onward for other people's stuff // don't send deletions onward for other people's stuff
@ -306,9 +323,9 @@ function notifier_run(&$argv, &$argc){
return; return;
} }
if((strlen($parent['allow_cid'])) if((strlen($parent['allow_cid']))
|| (strlen($parent['allow_gid'])) || (strlen($parent['allow_gid']))
|| (strlen($parent['deny_cid'])) || (strlen($parent['deny_cid']))
|| (strlen($parent['deny_gid']))) { || (strlen($parent['deny_gid']))) {
$public_message = false; // private recipients, not public $public_message = false; // private recipients, not public
} }
@ -410,8 +427,7 @@ function notifier_run(&$argv, &$argc){
'$content' => xmlify($body), '$content' => xmlify($body),
'$parent_id' => xmlify($item['parent-uri']) '$parent_id' => xmlify($item['parent-uri'])
)); ));
} } elseif($fsuggest) {
elseif($fsuggest) {
$public_message = false; // suggestions are not public $public_message = false; // suggestions are not public
$sugg_template = get_markup_template('atom_suggest.tpl'); $sugg_template = get_markup_template('atom_suggest.tpl');
@ -430,9 +446,8 @@ function notifier_run(&$argv, &$argc){
intval($item['id']) intval($item['id'])
); );
} } elseif($relocate) {
elseif($relocate) { $public_message = false; // suggestions are not public
$public_message = false; // suggestions are not public
$sugg_template = get_markup_template('atom_relocate.tpl'); $sugg_template = get_markup_template('atom_relocate.tpl');
@ -453,24 +468,23 @@ function notifier_run(&$argv, &$argc){
} }
unset($rp, $ext); unset($rp, $ext);
$atom .= replace_macros($sugg_template, array( $atom .= replace_macros($sugg_template, array(
'$name' => xmlify($owner['name']), '$name' => xmlify($owner['name']),
'$photo' => xmlify($photos[4]), '$photo' => xmlify($photos[4]),
'$thumb' => xmlify($photos[5]), '$thumb' => xmlify($photos[5]),
'$micro' => xmlify($photos[6]), '$micro' => xmlify($photos[6]),
'$url' => xmlify($owner['url']), '$url' => xmlify($owner['url']),
'$request' => xmlify($owner['request']), '$request' => xmlify($owner['request']),
'$confirm' => xmlify($owner['confirm']), '$confirm' => xmlify($owner['confirm']),
'$notify' => xmlify($owner['notify']), '$notify' => xmlify($owner['notify']),
'$poll' => xmlify($owner['poll']), '$poll' => xmlify($owner['poll']),
'$sitepubkey' => xmlify(get_config('system','site_pubkey')), '$sitepubkey' => xmlify(get_config('system','site_pubkey')),
//'$pubkey' => xmlify($owner['pubkey']), //'$pubkey' => xmlify($owner['pubkey']),
//'$prvkey' => xmlify($owner['prvkey']), //'$prvkey' => xmlify($owner['prvkey']),
)); ));
$recipients_relocate = q("SELECT * FROM contact WHERE uid = %d AND self = 0 AND network = '%s'" , intval($uid), NETWORK_DFRN); $recipients_relocate = q("SELECT * FROM contact WHERE uid = %d AND self = 0 AND network = '%s'" , intval($uid), NETWORK_DFRN);
unset($photos); unset($photos);
} } else {
else {
if($followup) { if($followup) {
foreach($items as $item) { // there is only one item foreach($items as $item) { // there is only one item
if(! $item['parent']) if(! $item['parent'])
@ -481,8 +495,7 @@ function notifier_run(&$argv, &$argc){
$atom .= atom_entry($item,'text',null,$owner,false); $atom .= atom_entry($item,'text',null,$owner,false);
} }
} }
} } else {
else {
foreach($items as $item) { foreach($items as $item) {
if(! $item['parent']) if(! $item['parent'])
@ -506,11 +519,10 @@ function notifier_run(&$argv, &$argc){
if($item_id == $item['id'] || $item['id'] == $item['parent']) if($item_id == $item['id'] || $item['id'] == $item['parent'])
$atom .= atom_entry($item,'text',null,$owner,true); $atom .= atom_entry($item,'text',null,$owner,true);
} } else
else
$atom .= atom_entry($item,'text',null,$owner,true); $atom .= atom_entry($item,'text',null,$owner,true);
if(($top_level) && ($public_message) && ($item['author-link'] === $item['owner-link']) && (! $expire)) if(($top_level) && ($public_message) && ($item['author-link'] === $item['owner-link']) && (! $expire))
$slaps[] = atom_entry($item,'html',null,$owner,true); $slaps[] = atom_entry($item,'html',null,$owner,true);
} }
} }
@ -526,8 +538,8 @@ function notifier_run(&$argv, &$argc){
$mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1); $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
if(! $mail_disabled) { if(! $mail_disabled) {
if((! strlen($target_item['allow_cid'])) && (! strlen($target_item['allow_gid'])) if((! strlen($target_item['allow_cid'])) && (! strlen($target_item['allow_gid']))
&& (! strlen($target_item['deny_cid'])) && (! strlen($target_item['deny_gid'])) && (! strlen($target_item['deny_cid'])) && (! strlen($target_item['deny_gid']))
&& (intval($target_item['pubmail']))) { && (intval($target_item['pubmail']))) {
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `network` = '%s'", $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `network` = '%s'",
intval($uid), intval($uid),
@ -545,12 +557,12 @@ function notifier_run(&$argv, &$argc){
else else
$recip_str = implode(', ', $recipients); $recip_str = implode(', ', $recipients);
if ($relocate) if ($relocate)
$r = $recipients_relocate; $r = $recipients_relocate;
else else
$r = q("SELECT * FROM `contact` WHERE `id` IN ( %s ) AND `blocked` = 0 AND `pending` = 0 ", $r = q("SELECT * FROM `contact` WHERE `id` IN ( %s ) AND `blocked` = 0 AND `pending` = 0 ",
dbesc($recip_str) dbesc($recip_str)
); );
require_once('include/salmon.php'); require_once('include/salmon.php');
@ -946,7 +958,7 @@ function notifier_run(&$argv, &$argc){
} }
if((! $mail) && (! $fsuggest) && (! $followup)) { if((! $mail) && (! $fsuggest) && (! $followup)) {
logger('notifier: delivery agent: ' . $rr['name'] . ' ' . $rr['id']); logger('notifier: delivery agent: ' . $rr['name'] . ' ' . $rr['id']);
proc_run('php','include/delivery.php',$cmd,$item_id,$rr['id']); proc_run('php','include/delivery.php',$cmd,$item_id,$rr['id']);
if($interval) if($interval)
@time_sleep_until(microtime(true) + (float) $interval); @time_sleep_until(microtime(true) + (float) $interval);
@ -966,7 +978,7 @@ function notifier_run(&$argv, &$argc){
if ($h === '[internal]') { if ($h === '[internal]') {
// Set push flag for PuSH subscribers to this topic, // Set push flag for PuSH subscribers to this topic,
// they will be notified in queue.php // they will be notified in queue.php
q("UPDATE `push_subscriber` SET `push` = 1 " . q("UPDATE `push_subscriber` SET `push` = 1 " .
"WHERE `nickname` = '%s'", dbesc($owner['nickname'])); "WHERE `nickname` = '%s'", dbesc($owner['nickname']));
} else { } else {
@ -1001,6 +1013,6 @@ function notifier_run(&$argv, &$argc){
if (array_search(__file__,get_included_files())===0){ if (array_search(__file__,get_included_files())===0){
notifier_run($argv,$argc); notifier_run($_SERVER["argv"],$_SERVER["argc"]);
killme(); killme();
} }

View file

@ -110,6 +110,8 @@ function oembed_fetch_url($embedurl, $no_rich_type = false){
} }
} }
call_hooks('oembed_fetch_url', $embedurl, $j);
return $j; return $j;
} }

View file

@ -586,8 +586,8 @@ function onepoll_run(&$argv, &$argc){
// load current friends if possible. // load current friends if possible.
if($contact['poco']) { if($contact['poco']) {
$r = q("SELECT count(*) as total from glink $r = q("SELECT count(*) as total from glink
where `cid` = %d and updated > UTC_TIMESTAMP() - INTERVAL 1 DAY", where `cid` = %d and updated > UTC_TIMESTAMP() - INTERVAL 1 DAY",
intval($contact['id']) intval($contact['id'])
); );
@ -602,6 +602,6 @@ function onepoll_run(&$argv, &$argc){
} }
if (array_search(__file__,get_included_files())===0){ if (array_search(__file__,get_included_files())===0){
onepoll_run($argv,$argc); onepoll_run($_SERVER["argv"],$_SERVER["argc"]);
killme(); killme();
} }

View file

@ -20,12 +20,12 @@ function check_conversations() {
if($last) { if($last) {
$next = $last + ($poll_interval * 60); $next = $last + ($poll_interval * 60);
if($next > time()) { if($next > time()) {
logger('complete_conversation: poll interval not reached'); logger('poll interval not reached');
return; return;
} }
} }
logger('complete_conversation: cron_start'); logger('cron_start');
$start = date("Y-m-d H:i:s", time() - ($poll_timeframe * 60)); $start = date("Y-m-d H:i:s", time() - ($poll_timeframe * 60));
$conversations = q("SELECT * FROM `term` WHERE `type` = 7 AND `term` > '%s'", $conversations = q("SELECT * FROM `term` WHERE `type` = 7 AND `term` > '%s'",
@ -36,7 +36,7 @@ function check_conversations() {
complete_conversation($id, $url); complete_conversation($id, $url);
} }
logger('complete_conversation: cron_end'); logger(' cron_end');
set_config('system','ostatus_last_poll', time()); set_config('system','ostatus_last_poll', time());
} }
@ -52,8 +52,6 @@ function complete_conversation($itemid, $conversation_url, $only_add_conversatio
$a->last_ostatus_conversation_url = $conversation_url; $a->last_ostatus_conversation_url = $conversation_url;
//logger('complete_conversation: completing conversation url '.$conversation_url.' for id '.$itemid);
$messages = q("SELECT `uid`, `parent`, `created` FROM `item` WHERE `id` = %d LIMIT 1", intval($itemid)); $messages = q("SELECT `uid`, `parent`, `created` FROM `item` WHERE `id` = %d LIMIT 1", intval($itemid));
if (!$messages) if (!$messages)
return; return;
@ -90,8 +88,6 @@ function complete_conversation($itemid, $conversation_url, $only_add_conversatio
do { do {
$conv_as = fetch_url($conv."?page=".$pageno); $conv_as = fetch_url($conv."?page=".$pageno);
//$conv_as = fetch_url($conv."?page=".$pageno, false, 0, 10);
//$conv_as = file_get_contents($conv."?page=".$pageno);
$conv_as = str_replace(',"statusnet:notice_info":', ',"statusnet_notice_info":', $conv_as); $conv_as = str_replace(',"statusnet:notice_info":', ',"statusnet_notice_info":', $conv_as);
$conv_as = json_decode($conv_as); $conv_as = json_decode($conv_as);
@ -110,7 +106,7 @@ function complete_conversation($itemid, $conversation_url, $only_add_conversatio
$items = array_reverse($items); $items = array_reverse($items);
foreach ($items as $single_conv) { foreach ($items as $single_conv) {
// identi.ca just changed the format of the activity streams. This is a quick fix. // status.net changed the format of the activity streams. This is a quick fix.
if (@is_string($single_conv->object->id)) if (@is_string($single_conv->object->id))
$single_conv->id = $single_conv->object->id; $single_conv->id = $single_conv->object->id;
@ -127,7 +123,7 @@ function complete_conversation($itemid, $conversation_url, $only_add_conversatio
intval($message["uid"]), dbesc($first_id)); intval($message["uid"]), dbesc($first_id));
if ($new_parents) { if ($new_parents) {
$parent = $new_parents[0]; $parent = $new_parents[0];
logger('complete_conversation: adopting new parent '.$parent["id"].' for '.$itemid); logger('adopting new parent '.$parent["id"].' for '.$itemid);
} else { } else {
$parent["id"] = 0; $parent["id"] = 0;
$parent["uri"] = $first_id; $parent["uri"] = $first_id;
@ -144,6 +140,8 @@ function complete_conversation($itemid, $conversation_url, $only_add_conversatio
if ($message_exists) { if ($message_exists) {
if ($parent["id"] != 0) { if ($parent["id"] != 0) {
$existing_message = $message_exists[0]; $existing_message = $message_exists[0];
// This is partly bad, since the entry in the thread table isn't updated
$r = q("UPDATE `item` SET `parent` = %d, `parent-uri` = '%s', `thr-parent` = '%s' WHERE `id` = %d", $r = q("UPDATE `item` SET `parent` = %d, `parent-uri` = '%s', `thr-parent` = '%s' WHERE `id` = %d",
intval($parent["id"]), intval($parent["id"]),
dbesc($parent["uri"]), dbesc($parent["uri"]),
@ -153,12 +151,23 @@ function complete_conversation($itemid, $conversation_url, $only_add_conversatio
continue; continue;
} }
$contact = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' AND `network` != '%s'",
$message["uid"], normalise_link($single_conv->actor->id), NETWORK_STATUSNET);
if (count($contact)) {
logger("Found contact for url ".$single_conv->actor->id, LOGGER_DEBUG);
$contact_id = $contact[0]["id"];
} else {
logger("No contact found for url ".$single_conv->actor->id, LOGGER_DEBUG);
$contact_id = $parent["contact-id"];
}
$arr = array(); $arr = array();
$arr["network"] = NETWORK_OSTATUS; $arr["network"] = NETWORK_OSTATUS;
$arr["uri"] = $single_conv->id; $arr["uri"] = $single_conv->id;
$arr["plink"] = $single_conv->id; $arr["plink"] = $single_conv->id;
$arr["uid"] = $message["uid"]; $arr["uid"] = $message["uid"];
$arr["contact-id"] = $parent["contact-id"]; // To-Do $arr["contact-id"] = $contact_id;
if ($parent["id"] != 0) if ($parent["id"] != 0)
$arr["parent"] = $parent["id"]; $arr["parent"] = $parent["id"];
$arr["parent-uri"] = $parent["uri"]; $arr["parent-uri"] = $parent["uri"];
@ -201,20 +210,13 @@ function complete_conversation($itemid, $conversation_url, $only_add_conversatio
// If the newly created item is the top item then change the parent settings of the thread // If the newly created item is the top item then change the parent settings of the thread
if ($newitem AND ($arr["uri"] == $first_id)) { if ($newitem AND ($arr["uri"] == $first_id)) {
logger('complete_conversation: setting new parent to id '.$newitem); logger('setting new parent to id '.$newitem);
$new_parents = q("SELECT `id`, `uri`, `contact-id`, `type`, `verb`, `visible` FROM `item` WHERE `uid` = %d AND `id` = %d LIMIT 1", $new_parents = q("SELECT `id`, `uri`, `contact-id`, `type`, `verb`, `visible` FROM `item` WHERE `uid` = %d AND `id` = %d LIMIT 1",
intval($message["uid"]), intval($newitem)); intval($message["uid"]), intval($newitem));
if ($new_parents) { if ($new_parents) {
$parent = $new_parents[0]; $parent = $new_parents[0];
logger('complete_conversation: done changing parents to parent '.$newitem); logger('done changing parents to parent '.$newitem);
} }
/*logger('complete_conversation: changing parents to parent '.$newitem.' old parent: '.$parent["id"].' new uri: '.$arr["uri"]);
$r = q("UPDATE `item` SET `parent` = %d, `parent-uri` = '%s' WHERE `parent` = %d",
intval($newitem),
dbesc($arr["uri"]),
intval($parent["id"]));
logger('complete_conversation: done changing parents to parent '.$newitem.' '.print_r($r, true));*/
} }
} }
} }

View file

@ -301,6 +301,6 @@ function poller_run(&$argv, &$argc){
} }
if (array_search(__file__,get_included_files())===0){ if (array_search(__file__,get_included_files())===0){
poller_run($argv,$argc); poller_run($_SERVER["argv"],$_SERVER["argc"]);
killme(); killme();
} }

View file

@ -265,6 +265,6 @@ function queue_run(&$argv, &$argc){
} }
if (array_search(__file__,get_included_files())===0){ if (array_search(__file__,get_included_files())===0){
queue_run($argv,$argc); queue_run($_SERVER["argv"],$_SERVER["argc"]);
killme(); killme();
} }

View file

@ -12,14 +12,17 @@ require_once('include/datetime.php');
* *
* Once the global contact is stored add (if necessary) the contact linkage which associates * Once the global contact is stored add (if necessary) the contact linkage which associates
* the given uid, cid to the global contact entry. There can be many uid/cid combinations * the given uid, cid to the global contact entry. There can be many uid/cid combinations
* pointing to the same global contact id. * pointing to the same global contact id.
* *
*/ */
function poco_load($cid,$uid = 0,$zcid = 0,$url = null) { function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
require_once("include/html2bbcode.php");
$a = get_app(); $a = get_app();
if($cid) { if($cid) {
@ -39,7 +42,7 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
if(! $url) if(! $url)
return; return;
$url = $url . (($uid) ? '/@me/@all?fields=displayName,urls,photos' : '?fields=displayName,urls,photos') ; $url = $url . (($uid) ? '/@me/@all?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender' : '?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender') ;
logger('poco_load: ' . $url, LOGGER_DEBUG); logger('poco_load: ' . $url, LOGGER_DEBUG);
@ -67,6 +70,12 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
$profile_photo = ''; $profile_photo = '';
$connect_url = ''; $connect_url = '';
$name = ''; $name = '';
$network = '';
$updated = '0000-00-00 00:00:00';
$location = '';
$about = '';
$keywords = '';
$gender = '';
$name = $entry->displayName; $name = $entry->displayName;
@ -82,7 +91,7 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
} }
} }
} }
if(isset($entry->photos)) { if(isset($entry->photos)) {
foreach($entry->photos as $photo) { foreach($entry->photos as $photo) {
if($photo->type == 'profile') { if($photo->type == 'profile') {
$profile_photo = $photo->value; $profile_photo = $photo->value;
@ -91,74 +100,41 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
} }
} }
if((! $name) || (! $profile_url) || (! $profile_photo)) if(isset($entry->updated))
continue; $updated = date("Y-m-d H:i:s", strtotime($entry->updated));
$x = q("select * from `gcontact` where `nurl` = '%s' limit 1", if(isset($entry->network))
dbesc(normalise_link($profile_url)) $network = $entry->network;
);
if(count($x)) { if(isset($entry->currentLocation))
$gcid = $x[0]['id']; $location = $entry->currentLocation;
if($x[0]['name'] != $name || $x[0]['photo'] != $profile_photo) { if(isset($entry->aboutMe))
q("update gcontact set `name` = '%s', `photo` = '%s', `connect` = '%s', `url` = '%s' $about = html2bbcode($entry->aboutMe);
where `nurl` = '%s'",
dbesc($name), if(isset($entry->gender))
dbesc($profile_photo), $gender = $entry->gender;
dbesc($connect_url),
dbesc($profile_url), if(isset($entry->tags))
dbesc(normalise_link($profile_url)) foreach($entry->tags as $tag)
); $keywords = implode(", ", $tag);
}
} poco_check($profile_url, $name, $network, $profile_photo, $about, $location, $gender, $keywords, $connect_url, $updated, $cid, $uid, $zcid);
else {
q("insert into `gcontact` (`name`,`url`,`nurl`,`photo`,`connect`) // Update the Friendica contacts. Diaspora is doing it via a message. (See include/diaspora.php)
values ( '%s', '%s', '%s', '%s','%s') ", if (($location != "") OR ($about != "") OR ($keywords != "") OR ($gender != ""))
dbesc($name), q("UPDATE `contact` SET `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s'
dbesc($profile_url), WHERE `nurl` = '%s' AND NOT `self` AND `network` = '%s'",
dbesc($location),
dbesc($about),
dbesc($keywords),
dbesc($gender),
dbesc(normalise_link($profile_url)), dbesc(normalise_link($profile_url)),
dbesc($profile_photo), dbesc(NETWORK_DFRN));
dbesc($connect_url)
);
$x = q("select * from `gcontact` where `nurl` = '%s' limit 1",
dbesc(normalise_link($profile_url))
);
if(count($x))
$gcid = $x[0]['id'];
}
if(! $gcid)
return;
$r = q("select * from glink where `cid` = %d and `uid` = %d and `gcid` = %d and `zcid` = %d limit 1",
intval($cid),
intval($uid),
intval($gcid),
intval($zcid)
);
if(! count($r)) {
q("insert into glink ( `cid`,`uid`,`gcid`,`zcid`, `updated`) values (%d,%d,%d,%d, '%s') ",
intval($cid),
intval($uid),
intval($gcid),
intval($zcid),
dbesc(datetime_convert())
);
}
else {
q("update glink set updated = '%s' where `cid` = %d and `uid` = %d and `gcid` = %d and zcid = %d",
dbesc(datetime_convert()),
intval($cid),
intval($uid),
intval($gcid),
intval($zcid)
);
}
} }
logger("poco_load: loaded $total entries",LOGGER_DEBUG); logger("poco_load: loaded $total entries",LOGGER_DEBUG);
q("delete from glink where `cid` = %d and `uid` = %d and `zcid` = %d and `updated` < UTC_TIMESTAMP - INTERVAL 2 DAY", q("DELETE FROM `glink` WHERE `cid` = %d AND `uid` = %d AND `zcid` = %d AND `updated` < UTC_TIMESTAMP - INTERVAL 2 DAY",
intval($cid), intval($cid),
intval($uid), intval($uid),
intval($zcid) intval($zcid)
@ -166,6 +142,156 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
} }
function poco_check($profile_url, $name, $network, $profile_photo, $about, $location, $gender, $keywords, $connect_url, $updated, $cid = 0, $uid = 0, $zcid = 0) {
$gcid = "";
if ($profile_url == "")
return $gcid;
$x = q("SELECT * FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
dbesc(normalise_link($profile_url))
);
if(count($x))
$network = $x[0]["network"];
if (($network == "") OR ($name == "") OR ($profile_photo == "")) {
require_once("include/Scrape.php");
$data = probe_url($profile_url);
$network = $data["network"];
$name = $data["name"];
$profile_photo = $data["photo"];
}
if (count($x) AND ($x[0]["network"] == "") AND ($network != "")) {
q("UPDATE `gcontact` SET `network` = '%s' WHERE `nurl` = '%s'",
dbesc($network),
dbesc(normalise_link($profile_url))
);
}
if (($name == "") OR ($profile_photo == ""))
return $gcid;
if (!in_array($network, array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_STATUSNET)))
return $gcid;
logger("profile-check URL: ".$profile_url." name: ".$name." avatar: ".$profile_photo, LOGGER_DEBUG);
if(count($x)) {
$gcid = $x[0]['id'];
if (($location == "") AND ($x[0]['location'] != ""))
$location = $x[0]['location'];
if (($about == "") AND ($x[0]['about'] != ""))
$about = $x[0]['about'];
if (($gender == "") AND ($x[0]['gender'] != ""))
$gender = $x[0]['gender'];
if (($keywords == "") AND ($x[0]['keywords'] != ""))
$keywords = $x[0]['keywords'];
if($x[0]['name'] != $name || $x[0]['photo'] != $profile_photo || $x[0]['updated'] < $updated) {
q("update gcontact set `name` = '%s', `network` = '%s', `photo` = '%s', `connect` = '%s', `url` = '%s',
`updated` = '%s', `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s'
where `nurl` = '%s'",
dbesc($name),
dbesc($network),
dbesc($profile_photo),
dbesc($connect_url),
dbesc($profile_url),
dbesc($updated),
dbesc($location),
dbesc($about),
dbesc($keywords),
dbesc($gender),
dbesc(normalise_link($profile_url))
);
}
} else {
q("insert into `gcontact` (`name`,`network`, `url`,`nurl`,`photo`,`connect`, `updated`, `location`, `about`, `keywords`, `gender`)
values ('%s', '%s', '%s', '%s', '%s','%s', '%s', '%s', '%s', '%s', '%s')",
dbesc($name),
dbesc($network),
dbesc($profile_url),
dbesc(normalise_link($profile_url)),
dbesc($profile_photo),
dbesc($connect_url),
dbesc($updated),
dbesc($location),
dbesc($about),
dbesc($keywords),
dbesc($gender)
);
$x = q("SELECT * FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
dbesc(normalise_link($profile_url))
);
if(count($x))
$gcid = $x[0]['id'];
}
if(! $gcid)
return $gcid;
$r = q("SELECT * FROM `glink` WHERE `cid` = %d AND `uid` = %d AND `gcid` = %d AND `zcid` = %d LIMIT 1",
intval($cid),
intval($uid),
intval($gcid),
intval($zcid)
);
if(! count($r)) {
q("INSERT INTO `glink` (`cid`,`uid`,`gcid`,`zcid`, `updated`) VALUES (%d,%d,%d,%d, '%s') ",
intval($cid),
intval($uid),
intval($gcid),
intval($zcid),
dbesc(datetime_convert())
);
} else {
q("UPDATE `glink` SET `updated` = '%s' WHERE `cid` = %d AND `uid` = %d AND `gcid` = %d AND `zcid` = %d",
dbesc(datetime_convert()),
intval($cid),
intval($uid),
intval($gcid),
intval($zcid)
);
}
// For unknown reasons there are sometimes duplicates
q("DELETE FROM `gcontact` WHERE `nurl` = '%s' AND `id` != %d AND
NOT EXISTS (SELECT `gcid` FROM `glink` WHERE `gcid` = `gcontact`.`id`)",
dbesc(normalise_link($profile_url)),
intval($gcid)
);
return $gcid;
}
function poco_contact_from_body($body, $created, $cid, $uid) {
preg_replace_callback("/\[share(.*?)\].*?\[\/share\]/ism",
function ($match) use ($created, $cid, $uid){
return(sub_poco_from_share($match, $created, $cid, $uid));
}, $body);
}
function sub_poco_from_share($share, $created, $cid, $uid) {
$profile = "";
preg_match("/profile='(.*?)'/ism", $share[1], $matches);
if ($matches[1] != "")
$profile = $matches[1];
preg_match('/profile="(.*?)"/ism', $share[1], $matches);
if ($matches[1] != "")
$profile = $matches[1];
if ($profile == "")
return;
logger("prepare poco_check for profile ".$profile, LOGGER_DEBUG);
poco_check($profile, "", "", "", "", "", "", "", "", $created, $cid, $uid);
}
function count_common_friends($uid,$cid) { function count_common_friends($uid,$cid) {
@ -192,9 +318,9 @@ function common_friends($uid,$cid,$start = 0,$limit=9999,$shuffle = false) {
if($shuffle) if($shuffle)
$sql_extra = " order by rand() "; $sql_extra = " order by rand() ";
else else
$sql_extra = " order by `gcontact`.`name` asc "; $sql_extra = " order by `gcontact`.`name` asc ";
$r = q("SELECT `gcontact`.* $r = q("SELECT `gcontact`.*
FROM `glink` INNER JOIN `gcontact` on `glink`.`gcid` = `gcontact`.`id` FROM `glink` INNER JOIN `gcontact` on `glink`.`gcid` = `gcontact`.`id`
where `glink`.`cid` = %d and `glink`.`uid` = %d where `glink`.`cid` = %d and `glink`.`uid` = %d
and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 and id != %d ) and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 and id != %d )
@ -214,7 +340,7 @@ function common_friends($uid,$cid,$start = 0,$limit=9999,$shuffle = false) {
function count_common_friends_zcid($uid,$zcid) { function count_common_friends_zcid($uid,$zcid) {
$r = q("SELECT count(*) as `total` $r = q("SELECT count(*) as `total`
FROM `glink` INNER JOIN `gcontact` on `glink`.`gcid` = `gcontact`.`id` FROM `glink` INNER JOIN `gcontact` on `glink`.`gcid` = `gcontact`.`id`
where `glink`.`zcid` = %d where `glink`.`zcid` = %d
and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 ) ", and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 ) ",
@ -233,9 +359,9 @@ function common_friends_zcid($uid,$zcid,$start = 0, $limit = 9999,$shuffle = fal
if($shuffle) if($shuffle)
$sql_extra = " order by rand() "; $sql_extra = " order by rand() ";
else else
$sql_extra = " order by `gcontact`.`name` asc "; $sql_extra = " order by `gcontact`.`name` asc ";
$r = q("SELECT `gcontact`.* $r = q("SELECT `gcontact`.*
FROM `glink` INNER JOIN `gcontact` on `glink`.`gcid` = `gcontact`.`id` FROM `glink` INNER JOIN `gcontact` on `glink`.`gcid` = `gcontact`.`id`
where `glink`.`zcid` = %d where `glink`.`zcid` = %d
and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 ) and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 )
@ -269,9 +395,9 @@ function count_all_friends($uid,$cid) {
function all_friends($uid,$cid,$start = 0, $limit = 80) { function all_friends($uid,$cid,$start = 0, $limit = 80) {
$r = q("SELECT `gcontact`.* $r = q("SELECT `gcontact`.*
FROM `glink` INNER JOIN `gcontact` on `glink`.`gcid` = `gcontact`.`id` FROM `glink` INNER JOIN `gcontact` on `glink`.`gcid` = `gcontact`.`id`
where `glink`.`cid` = %d and `glink`.`uid` = %d where `glink`.`cid` = %d and `glink`.`uid` = %d
order by `gcontact`.`name` asc LIMIT %d, %d ", order by `gcontact`.`name` asc LIMIT %d, %d ",
intval($cid), intval($cid),
intval($uid), intval($uid),
@ -289,16 +415,31 @@ function suggestion_query($uid, $start = 0, $limit = 80) {
if(! $uid) if(! $uid)
return array(); return array();
$r = q("SELECT count(glink.gcid) as `total`, gcontact.* from gcontact $network = array(NETWORK_DFRN);
INNER JOIN glink on glink.gcid = gcontact.id
if (get_config('system','diaspora_enabled'))
$network[] = NETWORK_DIASPORA;
if (!get_config('system','ostatus_disabled'))
$network[] = NETWORK_OSTATUS;
$sql_network = implode("', '", $network);
//$sql_network = "'".$sql_network."', ''";
$sql_network = "'".$sql_network."'";
$r = q("SELECT count(glink.gcid) as `total`, gcontact.* from gcontact
INNER JOIN glink on glink.gcid = gcontact.id
where uid = %d and not gcontact.nurl in ( select nurl from contact where uid = %d ) where uid = %d and not gcontact.nurl in ( select nurl from contact where uid = %d )
and not gcontact.name in ( select name from contact where uid = %d ) and not gcontact.name in ( select name from contact where uid = %d )
and not gcontact.id in ( select gcid from gcign where uid = %d ) and not gcontact.id in ( select gcid from gcign where uid = %d )
group by glink.gcid order by total desc limit %d, %d ", AND `gcontact`.`updated` != '0000-00-00 00:00:00'
AND `gcontact`.`network` IN (%s)
group by glink.gcid order by gcontact.updated desc,total desc limit %d, %d ",
intval($uid), intval($uid),
intval($uid), intval($uid),
intval($uid), intval($uid),
intval($uid), intval($uid),
$sql_network,
intval($start), intval($start),
intval($limit) intval($limit)
); );
@ -306,22 +447,30 @@ function suggestion_query($uid, $start = 0, $limit = 80) {
if(count($r) && count($r) >= ($limit -1)) if(count($r) && count($r) >= ($limit -1))
return $r; return $r;
$r2 = q("SELECT gcontact.* from gcontact $r2 = q("SELECT gcontact.* from gcontact
INNER JOIN glink on glink.gcid = gcontact.id INNER JOIN glink on glink.gcid = gcontact.id
where glink.uid = 0 and glink.cid = 0 and glink.zcid = 0 and not gcontact.nurl in ( select nurl from contact where uid = %d ) where glink.uid = 0 and glink.cid = 0 and glink.zcid = 0 and not gcontact.nurl in ( select nurl from contact where uid = %d )
and not gcontact.name in ( select name from contact where uid = %d ) and not gcontact.name in ( select name from contact where uid = %d )
and not gcontact.id in ( select gcid from gcign where uid = %d ) and not gcontact.id in ( select gcid from gcign where uid = %d )
AND `gcontact`.`updated` != '0000-00-00 00:00:00'
AND `gcontact`.`network` IN (%s)
order by rand() limit %d, %d ", order by rand() limit %d, %d ",
intval($uid), intval($uid),
intval($uid), intval($uid),
intval($uid), intval($uid),
$sql_network,
intval($start), intval($start),
intval($limit) intval($limit)
); );
$list = array();
foreach ($r2 AS $suggestion)
$list[$suggestion["nurl"]] = $suggestion;
return array_merge($r,$r2); foreach ($r AS $suggestion)
$list[$suggestion["nurl"]] = $suggestion;
return $list;
} }
function update_suggestions() { function update_suggestions() {

View file

@ -2,6 +2,7 @@
require_once("include/template_processor.php"); require_once("include/template_processor.php");
require_once("include/friendica_smarty.php"); require_once("include/friendica_smarty.php");
require_once("mod/proxy.php");
if(! function_exists('replace_macros')) { if(! function_exists('replace_macros')) {
/** /**
@ -275,17 +276,17 @@ function paginate_data(&$a, $count=null) {
$stripped = trim($stripped,'/'); $stripped = trim($stripped,'/');
$pagenum = $a->pager['page']; $pagenum = $a->pager['page'];
if (($a->page_offset != "") AND !strstr($stripped, "&offset=")) if (($a->page_offset != "") AND !preg_match('/[?&].offset=/', $stripped))
$stripped .= "&offset=".urlencode($a->page_offset); $stripped .= "&offset=".urlencode($a->page_offset);
if (!strpos($stripped, "?")) {
if ($pos = strpos($stripped, "&"))
$stripped = substr($stripped, 0, $pos)."?".substr($stripped, $pos + 1);
}
$url = $a->get_baseurl() . '/' . $stripped; $url = $a->get_baseurl() . '/' . $stripped;
$data = array(); $data = array();
function _l(&$d, $name, $url, $text, $class="") { function _l(&$d, $name, $url, $text, $class="") {
if (!strpos($url, "?")) {
if ($pos = strpos($url, "&"))
$url = substr($url, 0, $pos)."?".substr($url, $pos + 1);
}
$d[$name] = array('url'=>$url, 'text'=>$text, 'class'=>$class); $d[$name] = array('url'=>$url, 'text'=>$text, 'class'=>$class);
} }
@ -928,7 +929,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
. (($click) ? ' fakelink' : '') . '" ' . (($click) ? ' fakelink' : '') . '" '
. (($redir) ? ' target="redir" ' : '') . (($redir) ? ' target="redir" ' : '')
. (($url) ? ' href="' . $url . '"' : '') . $click . ' ><img class="contact-block-img' . $class . $sparkle . '" src="' . (($url) ? ' href="' . $url . '"' : '') . $click . ' ><img class="contact-block-img' . $class . $sparkle . '" src="'
. $contact['micro'] . '" title="' . $contact['name'] . ' [' . $contact['url'] . ']" alt="' . $contact['name'] . proxy_url($contact['micro']) . '" title="' . $contact['name'] . ' [' . $contact['url'] . ']" alt="' . $contact['name']
. '" /></a></div>' . "\r\n"; . '" /></a></div>' . "\r\n";
} }
}} }}

View file

@ -149,26 +149,26 @@ function delete_thread_uri($itemuri, $uid) {
if(count($messages)) if(count($messages))
foreach ($messages as $message) foreach ($messages as $message)
delete_thread($message["id"]); delete_thread($message["id"], $itemuri);
} }
function delete_thread($itemid) { function delete_thread($itemid, $itemuri = "") {
$item = q("SELECT `uri`, `uid` FROM `thread` WHERE `iid` = %d", intval($itemid)); $item = q("SELECT `uid` FROM `thread` WHERE `iid` = %d", intval($itemid));
$result = q("DELETE FROM `thread` WHERE `iid` = %d", intval($itemid)); $result = q("DELETE FROM `thread` WHERE `iid` = %d", intval($itemid));
logger("delete_thread: Deleted thread for item ".$itemid." - ".print_r($result, true), LOGGER_DEBUG); logger("delete_thread: Deleted thread for item ".$itemid." - ".print_r($result, true), LOGGER_DEBUG);
if (count($item)) { if ($itemuri != "") {
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND NOT (`uid` IN (%d, 0))", $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND NOT (`uid` IN (%d, 0))",
dbesc($item["uri"]), dbesc($itemuri),
intval($item["uid"]) intval($item["uid"])
); );
if (!count($r)) { if (!count($r)) {
$r = q("DELETE FROM `item` WHERE `uri` = '%s' AND `uid` = 0)", $r = q("DELETE FROM `item` WHERE `uri` = '%s' AND `uid` = 0)",
dbesc($item["uri"]) dbesc($itemuri)
); );
logger("delete_thread: Deleted shadow for item ".$item["uri"]." - ".print_r($result, true), LOGGER_DEBUG); logger("delete_thread: Deleted shadow for item ".$itemuri." - ".print_r($result, true), LOGGER_DEBUG);
} }
} }
} }

View file

@ -20,7 +20,12 @@ class HTML5_Parser
// Cleanup invalid HTML // Cleanup invalid HTML
$doc = new DOMDocument(); $doc = new DOMDocument();
@$doc->loadHTML($text);
if (mb_detect_encoding($text, "UTF-8", true) == "UTF-8")
@$doc->loadHTML('<?xml encoding="UTF-8" ?>'.$text);
else
@$doc->loadHTML($text);
$text = $doc->saveHTML(); $text = $doc->saveHTML();
$tokenizer = new HTML5_Tokenizer($text, $builder); $tokenizer = new HTML5_Tokenizer($text, $builder);

View file

@ -1000,7 +1000,7 @@ function admin_page_users(&$a){
'$users' => $users, '$users' => $users,
'$newusername' => array('new_user_name', t("Name"), '', t("Name of the new user.")), '$newusername' => array('new_user_name', t("Name"), '', t("Name of the new user.")),
'$newusernickname' => array('new_user_nickname', t("Nickname"), '', t("Nickname of the new user.")), '$newusernickname' => array('new_user_nickname', t("Nickname"), '', t("Nickname of the new user.")),
'$newuseremail' => array('new_user_email', t("Email"), '', t("Email address of the new user.")), '$newuseremail' => array('new_user_email', t("Email"), '', t("Email address of the new user."), '', '', 'email'),
)); ));
$o .= paginate($a); $o .= paginate($a);
return $o; return $o;

46
mod/bookmarklet.php Normal file
View file

@ -0,0 +1,46 @@
<?php
require_once('include/conversation.php');
require_once('include/items.php');
function bookmarklet_init(&$a) {
$_GET["mode"] = "minimal";
}
function bookmarklet_content(&$a) {
if(!local_user()) {
$o = '<h2>'.t('Login').'</h2>';
$o .= login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true);
return $o;
}
$referer = normalise_link($_SERVER["HTTP_REFERER"]);
$page = normalise_link($a->get_baseurl()."/bookmarklet");
if (!strstr($referer, $page)) {
$content = add_page_info($_REQUEST["url"]);
$x = array(
'is_owner' => true,
'allow_location' => $a->user['allow_location'],
'default_location' => $a->user['default-location'],
'nickname' => $a->user['nickname'],
'lockstate' => ((is_array($a->user) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid'])))) ? 'lock' : 'unlock'),
'default_perms' => get_acl_permissions($a->user),
'acl' => populate_acl($a->user, $celeb),
'bang' => '',
'visitor' => 'block',
'profile_uid' => local_user(),
'acl_data' => construct_acl_data($a, $a->user), // For non-Javascript ACL selector
'title' => $_REQUEST["title"],
'content' => $content
);
$o = status_editor($a,$x, 0, false);
$o .= "<script>window.resizeTo(800,550);</script>";
} else {
$o = '<h2>'.t('The post was created').'</h2>';
$o .= "<script>window.close()</script>";
}
return $o;
}

View file

@ -3,6 +3,7 @@
require_once('include/Contact.php'); require_once('include/Contact.php');
require_once('include/socgraph.php'); require_once('include/socgraph.php');
require_once('include/contact_selectors.php'); require_once('include/contact_selectors.php');
require_once('mod/proxy.php');
function contacts_init(&$a) { function contacts_init(&$a) {
if(! local_user()) if(! local_user())
@ -73,12 +74,12 @@ function contacts_init(&$a) {
function contacts_batch_actions(&$a){ function contacts_batch_actions(&$a){
$contacts_id = $_POST['contact_batch']; $contacts_id = $_POST['contact_batch'];
if (!is_array($contacts_id)) return; if (!is_array($contacts_id)) return;
$orig_records = q("SELECT * FROM `contact` WHERE `id` IN (%s) AND `uid` = %d AND `self` = 0", $orig_records = q("SELECT * FROM `contact` WHERE `id` IN (%s) AND `uid` = %d AND `self` = 0",
implode(",", $contacts_id), implode(",", $contacts_id),
intval(local_user()) intval(local_user())
); );
$count_actions=0; $count_actions=0;
foreach($orig_records as $orig_record) { foreach($orig_records as $orig_record) {
$contact_id = $orig_record['id']; $contact_id = $orig_record['id'];
@ -106,7 +107,7 @@ function contacts_batch_actions(&$a){
if ($count_actions>0) { if ($count_actions>0) {
info ( sprintf( tt("%d contact edited.", "%d contacts edited", $count_actions), $count_actions) ); info ( sprintf( tt("%d contact edited.", "%d contacts edited", $count_actions), $count_actions) );
} }
if(x($_SESSION,'return_url')) if(x($_SESSION,'return_url'))
goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']); goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
else else
@ -407,19 +408,19 @@ function contacts_content(&$a) {
$url = "redir/{$contact['id']}"; $url = "redir/{$contact['id']}";
$sparkle = ' class="sparkle" '; $sparkle = ' class="sparkle" ';
} }
else { else {
$url = $contact['url']; $url = $contact['url'];
$sparkle = ''; $sparkle = '';
} }
$insecure = t('Private communications are not available for this contact.'); $insecure = t('Private communications are not available for this contact.');
$last_update = (($contact['last-update'] == '0000-00-00 00:00:00') $last_update = (($contact['last-update'] == '0000-00-00 00:00:00')
? t('Never') ? t('Never')
: datetime_convert('UTC',date_default_timezone_get(),$contact['last-update'],'D, j M Y, g:i A')); : datetime_convert('UTC',date_default_timezone_get(),$contact['last-update'],'D, j M Y, g:i A'));
if($contact['last-update'] !== '0000-00-00 00:00:00') if($contact['last-update'] !== '0000-00-00 00:00:00')
$last_update .= ' ' . (($contact['last-update'] == $contact['success_update']) ? t("\x28Update was successful\x29") : t("\x28Update was not successful\x29")); $last_update .= ' ' . (($contact['last-update'] <= $contact['success_update']) ? t("\x28Update was successful\x29") : t("\x28Update was not successful\x29"));
$lblsuggest = (($contact['network'] === NETWORK_DFRN) ? t('Suggest friends') : ''); $lblsuggest = (($contact['network'] === NETWORK_DFRN) ? t('Suggest friends') : '');
@ -430,7 +431,7 @@ function contacts_content(&$a) {
$common = count_common_friends(local_user(),$contact['id']); $common = count_common_friends(local_user(),$contact['id']);
$common_text = (($common) ? sprintf( tt('%d contact in common','%d contacts in common', $common),$common) : ''); $common_text = (($common) ? sprintf( tt('%d contact in common','%d contacts in common', $common),$common) : '');
$polling = (($contact['network'] === NETWORK_MAIL | $contact['network'] === NETWORK_FEED) ? 'polling' : ''); $polling = (($contact['network'] === NETWORK_MAIL | $contact['network'] === NETWORK_FEED) ? 'polling' : '');
$x = count_all_friends(local_user(), $contact['id']); $x = count_all_friends(local_user(), $contact['id']);
$all_friends = (($x) ? t('View all contacts') : ''); $all_friends = (($x) ? t('View all contacts') : '');
@ -623,11 +624,11 @@ function contacts_content(&$a) {
if($nets) if($nets)
$sql_extra .= sprintf(" AND network = '%s' ", dbesc($nets)); $sql_extra .= sprintf(" AND network = '%s' ", dbesc($nets));
$sql_extra2 = ((($sort_type > 0) && ($sort_type <= CONTACT_IS_FRIEND)) ? sprintf(" AND `rel` = %d ",intval($sort_type)) : '');
$sql_extra2 = ((($sort_type > 0) && ($sort_type <= CONTACT_IS_FRIEND)) ? sprintf(" AND `rel` = %d ",intval($sort_type)) : '');
$r = q("SELECT COUNT(*) AS `total` FROM `contact`
$r = q("SELECT COUNT(*) AS `total` FROM `contact`
WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ", WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ",
intval($_SESSION['uid'])); intval($_SESSION['uid']));
if(count($r)) { if(count($r)) {
@ -668,7 +669,7 @@ function contacts_content(&$a) {
$url = "redir/{$rr['id']}"; $url = "redir/{$rr['id']}";
$sparkle = ' class="sparkle" '; $sparkle = ' class="sparkle" ';
} }
else { else {
$url = $rr['url']; $url = $rr['url'];
$sparkle = ''; $sparkle = '';
} }
@ -681,7 +682,7 @@ function contacts_content(&$a) {
'id' => $rr['id'], 'id' => $rr['id'],
'alt_text' => $alt_text, 'alt_text' => $alt_text,
'dir_icon' => $dir_icon, 'dir_icon' => $dir_icon,
'thumb' => $rr['thumb'], 'thumb' => proxy_url($rr['thumb']),
'name' => $rr['name'], 'name' => $rr['name'],
'username' => $rr['name'], 'username' => $rr['name'],
'sparkle' => $sparkle, 'sparkle' => $sparkle,

View file

@ -16,7 +16,7 @@ function display_init(&$a) {
// Does the local user have this item? // Does the local user have this item?
if (local_user()) { if (local_user()) {
$r = q("SELECT `id`, `parent`, `author-name`, `author-link`, `author-avatar`, `network`, `body` FROM `item` $r = q("SELECT `id`, `parent`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid` FROM `item`
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
AND `guid` = '%s' AND `uid` = %d", $a->argv[1], local_user()); AND `guid` = '%s' AND `uid` = %d", $a->argv[1], local_user());
if (count($r)) { if (count($r)) {
@ -43,7 +43,7 @@ function display_init(&$a) {
} }
if (count($r)) { if (count($r)) {
if ($r[0]["id"] != $r[0]["parent"]) if ($r[0]["id"] != $r[0]["parent"])
$r = q("SELECT `id`, `author-name`, `author-link`, `author-avatar`, `network`, `body` FROM `item` $r = q("SELECT `id`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid` FROM `item`
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
AND `id` = %d", $r[0]["parent"]); AND `id` = %d", $r[0]["parent"]);
@ -89,23 +89,28 @@ function display_fetchauthor($a, $item) {
$profiledata["url"] = $item["author-link"]; $profiledata["url"] = $item["author-link"];
$profiledata["network"] = $item["network"]; $profiledata["network"] = $item["network"];
// Fetching profile data from unique contacts // Fetching further contact data from the contact table
// To-do: Extend "unique contacts" table for further contact data like location, ... $r = q("SELECT `photo`, `nick`, `location`, `about` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d",
$r = q("SELECT `avatar`, `nick` FROM `unique_contacts` WHERE `url` = '%s'", normalise_link($profiledata["url"])); normalise_link($profiledata["url"]), $item["uid"]);
if (count($r)) { if (count($r)) {
$profiledata["photo"] = proxy_url($r[0]["avatar"]); $profiledata["photo"] = proxy_url($r[0]["photo"]);
$profiledata["address"] = proxy_parse_html(bbcode($r[0]["location"]));
$profiledata["about"] = proxy_parse_html(bbcode($r[0]["about"]));
if ($r[0]["nick"] != "") if ($r[0]["nick"] != "")
$profiledata["nickname"] = $r[0]["nick"]; $profiledata["nickname"] = $r[0]["nick"];
} else { }
// Is this case possible?
// Fetching further contact data from the contact table, when it isn't available in the "unique contacts" // Fetching profile data from unique contacts
$r = q("SELECT `photo`, `nick` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d", $r = q("SELECT `avatar`, `nick`, `location`, `about` FROM `unique_contacts` WHERE `url` = '%s'", normalise_link($profiledata["url"]));
normalise_link($profiledata["url"]), $itemuid); if (count($r)) {
if (count($r)) { if ($profiledata["photo"] == "")
$profiledata["photo"] = proxy_url($r[0]["photo"]); $profiledata["photo"] = proxy_url($r[0]["avatar"]);
if ($r[0]["nick"] != "") if ($profiledata["address"] == "")
$profiledata["nickname"] = $r[0]["nick"]; $profiledata["address"] = proxy_parse_html(bbcode($r[0]["location"]));
} if ($profiledata["about"] == "")
$profiledata["about"] = proxy_parse_html(bbcode($r[0]["about"]));
if (($profiledata["nickname"] == "") AND ($r[0]["nick"] != ""))
$profiledata["nickname"] = $r[0]["nick"];
} }
// Check for a repeated message // Check for a repeated message
@ -158,6 +163,21 @@ function display_fetchauthor($a, $item) {
$profiledata["nickname"] = $profiledata["name"]; $profiledata["nickname"] = $profiledata["name"];
$profiledata["network"] = GetProfileUsername($profiledata["url"], "", false, true); $profiledata["network"] = GetProfileUsername($profiledata["url"], "", false, true);
$profiledata["address"] = "";
$profiledata["about"] = "";
// Fetching profile data from unique contacts
if ($profiledata["url"] != "") {
$r = q("SELECT `avatar`, `nick`, `location`, `about` FROM `unique_contacts` WHERE `url` = '%s'", normalise_link($profiledata["url"]));
if (count($r)) {
$profiledata["photo"] = proxy_url($r[0]["avatar"]);
$profiledata["address"] = proxy_parse_html(bbcode($r[0]["location"]));
$profiledata["about"] = proxy_parse_html(bbcode($r[0]["about"]));
if ($r[0]["nick"] != "")
$profiledata["nickname"] = $r[0]["nick"];
}
}
} }
if (local_user()) { if (local_user()) {

View file

@ -231,11 +231,11 @@ function install_content(&$a) {
'$status' => $wizard_status, '$status' => $wizard_status,
'$dbhost' => array('dbhost', t('Database Server Name'), $dbhost, ''), '$dbhost' => array('dbhost', t('Database Server Name'), $dbhost, '', 'required'),
'$dbuser' => array('dbuser', t('Database Login Name'), $dbuser, ''), '$dbuser' => array('dbuser', t('Database Login Name'), $dbuser, '', 'required', 'autofocus'),
'$dbpass' => array('dbpass', t('Database Login Password'), $dbpass, ''), '$dbpass' => array('dbpass', t('Database Login Password'), $dbpass, '', 'required'),
'$dbdata' => array('dbdata', t('Database Name'), $dbdata, ''), '$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.')), '$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, '$dbdata' => $dbdata,
'$phpath' => $phpath, '$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, ''), '$timezone' => field_timezone('timezone', t('Please select a default timezone for your website'), $timezone, ''),

View file

@ -90,14 +90,14 @@ function item_post(&$a) {
$r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1", $r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1",
intval($parent) intval($parent)
); );
} } elseif($parent_uri && local_user()) {
elseif($parent_uri && local_user()) {
// This is coming from an API source, and we are logged in // This is coming from an API source, and we are logged in
$r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", $r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($parent_uri), dbesc($parent_uri),
intval(local_user()) intval(local_user())
); );
} }
// if this isn't the real parent of the conversation, find it // if this isn't the real parent of the conversation, find it
if($r !== false && count($r)) { if($r !== false && count($r)) {
$parid = $r[0]['parent']; $parid = $r[0]['parent'];
@ -127,8 +127,27 @@ function item_post(&$a) {
intval($parent_item['contact-id']), intval($parent_item['contact-id']),
intval($uid) intval($uid)
); );
if(count($r)) if(count($r)) {
$parent_contact = $r[0]; $parent_contact = $r[0];
// If the contact id doesn't fit with the contact, then set the contact to null
$thrparent = q("SELECT `author-link`, `network` FROM `item` WHERE `uri` = '%s' LIMIT 1", dbesc($thr_parent));
if (count($thrparent) AND ($thrparent[0]["network"] === NETWORK_OSTATUS)
AND (normalise_link($parent_contact["url"]) != normalise_link($thrparent[0]["author-link"]))) {
$parent_contact = null;
require_once("include/Scrape.php");
$probed_contact = probe_url($thrparent[0]["author-link"]);
if ($probed_contact["network"] != NETWORK_FEED) {
$parent_contact = $probed_contact;
$parent_contact["nurl"] = normalise_link($probed_contact["url"]);
$parent_contact["thumb"] = $probed_contact["photo"];
$parent_contact["micro"] = $probed_contact["photo"];
}
logger('parent contact: '.print_r($parent_contact, true), LOGGER_DEBUG);
} else
logger('no contact found: '.print_r($thrparent, true), LOGGER_DEBUG);
}
} }
} }

View file

@ -139,7 +139,7 @@ function item_redir_and_replace_images($body, $images, $cid) {
for($i = 0; $i < count($images); $i++) { for($i = 0; $i < count($images); $i++) {
$search = '/\[url\=(.*?)\]\[!#saved_image' . $i . '#!\]\[\/url\]' . '/is'; $search = '/\[url\=(.*?)\]\[!#saved_image' . $i . '#!\]\[\/url\]' . '/is';
$replace = '[url=' . z_path() . '/redir/' . $cid $replace = '[url=' . z_path() . '/redir/' . $cid
. '?f=1&url=' . '$1' . '][!#saved_image' . $i . '#!][/url]' ; . '?f=1&url=' . '$1' . '][!#saved_image' . $i . '#!][/url]' ;
$img_end = strpos($origbody, '[!#saved_image' . $i . '#!][/url]') + strlen('[!#saved_image' . $i . '#!][/url]'); $img_end = strpos($origbody, '[!#saved_image' . $i . '#!][/url]') + strlen('[!#saved_image' . $i . '#!][/url]');
@ -256,17 +256,17 @@ function message_content(&$a) {
if($r) if($r)
info( t('Conversation removed.') . EOL ); info( t('Conversation removed.') . EOL );
} }
//goaway($a->get_baseurl(true) . '/message' ); //goaway($a->get_baseurl(true) . '/message' );
goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']); goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
} }
} }
if(($a->argc > 1) && ($a->argv[1] === 'new')) { if(($a->argc > 1) && ($a->argv[1] === 'new')) {
$o .= $header; $o .= $header;
/* $plaintext = false; /* $plaintext = false;
if(intval(get_pconfig(local_user(),'system','plaintext'))) if(intval(get_pconfig(local_user(),'system','plaintext')))
$plaintext = true;*/ $plaintext = true;*/
@ -282,7 +282,7 @@ function message_content(&$a) {
'$nickname' => $a->user['nickname'], '$nickname' => $a->user['nickname'],
'$linkurl' => t('Please enter a link URL:') '$linkurl' => t('Please enter a link URL:')
)); ));
$tpl = get_markup_template('msg-end.tpl'); $tpl = get_markup_template('msg-end.tpl');
$a->page['end'] .= replace_macros($tpl, array( $a->page['end'] .= replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(true), '$baseurl' => $a->get_baseurl(true),
@ -290,9 +290,9 @@ function message_content(&$a) {
'$nickname' => $a->user['nickname'], '$nickname' => $a->user['nickname'],
'$linkurl' => t('Please enter a link URL:') '$linkurl' => t('Please enter a link URL:')
)); ));
$preselect = (isset($a->argv[2])?array($a->argv[2]):false); $preselect = (isset($a->argv[2])?array($a->argv[2]):false);
$prename = $preurl = $preid = ''; $prename = $preurl = $preid = '';
@ -306,19 +306,19 @@ function message_content(&$a) {
$preurl = $r[0]['url']; $preurl = $r[0]['url'];
$preid = $r[0]['id']; $preid = $r[0]['id'];
} }
} }
$prefill = (($preselect) ? $prename : ''); $prefill = (($preselect) ? $prename : '');
// the ugly select box // the ugly select box
$select = contact_select('messageto','message-to-select', $preselect, 4, true, false, false, 10); $select = contact_select('messageto','message-to-select', $preselect, 4, true, false, false, 10);
$tpl = get_markup_template('prv_message.tpl'); $tpl = get_markup_template('prv_message.tpl');
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$header' => t('Send Private Message'), '$header' => t('Send Private Message'),
'$to' => t('To:'), '$to' => t('To:'),
'$showinputs' => 'true', '$showinputs' => 'true',
'$prefill' => $prefill, '$prefill' => $prefill,
'$autocomp' => $autocomp, '$autocomp' => $autocomp,
'$preid' => $preid, '$preid' => $preid,
@ -347,8 +347,8 @@ function message_content(&$a) {
$o .= $header; $o .= $header;
$r = q("SELECT count(*) AS `total` FROM `mail` $r = q("SELECT count(*) AS `total` FROM `mail`
WHERE `mail`.`uid` = %d GROUP BY `parent-uri` ORDER BY `created` DESC", WHERE `mail`.`uid` = %d GROUP BY `parent-uri` ORDER BY `created` DESC",
intval(local_user()), intval(local_user()),
dbesc($myprofile) dbesc($myprofile)
@ -356,10 +356,10 @@ function message_content(&$a) {
if(count($r)) if(count($r))
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
$r = q("SELECT max(`mail`.`created`) AS `mailcreated`, min(`mail`.`seen`) AS `mailseen`, $r = q("SELECT max(`mail`.`created`) AS `mailcreated`, min(`mail`.`seen`) AS `mailseen`,
`mail`.* , `contact`.`name`, `contact`.`url`, `contact`.`thumb` , `contact`.`network`, `mail`.* , `contact`.`name`, `contact`.`url`, `contact`.`thumb` , `contact`.`network`,
count( * ) as count count( * ) as count
FROM `mail` LEFT JOIN `contact` ON `mail`.`contact-id` = `contact`.`id` FROM `mail` LEFT JOIN `contact` ON `mail`.`contact-id` = `contact`.`id`
WHERE `mail`.`uid` = %d GROUP BY `parent-uri` ORDER BY `mailcreated` DESC LIMIT %d , %d ", WHERE `mail`.`uid` = %d GROUP BY `parent-uri` ORDER BY `mailcreated` DESC LIMIT %d , %d ",
intval(local_user()), intval(local_user()),
// //
@ -394,7 +394,7 @@ function message_content(&$a) {
$body_e = $rr['body']; $body_e = $rr['body'];
$to_name_e = $rr['name']; $to_name_e = $rr['name'];
} }
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
'$id' => $rr['id'], '$id' => $rr['id'],
'$from_name' => $partecipants, '$from_name' => $partecipants,
@ -411,7 +411,7 @@ function message_content(&$a) {
'$count' => sprintf( tt('%d message', '%d messages', $rr['count']), $rr['count']), '$count' => sprintf( tt('%d message', '%d messages', $rr['count']), $rr['count']),
)); ));
} }
$o .= paginate($a); $o .= paginate($a);
return $o; return $o;
} }
@ -423,13 +423,13 @@ function message_content(&$a) {
if( local_user() && feature_enabled(local_user(),'richtext') ) if( local_user() && feature_enabled(local_user(),'richtext') )
$plaintext = false; $plaintext = false;
$r = q("SELECT `mail`.*, `contact`.`name`, `contact`.`url`, `contact`.`thumb` $r = q("SELECT `mail`.*, `contact`.`name`, `contact`.`url`, `contact`.`thumb`
FROM `mail` LEFT JOIN `contact` ON `mail`.`contact-id` = `contact`.`id` FROM `mail` LEFT JOIN `contact` ON `mail`.`contact-id` = `contact`.`id`
WHERE `mail`.`uid` = %d AND `mail`.`id` = %d LIMIT 1", WHERE `mail`.`uid` = %d AND `mail`.`id` = %d LIMIT 1",
intval(local_user()), intval(local_user()),
intval($a->argv[1]) intval($a->argv[1])
); );
if(count($r)) { if(count($r)) {
$contact_id = $r[0]['contact-id']; $contact_id = $r[0]['contact-id'];
$convid = $r[0]['convid']; $convid = $r[0]['convid'];
@ -438,10 +438,10 @@ function message_content(&$a) {
$sql_extra = sprintf(" and ( `mail`.`parent-uri` = '%s' OR `mail`.`convid` = '%d' ) ", $sql_extra = sprintf(" and ( `mail`.`parent-uri` = '%s' OR `mail`.`convid` = '%d' ) ",
dbesc($r[0]['parent-uri']), dbesc($r[0]['parent-uri']),
intval($convid) intval($convid)
); );
$messages = q("SELECT `mail`.*, `contact`.`name`, `contact`.`url`, `contact`.`thumb` $messages = q("SELECT `mail`.*, `contact`.`name`, `contact`.`url`, `contact`.`thumb`
FROM `mail` LEFT JOIN `contact` ON `mail`.`contact-id` = `contact`.`id` FROM `mail` LEFT JOIN `contact` ON `mail`.`contact-id` = `contact`.`id`
WHERE `mail`.`uid` = %d $sql_extra ORDER BY `mail`.`created` ASC", WHERE `mail`.`uid` = %d $sql_extra ORDER BY `mail`.`created` ASC",
intval(local_user()) intval(local_user())
); );
@ -522,7 +522,7 @@ function message_content(&$a) {
'date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'],'D, d M Y - g:i A'), 'date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'],'D, d M Y - g:i A'),
'ago' => relative_date($message['created']), 'ago' => relative_date($message['created']),
); );
$seen = $message['seen']; $seen = $message['seen'];
} }
@ -545,9 +545,9 @@ function message_content(&$a) {
'$thread_seen' => $seen, '$thread_seen' => $seen,
'$delete' => t('Delete conversation'), '$delete' => t('Delete conversation'),
'$canreply' => (($unknown) ? false : '1'), '$canreply' => (($unknown) ? false : '1'),
'$unknown_text' => t("No secure communications available. You <strong>may</strong> be able to respond from the sender's profile page."), '$unknown_text' => t("No secure communications available. You <strong>may</strong> be able to respond from the sender's profile page."),
'$mails' => $mails, '$mails' => $mails,
// reply // reply
'$header' => t('Send Reply'), '$header' => t('Send Reply'),
'$to' => t('To:'), '$to' => t('To:'),

View file

@ -369,7 +369,7 @@ function network_content(&$a, $update = 0) {
if(feature_enabled(local_user(),'personal_tab')) { if(feature_enabled(local_user(),'personal_tab')) {
$tabs[] = array( $tabs[] = array(
'label' => t('Personal'), '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, 'sel' => $conv_active,
'title' => t('Posts that mention or involve you'), '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')) { if(feature_enabled(local_user(),'link_tab')) {
$tabs[] = array( $tabs[] = array(
'label' => t('Shared Links'), '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, 'sel'=>$bookmarked_active,
'title'=> t('Interesting Links'), 'title'=> t('Interesting Links'),
); );
@ -396,7 +396,7 @@ function network_content(&$a, $update = 0) {
if(feature_enabled(local_user(),'star_posts')) { if(feature_enabled(local_user(),'star_posts')) {
$tabs[] = array( $tabs[] = array(
'label' => t('Starred'), '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, 'sel'=>$starred_active,
'title' => t('Favourite Posts'), 'title' => t('Favourite Posts'),
); );

View file

@ -73,7 +73,7 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 0); curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 3); curl_setopt($ch, CURLOPT_TIMEOUT, 3);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
@ -102,6 +102,28 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co
$siteinfo["type"] = $oembed_data->type; $siteinfo["type"] = $oembed_data->type;
} }
// if the file is too large then exit
if ($curl_info["download_content_length"] > 1000000)
return($siteinfo);
// if it isn't a HTML file then exit
if (($curl_info["content_type"] != "") AND !strstr(strtolower($curl_info["content_type"]),"html"))
return($siteinfo);
// Now fetch the body as well
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent());
$header = curl_exec($ch);
$curl_info = @curl_getinfo($ch);
$http_code = $curl_info['http_code'];
curl_close($ch);
// Fetch the first mentioned charset. Can be in body or header // Fetch the first mentioned charset. Can be in body or header
$charset = ""; $charset = "";
if (preg_match('/charset=(.*?)['."'".'"\s\n]/', $header, $matches)) if (preg_match('/charset=(.*?)['."'".'"\s\n]/', $header, $matches))

View file

@ -1,6 +1,7 @@
<?php <?php
function poco_init(&$a) { function poco_init(&$a) {
require_once("include/bbcode.php");
$system_mode = false; $system_mode = false;
@ -12,7 +13,7 @@ function poco_init(&$a) {
$user = notags(trim($a->argv[1])); $user = notags(trim($a->argv[1]));
} }
if(! x($user)) { if(! x($user)) {
$c = q("select * from pconfig where cat = 'system' and k = 'suggestme' and v = 1"); $c = q("SELECT * FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1");
if(! count($c)) if(! count($c))
http_status_exit(401); http_status_exit(401);
$system_mode = true; $system_mode = true;
@ -21,7 +22,12 @@ function poco_init(&$a) {
$format = (($_GET['format']) ? $_GET['format'] : 'json'); $format = (($_GET['format']) ? $_GET['format'] : 'json');
$justme = false; $justme = false;
$global = false;
if($a->argc > 1 && $a->argv[1] === '@global') {
$global = true;
$update_limit = date("Y-m-d H:i:s", time() - 30 * 86400);
}
if($a->argc > 2 && $a->argv[2] === '@me') if($a->argc > 2 && $a->argv[2] === '@me')
$justme = true; $justme = true;
if($a->argc > 3 && $a->argv[3] === '@all') if($a->argc > 3 && $a->argv[3] === '@all')
@ -30,9 +36,9 @@ function poco_init(&$a) {
$justme = true; $justme = true;
if($a->argc > 4 && intval($a->argv[4]) && $justme == false) if($a->argc > 4 && intval($a->argv[4]) && $justme == false)
$cid = intval($a->argv[4]); $cid = intval($a->argv[4]);
if(! $system_mode) {
if(!$system_mode AND !$global) {
$r = q("SELECT `user`.*,`profile`.`hide-friends` from user left join profile on `user`.`uid` = `profile`.`uid` $r = q("SELECT `user`.*,`profile`.`hide-friends` from user left join profile on `user`.`uid` = `profile`.`uid`
where `user`.`nickname` = '%s' and `profile`.`is-default` = 1 limit 1", where `user`.`nickname` = '%s' and `profile`.`is-default` = 1 limit 1",
dbesc($user) dbesc($user)
@ -44,21 +50,37 @@ function poco_init(&$a) {
} }
if($justme) if($justme)
$sql_extra = " and `contact`.`self` = 1 "; $sql_extra = " AND `contact`.`self` = 1 ";
else // else
$sql_extra = " and `contact`.`self` = 0 "; // $sql_extra = " AND `contact`.`self` = 0 ";
if($cid) if($cid)
$sql_extra = sprintf(" and `contact`.`id` = %d ",intval($cid)); $sql_extra = sprintf(" AND `contact`.`id` = %d ",intval($cid));
if($system_mode) { if(x($_GET,'updatedSince'))
$r = q("SELECT count(*) as `total` from `contact` where self = 1 $update_limit = date("Y-m-d H:i:s",strtotime($_GET['updatedSince']));
and uid in (select uid from pconfig where cat = 'system' and k = 'suggestme' and v = 1) ");
} if ($global) {
else { $r = q("SELECT count(*) AS `total` FROM `gcontact` WHERE `updated` >= '%s' AND `network` IN ('%s')",
$r = q("SELECT count(*) as `total` from `contact` where `uid` = %d and blocked = 0 and pending = 0 and hidden = 0 and archive = 0 dbesc($update_limit),
$sql_extra ", dbesc(NETWORK_DFRN)
intval($user['uid']) );
} elseif($system_mode) {
$r = q("SELECT count(*) AS `total` FROM `contact` WHERE `self` = 1 AND `network` IN ('%s', '%s', '%s', '%s', '')
AND `uid` IN (SELECT `uid` FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1) ",
dbesc(NETWORK_DFRN),
dbesc(NETWORK_DIASPORA),
dbesc(NETWORK_OSTATUS),
dbesc(NETWORK_STATUSNET)
);
} else {
$r = q("SELECT count(*) AS `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0
AND `network` IN ('%s', '%s', '%s', '%s', '') $sql_extra",
intval($user['uid']),
dbesc(NETWORK_DFRN),
dbesc(NETWORK_DIASPORA),
dbesc(NETWORK_OSTATUS),
dbesc(NETWORK_STATUSNET)
); );
} }
if(count($r)) if(count($r))
@ -72,29 +94,45 @@ function poco_init(&$a) {
$itemsPerPage = ((x($_GET,'count') && intval($_GET['count'])) ? intval($_GET['count']) : $totalResults); $itemsPerPage = ((x($_GET,'count') && intval($_GET['count'])) ? intval($_GET['count']) : $totalResults);
if($system_mode) { if ($global) {
$r = q("SELECT * from contact where self = 1 $r = q("SELECT * FROM `gcontact` WHERE `updated` > '%s' AND `network` IN ('%s') LIMIT %d, %d",
and uid in (select uid from pconfig where cat = 'system' and k = 'suggestme' and v = 1) limit %d, %d ", dbesc($update_limit),
dbesc(NETWORK_DFRN),
intval($startIndex), intval($startIndex),
intval($itemsPerPage) intval($itemsPerPage)
); );
} } elseif($system_mode) {
else { $r = q("SELECT `contact`.*, `profile`.`about` AS `pabout`, `profile`.`locality` AS `plocation`, `profile`.`pub_keywords`, `profile`.`gender` AS `pgender`
FROM `contact` INNER JOIN `profile` ON `profile`.`uid` = `contact`.`uid`
$r = q("SELECT * from `contact` where `uid` = %d and blocked = 0 and pending = 0 and hidden = 0 and archive = 0 WHERE `self` = 1 AND `network` IN ('%s', '%s', '%s', '%s', '') AND `profile`.`is-default`
$sql_extra LIMIT %d, %d", AND `contact`.`uid` IN (SELECT `uid` FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1) LIMIT %d, %d",
dbesc(NETWORK_DFRN),
dbesc(NETWORK_DIASPORA),
dbesc(NETWORK_OSTATUS),
dbesc(NETWORK_STATUSNET),
intval($startIndex),
intval($itemsPerPage)
);
} else {
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0
AND `network` IN ('%s', '%s', '%s', '%s', '') $sql_extra LIMIT %d, %d",
intval($user['uid']), intval($user['uid']),
dbesc(NETWORK_DFRN),
dbesc(NETWORK_DIASPORA),
dbesc(NETWORK_OSTATUS),
dbesc(NETWORK_STATUSNET),
intval($startIndex), intval($startIndex),
intval($itemsPerPage) intval($itemsPerPage)
); );
} }
$ret = array(); $ret = array();
if(x($_GET,'sorted')) if(x($_GET,'sorted'))
$ret['sorted'] = 'false'; $ret['sorted'] = false;
if(x($_GET,'filtered')) if(x($_GET,'filtered'))
$ret['filtered'] = 'false'; $ret['filtered'] = false;
if(x($_GET,'updatedSince')) if(x($_GET,'updatedSince') AND !$global)
$ret['updateSince'] = 'false'; $ret['updatedSince'] = false;
$ret['startIndex'] = (string) $startIndex; $ret['startIndex'] = (string) $startIndex;
$ret['itemsPerPage'] = (string) $itemsPerPage; $ret['itemsPerPage'] = (string) $itemsPerPage;
@ -106,8 +144,14 @@ function poco_init(&$a) {
'id' => false, 'id' => false,
'displayName' => false, 'displayName' => false,
'urls' => false, 'urls' => false,
'updated' => false,
'preferredUsername' => false, 'preferredUsername' => false,
'photos' => false 'photos' => false,
'aboutMe' => false,
'currentLocation' => false,
'network' => false,
'gender' => false,
'tags' => false
); );
if((! x($_GET,'fields')) || ($_GET['fields'] === '@all')) if((! x($_GET,'fields')) || ($_GET['fields'] === '@all'))
@ -122,20 +166,76 @@ function poco_init(&$a) {
if(is_array($r)) { if(is_array($r)) {
if(count($r)) { if(count($r)) {
foreach($r as $rr) { foreach($r as $rr) {
if (($rr['about'] == "") AND isset($rr['pabout']))
$rr['about'] = $rr['pabout'];
if (($rr['location'] == "") AND isset($rr['plocation']))
$rr['location'] = $rr['plocation'];
if (($rr['gender'] == "") AND isset($rr['pgender']))
$rr['gender'] = $rr['pgender'];
if (($rr['keywords'] == "") AND isset($rr['pub_keywords']))
$rr['keywords'] = $rr['pub_keywords'];
$entry = array(); $entry = array();
if($fields_ret['id']) if($fields_ret['id'])
$entry['id'] = $rr['id']; $entry['id'] = $rr['id'];
if($fields_ret['displayName']) if($fields_ret['displayName'])
$entry['displayName'] = $rr['name']; $entry['displayName'] = $rr['name'];
if($fields_ret['aboutMe'])
$entry['aboutMe'] = bbcode($rr['about'], false, false);
if($fields_ret['currentLocation'])
$entry['currentLocation'] = $rr['location'];
if($fields_ret['gender'])
$entry['gender'] = $rr['gender'];
if($fields_ret['urls']) { if($fields_ret['urls']) {
$entry['urls'] = array(array('value' => $rr['url'], 'type' => 'profile')); $entry['urls'] = array(array('value' => $rr['url'], 'type' => 'profile'));
if($rr['addr'] && ($rr['network'] !== NETWORK_MAIL)) if($rr['addr'] && ($rr['network'] !== NETWORK_MAIL))
$entry['urls'][] = array('value' => 'acct:' . $rr['addr'], 'type' => 'webfinger'); $entry['urls'][] = array('value' => 'acct:' . $rr['addr'], 'type' => 'webfinger');
} }
if($fields_ret['preferredUsername']) if($fields_ret['preferredUsername'])
$entry['preferredUsername'] = $rr['nick']; $entry['preferredUsername'] = $rr['nick'];
if($fields_ret['updated']) {
if (!$global) {
$entry['updated'] = $rr['success_update'];
if ($rr['name-date'] > $entry['updated'])
$entry['updated'] = $rr['name-date'];
if ($rr['uri-date'] > $entry['updated'])
$entry['updated'] = $rr['uri-date'];
if ($rr['avatar-date'] > $entry['updated'])
$entry['updated'] = $rr['avatar-date'];
} else
$entry['updated'] = $rr['updated'];
$entry['updated'] = date("c", strtotime($entry['updated']));
}
if($fields_ret['photos']) if($fields_ret['photos'])
$entry['photos'] = array(array('value' => $rr['photo'], 'type' => 'profile')); $entry['photos'] = array(array('value' => $rr['photo'], 'type' => 'profile'));
if($fields_ret['network']) {
$entry['network'] = $rr['network'];
if ($entry['network'] == NETWORK_STATUSNET)
$entry['network'] = NETWORK_OSTATUS;
if (($entry['network'] == "") AND ($rr['self']))
$entry['network'] = NETWORK_DFRN;
}
if($fields_ret['tags']) {
$tags = str_replace(","," ",$rr['keywords']);
$tags = explode(" ", $tags);
$cleaned = array();
foreach ($tags as $tag) {
$tag = trim(strtolower($tag));
if ($tag != "")
$cleaned[] = $tag;
}
$entry['tags'] = array($cleaned);
}
$ret['entry'][] = $entry; $ret['entry'][] = $entry;
} }
} }
@ -153,7 +253,7 @@ function poco_init(&$a) {
if($format === 'json') { if($format === 'json') {
header('Content-type: application/json'); header('Content-type: application/json');
echo json_encode($ret); echo json_encode($ret);
killme(); killme();
} }
else else
http_status_exit(500); http_status_exit(500);

View file

@ -137,9 +137,26 @@ function profiles_init(&$a) {
profile_load($a,$a->user['nickname'],$r[0]['id']); profile_load($a,$a->user['nickname'],$r[0]['id']);
} }
}
function profile_clean_keywords($keywords) {
$keywords = str_replace(","," ",$keywords);
$keywords = explode(" ", $keywords);
$cleaned = array();
foreach ($keywords as $keyword) {
$keyword = trim(strtolower($keyword));
$keyword = trim($keyword, "#");
if ($keyword != "")
$cleaned[] = $keyword;
}
$keywords = implode(", ", $cleaned);
return $keywords;
} }
function profiles_post(&$a) { function profiles_post(&$a) {
@ -193,7 +210,7 @@ function profiles_post(&$a) {
$dob = '0000-00-00'; $dob = '0000-00-00';
$dob = sprintf('%04d-%02d-%02d',$year,$month,$day); $dob = sprintf('%04d-%02d-%02d',$year,$month,$day);
$name = notags(trim($_POST['name'])); $name = notags(trim($_POST['name']));
if(! strlen($name)) { if(! strlen($name)) {
@ -212,8 +229,8 @@ function profiles_post(&$a) {
$region = notags(trim($_POST['region'])); $region = notags(trim($_POST['region']));
$postal_code = notags(trim($_POST['postal_code'])); $postal_code = notags(trim($_POST['postal_code']));
$country_name = notags(trim($_POST['country_name'])); $country_name = notags(trim($_POST['country_name']));
$pub_keywords = notags(trim($_POST['pub_keywords'])); $pub_keywords = profile_clean_keywords(notags(trim($_POST['pub_keywords'])));
$prv_keywords = notags(trim($_POST['prv_keywords'])); $prv_keywords = profile_clean_keywords(notags(trim($_POST['prv_keywords'])));
$marital = notags(trim($_POST['marital'])); $marital = notags(trim($_POST['marital']));
$howlong = notags(trim($_POST['howlong'])); $howlong = notags(trim($_POST['howlong']));
@ -223,7 +240,7 @@ function profiles_post(&$a) {
$howlong = '0000-00-00 00:00:00'; $howlong = '0000-00-00 00:00:00';
else else
$howlong = datetime_convert(date_default_timezone_get(),'UTC',$howlong); $howlong = datetime_convert(date_default_timezone_get(),'UTC',$howlong);
// linkify the relationship target if applicable // linkify the relationship target if applicable
$withchanged = false; $withchanged = false;
@ -277,7 +294,7 @@ function profiles_post(&$a) {
$newname = $r[0]['name']; $newname = $r[0]['name'];
} }
} }
if($prf) { if($prf) {
$with = str_replace($lookup,'<a href="' . $prf . '">' . $newname . '</a>', $with); $with = str_replace($lookup,'<a href="' . $prf . '">' . $newname . '</a>', $with);
if(strpos($with,'@') === 0) if(strpos($with,'@') === 0)
@ -468,6 +485,15 @@ function profiles_post(&$a) {
} }
if($is_default) { if($is_default) {
$r = q("UPDATE `contact` SET `about` = '%s', `location` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `self` = 1 AND `uid` = %d",
dbesc($about),
dbesc($locality),
dbesc($pub_keywords),
dbesc($gender),
intval(local_user())
);
// Update global directory in background // Update global directory in background
$url = $_SESSION['my_url']; $url = $_SESSION['my_url'];
if($url && strlen(get_config('system','directory_submit_url'))) if($url && strlen(get_config('system','directory_submit_url')))

View file

@ -15,7 +15,7 @@ function salmon_return($val) {
if($val >= 200 && $val < 300) if($val >= 200 && $val < 300)
$err = 'OK'; $err = 'OK';
logger('mod-salmon returns ' . $val); logger('mod-salmon returns ' . $val);
header($_SERVER["SERVER_PROTOCOL"] . ' ' . $val . ' ' . $err); header($_SERVER["SERVER_PROTOCOL"] . ' ' . $val . ' ' . $err);
killme(); killme();
@ -50,7 +50,7 @@ function salmon_post(&$a) {
$base = $dom->env; $base = $dom->env;
elseif($dom->data) elseif($dom->data)
$base = $dom; $base = $dom;
if(! $base) { if(! $base) {
logger('mod-salmon: unable to locate salmon data in xml '); logger('mod-salmon: unable to locate salmon data in xml ');
http_status_exit(400); http_status_exit(400);
@ -92,7 +92,7 @@ function salmon_post(&$a) {
// Create a fake feed wrapper so simplepie doesn't choke // Create a fake feed wrapper so simplepie doesn't choke
$tpl = get_markup_template('fake_feed.tpl'); $tpl = get_markup_template('fake_feed.tpl');
$base = substr($data,strpos($data,'<entry')); $base = substr($data,strpos($data,'<entry'));
$feedxml = $tpl . $base . '</feed>'; $feedxml = $tpl . $base . '</feed>';
@ -100,7 +100,7 @@ function salmon_post(&$a) {
logger('mod-salmon: Processed feed: ' . $feedxml); logger('mod-salmon: Processed feed: ' . $feedxml);
// Now parse it like a normal atom feed to scrape out the author URI // Now parse it like a normal atom feed to scrape out the author URI
$feed = new SimplePie(); $feed = new SimplePie();
$feed->set_raw_data($feedxml); $feed->set_raw_data($feedxml);
$feed->enable_order_by_date(false); $feed->enable_order_by_date(false);
@ -192,7 +192,7 @@ function salmon_post(&$a) {
); );
} }
} }
} }
// is this a follower? Or have we ignored the person? // is this a follower? Or have we ignored the person?
// If so we can not accept this post. // If so we can not accept this post.
@ -223,7 +223,3 @@ function salmon_post(&$a) {
http_status_exit(200); http_status_exit(200);
} }

View file

@ -395,6 +395,8 @@ function settings_post(&$a) {
$post_joingroup = (($_POST['post_joingroup'] == 1) ? 1: 0); $post_joingroup = (($_POST['post_joingroup'] == 1) ? 1: 0);
$post_profilechange = (($_POST['post_profilechange'] == 1) ? 1: 0); $post_profilechange = (($_POST['post_profilechange'] == 1) ? 1: 0);
$email_textonly = (($_POST['email_textonly'] == 1) ? 1 : 0);
$notify = 0; $notify = 0;
if(x($_POST,'notify1')) 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_joingroup', $post_joingroup);
set_pconfig(local_user(),'system','post_profilechange', $post_profilechange); set_pconfig(local_user(),'system','post_profilechange', $post_profilechange);
set_pconfig(local_user(),'system','email_textonly', $email_textonly);
if($page_flags == PAGE_PRVGROUP) { if($page_flags == PAGE_PRVGROUP) {
$hidewall = 1; $hidewall = 1;
@ -505,7 +508,7 @@ function settings_post(&$a) {
} }
else { else {
notice( t('Private forum has no privacy permissions and no default privacy group.') . EOL); notice( t('Private forum has no privacy permissions and no default privacy group.') . EOL);
} }
} }
} }
@ -656,7 +659,7 @@ function settings_content(&$a) {
} }
$r = q("SELECT clients.*, tokens.id as oauth_token, (clients.uid=%d) AS my $r = q("SELECT clients.*, tokens.id as oauth_token, (clients.uid=%d) AS my
FROM clients FROM clients
LEFT JOIN tokens ON clients.client_id=tokens.client_id LEFT JOIN tokens ON clients.client_id=tokens.client_id
WHERE clients.uid IN (%d,0)", WHERE clients.uid IN (%d,0)",
@ -830,7 +833,7 @@ function settings_content(&$a) {
$is_experimental = file_exists('view/theme/' . $th . '/experimental'); $is_experimental = file_exists('view/theme/' . $th . '/experimental');
$unsupported = file_exists('view/theme/' . $th . '/unsupported'); $unsupported = file_exists('view/theme/' . $th . '/unsupported');
$is_mobile = file_exists('view/theme/' . $th . '/mobile'); $is_mobile = file_exists('view/theme/' . $th . '/mobile');
if (!$is_experimental or ($is_experimental && (get_config('experimentals','exp_themes')==1 or get_config('experimentals','exp_themes')===false))){ if (!$is_experimental or ($is_experimental && (get_config('experimentals','exp_themes')==1 or get_config('experimentals','exp_themes')===false))){
$theme_name = (($is_experimental) ? sprintf("%s - \x28Experimental\x29", $f) : $f); $theme_name = (($is_experimental) ? sprintf("%s - \x28Experimental\x29", $f) : $f);
if($is_mobile) { if($is_mobile) {
$mobile_themes[$f]=$theme_name; $mobile_themes[$f]=$theme_name;
@ -1078,8 +1081,8 @@ function settings_content(&$a) {
'items' => array('expire_items', t("Expire posts:"), $expire_items, '', array(t('No'),t('Yes'))), 'items' => array('expire_items', t("Expire posts:"), $expire_items, '', array(t('No'),t('Yes'))),
'notes' => array('expire_notes', t("Expire personal notes:"), $expire_notes, '', array(t('No'),t('Yes'))), 'notes' => array('expire_notes', t("Expire personal notes:"), $expire_notes, '', array(t('No'),t('Yes'))),
'starred' => array('expire_starred', t("Expire starred posts:"), $expire_starred, '', array(t('No'),t('Yes'))), 'starred' => array('expire_starred', t("Expire starred posts:"), $expire_starred, '', array(t('No'),t('Yes'))),
'photos' => array('expire_photos', t("Expire photos:"), $expire_photos, '', array(t('No'),t('Yes'))), 'photos' => array('expire_photos', t("Expire photos:"), $expire_photos, '', array(t('No'),t('Yes'))),
'network_only' => array('expire_network_only', t("Only expire posts by others:"), $expire_network_only, '', array(t('No'),t('Yes'))), 'network_only' => array('expire_network_only', t("Only expire posts by others:"), $expire_network_only, '', array(t('No'),t('Yes'))),
); );
require_once('include/group.php'); require_once('include/group.php');
@ -1123,7 +1126,7 @@ function settings_content(&$a) {
'$h_basic' => t('Basic Settings'), '$h_basic' => t('Basic Settings'),
'$username' => array('username', t('Full Name:'), $username,''), '$username' => array('username', t('Full Name:'), $username,''),
'$email' => array('email', t('Email Address:'), $email, ''), '$email' => array('email', t('Email Address:'), $email, '', '', '', 'email'),
'$timezone' => array('timezone_select' , t('Your Timezone:'), select_timezone($timezone), ''), '$timezone' => array('timezone_select' , t('Your Timezone:'), select_timezone($timezone), ''),
'$defloc' => array('defloc', t('Default Post Location:'), $defloc, ''), '$defloc' => array('defloc', t('Default Post Location:'), $defloc, ''),
'$allowloc' => array('allow_location', t('Use Browser Location:'), ($a->user['allow_location'] == 1), ''), '$allowloc' => array('allow_location', t('Use Browser Location:'), ($a->user['allow_location'] == 1), ''),
@ -1175,10 +1178,13 @@ function settings_content(&$a) {
'$notify3' => array('notify3', t('Someone writes on your profile wall'), ($notify & NOTIFY_WALL), NOTIFY_WALL, ''), '$notify3' => array('notify3', t('Someone writes on your profile wall'), ($notify & NOTIFY_WALL), NOTIFY_WALL, ''),
'$notify4' => array('notify4', t('Someone writes a followup comment'), ($notify & NOTIFY_COMMENT), NOTIFY_COMMENT, ''), '$notify4' => array('notify4', t('Someone writes a followup comment'), ($notify & NOTIFY_COMMENT), NOTIFY_COMMENT, ''),
'$notify5' => array('notify5', t('You receive a private message'), ($notify & NOTIFY_MAIL), NOTIFY_MAIL, ''), '$notify5' => array('notify5', t('You receive a private message'), ($notify & NOTIFY_MAIL), NOTIFY_MAIL, ''),
'$notify6' => array('notify6', t('You receive a friend suggestion'), ($notify & NOTIFY_SUGGEST), NOTIFY_SUGGEST, ''), '$notify6' => array('notify6', t('You receive a friend suggestion'), ($notify & NOTIFY_SUGGEST), NOTIFY_SUGGEST, ''),
'$notify7' => array('notify7', t('You are tagged in a post'), ($notify & NOTIFY_TAGSELF), NOTIFY_TAGSELF, ''), '$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, ''), '$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_advn' => t('Advanced Account/Page Type Settings'),
'$h_descadvn' => t('Change the behaviour of this account for special situations'), '$h_descadvn' => t('Change the behaviour of this account for special situations'),

View file

@ -44,13 +44,15 @@ function suggest_init(&$a) {
} }
} }
function suggest_content(&$a) { function suggest_content(&$a) {
require_once("mod/proxy.php");
$o = ''; $o = '';
if(! local_user()) { if(! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);
@ -82,7 +84,7 @@ function suggest_content(&$a) {
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$url' => zrl($rr['url']), '$url' => zrl($rr['url']),
'$name' => $rr['name'], '$name' => $rr['name'],
'$photo' => $rr['photo'], '$photo' => proxy_url($rr['photo']),
'$ignlnk' => $a->get_baseurl() . '/suggest?ignore=' . $rr['id'], '$ignlnk' => $a->get_baseurl() . '/suggest?ignore=' . $rr['id'],
'$ignid' => $rr['id'], '$ignid' => $rr['id'],
'$conntxt' => t('Connect'), '$conntxt' => t('Connect'),

View file

@ -13,6 +13,8 @@ function viewcontacts_init(&$a) {
function viewcontacts_content(&$a) { function viewcontacts_content(&$a) {
require_once("mod/proxy.php");
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) { if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
notice( t('Public access denied.') . EOL); notice( t('Public access denied.') . EOL);
return; return;
@ -21,7 +23,7 @@ function viewcontacts_content(&$a) {
if(((! count($a->profile)) || ($a->profile['hide-friends']))) { if(((! count($a->profile)) || ($a->profile['hide-friends']))) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);
return; return;
} }
$r = q("SELECT COUNT(*) as `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ", $r = q("SELECT COUNT(*) as `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ",
@ -60,7 +62,7 @@ function viewcontacts_content(&$a) {
$contacts[] = array( $contacts[] = array(
'id' => $rr['id'], 'id' => $rr['id'],
'img_hover' => sprintf( t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']), 'img_hover' => sprintf( t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']),
'thumb' => $rr['thumb'], 'thumb' => proxy_url($rr['thumb']),
'name' => substr($rr['name'],0,20), 'name' => substr($rr['name'],0,20),
'username' => $rr['name'], 'username' => $rr['name'],
'url' => $url, 'url' => $url,

View file

@ -8,14 +8,14 @@
* During installation we need to check if register_argc_argv is * During installation we need to check if register_argc_argv is
* enabled for the command line PHP processor, because otherwise * enabled for the command line PHP processor, because otherwise
* deliveries will fail. So we will do a shell exec of php and * deliveries will fail. So we will do a shell exec of php and
* execute this file with a command line argument, and see if it * execute this file with a command line argument, and see if it
* echoes the argument back to us. Otherwise notify the person * echoes the argument back to us. Otherwise notify the person
* that their installation doesn't meet the system requirements. * that their installation doesn't meet the system requirements.
* *
*/ */
if(($argc > 1) && isset($argv[1])) if(($_SERVER["argc"] > 1) && isset($_SERVER["argv"][1]))
echo $argv[1]; echo $_SERVER["argv"][1];
else else
echo ''; echo '';

View file

@ -1,6 +1,6 @@
<?php <?php
define( 'UPDATE_VERSION' , 1175 ); define( 'UPDATE_VERSION' , 1178 );
/** /**
* *
@ -1609,3 +1609,24 @@ All following update functions are ONLY for jobs that need to run AFTER the data
Database changes are ONLY applied in the file include/dbstructure.php. Database changes are ONLY applied in the file include/dbstructure.php.
*/ */
function update_1177() {
require_once("mod/profiles.php");
$profiles = q("SELECT `uid`, `about`, `locality`, `pub_keywords`, `gender` FROM `profile` WHERE `is-default`");
foreach ($profiles AS $profile) {
if ($profile["about"].$profile["locality"].$profile["pub_keywords"].$profile["gender"] == "")
continue;
$profile["pub_keywords"] = profile_clean_keywords($profile["pub_keywords"]);
$r = q("UPDATE `contact` SET `about` = '%s', `location` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `self` AND `uid` = %d",
dbesc($profile["about"]),
dbesc($profile["locality"]),
dbesc($profile["pub_keywords"]),
dbesc($profile["gender"]),
intval($profile["uid"])
);
}
}

View file

@ -82,11 +82,11 @@ Xgettext and .po workflow
This script runs xgettext on source tree, extracting strings from t() and tt() This script runs xgettext on source tree, extracting strings from t() and tt()
functions, and creates a util/messages.po file. functions, and creates a util/messages.po file.
% cd util; ./run_xgettext.sh ../view/{language}/messages.po $ cd util; ./run_xgettext.sh
Replace {language} with the language you are working on - e.g. 'es', 'fr', 'de', etc.
2. copy util/messages.po to view/<langauage>/messages.po 2. copy util/messages.po to view/<langauage>/messages.po
Replace <language> with the language you are working on - e.g. 'es', 'fr', 'de', etc.
3. open view/<langauage>/messages.po with a text editor and fill in infos in 3. open view/<langauage>/messages.po with a text editor and fill in infos in
"Last-Translator: FULL NAME <EMAIL@ADDRESS>" "Last-Translator: FULL NAME <EMAIL@ADDRESS>"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

File diff suppressed because it is too large Load diff

View file

@ -8,7 +8,7 @@ function po2php_run(&$argv, &$argc) {
print "Usage: ".$argv[0]." <file.po>\n\n"; print "Usage: ".$argv[0]." <file.po>\n\n";
return; return;
} }
$pofile = $argv[1]; $pofile = $argv[1];
$outfile = dirname($pofile)."/strings.php"; $outfile = dirname($pofile)."/strings.php";
@ -23,11 +23,11 @@ function po2php_run(&$argv, &$argc) {
print "Unable to find '$pofile'\n"; print "Unable to find '$pofile'\n";
return; return;
} }
print "Out to '$outfile'\n"; print "Out to '$outfile'\n";
$out="<?php\n\n"; $out="<?php\n\n";
$infile = file($pofile); $infile = file($pofile);
$k=""; $k="";
$v=""; $v="";
@ -53,14 +53,14 @@ function po2php_run(&$argv, &$argc) {
$out .= ' return '.$cond.';'."\n"; $out .= ' return '.$cond.';'."\n";
$out .= '}}'."\n"; $out .= '}}'."\n";
} }
if ($k!="" && substr($l,0,7)=="msgstr "){ if ($k!="" && substr($l,0,7)=="msgstr "){
if ($ink) { $ink = False; $out .= '$a->strings["'.$k.'"] = '; } if ($ink) { $ink = False; $out .= '$a->strings["'.$k.'"] = '; }
if ($inv) { $inv = False; $out .= '"'.$v.'"'; } if ($inv) { $inv = False; $out .= '"'.$v.'"'; }
$v = substr($l,8,$len-10); $v = substr($l,8,$len-10);
$v = preg_replace_callback($escape_s_exp,'escape_s',$v); $v = preg_replace_callback($escape_s_exp,'escape_s',$v);
$inv = True; $inv = True;
@ -69,28 +69,28 @@ function po2php_run(&$argv, &$argc) {
if ($k!="" && substr($l,0,7)=="msgstr["){ if ($k!="" && substr($l,0,7)=="msgstr["){
if ($ink) { $ink = False; $out .= '$a->strings["'.$k.'"] = '; } if ($ink) { $ink = False; $out .= '$a->strings["'.$k.'"] = '; }
if ($inv) { $inv = False; $out .= '"'.$v.'"'; } if ($inv) { $inv = False; $out .= '"'.$v.'"'; }
if (!$arr) { if (!$arr) {
$arr=True; $arr=True;
$out .= "array(\n"; $out .= "array(\n";
} }
$match=Array(); $match=Array();
preg_match("|\[([0-9]*)\] (.*)|", $l, $match); preg_match("|\[([0-9]*)\] (.*)|", $l, $match);
$out .= "\t". $out .= "\t".
preg_replace_callback($escape_s_exp,'escape_s',$match[1]) preg_replace_callback($escape_s_exp,'escape_s',$match[1])
." => " ." => "
.preg_replace_callback($escape_s_exp,'escape_s',$match[2]) .",\n"; .preg_replace_callback($escape_s_exp,'escape_s',$match[2]) .",\n";
} }
if (substr($l,0,6)=="msgid_") { $ink = False; $out .= '$a->strings["'.$k.'"] = '; }; if (substr($l,0,6)=="msgid_") { $ink = False; $out .= '$a->strings["'.$k.'"] = '; };
if ($ink) { if ($ink) {
$k .= trim($l,"\"\r\n"); $k .= trim($l,"\"\r\n");
$k = preg_replace_callback($escape_s_exp,'escape_s',$k); $k = preg_replace_callback($escape_s_exp,'escape_s',$k);
//$out .= '$a->strings['.$k.'] = '; //$out .= '$a->strings['.$k.'] = ';
} }
if (substr($l,0,6)=="msgid "){ if (substr($l,0,6)=="msgid "){
if ($inv) { $inv = False; $out .= '"'.$v.'"'; } if ($inv) { $inv = False; $out .= '"'.$v.'"'; }
if ($k!="") $out .= $arr?");\n":";\n"; if ($k!="") $out .= $arr?");\n":";\n";
@ -101,28 +101,28 @@ function po2php_run(&$argv, &$argc) {
} else { } else {
$k = ""; $k = "";
} }
$k = preg_replace_callback($escape_s_exp,'escape_s',$k); $k = preg_replace_callback($escape_s_exp,'escape_s',$k);
$ink = True; $ink = True;
} }
if ($inv && substr($l,0,6)!="msgstr") { if ($inv && substr($l,0,6)!="msgstr") {
$v .= trim($l,"\"\r\n"); $v .= trim($l,"\"\r\n");
$v = preg_replace_callback($escape_s_exp,'escape_s',$v); $v = preg_replace_callback($escape_s_exp,'escape_s',$v);
//$out .= '$a->strings['.$k.'] = '; //$out .= '$a->strings['.$k.'] = ';
} }
} }
if ($inv) { $inv = False; $out .= '"'.$v.'"'; } if ($inv) { $inv = False; $out .= '"'.$v.'"'; }
if ($k!="") $out .= $arr?");\n":";\n"; if ($k!="") $out .= $arr?");\n":";\n";
$out = str_replace(DQ_ESCAPE, '\"', $out); $out = str_replace(DQ_ESCAPE, '\"', $out);
file_put_contents($outfile, $out); file_put_contents($outfile, $out);
} }
if (array_search(__file__,get_included_files())===0){ if (array_search(__file__,get_included_files())===0){
po2php_run($argv,$argc); po2php_run($_SERVER["argv"],$_SERVER["argc"]);
} }

View file

@ -30,18 +30,6 @@ F9KVERSION=$(sed -n "s/.*'FRIENDICA_VERSION'.*'\([0-9.]*\)'.*/\1/p" ../../boot.p
echo "Friendica version $F9KVERSION" echo "Friendica version $F9KVERSION"
OPTS=
#if [ "" != "$1" ]
#then
# OUTFILE="$(readlink -f ${FULLPATH}/$1)"
# if [ -e "$OUTFILE" ]
# then
# echo "join extracted strings"
# OPTS="-j"
# fi
#fi
KEYWORDS="-k -kt -ktt:1,2" KEYWORDS="-k -kt -ktt:1,2"
echo "extract strings to $OUTFILE.." echo "extract strings to $OUTFILE.."
@ -50,7 +38,7 @@ for f in $(find "$FINDSTARTDIR" $FINDOPTS -name "*.php" -type f)
do do
if [ ! -d "$f" ] if [ ! -d "$f" ]
then then
xgettext $KEYWORDS $OPTS -j -o "$OUTFILE" --from-code=UTF-8 "$f" xgettext $KEYWORDS -j -o "$OUTFILE" --from-code=UTF-8 "$f"
sed -i "s/CHARSET/UTF-8/g" "$OUTFILE" sed -i "s/CHARSET/UTF-8/g" "$OUTFILE"
fi fi
done done
@ -75,4 +63,11 @@ else
sed -i "s/^\"Plural-Forms.*$//g" "$OUTFILE" sed -i "s/^\"Plural-Forms.*$//g" "$OUTFILE"
fi fi
if [ "" != "$1" -a "$ADDONMODE" == "" ]
then
UPDATEFILE="$(readlink -f ${FULLPATH}/$1)"
echo "merging new strings to $UPDATEFILE.."
msgmerge -U $OUTFILE $UPDATEFILE
fi
echo "done." echo "done."

File diff suppressed because it is too large Load diff

View file

@ -12,25 +12,28 @@
$a = new App(); $a = new App();
if(x($a->config,'php_path'))
$phpath = $a->config['php_path'];
else
$phpath = 'php';
echo "Directory: mod\n"; echo "Directory: mod\n";
$files = glob('mod/*.php'); $files = glob('mod/*.php');
foreach($files as $file) { foreach($files as $file) {
echo $file . "\n"; passthru("$phpath -l $file", $ret); $ret===0 or die();
include_once($file);
} }
echo "Directory: include\n"; echo "Directory: include\n";
$files = glob('include/*.php'); $files = glob('include/*.php');
foreach($files as $file) { foreach($files as $file) {
echo $file . "\n"; passthru("$phpath -l $file", $ret); $ret===0 or die();
include_once($file);
} }
echo "Directory: object\n"; echo "Directory: object\n";
$files = glob('object/*.php'); $files = glob('object/*.php');
foreach($files as $file) { foreach($files as $file) {
echo $file . "\n"; passthru("$phpath -l $file", $ret); $ret===0 or die();
include_once($file);
} }
echo "Directory: addon\n"; echo "Directory: addon\n";
@ -40,26 +43,17 @@
$addon = basename($dir); $addon = basename($dir);
$files = glob($dir . '/' . $addon . '.php'); $files = glob($dir . '/' . $addon . '.php');
foreach($files as $file) { foreach($files as $file) {
echo $file . "\n"; passthru("$phpath -l $file", $ret); $ret===0 or die();
include_once($file);
} }
} }
if(x($a->config,'php_path'))
$phpath = $a->config['php_path'];
else
$phpath = 'php';
echo "String files\n"; echo "String files\n";
echo 'util/strings.php' . "\n"; echo 'util/strings.php' . "\n";
include_once('util/strings.php'); passthru("$phpath -l util/strings.php", $ret); $ret===0 or die();
echo count($a->strings) . ' strings' . "\n";
$files = glob('view/*/strings.php'); $files = glob('view/*/strings.php');
foreach($files as $file) { foreach($files as $file) {
echo $file . "\n"; passthru("$phpath -l $file", $ret); $ret===0 or die();
passthru($phpath . ' util/typohelper.php ' . $file);
// include_once($file);
} }

View file

@ -1,11 +0,0 @@
<?php
$str = <<< EOT
error_reporting(E_ERROR | E_WARNING | E_PARSE );
ini_set('display_errors', '1');
ini_set('log_errors','0');
EOT;
$str .= str_replace('<?php', '', file_get_contents($argv[1]));
eval($str);

View file

@ -28,6 +28,8 @@ sudo openssl x509 -req -days 365 -in "$SSL_DIR/xip.io.csr" -signkey "$SSL_DIR/xi
#Install apache2 #Install apache2
echo ">>> Installing Apache2 webserver" 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 add-apt-repository -y ppa:ondrej/apache2
sudo apt-key update sudo apt-key update
sudo apt-get update sudo apt-get update

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -40,3 +40,8 @@
<li class='admin link button {{$admin.logs.2}}'><a href='{{$admin.logs.0}}'>{{$admin.logs.1}}</a></li> <li class='admin link button {{$admin.logs.2}}'><a href='{{$admin.logs.0}}'>{{$admin.logs.1}}</a></li>
</ul> </ul>
<h4>{{$diagnosticstxt}}</h4>
<ul class='admin linklist'>
<li class='admin link {{$admin.diagnostics_probe.2}}'><a href="{{$admin.diagnostics_probe.0}}">{{$admin.diagnostics_probe.1}}</a></li>
<li class='admin link {{$admin.diagnostics_webfinger.2}}'><a href="{{$admin.diagnostics_webfinger.0}}">{{$admin.diagnostics_webfinger.1}}</a></li>
</ul>

View file

@ -2,13 +2,13 @@
<h1>{{$title}} - {{$page}}</h1> <h1>{{$title}} - {{$page}}</h1>
<form action="{{$baseurl}}/admin/logs" method="post"> <form action="{{$baseurl}}/admin/logs" method="post">
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'> <input type='hidden' name='form_security_token' value="{{$form_security_token|escape:'html'}}">
{{include file="field_checkbox.tpl" field=$debugging}} {{include file="field_checkbox.tpl" field=$debugging}}
{{include file="field_input.tpl" field=$logfile}} {{include file="field_input.tpl" field=$logfile}}
{{include file="field_select.tpl" field=$loglevel}} {{include file="field_select.tpl" field=$loglevel}}
<div class="submit"><input type="submit" name="page_logs" value="{{$submit}}" /></div> <div class="submit"><input type="submit" name="page_logs" value="{{$submit|escape:'html'}}" /></div>
</form> </form>

View file

@ -66,7 +66,7 @@
<h1>Friendica Update</h1> <h1>Friendica Update</h1>
<div class="panel_text"></div> <div class="panel_text"></div>
<div class="panel_actions"> <div class="panel_actions">
<input type="button" value="{{$close}}" class="panel_action_close"> <input type="button" value="{{$close|escape:'html'}}" class="panel_action_close">
</div> </div>
</div> </div>
</div> </div>
@ -77,10 +77,10 @@
<dl> <dt>New version:</dt><dd>{{$remoteversion}}</dd> </dl> <dl> <dt>New version:</dt><dd>{{$remoteversion}}</dd> </dl>
<form id="remoteupdate_form" method="POST" action="{{$baseurl}}/admin/update"> <form id="remoteupdate_form" method="POST" action="{{$baseurl}}/admin/update">
<input type="hidden" name="{{$remotefile.0}}" value="{{$remotefile.2}}"> <input type="hidden" name="{{$remotefile.0}}" value="{{$remotefile.2|escape:'html'}}">
{{if $canwrite}} {{if $canwrite}}
<div class="submit"><input type="submit" name="remoteupdate" value="{{$submit}}" /></div> <div class="submit"><input type="submit" name="remoteupdate" value="{{$submit|escape:'html'}}" /></div>
{{else}} {{else}}
<h3>Your friendica installation is not writable by web server.</h3> <h3>Your friendica installation is not writable by web server.</h3>
{{if $canftp}} {{if $canftp}}
@ -89,7 +89,7 @@
{{include file="field_input.tpl" field=$ftppath}} {{include file="field_input.tpl" field=$ftppath}}
{{include file="field_input.tpl" field=$ftpuser}} {{include file="field_input.tpl" field=$ftpuser}}
{{include file="field_password.tpl" field=$ftppwd}} {{include file="field_password.tpl" field=$ftppwd}}
<div class="submit"><input type="submit" name="remoteupdate" value="{{$submit}}" /></div> <div class="submit"><input type="submit" name="remoteupdate" value="{{$submit|escape:'html'}}" /></div>
{{/if}} {{/if}}
{{/if}} {{/if}}
</form> </form>

View file

@ -46,7 +46,10 @@
{{include file="field_input.tpl" field=$sitename}} {{include file="field_input.tpl" field=$sitename}}
{{include file="field_input.tpl" field=$hostname}} {{include file="field_input.tpl" field=$hostname}}
{{include file="field_input.tpl" field=$sender_email}}
{{include file="field_textarea.tpl" field=$banner}} {{include file="field_textarea.tpl" field=$banner}}
{{include file="field_input.tpl" field=$shortcut_icon}}
{{include file="field_input.tpl" field=$touch_icon}}
{{include file="field_textarea.tpl" field=$info}} {{include file="field_textarea.tpl" field=$info}}
{{include file="field_select.tpl" field=$language}} {{include file="field_select.tpl" field=$language}}
{{include file="field_select.tpl" field=$theme}} {{include file="field_select.tpl" field=$theme}}
@ -58,7 +61,7 @@
{{include file="field_select.tpl" field=$singleuser}} {{include file="field_select.tpl" field=$singleuser}}
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div> <div class="submit"><input type="submit" name="page_site" value="{{$submit|escape:'html'}}" /></div>
<h3>{{$registration}}</h3> <h3>{{$registration}}</h3>
{{include file="field_input.tpl" field=$register_text}} {{include file="field_input.tpl" field=$register_text}}
@ -68,7 +71,7 @@
{{include file="field_checkbox.tpl" field=$no_openid}} {{include file="field_checkbox.tpl" field=$no_openid}}
{{include file="field_checkbox.tpl" field=$no_regfullname}} {{include file="field_checkbox.tpl" field=$no_regfullname}}
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div> <div class="submit"><input type="submit" name="page_site" value="{{$submit|escape:'html'}}" /></div>
<h3>{{$upload}}</h3> <h3>{{$upload}}</h3>
{{include file="field_input.tpl" field=$maximagesize}} {{include file="field_input.tpl" field=$maximagesize}}
@ -80,7 +83,8 @@
{{include file="field_input.tpl" field=$allowed_email}} {{include file="field_input.tpl" field=$allowed_email}}
{{include file="field_checkbox.tpl" field=$block_public}} {{include file="field_checkbox.tpl" field=$block_public}}
{{include file="field_checkbox.tpl" field=$force_publish}} {{include file="field_checkbox.tpl" field=$force_publish}}
{{include file="field_checkbox.tpl" field=$no_community_page}} {{include file="field_select.tpl" field=$community_page_style}}
{{include file="field_input.tpl" field=$max_author_posts_community_page}}
{{include file="field_checkbox.tpl" field=$ostatus_disabled}} {{include file="field_checkbox.tpl" field=$ostatus_disabled}}
{{include file="field_select.tpl" field=$ostatus_poll_interval}} {{include file="field_select.tpl" field=$ostatus_poll_interval}}
{{include file="field_checkbox.tpl" field=$diaspora_enabled}} {{include file="field_checkbox.tpl" field=$diaspora_enabled}}
@ -92,7 +96,7 @@
{{include file="field_checkbox.tpl" field=$private_addons}} {{include file="field_checkbox.tpl" field=$private_addons}}
{{include file="field_checkbox.tpl" field=$disable_embedded}} {{include file="field_checkbox.tpl" field=$disable_embedded}}
{{include file="field_checkbox.tpl" field=$allow_users_remote_self}} {{include file="field_checkbox.tpl" field=$allow_users_remote_self}}
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div> <div class="submit"><input type="submit" name="page_site" value="{{$submit|escape:'html'}}" /></div>
<h3>{{$advanced}}</h3> <h3>{{$advanced}}</h3>
{{include file="field_checkbox.tpl" field=$no_utf}} {{include file="field_checkbox.tpl" field=$no_utf}}
@ -108,15 +112,17 @@
{{include file="field_input.tpl" field=$temppath}} {{include file="field_input.tpl" field=$temppath}}
{{include file="field_input.tpl" field=$basepath}} {{include file="field_input.tpl" field=$basepath}}
{{include file="field_checkbox.tpl" field=$suppress_language}} {{include file="field_checkbox.tpl" field=$suppress_language}}
{{include file="field_checkbox.tpl" field=$suppress_tags}}
<h3>{{$performance}}</h3> <h3>{{$performance}}</h3>
{{include file="field_checkbox.tpl" field=$disable_noscrape}}
{{include file="field_checkbox.tpl" field=$use_fulltext_engine}} {{include file="field_checkbox.tpl" field=$use_fulltext_engine}}
{{include file="field_checkbox.tpl" field=$only_tag_search}}
{{include file="field_input.tpl" field=$itemcache}} {{include file="field_input.tpl" field=$itemcache}}
{{include file="field_input.tpl" field=$itemcache_duration}} {{include file="field_input.tpl" field=$itemcache_duration}}
{{include file="field_input.tpl" field=$max_comments}} {{include file="field_input.tpl" field=$max_comments}}
{{include file="field_checkbox.tpl" field=$proxy_disabled}} {{include file="field_checkbox.tpl" field=$proxy_disabled}}
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div> {{include file="field_checkbox.tpl" field=$old_pager}}
<div class="submit"><input type="submit" name="page_site" value="{{$submit|escape:'html'}}" /></div>
</form> </form>
@ -125,8 +131,8 @@
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'> <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
<h3>{{$relocate}}</h3> <h3>{{$relocate}}</h3>
{{include file="field_input.tpl" field=$relocate_url}} {{include file="field_input.tpl" field=$relocate_url}}
<input type="hidden" name="page_site" value="{{$submit}}"> <input type="hidden" name="page_site" value="{{$submit|escape:'html'}}">
<div class="submit"><input type="submit" name="relocate" value="{{$submit}}" /></div> <div class="submit"><input type="submit" name="relocate" value="{{$submit|escape:'html'}}" /></div>
</form> </form>
</div> </div>

View file

@ -27,7 +27,7 @@
<dt>{{$plugins.0}}</dt> <dt>{{$plugins.0}}</dt>
{{foreach $plugins.1 as $p}} {{foreach $plugins.1 as $p}}
<dd>{{$p}}</dd> <dd><a href="/admin/plugins/{{$p}}/">{{$p}}</a></dd>
{{/foreach}} {{/foreach}}
</dl> </dl>

View file

@ -43,7 +43,7 @@
</tbody> </tbody>
</table> </table>
<div class='selectall'><a href='#' onclick="return selectall('pending_ckbx');">{{$select_all}}</a></div> <div class='selectall'><a href='#' onclick="return selectall('pending_ckbx');">{{$select_all}}</a></div>
<div class="submit"><input type="submit" name="page_users_deny" value="{{$deny}}"/> <input type="submit" name="page_users_approve" value="{{$approve}}" /></div> <div class="submit"><input type="submit" name="page_users_deny" value="{{$deny|escape:'html'}}"/> <input type="submit" name="page_users_approve" value="{{$approve|escape:'html'}}" /></div>
{{else}} {{else}}
<p>{{$no_pending}}</p> <p>{{$no_pending}}</p>
{{/if}} {{/if}}
@ -88,7 +88,7 @@
</tbody> </tbody>
</table> </table>
<div class='selectall'><a href='#' onclick="return selectall('users_ckbx');">{{$select_all}}</a></div> <div class='selectall'><a href='#' onclick="return selectall('users_ckbx');">{{$select_all}}</a></div>
<div class="submit"><input type="submit" name="page_users_block" value="{{$block}}/{{$unblock}}" /> <input type="submit" name="page_users_delete" value="{{$delete}}" onclick="return confirm_delete_multi()" /></div> <div class="submit"><input type="submit" name="page_users_block" value="{{$block|escape:'html'}}/{{$unblock|escape:'html'}}" /> <input type="submit" name="page_users_delete" value="{{$delete|escape:'html'}}" onclick="return confirm_delete_multi()" /></div>
{{else}} {{else}}
NO USERS?!? NO USERS?!?
{{/if}} {{/if}}
@ -133,6 +133,6 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div class="submit"><input type="submit" name="add_new_user_submit" value="{{$submit}}" /></div> <div class="submit"><input type="submit" name="add_new_user_submit" value="{{$submit|escape:'html'}}" /></div>
</form> </form>
</div> </div>

View file

@ -4,12 +4,12 @@
<label id="photo-album-edit-name-label" for="photo-album-edit-name" >{{$nametext}}</label> <label id="photo-album-edit-name-label" for="photo-album-edit-name" >{{$nametext}}</label>
<input type="text" size="64" name="albumname" value="{{$album}}" > <input type="text" size="64" name="albumname" value="{{$album|escape:'html'}}" >
<div id="photo-album-edit-name-end"></div> <div id="photo-album-edit-name-end"></div>
<input id="photo-album-edit-submit" type="submit" name="submit" value="{{$submit}}" /> <input id="photo-album-edit-submit" type="submit" name="submit" value="{{$submit|escape:'html'}}" />
<input id="photo-album-edit-drop" type="submit" name="dropalbum" value="{{$dropsubmit}}" onclick="return confirmDelete();" /> <input id="photo-album-edit-drop" type="submit" name="dropalbum" value="{{$dropsubmit|escape:'html'}}" onclick="return confirmDelete();" />
</form> </form>
</div> </div>

View file

@ -26,9 +26,9 @@
<label id="dfrn-url-label" for="dfrn-url" >{{$your_address}}</label> <label id="dfrn-url-label" for="dfrn-url" >{{$your_address}}</label>
{{if $myaddr}} {{if $myaddr}}
{{$myaddr}} {{$myaddr}}
<input type="hidden" name="dfrn_url" id="dfrn-url" size="32" value="{{$myaddr}}" /> <input type="hidden" name="dfrn_url" id="dfrn-url" size="32" value="{{$myaddr|escape:'html'}}" />
{{else}} {{else}}
<input type="text" name="dfrn_url" id="dfrn-url" size="32" value="{{$myaddr}}" /> <input type="text" name="dfrn_url" id="dfrn-url" size="32" value="{{$myaddr|escape:'html'}}" />
{{/if}} {{/if}}
<div id="dfrn-request-url-end"></div> <div id="dfrn-request-url-end"></div>
</div> </div>
@ -39,7 +39,7 @@
</div> </div>
<div id="dfrn-request-submit-wrapper"> <div id="dfrn-request-submit-wrapper">
<input type="submit" name="submit" id="dfrn-request-submit-button" value="{{$submit}}" /> <input type="submit" name="submit" id="dfrn-request-submit-button" value="{{$submit|escape:'html'}}" />
<input type="submit" name="cancel" id="dfrn-request-cancel-button" value="{{$cancel}}" /> <input type="submit" name="cancel" id="dfrn-request-cancel-button" value="{{$cancel|escape:'html'}}" />
</div> </div>
</form> </form>

View file

@ -22,14 +22,14 @@
<select id="qcomment-select-{{$id}}" name="qcomment-{{$id}}" class="qcomment" onchange="qCommentInsert(this,{{$id}});" > <select id="qcomment-select-{{$id}}" name="qcomment-{{$id}}" class="qcomment" onchange="qCommentInsert(this,{{$id}});" >
<option value=""></option> <option value=""></option>
{{foreach $qcomment as $qc}} {{foreach $qcomment as $qc}}
<option value="{{$qc}}">{{$qc}}</option> <option value="{{$qc|escape:'html'}}">{{$qc}}</option>
{{/foreach}} {{/foreach}}
</select> </select>
{{/if}} {{/if}}
<div class="comment-edit-text-end"></div> <div class="comment-edit-text-end"></div>
<div class="comment-edit-submit-wrapper" id="comment-edit-submit-wrapper-{{$id}}" style="display: none;" > <div class="comment-edit-submit-wrapper" id="comment-edit-submit-wrapper-{{$id}}" style="display: none;" >
<input type="submit" onclick="post_comment({{$id}}); return false;" id="comment-edit-submit-{{$id}}" class="comment-edit-submit" name="submit" value="{{$submit}}" /> <input type="submit" onclick="post_comment({{$id}}); return false;" id="comment-edit-submit-{{$id}}" class="comment-edit-submit" name="submit" value="{{$submit|escape:'html'}}" />
{{if $preview}}<span onclick="preview_comment({{$id}});" id="comment-edit-preview-link-{{$id}}" class="fakelink">{{$preview}}</span>{{/if}} {{if $preview}}<span onclick="preview_comment({{$id}});" id="comment-edit-preview-link-{{$id}}" class="fakelink">{{$preview}}</span>{{/if}}
<div id="comment-edit-preview-{{$id}}" class="comment-edit-preview" style="display:none;"></div> <div id="comment-edit-preview-{{$id}}" class="comment-edit-preview" style="display:none;"></div>
</div> </div>

View file

@ -4,11 +4,11 @@
<span id="confirm-message">{{$message}}</span> <span id="confirm-message">{{$message}}</span>
{{foreach $extra_inputs as $input}} {{foreach $extra_inputs as $input}}
<input type="hidden" name="{{$input.name}}" value="{{$input.value}}" /> <input type="hidden" name="{{$input.name}}" value="{{$input.value|escape:'html'}}" />
{{/foreach}} {{/foreach}}
<input class="confirm-button" id="confirm-submit-button" type="submit" name="{{$confirm_name}}" value="{{$confirm}}" /> <input class="confirm-button" id="confirm-submit-button" type="submit" name="{{$confirm_name}}" value="{{$confirm|escape:'html'}}" />
<input class="confirm-button" id="confirm-cancel-button" type="submit" name="canceled" value="{{$cancel}}" /> <input class="confirm-button" id="confirm-cancel-button" type="submit" name="canceled" value="{{$cancel|escape:'html'}}" />
</form> </form>
</center> </center>

View file

@ -73,7 +73,7 @@
<div id="contact-edit-info-wrapper"> <div id="contact-edit-info-wrapper">
<h4>{{$lbl_info1}}</h4> <h4>{{$lbl_info1}}</h4>
<textarea id="contact-edit-info" rows="8" cols="60" name="info">{{$info}}</textarea> <textarea id="contact-edit-info" rows="8" cols="60" name="info">{{$info}}</textarea>
<input class="contact-edit-submit" type="submit" name="submit" value="{{$submit}}" /> <input class="contact-edit-submit" type="submit" name="submit" value="{{$submit|escape:'html'}}" />
</div> </div>
<div id="contact-edit-info-end"></div> <div id="contact-edit-info-end"></div>
@ -85,7 +85,7 @@
{{$profile_select}} {{$profile_select}}
<div id="contact-edit-profile-select-end"></div> <div id="contact-edit-profile-select-end"></div>
<input class="contact-edit-submit" type="submit" name="submit" value="{{$submit}}" /> <input class="contact-edit-submit" type="submit" name="submit" value="{{$submit|escape:'html'}}" />
</form> </form>
</div> </div>

View file

@ -6,8 +6,8 @@
<div id="contacts-search-wrapper"> <div id="contacts-search-wrapper">
<form id="contacts-search-form" action="{{$cmd}}" method="get" > <form id="contacts-search-form" action="{{$cmd}}" method="get" >
<span class="contacts-search-desc">{{$desc}}</span> <span class="contacts-search-desc">{{$desc}}</span>
<input type="text" name="search" id="contacts-search" class="search-input" onfocus="this.select();" value="{{$search}}" /> <input type="text" name="search" id="contacts-search" class="search-input" onfocus="this.select();" value="{{$search|escape:'html'}}" />
<input type="submit" name="submit" id="contacts-search-submit" value="{{$submit}}" /> <input type="submit" name="submit" id="contacts-search-submit" value="{{$submit|escape:'html'}}" />
</form> </form>
</div> </div>
<div id="contacts-search-end"></div> <div id="contacts-search-end"></div>
@ -21,7 +21,7 @@
<div id="contact-edit-end"></div> <div id="contact-edit-end"></div>
<div id="contacts-actions"> <div id="contacts-actions">
{{foreach $batch_actions as $n=>$l}} {{foreach $batch_actions as $n=>$l}}
<input class="batch-action" name="{{$n}}" value="{{$l}}" type="submit"> <input class="batch-action" name="{{$n}}" value="{{$l|escape:'html'}}" type="submit">
{{/foreach}} {{/foreach}}
</div> </div>
</form> </form>

View file

@ -3,35 +3,35 @@
<h4>{{$contact_name}}</h4> <h4>{{$contact_name}}</h4>
<label id="crepair-name-label" class="crepair-label" for="crepair-name">{{$label_name}}</label> <label id="crepair-name-label" class="crepair-label" for="crepair-name">{{$label_name}}</label>
<input type="text" id="crepair-name" class="crepair-input" name="name" value="{{$contact_name}}" /> <input type="text" id="crepair-name" class="crepair-input" name="name" value="{{$contact_name|escape:'html'}}" />
<div class="clear"></div> <div class="clear"></div>
<label id="crepair-nick-label" class="crepair-label" for="crepair-nick">{{$label_nick}}</label> <label id="crepair-nick-label" class="crepair-label" for="crepair-nick">{{$label_nick}}</label>
<input type="text" id="crepair-nick" class="crepair-input" name="nick" value="{{$contact_nick}}" /> <input type="text" id="crepair-nick" class="crepair-input" name="nick" value="{{$contact_nick|escape:'html'}}" />
<div class="clear"></div> <div class="clear"></div>
<label id="crepair-attag-label" class="crepair-label" for="crepair-attag">{{$label_attag}}</label> <label id="crepair-attag-label" class="crepair-label" for="crepair-attag">{{$label_attag}}</label>
<input type="text" id="crepair-attag" class="crepair-input" name="attag" value="{{$contact_attag}}" /> <input type="text" id="crepair-attag" class="crepair-input" name="attag" value="{{$contact_attag|escape:'html'}}" />
<div class="clear"></div> <div class="clear"></div>
<label id="crepair-url-label" class="crepair-label" for="crepair-url">{{$label_url}}</label> <label id="crepair-url-label" class="crepair-label" for="crepair-url">{{$label_url}}</label>
<input type="text" id="crepair-url" class="crepair-input" name="url" value="{{$contact_url}}" /> <input type="text" id="crepair-url" class="crepair-input" name="url" value="{{$contact_url|escape:'html'}}" />
<div class="clear"></div> <div class="clear"></div>
<label id="crepair-request-label" class="crepair-label" for="crepair-request">{{$label_request}}</label> <label id="crepair-request-label" class="crepair-label" for="crepair-request">{{$label_request}}</label>
<input type="text" id="crepair-request" class="crepair-input" name="request" value="{{$request}}" /> <input type="text" id="crepair-request" class="crepair-input" name="request" value="{{$request|escape:'html'}}" />
<div class="clear"></div> <div class="clear"></div>
<label id="crepair-confirm-label" class="crepair-label" for="crepair-confirm">{{$label_confirm}}</label> <label id="crepair-confirm-label" class="crepair-label" for="crepair-confirm">{{$label_confirm}}</label>
<input type="text" id="crepair-confirm" class="crepair-input" name="confirm" value="{{$confirm}}" /> <input type="text" id="crepair-confirm" class="crepair-input" name="confirm" value="{{$confirm|escape:'html'}}" />
<div class="clear"></div> <div class="clear"></div>
<label id="crepair-notify-label" class="crepair-label" for="crepair-notify">{{$label_notify}}</label> <label id="crepair-notify-label" class="crepair-label" for="crepair-notify">{{$label_notify}}</label>
<input type="text" id="crepair-notify" class="crepair-input" name="notify" value="{{$notify}}" /> <input type="text" id="crepair-notify" class="crepair-input" name="notify" value="{{$notify|escape:'html'}}" />
<div class="clear"></div> <div class="clear"></div>
<label id="crepair-poll-label" class="crepair-label" for="crepair-poll">{{$label_poll}}</label> <label id="crepair-poll-label" class="crepair-label" for="crepair-poll">{{$label_poll}}</label>
<input type="text" id="crepair-poll" class="crepair-input" name="poll" value="{{$poll}}" /> <input type="text" id="crepair-poll" class="crepair-input" name="poll" value="{{$poll|escape:'html'}}" />
<div class="clear"></div> <div class="clear"></div>
<label id="crepair-photo-label" class="crepair-label" for="crepair-photo">{{$label_photo}}</label> <label id="crepair-photo-label" class="crepair-label" for="crepair-photo">{{$label_photo}}</label>
@ -42,7 +42,7 @@
{{include file="field_select.tpl" field=$remote_self}} {{include file="field_select.tpl" field=$remote_self}}
{{/if}} {{/if}}
<input type="submit" name="submit" value="{{$lbl_submit}}" /> <input type="submit" name="submit" value="{{$lbl_submit|escape:'html'}}" />
</form> </form>

View file

@ -52,7 +52,7 @@
<input type="hidden" name="width" id="width" /> <input type="hidden" name="width" id="width" />
<div id="crop-image-submit-wrapper" > <div id="crop-image-submit-wrapper" >
<input type="submit" name="submit" value="{{$done}}" /> <input type="submit" name="submit" value="{{$done|escape:'html'}}" />
</div> </div>
</form> </form>

View file

@ -17,6 +17,6 @@
<div id="dfrn-request-homecoming-submit-wrapper" > <div id="dfrn-request-homecoming-submit-wrapper" >
<input id="dfrn-request-homecoming-submit" type="submit" name="submit" value="{{$submit}}" /> <input id="dfrn-request-homecoming-submit" type="submit" name="submit" value="{{$submit|escape:'html'}}" />
</div> </div>
</form> </form>

View file

@ -25,9 +25,9 @@
<label id="dfrn-url-label" for="dfrn-url" >{{$your_address}}</label> <label id="dfrn-url-label" for="dfrn-url" >{{$your_address}}</label>
{{if $myaddr}} {{if $myaddr}}
{{$myaddr}} {{$myaddr}}
<input type="hidden" name="dfrn_url" id="dfrn-url" size="32" value="{{$myaddr}}" /> <input type="hidden" name="dfrn_url" id="dfrn-url" size="32" value="{{$myaddr|escape:'html'}}" />
{{else}} {{else}}
<input type="text" name="dfrn_url" id="dfrn-url" size="32" value="{{$myaddr}}" /> <input type="text" name="dfrn_url" id="dfrn-url" size="32" value="{{$myaddr|escape:'html'}}" />
{{/if}} {{/if}}
<div id="dfrn-request-url-end"></div> <div id="dfrn-request-url-end"></div>
</div> </div>
@ -69,7 +69,7 @@
</div> </div>
<div id="dfrn-request-submit-wrapper"> <div id="dfrn-request-submit-wrapper">
<input type="submit" name="submit" id="dfrn-request-submit-button" value="{{$submit}}" /> <input type="submit" name="submit" id="dfrn-request-submit-button" value="{{$submit|escape:'html'}}" />
<input type="submit" name="cancel" id="dfrn-request-cancel-button" value="{{$cancel}}" /> <input type="submit" name="cancel" id="dfrn-request-cancel-button" value="{{$cancel|escape:'html'}}" />
</div> </div>
</form> </form>

View file

@ -9,8 +9,8 @@
<div id="directory-search-wrapper"> <div id="directory-search-wrapper">
<form id="directory-search-form" action="directory" method="get" > <form id="directory-search-form" action="directory" method="get" >
<span class="dirsearch-desc">{{$desc}}</span> <span class="dirsearch-desc">{{$desc}}</span>
<input type="text" name="search" id="directory-search" class="search-input" onfocus="this.select();" value="{{$search}}" /> <input type="text" name="search" id="directory-search" class="search-input" onfocus="this.select();" value="{{$search|escape:'html'}}" />
<input type="submit" name="submit" id="directory-search-submit" value="{{$submit}}" class="button" /> <input type="submit" name="submit" id="directory-search-submit" value="{{$submit|escape:'html'}}" class="button" />
</form> </form>
</div> </div>
<div id="directory-search-end"></div> <div id="directory-search-end"></div>

View file

@ -28,7 +28,7 @@
<div id="event-adjust-break"></div> <div id="event-adjust-break"></div>
<div id="event-summary-text">{{$t_text}}</div> <div id="event-summary-text">{{$t_text}}</div>
<input type="text" id="event-summary" name="summary" value="{{$t_orig}}" /> <input type="text" id="event-summary" name="summary" value="{{$t_orig|escape:'html'}}" />
<div id="event-desc-text">{{$d_text}}</div> <div id="event-desc-text">{{$d_text}}</div>
@ -44,7 +44,7 @@
{{$acl}} {{$acl}}
<div class="clear"></div> <div class="clear"></div>
<input id="event-submit" type="submit" name="submit" value="{{$submit}}" /> <input id="event-submit" type="submit" name="submit" value="{{$submit|escape:'html'}}" />
</form> </form>

View file

@ -4,13 +4,13 @@
{{* html5 don't work on Chrome, Safari and IE9 {{* html5 don't work on Chrome, Safari and IE9
<input id="id_{{$field.0}}" type="text" list="data_{{$field.0}}" > <input id="id_{{$field.0}}" type="text" list="data_{{$field.0}}" >
<datalist id="data_{{$field.0}}" > <datalist id="data_{{$field.0}}" >
{{foreach $field.4 as $opt=>$val}}<option value="{{$val}}">{{/foreach}} {{foreach $field.4 as $opt=>$val}}<option value="{{$val|escape:'html'}}">{{/foreach}}
</datalist> *}} </datalist> *}}
<input id="id_{{$field.0}}" type="text" value="{{$field.2}}"> <input id="id_{{$field.0}}" type="text" value="{{$field.2}}">
<select id="select_{{$field.0}}" onChange="$('#id_{{$field.0}}').val($(this).val())"> <select id="select_{{$field.0}}" onChange="$('#id_{{$field.0}}').val($(this).val())">
<option value="">{{$field.5}}</option> <option value="">{{$field.5}}</option>
{{foreach $field.4 as $opt=>$val}}<option value="{{$val}}">{{$val}}</option>{{/foreach}} {{foreach $field.4 as $opt=>$val}}<option value="{{$val|escape:'html'}}">{{$val}}</option>{{/foreach}}
</select> </select>
<span class='field_help'>{{$field.3}}</span> <span class='field_help'>{{$field.3}}</span>

View file

@ -1,6 +1,6 @@
<div class='field input' id='wrapper_{{$field.0}}'> <div class='field input' id='wrapper_{{$field.0}}'>
<label for='id_{{$field.0}}'>{{$field.1}}</label> <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|escape:'html'}}"{{if $field.4 eq 'required'}} required{{/if}}{{if $field.5 eq 'autofocus'}} autofocus{{/if}}>
<span class='field_help'>{{$field.3}}</span> <span class='field_help'>{{$field.3}}</span>
</div> </div>

View file

@ -2,6 +2,6 @@
<div class='field checkbox'> <div class='field checkbox'>
<label for='id_{{$field.0}}'>{{$field.1}}</label> <label for='id_{{$field.0}}'>{{$field.1}}</label>
<input type="checkbox" name='{{$field.0}}' id='id_{{$field.0}}' value="{{$field.3}}" {{if $field.2}}checked="true"{{/if}}> <input type="checkbox" name='{{$field.0}}' id='id_{{$field.0}}' value="{{$field.3|escape:'html'}}" {{if $field.2}}checked="true"{{/if}}>
<span class='field_help'>{{$field.4}}</span> <span class='field_help'>{{$field.4}}</span>
</div> </div>

View file

@ -1,6 +1,6 @@
<div class='field input openid' id='wrapper_{{$field.0}}'> <div class='field input openid' id='wrapper_{{$field.0}}'>
<label for='id_{{$field.0}}'>{{$field.1}}</label> <label for='id_{{$field.0}}'>{{$field.1}}</label>
<input name='{{$field.0}}' id='id_{{$field.0}}' value="{{$field.2}}"> <input name='{{$field.0}}' id='id_{{$field.0}}' value="{{$field.2|escape:'html'}}">
<span class='field_help'>{{$field.3}}</span> <span class='field_help'>{{$field.3}}</span>
</div> </div>

View file

@ -1,6 +1,6 @@
<div class='field password' id='wrapper_{{$field.0}}'> <div class='field password' id='wrapper_{{$field.0}}'>
<label for='id_{{$field.0}}'>{{$field.1}}</label> <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|escape:'html'}}"{{if $field.4 eq 'required'}} required{{/if}}{{if $field.5 eq 'autofocus'}} autofocus{{/if}}>
<span class='field_help'>{{$field.3}}</span> <span class='field_help'>{{$field.3}}</span>
</div> </div>

View file

@ -2,6 +2,6 @@
<div class='field radio'> <div class='field radio'>
<label for='id_{{$field.0}}_{{$field.2}}'>{{$field.1}}</label> <label for='id_{{$field.0}}_{{$field.2}}'>{{$field.1}}</label>
<input type="radio" name='{{$field.0}}' id='id_{{$field.0}}_{{$field.2}}' value="{{$field.2}}" {{if $field.4}}checked="true"{{/if}}> <input type="radio" name='{{$field.0}}' id='id_{{$field.0}}_{{$field.2}}' value="{{$field.2|escape:'html'}}" {{if $field.4}}checked="true"{{/if}}>
<span class='field_help'>{{$field.3}}</span> <span class='field_help'>{{$field.3}}</span>
</div> </div>

View file

@ -3,7 +3,7 @@
<div class='field select'> <div class='field select'>
<label for='id_{{$field.0}}'>{{$field.1}}</label> <label for='id_{{$field.0}}'>{{$field.1}}</label>
<select name='{{$field.0}}' id='id_{{$field.0}}'> <select name='{{$field.0}}' id='id_{{$field.0}}'>
{{foreach $field.4 as $opt=>$val}}<option value="{{$opt}}" {{if $opt==$field.2}}selected="selected"{{/if}}>{{$val}}</option>{{/foreach}} {{foreach $field.4 as $opt=>$val}}<option value="{{$opt|escape:'html'}}" {{if $opt==$field.2}}selected="selected"{{/if}}>{{$val}}</option>{{/foreach}}
</select> </select>
<span class='field_help'>{{$field.3}}</span> <span class='field_help'>{{$field.3}}</span>
</div> </div>

View file

@ -3,7 +3,7 @@
<div class='field select'> <div class='field select'>
<label for='id_{{$field.0}}'>{{$field.1}}</label> <label for='id_{{$field.0}}'>{{$field.1}}</label>
<select name='{{$field.0}}' id='id_{{$field.0}}' {{if $field.5}}onchange="previewTheme(this);"{{/if}} > <select name='{{$field.0}}' id='id_{{$field.0}}' {{if $field.5}}onchange="previewTheme(this);"{{/if}} >
{{foreach $field.4 as $opt=>$val}}<option value="{{$opt}}" {{if $opt==$field.2}}selected="selected"{{/if}}>{{$val}}</option>{{/foreach}} {{foreach $field.4 as $opt=>$val}}<option value="{{$opt|escape:'html'}}" {{if $opt==$field.2}}selected="selected"{{/if}}>{{$val}}</option>{{/foreach}}
</select> </select>
<span class='field_help'>{{$field.3}}</span> <span class='field_help'>{{$field.3}}</span>
{{if $field.5}}<div id="theme-preview"></div>{{/if}} {{if $field.5}}<div id="theme-preview"></div>{{/if}}

View file

@ -2,7 +2,7 @@
<div class='field yesno'> <div class='field yesno'>
<label for='id_{{$field.0}}'>{{$field.1}}</label> <label for='id_{{$field.0}}'>{{$field.1}}</label>
<div class='onoff' id="id_{{$field.0}}_onoff"> <div class='onoff' id="id_{{$field.0}}_onoff">
<input type="hidden" name='{{$field.0}}' id='id_{{$field.0}}' value="{{$field.2}}"> <input type="hidden" name='{{$field.0}}' id='id_{{$field.0}}' value="{{$field.2|escape:'html'}}">
<a href="#" class='off'> <a href="#" class='off'>
{{if $field.4}}{{$field.4.0}}{{else}}OFF{{/if}} {{if $field.4}}{{$field.4.0}}{{else}}OFF{{/if}}
</a> </a>

View file

@ -78,7 +78,7 @@
</div> </div>
</div> </div>
<div class="mceActionPanel"> <div class="mceActionPanel">
<input type="button" id="cancel" name="cancel" value="{{$cancel}}" onclick="tinyMCEPopup.close();" /> <input type="button" id="cancel" name="cancel" value="{{$cancel|escape:'html'}}" onclick="tinyMCEPopup.close();" />
</div> </div>
</body> </body>

Some files were not shown because too many files have changed in this diff Show more