Merge branch 'release-3.3.3'
This commit is contained in:
commit
86b41eec77
166 changed files with 50167 additions and 47793 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -34,7 +34,11 @@ report/
|
|||
#ignore cache folders
|
||||
/privacy_image_cache/
|
||||
/photo/
|
||||
/proxy/
|
||||
nbproject
|
||||
|
||||
#ignore vagrant dir
|
||||
.vagrant/
|
||||
|
||||
#ignore local folder
|
||||
/local/
|
||||
|
|
34
CHANGELOG
34
CHANGELOG
|
@ -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
|
||||
|
||||
Set default value for all not-null fields (fixes SQL warinigs) (annando)
|
||||
|
|
19
boot.php
19
boot.php
|
@ -16,9 +16,9 @@ require_once('include/dbstructure.php');
|
|||
|
||||
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
||||
define ( 'FRIENDICA_CODENAME', 'Ginger');
|
||||
define ( 'FRIENDICA_VERSION', '3.3.2' );
|
||||
define ( 'FRIENDICA_VERSION', '3.3.3' );
|
||||
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
||||
define ( 'DB_UPDATE_VERSION', 1175 );
|
||||
define ( 'DB_UPDATE_VERSION', 1178 );
|
||||
define ( 'EOL', "<br />\r\n" );
|
||||
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
||||
|
||||
|
@ -435,7 +435,7 @@ if(! class_exists('App')) {
|
|||
|
||||
function __construct() {
|
||||
|
||||
global $default_timezone, $argv, $argc;
|
||||
global $default_timezone;
|
||||
|
||||
$hostname = "";
|
||||
|
||||
|
@ -504,9 +504,9 @@ if(! class_exists('App')) {
|
|||
if ($hostname != "")
|
||||
$this->hostname = $hostname;
|
||||
|
||||
if (is_array($argv) && $argc>1 && substr(end($argv), 0, 4)=="http" ) {
|
||||
$this->set_baseurl(array_pop($argv) );
|
||||
$argc --;
|
||||
if (is_array($_SERVER["argv"]) && $_SERVER["argc"]>1 && substr(end($_SERVER["argv"]), 0, 4)=="http" ) {
|
||||
$this->set_baseurl(array_pop($_SERVER["argv"]) );
|
||||
$_SERVER["argc"] --;
|
||||
}
|
||||
|
||||
#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);
|
||||
|
||||
$about = ((x($profile,'about') == 1) ? t('About:') : False);
|
||||
|
||||
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'],' '))
|
||||
|
@ -1695,6 +1697,7 @@ if(! function_exists('profile_sidebar')) {
|
|||
'$pdesc' => $pdesc,
|
||||
'$marital' => $marital,
|
||||
'$homepage' => $homepage,
|
||||
'$about' => $about,
|
||||
'$network' => t('Network:'),
|
||||
'$diaspora' => $diaspora,
|
||||
'$contact_block' => $contact_block,
|
||||
|
@ -2071,7 +2074,7 @@ if(! function_exists('load_contact_links')) {
|
|||
if(! $uid || x($a->contacts,'empty'))
|
||||
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)
|
||||
);
|
||||
if(count($r)) {
|
||||
|
|
|
@ -59,7 +59,7 @@ After your first login, please visit the 'Settings' page from the top menu bar a
|
|||
|
||||
**Getting Started**
|
||||
|
||||
A ['Tips for New Members'](newmember) link will show up on your home page for two weeks to provide some important Getting Started information.
|
||||
A ['Tips for New Members'](newmember) link will show up on your network and home pages for two weeks to provide some important Getting Started information.
|
||||
|
||||
|
||||
**Retrieving Personal Data**
|
||||
|
|
|
@ -11,21 +11,3 @@ If you're a technical user, or your site doesn't have a support page, you'll nee
|
|||
Try to provide as much information as you can about the bug, including the **full** text of any error messages or notices, and any steps required to replicate the problem in as much detail as possible. It's generally better to provide too much information than not enough.
|
||||
|
||||
<a href="http://www.chiark.greenend.org.uk/~sgtatham/bugs.html">See this article</a> to learn more about submitting **good** bug reports.
|
||||
|
||||
|
||||
**Bug Sponsorship**
|
||||
|
||||
If you find a bug, and it is caused by a problem in main branch (ie, is not specific to our site), you may sponsor it.
|
||||
|
||||
The bug/issue database allows you to sponsor issues. This provides an incentive for developers to work on your issue. This isn't necessary - we don't like bugs and will try to fix them. This has more importance for future development projects and feature requests.
|
||||
|
||||
Bug sponsorship works on the honour system. If you agree to pay $10 to fix a bug, when the fix has been checked in and verified you should send a paypal payment to the developer assigned to the bug. Don't ever think you can get away with not paying a developer for work performed. Some of these guys could hack into your credit card account if you make them mad.
|
||||
|
||||
At the present time, one has to be approved as a "developer" to be able to assign themselves to a sponsored bug. This requires the developer to have some history fixing Friendica bugs. This is for everybody's assurance that the bug fix will work well with Friendica. If you wish to become approved as a developer, work on and check in some non-sponsored issues or your own projects and we will move you up the ladder.
|
||||
|
||||
If you truly feel you have the solution to a sponsored bug but aren't an approved developer, you risk a sponsored developer assigning the bug to themselves before you check it in, but if they haven't done so - include a short note with your pull request. Assuming that it meets our code standards, we'll see that you get credit.
|
||||
|
||||
If you sponsor a project at greater than a $50 level, you may be requested by the developer for payment up front before work has begun (typically half). Again this is on the honour system - and is mostly to avoid payment issues and disagreements later. You should also expect to see some progress updates or demonstrations if the work takes more than a week or two. If the work is not completed within a reasonable time (as decided by those involved), you are entitled to get your money back.
|
||||
|
||||
Friendica is not involved in these transactions. It is purely a personal agreement between sponsors and developers. If there are any issues, the parties will need to work it out between themselves. We're just providing some guidelines to help avoid potential problems.
|
||||
|
||||
|
|
50
doc/Developers-Intro.md
Normal file
50
doc/Developers-Intro.md
Normal file
|
@ -0,0 +1,50 @@
|
|||
Where to get started to help improve Friendica?
|
||||
===============================================
|
||||
|
||||
* [Home](help)
|
||||
|
||||
Do you want to help us improve Friendica? Here we have compiled some hints on how to get started and some tasks to help you choose. A project like Friendica is the sum of many different contributions. **Very different skills are required to make good software. Some of them involve coding, others do not.** We are looking for helpers in all areas, whether you write text or code, whether you spread the word to convince people or design new icons. Whether you feel like an expert or like a newbie - join us with your ideas!
|
||||
|
||||
**Contact us**
|
||||
|
||||
The discussion of Friendica development takes place in the following Friendica forums:
|
||||
|
||||
* The main [forum for Friendica development](https://friendika.openmindspace.org/profile/friendicadevelopers)
|
||||
* The [forum for Friendica theme development](https://friendica.eu/profile/ftdevs)
|
||||
|
||||
**Help other users**
|
||||
|
||||
Remember the questions you had when you first tried Friendica? A good place to start can be to help new people find their way around Friendica in the [general support forum](https://helpers.pyxis.uberspace.de/profile/helpers). Welcome them, answer their questions, point them to documentation or ping other helpers directly if you can't help but think you know who can.
|
||||
|
||||
**Translations**
|
||||
|
||||
The documentation contains help on how to translate Friendica in the /help/translations page.
|
||||
|
||||
* Check if the user interface has already been translated to your language.
|
||||
* If not, we might want to start with translating the /help pages.
|
||||
|
||||
**Design**
|
||||
|
||||
Are you good at designing things? If you have seen Friendica you probably have ideas to improve it, haven't you?
|
||||
|
||||
* Make plans for a better Friendica interface design and share them with us.
|
||||
* Tell us if you are able to realize your ideas or what kind of help you need. We can't promise we have the right skills in the group but we'll try.
|
||||
* Choose a thing to start with, e.g. work on the icon set of your favourite theme
|
||||
|
||||
**Programming**
|
||||
|
||||
* **Issues:** Have a look at our issue tracker on gihub!
|
||||
* Try to reproduce a bug that needs more inquries and write down what you find out.
|
||||
* If a bug looks fixed, ask the bug reporters for feedback to find out if the bug can be closed.
|
||||
* Fix a bug if you can.
|
||||
|
||||
* **Web interface:** The thing many people want most is a better interface, preferably a responsive Friendica theme. This is a piece of work! If you want to get involved here:
|
||||
* Look at the first steps that were made (e.g. the clean theme). Ask us to find out whom to talk to about their experiences.
|
||||
* Talk to design people if you know any.
|
||||
* Let us know about your plans [in the dev forum](https://friendika.openmindspace.org/profile/friendicadevelopers) and the [theme developer forum](https://friendica.eu/profile/ftdevs). Do not worry about cross-posting.
|
||||
|
||||
* **Client software:** There are free software clients that do somehow work with Friendica but most of them need love and maintenance. Also, they were mostly made for other platforms using the StatusNet API. This means they lack:w
|
||||
the features that are really specific to Friendica. Popular clients you might want to have a look at are:
|
||||
* [Hotot (Linux)](http://hotot.org/) - abandoned
|
||||
* [Friendica for Android](https://github.com/max-weller/friendica-for-android) - abandoned
|
||||
* You can find more working client software in [Wikipedia](https://en.wikipedia.org/wiki/Friendica).
|
|
@ -1,23 +0,0 @@
|
|||
Friendica Developer Guide
|
||||
===================
|
||||
|
||||
**Here is how you can join us.**
|
||||
|
||||
First, get yourself a working git package on the system where you will be
|
||||
doing development.
|
||||
|
||||
Create your own github account.
|
||||
|
||||
You may fork/clone the Friendica repository from [https://github.com/friendica/friendica.git](https://github.com/friendica/friendica.git).
|
||||
|
||||
Follow the instructions provided here: [http://help.github.com/fork-a-repo/](http://help.github.com/fork-a-repo/)
|
||||
to create and use your own tracking fork on github
|
||||
|
||||
Then go to your github page and create a "Pull request" when you are ready
|
||||
to notify us to merge your work.
|
||||
|
||||
**Important**
|
||||
|
||||
Please pull in any changes from the project repository and merge them with your work **before** issuing a pull request. We reserve the right to reject any patch which results in a large number of merge conflicts. This is especially true in the case of language translations - where we may not be able to understand the subtle differences between conflicting versions.
|
||||
|
||||
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.
|
28
doc/Github.md
Normal file
28
doc/Github.md
Normal file
|
@ -0,0 +1,28 @@
|
|||
Friendica on Github
|
||||
===================
|
||||
|
||||
* [Home](help)
|
||||
|
||||
**Here is how you can work on the code with us**
|
||||
|
||||
1. Install git on the system you will be developing on.
|
||||
2. Create your own [github](https://github.com) account.
|
||||
3. Fork the Friendica repository from [https://github.com/friendica/friendica.git](https://github.com/friendica/friendica.git).
|
||||
4. Clone your fork from your Github account to your machine. Follow the instructions provided here: [http://help.github.com/fork-a-repo/](http://help.github.com/fork-a-repo/) to create and use your own tracking fork on github
|
||||
5. Commit your changes to your fork. Then go to your github page and create a "Pull request" to notify us to merge your work.
|
||||
|
||||
**Branches**
|
||||
|
||||
There are two branches in the main repo on Github:
|
||||
|
||||
1. master: This branch contains stable releases only.
|
||||
2. develop: This branch contains the latest code. This is what you want to work with.
|
||||
|
||||
**Important**
|
||||
|
||||
Please pull in any changes from the project repository and merge them with your work **before** issuing a pull request. We reserve the right to reject any patch which results in a large number of merge conflicts. This is especially true in the case of language translations - where we may not be able to understand the subtle differences between conflicting versions.
|
||||
|
||||
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.
|
||||
|
||||
Check out how to work with [our Vagrant](help/Vagrant) to save a lot of setup time!
|
||||
|
21
doc/Home.md
21
doc/Home.md
|
@ -1,7 +1,7 @@
|
|||
Friendica Documentation and Resources
|
||||
=====================================
|
||||
|
||||
**Contents**
|
||||
**User Manual**
|
||||
|
||||
* General functions - first steps
|
||||
* [Account Basics](help/Account-Basics)
|
||||
|
@ -10,7 +10,7 @@ Friendica Documentation and Resources
|
|||
* [BBCode tag reference](help/BBCode)
|
||||
* [Comment, sort and delete posts](help/Text_comment)
|
||||
* [Profiles](help/Profiles)
|
||||
* You and other user
|
||||
* You and other users
|
||||
* [Connectors](help/Connectors)
|
||||
* [Making Friends](help/Making-Friends)
|
||||
* [Groups and Privacy](help/Groups-and-Privacy)
|
||||
|
@ -19,12 +19,11 @@ Friendica Documentation and Resources
|
|||
* [Chats](help/Chats)
|
||||
* Further information
|
||||
* [Improve Performance](help/Improve-Performance)
|
||||
* [Move Account](help/Move-Account)
|
||||
* [Remove Account](help/Remove-Account)
|
||||
* [Bugs and Issues](help/Bugs-and-Issues)
|
||||
* [Move your account](help/Move-Account)
|
||||
* [Delete your account](help/Remove-Account)
|
||||
* [Frequently asked questions (FAQ)](help/FAQ)
|
||||
|
||||
**Technical Documentation**
|
||||
**Admin Manual**
|
||||
|
||||
* [Install](help/Install)
|
||||
* [Settings](help/Settings)
|
||||
|
@ -32,10 +31,16 @@ Friendica Documentation and Resources
|
|||
* [Installing Connectors (Facebook/Twitter/StatusNet)](help/Installing-Connectors)
|
||||
* [Message Flow](help/Message-Flow)
|
||||
* [Using SSL with Friendica](help/SSL)
|
||||
* [Developers](help/Developers)
|
||||
* [Twitter/StatusNet API Functions](help/api)
|
||||
* [Translation of Friendica](help/translations)
|
||||
|
||||
**Developer Manual**
|
||||
|
||||
* [Where to get started?](help/Developers-Intro)
|
||||
* [Help on Github](help/Github)
|
||||
* [Help on Vagrant](help/Vagrant)
|
||||
* [How to translate Friendica](help/translations)
|
||||
* [Bugs and Issues](help/Bugs-and-Issues)
|
||||
* [Smarty 3 Templates](help/smarty3-templates)
|
||||
|
||||
**External Resources**
|
||||
|
||||
|
|
|
@ -196,6 +196,24 @@ Current hooks:
|
|||
'email' => email to look up the avatar for
|
||||
'url' => the (string) generated URL of the avatar
|
||||
|
||||
**'emailer_send_prepare'** - called from Emailer::send() before building the mime message
|
||||
$b is (array) , params to Emailer::send()
|
||||
'fromName' => name of the sender
|
||||
'fromEmail' => email fo the sender
|
||||
'replyTo' => replyTo address to direct responses
|
||||
'toEmail' => destination email address
|
||||
'messageSubject' => subject of the message
|
||||
'htmlVersion' => html version of the message
|
||||
'textVersion' => text only version of the message
|
||||
'additionalMailHeader' => additions to the smtp mail header
|
||||
|
||||
**'emailer_send'** - called before calling PHP's mail()
|
||||
$b is (array) , params to mail()
|
||||
'to'
|
||||
'subject'
|
||||
'body'
|
||||
'headers'
|
||||
|
||||
|
||||
A complete list of all hook callbacks with file locations (generated 14-Feb-2012): Please see the source for details of any hooks not documented above.
|
||||
|
||||
|
|
23
doc/Vagrant.md
Normal file
23
doc/Vagrant.md
Normal 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
173
doc/snarty3-templates.md
Normal 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".
|
|
@ -14,16 +14,24 @@ class Emailer {
|
|||
* @param htmlVersion html version of the message
|
||||
* @param textVersion text only version of the message
|
||||
* @param additionalMailHeader additions to the smtp mail header
|
||||
* @param optional uid user id of the destination user
|
||||
*/
|
||||
static public function send($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');
|
||||
$messageSubject = email_header_encode(html_entity_decode($params['messageSubject'],ENT_QUOTES,'UTF-8'),'UTF-8');
|
||||
|
||||
// generate a mime boundary
|
||||
$mimeBoundary =rand(0,9)."-"
|
||||
.rand(10000000000,9999999999)."-"
|
||||
.rand(10000000000,9999999999)."=:"
|
||||
.rand(10000000000,99999999999)."-"
|
||||
.rand(10000000000,99999999999)."=:"
|
||||
.rand(10000,99999);
|
||||
|
||||
// generate a multipart/alternative message header
|
||||
|
@ -41,19 +49,32 @@ class Emailer {
|
|||
"--" . $mimeBoundary . "\n" . // plain text section
|
||||
"Content-Type: text/plain; charset=UTF-8\n" .
|
||||
"Content-Transfer-Encoding: base64\n\n" .
|
||||
$textBody . "\n" .
|
||||
$textBody . "\n";
|
||||
|
||||
if (!$email_textonly && !is_null($params['htmlVersion'])){
|
||||
$multipartMessageBody .=
|
||||
"--" . $mimeBoundary . "\n" . // text/html section
|
||||
"Content-Type: text/html; charset=UTF-8\n" .
|
||||
"Content-Transfer-Encoding: base64\n\n" .
|
||||
$htmlBody . "\n" .
|
||||
$htmlBody . "\n";
|
||||
}
|
||||
$multipartMessageBody .=
|
||||
"--" . $mimeBoundary . "--\n"; // message ending
|
||||
|
||||
// send the message
|
||||
$hookdata = array(
|
||||
'to' => $params['toEmail'],
|
||||
'subject' => $messageSubject,
|
||||
'body' => $multipartMessageBody,
|
||||
'headers' => $messageHeader
|
||||
);
|
||||
//echo "<pre>"; var_dump($hookdata); killme();
|
||||
call_hooks("emailer_send", $hookdata);
|
||||
$res = mail(
|
||||
$params['toEmail'], // send to address
|
||||
$messageSubject, // subject
|
||||
$multipartMessageBody, // message body
|
||||
$messageHeader // message headers
|
||||
$hookdata['to'], // send to address
|
||||
$hookdata['subject'], // subject
|
||||
$hookdata['body'], // message body
|
||||
$hookdata['headers'] // message headers
|
||||
);
|
||||
logger("header " . 'To: ' . $params['toEmail'] . "\n" . $messageHeader, LOGGER_DEBUG);
|
||||
logger("return value " . (($res)?"true":"false"), LOGGER_DEBUG);
|
||||
|
|
|
@ -764,11 +764,16 @@ function get_photo_info($url) {
|
|||
if (is_null($data)) {
|
||||
$img_str = fetch_url($url, true, $redirects, 4);
|
||||
|
||||
$filesize = strlen($img_str);
|
||||
|
||||
$tempfile = tempnam(get_temppath(), "cache");
|
||||
file_put_contents($tempfile, $img_str);
|
||||
$data = getimagesize($tempfile);
|
||||
unlink($tempfile);
|
||||
|
||||
if ($data)
|
||||
$data["size"] = $filesize;
|
||||
|
||||
Cache::set($url, serialize($data));
|
||||
} else
|
||||
$data = unserialize($data);
|
||||
|
|
|
@ -343,6 +343,12 @@ function probe_url($url, $mode = PROBE_NORMAL) {
|
|||
if(! $url)
|
||||
return $result;
|
||||
|
||||
$result = Cache::get("probe_url:".$mode.":".$url);
|
||||
if (!is_null($result)) {
|
||||
$result = unserialize($result);
|
||||
return $result;
|
||||
}
|
||||
|
||||
$network = null;
|
||||
$diaspora = false;
|
||||
$diaspora_base = '';
|
||||
|
@ -350,6 +356,23 @@ function probe_url($url, $mode = PROBE_NORMAL) {
|
|||
$diaspora_key = '';
|
||||
$has_lrdd = 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 = ((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);
|
||||
|
||||
if((! $twitter) && (! $lastfm)) {
|
||||
if((!$appnet) && (!$lastfm) && !$connectornetworks) {
|
||||
|
||||
if(strpos($url,'mailto:') !== false && $at_addr) {
|
||||
$url = str_replace('mailto:','',$url);
|
||||
|
@ -401,6 +424,9 @@ function probe_url($url, $mode = PROBE_NORMAL) {
|
|||
$pubkey = $diaspora_key;
|
||||
$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
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
if($twitter || ! $poll)
|
||||
if($appnet || ! $poll)
|
||||
$check_feed = true;
|
||||
if((! isset($vcard)) || (! x($vcard,'fn')) || (! $profile))
|
||||
$check_feed = true;
|
||||
if(($at_addr) && (! count($links)))
|
||||
$check_feed = false;
|
||||
|
||||
if ($connectornetworks)
|
||||
$check_feed = false;
|
||||
|
||||
if($check_feed) {
|
||||
|
||||
$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);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
require_once("include/contact_selectors.php");
|
||||
require_once("include/features.php");
|
||||
require_once("mod/proxy.php");
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -35,6 +36,7 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) {
|
|||
$selected = " selected=\"selected\" ";
|
||||
else
|
||||
$selected = '';
|
||||
|
||||
$trimmed = mb_substr($rr['name'],0,12);
|
||||
|
||||
$o .= "<option value=\"{$rr['id']}\" $selected title=\"{$rr['name']}\" >$trimmed</option>\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) {
|
||||
|
||||
require_once("include/bbcode.php");
|
||||
|
||||
$a = get_app();
|
||||
|
||||
$o = '';
|
||||
|
@ -212,6 +216,9 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
|
|||
else
|
||||
$selected = '';
|
||||
|
||||
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";
|
||||
|
@ -527,7 +534,7 @@ function acl_lookup(&$a, $out_type = 'json') {
|
|||
$x['data'] = array();
|
||||
if(count($r)) {
|
||||
foreach($r as $g) {
|
||||
$x['photos'][] = $g['micro'];
|
||||
$x['photos'][] = proxy_url($g['micro']);
|
||||
$x['links'][] = $g['url'];
|
||||
$x['suggestions'][] = $g['name'];
|
||||
$x['data'][] = intval($g['id']);
|
||||
|
@ -541,7 +548,7 @@ function acl_lookup(&$a, $out_type = 'json') {
|
|||
foreach($r as $g){
|
||||
$contacts[] = array(
|
||||
"type" => "c",
|
||||
"photo" => $g['micro'],
|
||||
"photo" => proxy_url($g['micro']),
|
||||
"name" => $g['name'],
|
||||
"id" => intval($g['id']),
|
||||
"network" => $g['network'],
|
||||
|
@ -586,7 +593,7 @@ function acl_lookup(&$a, $out_type = 'json') {
|
|||
// /nickname
|
||||
$unknow_contacts[] = array(
|
||||
"type" => "c",
|
||||
"photo" => $row['author-avatar'],
|
||||
"photo" => proxy_url($row['author-avatar']),
|
||||
"name" => $row['author-name'],
|
||||
"id" => '',
|
||||
"network" => "unknown",
|
||||
|
|
250
include/api.php
250
include/api.php
|
@ -96,13 +96,36 @@
|
|||
}
|
||||
|
||||
$user = $_SERVER['PHP_AUTH_USER'];
|
||||
$encrypted = hash('whirlpool',trim($_SERVER['PHP_AUTH_PW']));
|
||||
$password = $_SERVER['PHP_AUTH_PW'];
|
||||
$encrypted = hash('whirlpool',trim($password));
|
||||
|
||||
|
||||
/**
|
||||
* next code from mod/auth.php. needs better solution
|
||||
*/
|
||||
$record = null;
|
||||
|
||||
$addon_auth = array(
|
||||
'username' => trim($user),
|
||||
'password' => trim($password),
|
||||
'authenticated' => 0,
|
||||
'user_record' => null
|
||||
);
|
||||
|
||||
/**
|
||||
*
|
||||
* A plugin indicates successful login by setting 'authenticated' to non-zero value and returning a user record
|
||||
* Plugins should never set 'authenticated' except to indicate success - as hooks may be chained
|
||||
* and later plugins should not interfere with an earlier one that succeeded.
|
||||
*
|
||||
*/
|
||||
|
||||
call_hooks('authenticate', $addon_auth);
|
||||
|
||||
if(($addon_auth['authenticated']) && (count($addon_auth['user_record']))) {
|
||||
$record = $addon_auth['user_record'];
|
||||
}
|
||||
else {
|
||||
// process normal login request
|
||||
|
||||
$r = q("SELECT * FROM `user` WHERE ( `email` = '%s' OR `nickname` = '%s' )
|
||||
|
@ -111,9 +134,11 @@
|
|||
dbesc(trim($user)),
|
||||
dbesc($encrypted)
|
||||
);
|
||||
if(count($r)){
|
||||
if(count($r))
|
||||
$record = $r[0];
|
||||
} else {
|
||||
}
|
||||
|
||||
if((! $record) || (! count($record))) {
|
||||
logger('API_login failure: ' . print_r($_SERVER,true), LOGGER_DEBUG);
|
||||
header('WWW-Authenticate: Basic realm="Friendica"');
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
|
@ -197,6 +222,7 @@
|
|||
}
|
||||
|
||||
function api_error(&$a, $type, $error) {
|
||||
# TODO: https://dev.twitter.com/overview/api/response-codes
|
||||
$r = "<status><error>".$error."</error><request>".$a->query_string."</request></status>";
|
||||
switch($type){
|
||||
case "xml":
|
||||
|
@ -871,8 +897,10 @@
|
|||
$in_reply_to_screen_name = NULL;
|
||||
}
|
||||
|
||||
$converted = api_convert_item($item);
|
||||
|
||||
$status_info = array(
|
||||
'text' => trim(html2plain(bbcode(api_clean_plain_items($lastwall['body']), false, false, 2, true), 0)),
|
||||
'text' => $converted["text"],
|
||||
'truncated' => false,
|
||||
'created_at' => api_date($lastwall['created']),
|
||||
'in_reply_to_status_id' => $in_reply_to_status_id,
|
||||
|
@ -884,19 +912,17 @@
|
|||
'in_reply_to_user_id_str' => $in_reply_to_user_id_str,
|
||||
'in_reply_to_screen_name' => $in_reply_to_screen_name,
|
||||
'geo' => NULL,
|
||||
'favorited' => false,
|
||||
// attachments
|
||||
'favorited' => $lastwall['starred'] ? true : false,
|
||||
'user' => $user_info,
|
||||
'statusnet_html' => trim(bbcode($lastwall['body'], false, false)),
|
||||
'statusnet_html' => $converted["html"],
|
||||
'statusnet_conversation_id' => $lastwall['parent'],
|
||||
);
|
||||
|
||||
if ($lastwall['title'] != "")
|
||||
$status_info['statusnet_html'] = "<h4>".bbcode($lastwall['title'])."</h4>\n".$status_info['statusnet_html'];
|
||||
if (count($converted["attachments"]) > 0)
|
||||
$status_info["attachments"] = $converted["attachments"];
|
||||
|
||||
$entities = api_get_entitities($status_info['text'], $lastwall['body']);
|
||||
if (count($entities) > 0)
|
||||
$status_info['entities'] = $entities;
|
||||
if (count($converted["entities"]) > 0)
|
||||
$status_info["entities"] = $converted["entities"];
|
||||
|
||||
if (($lastwall['item_network'] != "") AND ($status["source"] == 'web'))
|
||||
$status_info["source"] = network_to_name($lastwall['item_network']);
|
||||
|
@ -970,8 +996,11 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
$converted = api_convert_item($item);
|
||||
|
||||
$user_info['status'] = array(
|
||||
'text' => trim(html2plain(bbcode(api_clean_plain_items($lastwall['body']), false, false, 2, true), 0)),
|
||||
'text' => $converted["text"],
|
||||
'truncated' => false,
|
||||
'created_at' => api_date($lastwall['created']),
|
||||
'in_reply_to_status_id' => $in_reply_to_status_id,
|
||||
|
@ -983,17 +1012,16 @@
|
|||
'in_reply_to_user_id_str' => $in_reply_to_user_id_str,
|
||||
'in_reply_to_screen_name' => $in_reply_to_screen_name,
|
||||
'geo' => NULL,
|
||||
'favorited' => false,
|
||||
'statusnet_html' => trim(bbcode($lastwall['body'], false, false)),
|
||||
'favorited' => $lastwall['starred'] ? true : false,
|
||||
'statusnet_html' => $converted["html"],
|
||||
'statusnet_conversation_id' => $lastwall['parent'],
|
||||
);
|
||||
|
||||
if ($lastwall['title'] != "")
|
||||
$user_info['statusnet_html'] = "<h4>".bbcode($lastwall['title'])."</h4>\n".$user_info['statusnet_html'];
|
||||
if (count($converted["attachments"]) > 0)
|
||||
$user_info["status"]["attachments"] = $converted["attachments"];
|
||||
|
||||
$entities = api_get_entitities($user_info['text'], $lastwall['body']);
|
||||
if (count($entities) > 0)
|
||||
$user_info['entities'] = $entities;
|
||||
if (count($converted["entities"]) > 0)
|
||||
$user_info["status"]["entities"] = $converted["entities"];
|
||||
|
||||
if (($lastwall['item_network'] != "") AND ($user_info["status"]["source"] == 'web'))
|
||||
$user_info["status"]["source"] = network_to_name($lastwall['item_network']);
|
||||
|
@ -1568,6 +1596,69 @@
|
|||
api_register_func('api/statuses/user_timeline','api_statuses_user_timeline', true);
|
||||
|
||||
|
||||
/**
|
||||
* Star/unstar an item
|
||||
* param: id : id of the item
|
||||
*
|
||||
* api v1 : https://web.archive.org/web/20131019055350/https://dev.twitter.com/docs/api/1/post/favorites/create/%3Aid
|
||||
*/
|
||||
function api_favorites_create_destroy(&$a, $type){
|
||||
if (api_user()===false) return false;
|
||||
|
||||
# for versioned api.
|
||||
# TODO: we need a better global soluton
|
||||
$action_argv_id=2;
|
||||
if ($a->argv[1]=="1.1") $action_argv_id=3;
|
||||
|
||||
if ($a->argc<=$action_argv_id) die(api_error($a, $type, t("Invalid request.")));
|
||||
$action = str_replace(".".$type,"",$a->argv[$action_argv_id]);
|
||||
if ($a->argc==$action_argv_id+2) {
|
||||
$itemid = intval($a->argv[$action_argv_id+1]);
|
||||
} else {
|
||||
$itemid = intval($_REQUEST['id']);
|
||||
}
|
||||
|
||||
$item = q("SELECT * FROM item WHERE id=%d AND uid=%d",
|
||||
$itemid, api_user());
|
||||
|
||||
if ($item===false || count($item)==0) die(api_error($a, $type, t("Invalid item.")));
|
||||
|
||||
switch($action){
|
||||
case "create":
|
||||
$item[0]['starred']=1;
|
||||
break;
|
||||
case "destroy":
|
||||
$item[0]['starred']=0;
|
||||
break;
|
||||
default:
|
||||
die(api_error($a, $type, t("Invalid action. ".$action)));
|
||||
}
|
||||
$r = q("UPDATE item SET starred=%d WHERE id=%d AND uid=%d",
|
||||
$item[0]['starred'], $itemid, api_user());
|
||||
|
||||
q("UPDATE thread SET starred=%d WHERE iid=%d AND uid=%d",
|
||||
$item[0]['starred'], $itemid, api_user());
|
||||
|
||||
if ($r===false) die(api_error($a, $type, t("DB error")));
|
||||
|
||||
|
||||
$user_info = api_get_user($a);
|
||||
$rets = api_format_items($item,$user_info);
|
||||
$ret = $rets[0];
|
||||
|
||||
$data = array('$status' => $ret);
|
||||
switch($type){
|
||||
case "atom":
|
||||
case "rss":
|
||||
$data = api_rss_extra($a, $data, $user_info);
|
||||
}
|
||||
|
||||
return api_apply_template("status", $type, $data);
|
||||
}
|
||||
|
||||
api_register_func('api/favorites/create', 'api_favorites_create_destroy', true);
|
||||
api_register_func('api/favorites/destroy', 'api_favorites_create_destroy', true);
|
||||
|
||||
function api_favorites(&$a, $type){
|
||||
global $called_api;
|
||||
|
||||
|
@ -1603,7 +1694,7 @@
|
|||
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
FROM `item`, `contact`
|
||||
WHERE `item`.`uid` = %d AND `verb` = '%s'
|
||||
WHERE `item`.`uid` = %d
|
||||
AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0
|
||||
AND `item`.`starred` = 1
|
||||
AND `contact`.`id` = `item`.`contact-id`
|
||||
|
@ -1612,7 +1703,6 @@
|
|||
AND `item`.`id`>%d
|
||||
ORDER BY `item`.`id` DESC LIMIT %d ,%d ",
|
||||
intval(api_user()),
|
||||
dbesc(ACTIVITY_POST),
|
||||
intval($since_id),
|
||||
intval($start), intval($count)
|
||||
);
|
||||
|
@ -1633,6 +1723,9 @@
|
|||
|
||||
api_register_func('api/favorites','api_favorites', true);
|
||||
|
||||
|
||||
|
||||
|
||||
function api_format_as($a, $ret, $user_info) {
|
||||
|
||||
$as = array();
|
||||
|
@ -1740,6 +1833,67 @@
|
|||
return $ret;
|
||||
}
|
||||
|
||||
function api_convert_item($item) {
|
||||
|
||||
$body = $item['body'];
|
||||
$attachments = api_get_attachments($body);
|
||||
|
||||
// Workaround for ostatus messages where the title is identically to the body
|
||||
$html = bbcode(api_clean_plain_items($body), false, false, 2, true);
|
||||
$statusbody = trim(html2plain($html, 0));
|
||||
|
||||
// handle data: images
|
||||
$statusbody = api_format_items_embeded_images($item,$statusbody);
|
||||
|
||||
$statustitle = trim($item['title']);
|
||||
|
||||
if (($statustitle != '') and (strpos($statusbody, $statustitle) !== false))
|
||||
$statustext = trim($statusbody);
|
||||
else
|
||||
$statustext = trim($statustitle."\n\n".$statusbody);
|
||||
|
||||
if (($item["network"] == NETWORK_FEED) and (strlen($statustext)> 1000))
|
||||
$statustext = substr($statustext, 0, 1000)."... \n".$item["plink"];
|
||||
|
||||
$statushtml = trim(bbcode($body, false, false));
|
||||
|
||||
if ($item['title'] != "")
|
||||
$statushtml = "<h4>".bbcode($item['title'])."</h4>\n".$statushtml;
|
||||
|
||||
$entities = api_get_entitities($statustext, $body);
|
||||
|
||||
return(array("text" => $statustext, "html" => $statushtml, "attachments" => $attachments, "entities" => $entities));
|
||||
}
|
||||
|
||||
function api_get_attachments(&$body) {
|
||||
|
||||
$text = $body;
|
||||
$text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '[img]$3[/img]', $text);
|
||||
|
||||
$URLSearchString = "^\[\]";
|
||||
$ret = preg_match_all("/\[img\]([$URLSearchString]*)\[\/img\]/ism", $text, $images);
|
||||
|
||||
if (!$ret)
|
||||
return false;
|
||||
|
||||
require_once("include/Photo.php");
|
||||
|
||||
$attachments = array();
|
||||
|
||||
foreach ($images[1] AS $image) {
|
||||
$imagedata = get_photo_info($image);
|
||||
|
||||
if ($imagedata)
|
||||
$attachments[] = array("url" => $image, "mimetype" => $imagedata["mime"], "size" => $imagedata["size"]);
|
||||
}
|
||||
|
||||
if (strstr($_SERVER['HTTP_USER_AGENT'], "AndStatus"))
|
||||
foreach ($images[0] AS $orig)
|
||||
$body = str_replace($orig, "", $body);
|
||||
|
||||
return $attachments;
|
||||
}
|
||||
|
||||
function api_get_entitities(&$text, $bbcode) {
|
||||
/*
|
||||
To-Do:
|
||||
|
@ -1914,7 +2068,7 @@
|
|||
$ret = Array();
|
||||
|
||||
foreach($r as $item) {
|
||||
api_share_as_retweet($a, api_user(), $item);
|
||||
api_share_as_retweet($item);
|
||||
|
||||
localize_item($item);
|
||||
$status_user = api_item_get_user($a,$item);
|
||||
|
@ -1961,29 +2115,10 @@
|
|||
$in_reply_to_status_id_str = NULL;
|
||||
}
|
||||
|
||||
// Workaround for ostatus messages where the title is identically to the body
|
||||
//$statusbody = trim(html2plain(bbcode(api_clean_plain_items($item['body']), false, false, 5, true), 0));
|
||||
$html = bbcode(api_clean_plain_items($item['body']), false, false, 2, true);
|
||||
$statusbody = trim(html2plain($html, 0));
|
||||
|
||||
// handle data: images
|
||||
$statusbody = api_format_items_embeded_images($item,$statusbody);
|
||||
|
||||
$statustitle = trim($item['title']);
|
||||
|
||||
if (($statustitle != '') and (strpos($statusbody, $statustitle) !== false))
|
||||
$statustext = trim($statusbody);
|
||||
else
|
||||
$statustext = trim($statustitle."\n\n".$statusbody);
|
||||
|
||||
if (($item["network"] == NETWORK_FEED) and (strlen($statustext)> 1000))
|
||||
$statustext = substr($statustext, 0, 1000)."... \n".$item["plink"];
|
||||
|
||||
$statushtml = trim(bbcode($item['body'], false, false));
|
||||
|
||||
$converted = api_convert_item($item);
|
||||
|
||||
$status = array(
|
||||
'text' => $statustext,
|
||||
'text' => $converted["text"],
|
||||
'truncated' => False,
|
||||
'created_at'=> api_date($item['created']),
|
||||
'in_reply_to_status_id' => $in_reply_to_status_id,
|
||||
|
@ -1996,19 +2131,17 @@
|
|||
'in_reply_to_screen_name' => $in_reply_to_screen_name,
|
||||
'geo' => NULL,
|
||||
'favorited' => $item['starred'] ? true : false,
|
||||
//'attachments' => array(),
|
||||
'user' => $status_user ,
|
||||
//'entities' => NULL,
|
||||
'statusnet_html' => $statushtml,
|
||||
'statusnet_html' => $converted["html"],
|
||||
'statusnet_conversation_id' => $item['parent'],
|
||||
);
|
||||
|
||||
if ($item['title'] != "")
|
||||
$status['statusnet_html'] = "<h4>".bbcode($item['title'])."</h4>\n".$status['statusnet_html'];
|
||||
if (count($converted["attachments"]) > 0)
|
||||
$status["attachments"] = $converted["attachments"];
|
||||
|
||||
$entities = api_get_entitities($status['text'], $item['body']);
|
||||
if (count($entities) > 0)
|
||||
$status['entities'] = $entities;
|
||||
if (count($converted["entities"]) > 0)
|
||||
$status["entities"] = $converted["entities"];
|
||||
|
||||
if (($item['item_network'] != "") AND ($status["source"] == 'web'))
|
||||
$status["source"] = network_to_name($item['item_network']);
|
||||
|
@ -2487,7 +2620,7 @@
|
|||
|
||||
|
||||
|
||||
function api_share_as_retweet($a, $uid, &$item) {
|
||||
function api_share_as_retweet(&$item) {
|
||||
$body = trim($item["body"]);
|
||||
|
||||
// Skip if it isn't a pure repeated messages
|
||||
|
@ -2531,6 +2664,15 @@ function api_share_as_retweet($a, $uid, &$item) {
|
|||
if ($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);
|
||||
|
||||
if (($shared_body == "") OR ($profile == "") OR ($author == "") OR ($avatar == ""))
|
||||
|
@ -2540,6 +2682,7 @@ function api_share_as_retweet($a, $uid, &$item) {
|
|||
$item["author-name"] = $author;
|
||||
$item["author-link"] = $profile;
|
||||
$item["author-avatar"] = $avatar;
|
||||
$item["plink"] = $link;
|
||||
|
||||
return(true);
|
||||
|
||||
|
@ -2697,9 +2840,6 @@ function api_best_nickname(&$contacts) {
|
|||
|
||||
/*
|
||||
Not implemented by now:
|
||||
favorites
|
||||
favorites/create
|
||||
favorites/destroy
|
||||
statuses/retweets_of_me
|
||||
friendships/create
|
||||
friendships/destroy
|
||||
|
|
|
@ -90,8 +90,9 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) {
|
|||
|
||||
} else {
|
||||
$Text = bbcode($Text, $preserve_nl, false, 4);
|
||||
|
||||
// Libertree doesn't convert a harizontal rule if there isn't a linefeed
|
||||
$Text = str_replace("<hr />", "<br /><hr />", $Text);
|
||||
$Text = str_replace(array("<hr />", "<hr>"), array("<br /><hr />", "<br><hr>"), $Text);
|
||||
}
|
||||
|
||||
// Now convert HTML to Markdown
|
||||
|
|
|
@ -41,7 +41,9 @@ function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
|
|||
if ($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("[", "]"), $title);
|
||||
|
||||
$image = "";
|
||||
if ($type != "video") {
|
||||
|
@ -617,6 +619,17 @@ function GetProfileUsername($profile, $username, $compact = false, $getnetwork =
|
|||
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);
|
||||
if ($StatusnetHost != $profile) {
|
||||
$StatusnetUser = preg_replace("=https?://(.*)/user/(.*)=ism", "$2", $profile);
|
||||
|
@ -695,7 +708,7 @@ function bb_RemovePictureLinks($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]");
|
||||
else
|
||||
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");
|
||||
|
||||
return $Text;
|
||||
return trim($Text);
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -203,12 +203,11 @@ function localize_item(&$item){
|
|||
|
||||
// we can't have a translation string with three positions but no distinguishable text
|
||||
// So here is the translate string.
|
||||
|
||||
$txt = t('%1$s poked %2$s');
|
||||
|
||||
// now translate the verb
|
||||
|
||||
$txt = str_replace( t('poked'), t($verb), $txt);
|
||||
$poked_t = trim(sprintf($txt, "",""));
|
||||
$txt = str_replace( $poked_t, t($verb), $txt);
|
||||
|
||||
// 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'),
|
||||
'$noloc' => t('Clear browser location'),
|
||||
'$shortnoloc' => t('clear location'),
|
||||
'$title' => "",
|
||||
'$title' => $x['title'],
|
||||
'$placeholdertitle' => t('Set title'),
|
||||
'$category' => "",
|
||||
'$category' => $x['category'],
|
||||
'$placeholdercategory' => (feature_enabled(local_user(),'categories') ? t('Categories (comma-separated list)') : ''),
|
||||
'$wait' => t('Please wait'),
|
||||
'$permset' => t('Permission settings'),
|
||||
'$shortpermset' => t('permissions'),
|
||||
'$ptyp' => (($notes_cid) ? 'note' : 'wall'),
|
||||
'$content' => '',
|
||||
'$post_id' => '',
|
||||
'$content' => $x['content'],
|
||||
'$post_id' => $x['post_id'],
|
||||
'$baseurl' => $a->get_baseurl(true),
|
||||
'$defloc' => $x['default_location'],
|
||||
'$visitor' => $x['visitor'],
|
||||
|
|
|
@ -66,6 +66,6 @@ function cronhooks_run(&$argv, &$argc){
|
|||
}
|
||||
|
||||
if (array_search(__file__,get_included_files())===0){
|
||||
cronhooks_run($argv,$argc);
|
||||
cronhooks_run($_SERVER["argv"],$_SERVER["argc"]);
|
||||
killme();
|
||||
}
|
||||
|
|
|
@ -413,6 +413,10 @@ function db_definition() {
|
|||
"network" => 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" => ""),
|
||||
"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" => ""),
|
||||
"photo" => 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" => ""),
|
||||
"photo" => 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(
|
||||
"PRIMARY" => array("id"),
|
||||
|
@ -823,6 +833,7 @@ function db_definition() {
|
|||
"id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
|
||||
"name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
|
||||
"locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"created" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
|
||||
),
|
||||
"indexes" => array(
|
||||
"PRIMARY" => array("id"),
|
||||
|
@ -1247,6 +1258,8 @@ function db_definition() {
|
|||
"nick" => 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" => ""),
|
||||
"location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"about" => array("type" => "text", "not null" => "1"),
|
||||
),
|
||||
"indexes" => array(
|
||||
"PRIMARY" => array("id"),
|
||||
|
@ -1339,6 +1352,6 @@ function dbstructure_run(&$argv, &$argc) {
|
|||
}
|
||||
|
||||
if (array_search(__file__,get_included_files())===0){
|
||||
dbstructure_run($argv,$argc);
|
||||
dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);
|
||||
killme();
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ function dbupdate_run(&$argv, &$argc) {
|
|||
}
|
||||
|
||||
if (array_search(__file__,get_included_files())===0){
|
||||
dbupdate_run($argv,$argc);
|
||||
dbupdate_run($_SERVER["argv"],$_SERVER["argc"]);
|
||||
killme();
|
||||
}
|
||||
|
||||
|
|
|
@ -565,6 +565,6 @@ function delivery_run(&$argv, &$argc){
|
|||
}
|
||||
|
||||
if (array_search(__file__,get_included_files())===0){
|
||||
delivery_run($argv,$argc);
|
||||
delivery_run($_SERVER["argv"],$_SERVER["argc"]);
|
||||
killme();
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
||||
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_guid = notags(unxmlify($xml->root_guid));
|
||||
|
||||
$source_url = 'https://' . substr($orig_author,strpos($orig_author,'@')+1) . '/p/' . $orig_guid . '.xml';
|
||||
$orig_url = 'https://'.substr($orig_author,strpos($orig_author,'@')+1).'/posts/'.$orig_guid;
|
||||
$x = fetch_url($source_url);
|
||||
if(! $x)
|
||||
$x = fetch_url(str_replace('https://','http://',$source_url));
|
||||
if(! $x) {
|
||||
logger('diaspora_reshare: unable to fetch source url ' . $source_url);
|
||||
return;
|
||||
}
|
||||
logger('diaspora_reshare: source: ' . $x);
|
||||
$create_original_post = false;
|
||||
|
||||
$x = str_replace(array('<activity_streams-photo>','</activity_streams-photo>'),array('<asphoto>','</asphoto>'),$x);
|
||||
$source_xml = parse_xml_string($x,false);
|
||||
// Do we already have this item?
|
||||
$r = q("SELECT `body`, `tag`, `app`, `author-link`, `plink` FROM `item` WHERE `guid` = '%s' AND `visible` AND NOT `deleted` AND `body` != '' LIMIT 1",
|
||||
dbesc($orig_guid),
|
||||
dbesc(NETWORK_DIASPORA)
|
||||
);
|
||||
if(count($r)) {
|
||||
logger('reshared message '.orig_guid." reshared by ".$guid.' already exists on system: '.$orig_url);
|
||||
|
||||
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('diaspora_reshare: embedded picture link found: '.$body, LOGGER_DEBUG);
|
||||
// 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;
|
||||
}
|
||||
|
||||
$body = scale_external_images($body);
|
||||
|
||||
// Add OEmbed and other information to the body
|
||||
$body = add_page_info_to_body($body, false, true);
|
||||
}
|
||||
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));
|
||||
if (!count($r)) {
|
||||
$body = "";
|
||||
//return;
|
||||
$str_tags = "";
|
||||
$app = "";
|
||||
|
||||
$orig_url = 'https://'.substr($orig_author,strpos($orig_author,'@')+1).'/posts/'.$orig_guid;
|
||||
|
||||
$server = 'https://'.substr($orig_author,strpos($orig_author,'@')+1);
|
||||
logger('1st 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 = '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);
|
||||
$item = diaspora_fetch_message($orig_guid, $server);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
//if(! $body) {
|
||||
// logger('diaspora_reshare: empty body: source= ' . $x);
|
||||
// return;
|
||||
//}
|
||||
if ($item) {
|
||||
$body = $item["body"];
|
||||
$str_tags = $item["tag"];
|
||||
$app = $item["app"];
|
||||
$orig_created = $item["created"];
|
||||
$orig_author = $item["author"];
|
||||
$orig_guid = $item["guid"];
|
||||
//$create_original_post = ($body != "");
|
||||
}
|
||||
}
|
||||
|
||||
$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("♲ ", ENT_QUOTES, 'UTF-8') . $details . "\n";*/
|
||||
|
||||
|
||||
// allocate a guid on our system - we aren't fixing any collisions.
|
||||
// we're ignoring them
|
||||
|
||||
|
@ -1026,34 +1125,6 @@ function diaspora_reshare($importer,$xml,$msg) {
|
|||
|
||||
$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;
|
||||
|
||||
$datarray['uid'] = $importer['uid'];
|
||||
|
@ -1087,19 +1158,37 @@ function diaspora_reshare($importer,$xml,$msg) {
|
|||
}
|
||||
|
||||
$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)
|
||||
$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) {
|
||||
// q("update item set plink = '%s' where id = %d",
|
||||
// dbesc($a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id),
|
||||
// intval($message_id)
|
||||
// );
|
||||
//}
|
||||
$datarray2['uid'] = 0;
|
||||
$datarray2['contact-id'] = 0;
|
||||
$datarray2['guid'] = $orig_guid;
|
||||
$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;
|
||||
|
||||
|
@ -2028,6 +2117,7 @@ function diaspora_retraction($importer,$xml) {
|
|||
dbesc(datetime_convert()),
|
||||
intval($r[0]['id'])
|
||||
);
|
||||
delete_thread($r[0]['id'], $r[0]['parent-uri']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2100,6 +2190,7 @@ function diaspora_signed_retraction($importer,$xml,$msg) {
|
|||
dbesc(datetime_convert()),
|
||||
intval($r[0]['id'])
|
||||
);
|
||||
delete_thread($r[0]['id'], $r[0]['parent-uri']);
|
||||
|
||||
// Now check if the retraction needs to be relayed by us
|
||||
//
|
||||
|
@ -2159,14 +2250,27 @@ function diaspora_profile($importer,$xml,$msg) {
|
|||
$name = unxmlify($xml->first_name) . ((strlen($xml->last_name)) ? ' ' . unxmlify($xml->last_name) : '');
|
||||
$image_url = unxmlify($xml->image_url);
|
||||
$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);
|
||||
if($name === '') {
|
||||
$name = $handle_parts[0];
|
||||
}
|
||||
|
||||
|
||||
if( preg_match("|^https?://|", $image_url) === 0) {
|
||||
$image_url = "http://" . $handle_parts[1] . $image_url;
|
||||
}
|
||||
|
@ -2196,7 +2300,7 @@ function diaspora_profile($importer,$xml,$msg) {
|
|||
// 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.
|
||||
|
||||
$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(datetime_convert()),
|
||||
dbesc($images[0]),
|
||||
|
@ -2204,10 +2308,35 @@ function diaspora_profile($importer,$xml,$msg) {
|
|||
dbesc($images[2]),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc($birthday),
|
||||
dbesc($location),
|
||||
dbesc($about),
|
||||
dbesc($keywords),
|
||||
dbesc($gender),
|
||||
intval($contact['id']),
|
||||
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($oldphotos) {
|
||||
foreach($oldphotos as $ph) {
|
||||
|
|
|
@ -46,6 +46,6 @@ function directory_run(&$argv, &$argc){
|
|||
}
|
||||
|
||||
if (array_search(__file__,get_included_files())===0){
|
||||
directory_run($argv,$argc);
|
||||
directory_run($_SERVER["argv"],$_SERVER["argc"]);
|
||||
killme();
|
||||
}
|
||||
|
|
|
@ -45,6 +45,6 @@ function dsprphotoq_run($argv, $argc){
|
|||
|
||||
|
||||
if (array_search(__file__,get_included_files())===0){
|
||||
dsprphotoq_run($argv,$argc);
|
||||
dsprphotoq_run($_SERVER["argv"],$_SERVER["argc"]);
|
||||
killme();
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ function notification($params) {
|
|||
$thanks = t('Thank You,');
|
||||
$sitename = $a->config['sitename'];
|
||||
$site_admin = sprintf( t('%s Administrator'), $sitename);
|
||||
$nickname = "";
|
||||
|
||||
$sender_name = $product;
|
||||
$hostname = $a->get_hostname();
|
||||
|
@ -29,6 +30,10 @@ function notification($params) {
|
|||
|
||||
$sender_email = t('noreply') . '@' . $hostname;
|
||||
|
||||
$user = q("SELECT `nickname` FROM `user` WHERE `uid` = %d", intval($params['uid']));
|
||||
if ($user)
|
||||
$nickname = $user[0]["nickname"];
|
||||
|
||||
// with $params['show_in_notification_page'] == false, the notification isn't inserted into
|
||||
// the database, and an email is sent if applicable.
|
||||
// default, if not specified: true
|
||||
|
@ -37,6 +42,7 @@ function notification($params) {
|
|||
$additional_mail_header = "";
|
||||
$additional_mail_header .= "Precedence: list\n";
|
||||
$additional_mail_header .= "X-Friendica-Host: ".$hostname."\n";
|
||||
$additional_mail_header .= "X-Friendica-Account: <".$nickname."@".$hostname.">\n";
|
||||
$additional_mail_header .= "X-Friendica-Platform: ".FRIENDICA_PLATFORM."\n";
|
||||
$additional_mail_header .= "X-Friendica-Version: ".FRIENDICA_VERSION."\n";
|
||||
$additional_mail_header .= "List-ID: <notification.".$hostname.">\n";
|
||||
|
@ -344,7 +350,7 @@ function notification($params) {
|
|||
$show_in_notification_page = false;
|
||||
}
|
||||
|
||||
|
||||
$subject .= " (".$nickname."@".$hostname.")";
|
||||
|
||||
$h = array(
|
||||
'params' => $params,
|
||||
|
@ -592,6 +598,7 @@ function notification($params) {
|
|||
// use the Emailer class to send the message
|
||||
|
||||
return Emailer::send(array(
|
||||
'uid' => $params['uid'],
|
||||
'fromName' => $sender_name,
|
||||
'fromEmail' => $sender_email,
|
||||
'replyTo' => $sender_email,
|
||||
|
|
|
@ -55,6 +55,6 @@ function expire_run(&$argv, &$argc){
|
|||
}
|
||||
|
||||
if (array_search(__file__,get_included_files())===0){
|
||||
expire_run($argv,$argc);
|
||||
expire_run($_SERVER["argv"],$_SERVER["argc"]);
|
||||
killme();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
// 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),
|
||||
dbesc($ret['poll'])
|
||||
dbesc($ret['poll']),
|
||||
dbesc($ret['network'])
|
||||
);
|
||||
|
||||
|
||||
if(count($r)) {
|
||||
// update contact
|
||||
if($r[0]['rel'] == CONTACT_IS_FOLLOWER || ($network === NETWORK_DIASPORA && $r[0]['rel'] == CONTACT_IS_SHARING)) {
|
||||
|
@ -170,9 +170,9 @@ function new_contact($uid,$url,$interactive = false) {
|
|||
$new_relation = CONTACT_IS_FOLLOWER;
|
||||
|
||||
// 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` )
|
||||
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),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc($ret['url']),
|
||||
|
@ -185,7 +185,6 @@ function new_contact($uid,$url,$interactive = false) {
|
|||
dbesc($ret['poco']),
|
||||
dbesc($ret['name']),
|
||||
dbesc($ret['nick']),
|
||||
dbesc($ret['photo']),
|
||||
dbesc($ret['network']),
|
||||
dbesc($ret['pubkey']),
|
||||
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['network']),
|
||||
intval($uid)
|
||||
);
|
||||
|
||||
|
@ -228,8 +228,7 @@ function new_contact($uid,$url,$interactive = false) {
|
|||
`name-date` = '%s',
|
||||
`uri-date` = '%s',
|
||||
`avatar-date` = '%s'
|
||||
WHERE `id` = %d
|
||||
",
|
||||
WHERE `id` = %d",
|
||||
dbesc($photos[0]),
|
||||
dbesc($photos[1]),
|
||||
dbesc($photos[2]),
|
||||
|
|
|
@ -63,6 +63,6 @@ function gprobe_run(&$argv, &$argc){
|
|||
}
|
||||
|
||||
if (array_search(__file__,get_included_files())===0){
|
||||
gprobe_run($argv,$argc);
|
||||
gprobe_run($_SERVER["argv"],$_SERVER["argc"]);
|
||||
killme();
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ function node2bbcode(&$doc, $oldnode, $attributes, $startbb, $endbb)
|
|||
|
||||
function node2bbcodesub(&$doc, $oldnode, $attributes, $startbb, $endbb)
|
||||
{
|
||||
$savestart = str_replace('$', '%', $startbb);
|
||||
$savestart = str_replace('$', '\x01', $startbb);
|
||||
$replace = false;
|
||||
|
||||
$xpath = new DomXPath($doc);
|
||||
|
@ -37,7 +37,7 @@ function node2bbcodesub(&$doc, $oldnode, $attributes, $startbb, $endbb)
|
|||
|
||||
foreach ($attributes as $attribute => $value) {
|
||||
|
||||
$startbb = str_replace('%'.++$i, '$1', $startbb);
|
||||
$startbb = str_replace('\x01'.++$i, '$1', $startbb);
|
||||
|
||||
if (strpos('*'.$startbb, '$1') > 0) {
|
||||
|
||||
|
@ -76,13 +76,14 @@ function node2bbcodesub(&$doc, $oldnode, $attributes, $startbb, $endbb)
|
|||
return($replace);
|
||||
}
|
||||
|
||||
if(!function_exists('deletenode')) {
|
||||
function deletenode(&$doc, $node)
|
||||
{
|
||||
$xpath = new DomXPath($doc);
|
||||
$list = $xpath->query("//".$node);
|
||||
foreach ($list as $child)
|
||||
$child->parentNode->removeChild($child);
|
||||
}
|
||||
}}
|
||||
|
||||
function html2bbcode($message)
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@ require_once('include/text.php');
|
|||
require_once('include/email.php');
|
||||
require_once('include/ostatus_conversation.php');
|
||||
require_once('include/threads.php');
|
||||
require_once('include/socgraph.php');
|
||||
|
||||
function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0) {
|
||||
|
||||
|
@ -872,9 +873,19 @@ function get_atom_elements($feed, $item, $contact = array()) {
|
|||
}
|
||||
|
||||
if (isset($contact["network"]) AND ($contact["network"] == NETWORK_FEED) AND $contact['fetch_further_information']) {
|
||||
$res["body"] = $res["title"].add_page_info($res['plink'], false, "", ($contact['fetch_further_information'] == 2), $contact['ffi_keyword_blacklist']);
|
||||
$preview = "";
|
||||
|
||||
// Handle enclosures and treat them as preview picture
|
||||
if (isset($attach))
|
||||
foreach ($attach AS $attachment)
|
||||
if ($attachment->type == "image/jpeg")
|
||||
$preview = $attachment->link;
|
||||
|
||||
$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["object-type"] = ACTIVITY_OBJ_BOOKMARK;
|
||||
unset($res["attach"]);
|
||||
} elseif (isset($contact["network"]) AND ($contact["network"] == NETWORK_OSTATUS))
|
||||
$res["body"] = add_page_info_to_body($res["body"]);
|
||||
elseif (isset($contact["network"]) AND ($contact["network"] == NETWORK_FEED) AND strstr($res['plink'], ".app.net/")) {
|
||||
|
@ -936,12 +947,20 @@ function add_page_info_data($data) {
|
|||
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");
|
||||
|
||||
$data = Cache::get("parse_url:".$url);
|
||||
if (is_null($data)){
|
||||
$data = parseurl_getsiteinfo($url, true);
|
||||
Cache::set("parse_url:".$url,serialize($data));
|
||||
} else
|
||||
$data = unserialize($data);
|
||||
|
||||
logger('add_page_info: fetch page info for '.$url.' '.print_r($data, true), LOGGER_DEBUG);
|
||||
if ($photo != "")
|
||||
$data["images"][0]["src"] = $photo;
|
||||
|
||||
logger('fetch page info for '.$url.' '.print_r($data, true), LOGGER_DEBUG);
|
||||
|
||||
if (!$keywords AND isset($data["keywords"]))
|
||||
unset($data["keywords"]);
|
||||
|
@ -956,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);
|
||||
|
||||
return($text);
|
||||
|
@ -1027,7 +1072,7 @@ function encode_rel_links($links) {
|
|||
|
||||
|
||||
|
||||
function item_store($arr,$force_parent = false, $notify = false) {
|
||||
function item_store($arr,$force_parent = false, $notify = false, $dontcache = false) {
|
||||
|
||||
// If it is a posting where users should get notifications, then define it as wall posting
|
||||
if ($notify) {
|
||||
|
@ -1305,6 +1350,9 @@ function item_store($arr,$force_parent = false, $notify = false) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
// Store the unescaped version
|
||||
$unescaped = $arr;
|
||||
|
||||
dbesc_array($arr);
|
||||
|
||||
logger('item_store: ' . print_r($arr,true), LOGGER_DATA);
|
||||
|
@ -1315,10 +1363,12 @@ function item_store($arr,$force_parent = false, $notify = false) {
|
|||
. 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 ",
|
||||
$arr['uri'], // already dbesc'd
|
||||
dbesc($arr['uri']),
|
||||
intval($arr['uid'])
|
||||
);
|
||||
|
||||
|
@ -1326,6 +1376,26 @@ function item_store($arr,$force_parent = false, $notify = false) {
|
|||
$current_post = $r[0]['id'];
|
||||
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
|
||||
if ($arr['parent-uri'] === $arr['uri']) {
|
||||
add_thread($r[0]['id']);
|
||||
|
@ -1376,7 +1446,7 @@ function item_store($arr,$force_parent = false, $notify = false) {
|
|||
if(count($r) > 1) {
|
||||
logger('item_store: duplicated post occurred. Removing duplicates.');
|
||||
q("DELETE FROM `item` WHERE `uri` = '%s' AND `uid` = %d AND `id` != %d ",
|
||||
$arr['uri'],
|
||||
dbesc($arr['uri']),
|
||||
intval($arr['uid']),
|
||||
intval($current_post)
|
||||
);
|
||||
|
@ -1452,7 +1522,7 @@ function item_store($arr,$force_parent = false, $notify = false) {
|
|||
|
||||
// current post can be deleted if is for a communuty page and no mention are
|
||||
// in it.
|
||||
if (!$deleted) {
|
||||
if (!$deleted AND !$dontcache) {
|
||||
|
||||
// Store the fresh generated item into the cache
|
||||
$cachefile = get_cachefile(urlencode($arr["guid"])."-".hash("md5", $arr['body']));
|
||||
|
@ -1474,7 +1544,7 @@ function item_store($arr,$force_parent = false, $notify = false) {
|
|||
}
|
||||
}
|
||||
|
||||
create_tags_from_item($current_post);
|
||||
create_tags_from_item($current_post, $dontcache);
|
||||
create_files_from_item($current_post);
|
||||
|
||||
if ($notify)
|
||||
|
@ -2651,14 +2721,14 @@ function item_is_remote_self($contact, &$datarray) {
|
|||
$datarray2 = $datarray;
|
||||
logger('remote-self start - Contact '.$contact['url'].' - '.$contact['remote_self'].' Item '.print_r($datarray, true), LOGGER_DEBUG);
|
||||
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']));
|
||||
if (count($r)) {
|
||||
$datarray['contact-id'] = $r[0]["id"];
|
||||
|
||||
$datarray['owner-name'] = $r[0]["name"];
|
||||
$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-link'] = $datarray['owner-link'];
|
||||
|
@ -4037,6 +4107,7 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) {
|
|||
else
|
||||
$body = $item['body'];
|
||||
|
||||
|
||||
$o = "\r\n\r\n<entry>\r\n";
|
||||
|
||||
if(is_array($author))
|
||||
|
@ -4051,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";
|
||||
}
|
||||
|
||||
$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 .= '<title>' . xmlify($item['title']) . '</title>' . "\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 .= '<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";
|
||||
|
||||
|
||||
if($comment)
|
||||
$o .= '<dfrn:comment-allow>' . intval($item['last-child']) . '</dfrn:comment-allow>' . "\r\n";
|
||||
|
||||
|
@ -4475,7 +4555,7 @@ function drop_item($id,$interactive = true) {
|
|||
);
|
||||
create_tags_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
|
||||
|
||||
|
|
|
@ -11,20 +11,22 @@ function lock_function($fn_name, $block = true, $wait_sec = 2, $timeout = 30) {
|
|||
$start = time();
|
||||
|
||||
do {
|
||||
q("LOCK TABLE locks WRITE");
|
||||
$r = q("SELECT locked FROM locks WHERE name = '%s' LIMIT 1",
|
||||
q("LOCK TABLE `locks` WRITE");
|
||||
$r = q("SELECT `locked`, `created` FROM `locks` WHERE `name` = '%s' LIMIT 1",
|
||||
dbesc($fn_name)
|
||||
);
|
||||
|
||||
if((count($r)) && (! $r[0]['locked'])) {
|
||||
q("UPDATE locks SET locked = 1 WHERE name = '%s'",
|
||||
if((count($r)) AND (!$r[0]['locked'] OR (strtotime($r[0]['created']) < time() - 3600))) {
|
||||
q("UPDATE `locks` SET `locked` = 1, `created` = '%s' WHERE `name` = '%s'",
|
||||
dbesc(datetime_convert()),
|
||||
dbesc($fn_name)
|
||||
);
|
||||
$got_lock = true;
|
||||
}
|
||||
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 )",
|
||||
dbesc($fn_name)
|
||||
q("INSERT INTO `locks` (`name`, `created`, `locked`) VALUES ('%s', '%s', 1)",
|
||||
dbesc($fn_name),
|
||||
dbesc(datetime_convert())
|
||||
);
|
||||
$got_lock = true;
|
||||
}
|
||||
|
@ -65,7 +67,7 @@ function block_on_function_lock($fn_name, $wait_sec = 2, $timeout = 30) {
|
|||
|
||||
if(! function_exists('unlock_function')) {
|
||||
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)
|
||||
);
|
||||
|
||||
|
|
|
@ -651,7 +651,7 @@ function validate_email($addr) {
|
|||
return false;
|
||||
$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 false;
|
||||
|
@ -1160,12 +1160,7 @@ function original_url($url, $depth=1, $fetchbody = false) {
|
|||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 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_RETURNTRANSFER, true);
|
||||
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));
|
||||
}
|
||||
|
||||
$pos = strpos($header, "\r\n\r\n");
|
||||
|
||||
if ($pos)
|
||||
$body = trim(substr($header, $pos));
|
||||
else
|
||||
$body = $header;
|
||||
|
||||
if (trim($body) == "")
|
||||
// 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 the file is too large then exit
|
||||
if ($curl_info["download_content_length"] > 1000000)
|
||||
return($url);
|
||||
|
||||
// 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) == "")
|
||||
return($url);
|
||||
|
||||
// Check for redirect in meta elements
|
||||
$doc = new DOMDocument();
|
||||
@$doc->loadHTML($body);
|
||||
|
||||
|
|
|
@ -135,8 +135,7 @@ function notifier_run(&$argv, &$argc){
|
|||
$uid = $suggest[0]['uid'];
|
||||
$recipients[] = $suggest[0]['cid'];
|
||||
$item = $suggest[0];
|
||||
}
|
||||
elseif($cmd === 'removeme') {
|
||||
} elseif($cmd === 'removeme') {
|
||||
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval($item_id));
|
||||
if (! $r)
|
||||
return;
|
||||
|
@ -156,13 +155,11 @@ function notifier_run(&$argv, &$argc){
|
|||
terminate_friendship($user, $self, $contact);
|
||||
}
|
||||
return;
|
||||
}
|
||||
elseif($cmd === 'relocate') {
|
||||
} elseif($cmd === 'relocate') {
|
||||
$normal_mode = false;
|
||||
$relocate = true;
|
||||
$uid = $item_id;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// find ancestors
|
||||
$r = q("SELECT * FROM `item` WHERE `id` = %d and visible = 1 and moderated = 0 LIMIT 1",
|
||||
intval($item_id)
|
||||
|
@ -295,8 +292,28 @@ function notifier_run(&$argv, &$argc){
|
|||
$followup = true;
|
||||
$public_message = false; // not public
|
||||
$conversant_str = dbesc($parent['contact-id']);
|
||||
$recipients = array($parent['contact-id']);
|
||||
|
||||
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"];
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
logger("url_recipients".print_r($url_recipients,true));
|
||||
}
|
||||
} else {
|
||||
$followup = false;
|
||||
|
||||
// don't send deletions onward for other people's stuff
|
||||
|
@ -410,8 +427,7 @@ function notifier_run(&$argv, &$argc){
|
|||
'$content' => xmlify($body),
|
||||
'$parent_id' => xmlify($item['parent-uri'])
|
||||
));
|
||||
}
|
||||
elseif($fsuggest) {
|
||||
} elseif($fsuggest) {
|
||||
$public_message = false; // suggestions are not public
|
||||
|
||||
$sugg_template = get_markup_template('atom_suggest.tpl');
|
||||
|
@ -430,8 +446,7 @@ function notifier_run(&$argv, &$argc){
|
|||
intval($item['id'])
|
||||
);
|
||||
|
||||
}
|
||||
elseif($relocate) {
|
||||
} elseif($relocate) {
|
||||
$public_message = false; // suggestions are not public
|
||||
|
||||
$sugg_template = get_markup_template('atom_relocate.tpl');
|
||||
|
@ -469,8 +484,7 @@ function notifier_run(&$argv, &$argc){
|
|||
));
|
||||
$recipients_relocate = q("SELECT * FROM contact WHERE uid = %d AND self = 0 AND network = '%s'" , intval($uid), NETWORK_DFRN);
|
||||
unset($photos);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if($followup) {
|
||||
foreach($items as $item) { // there is only one item
|
||||
if(! $item['parent'])
|
||||
|
@ -481,8 +495,7 @@ function notifier_run(&$argv, &$argc){
|
|||
$atom .= atom_entry($item,'text',null,$owner,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
foreach($items as $item) {
|
||||
|
||||
if(! $item['parent'])
|
||||
|
@ -506,8 +519,7 @@ function notifier_run(&$argv, &$argc){
|
|||
|
||||
if($item_id == $item['id'] || $item['id'] == $item['parent'])
|
||||
$atom .= atom_entry($item,'text',null,$owner,true);
|
||||
}
|
||||
else
|
||||
} else
|
||||
$atom .= atom_entry($item,'text',null,$owner,true);
|
||||
|
||||
if(($top_level) && ($public_message) && ($item['author-link'] === $item['owner-link']) && (! $expire))
|
||||
|
@ -1001,6 +1013,6 @@ function notifier_run(&$argv, &$argc){
|
|||
|
||||
|
||||
if (array_search(__file__,get_included_files())===0){
|
||||
notifier_run($argv,$argc);
|
||||
notifier_run($_SERVER["argv"],$_SERVER["argc"]);
|
||||
killme();
|
||||
}
|
||||
|
|
|
@ -78,6 +78,11 @@ function oembed_fetch_url($embedurl, $no_rich_type = false){
|
|||
if (!is_object($j))
|
||||
return false;
|
||||
|
||||
// Always embed the SSL version
|
||||
if (isset($j->html))
|
||||
$j->html = str_replace(array("http://www.youtube.com/", "http://player.vimeo.com/"),
|
||||
array("https://www.youtube.com/", "https://player.vimeo.com/"), $j->html);
|
||||
|
||||
$j->embedurl = $embedurl;
|
||||
|
||||
// If fetching information doesn't work, then improve via internal functions
|
||||
|
@ -105,6 +110,8 @@ function oembed_fetch_url($embedurl, $no_rich_type = false){
|
|||
}
|
||||
}
|
||||
|
||||
call_hooks('oembed_fetch_url', $embedurl, $j);
|
||||
|
||||
return $j;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,17 +57,19 @@ function onepoll_run(&$argv, &$argc){
|
|||
return;
|
||||
}
|
||||
|
||||
// Test
|
||||
$lockpath = get_lockpath();
|
||||
if ($lockpath != '') {
|
||||
$pidfile = new pidfile($lockpath, 'onepoll'.$contact_id);
|
||||
if($pidfile->is_already_running()) {
|
||||
if ($pidfile->is_already_running()) {
|
||||
logger("onepoll: Already running for contact ".$contact_id);
|
||||
if ($pidfile->running_time() > 9*60) {
|
||||
$pidfile->kill();
|
||||
logger("killed stale process");
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$d = datetime_convert();
|
||||
|
||||
// Only poll from those with suitable relationships,
|
||||
|
@ -600,6 +602,6 @@ function onepoll_run(&$argv, &$argc){
|
|||
}
|
||||
|
||||
if (array_search(__file__,get_included_files())===0){
|
||||
onepoll_run($argv,$argc);
|
||||
onepoll_run($_SERVER["argv"],$_SERVER["argc"]);
|
||||
killme();
|
||||
}
|
||||
|
|
|
@ -20,12 +20,12 @@ function check_conversations() {
|
|||
if($last) {
|
||||
$next = $last + ($poll_interval * 60);
|
||||
if($next > time()) {
|
||||
logger('complete_conversation: poll interval not reached');
|
||||
logger('poll interval not reached');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
logger('complete_conversation: cron_start');
|
||||
logger('cron_start');
|
||||
|
||||
$start = date("Y-m-d H:i:s", time() - ($poll_timeframe * 60));
|
||||
$conversations = q("SELECT * FROM `term` WHERE `type` = 7 AND `term` > '%s'",
|
||||
|
@ -36,7 +36,7 @@ function check_conversations() {
|
|||
complete_conversation($id, $url);
|
||||
}
|
||||
|
||||
logger('complete_conversation: cron_end');
|
||||
logger(' cron_end');
|
||||
|
||||
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;
|
||||
|
||||
//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));
|
||||
if (!$messages)
|
||||
return;
|
||||
|
@ -90,8 +88,6 @@ function complete_conversation($itemid, $conversation_url, $only_add_conversatio
|
|||
|
||||
do {
|
||||
$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 = json_decode($conv_as);
|
||||
|
||||
|
@ -110,7 +106,7 @@ function complete_conversation($itemid, $conversation_url, $only_add_conversatio
|
|||
$items = array_reverse($items);
|
||||
|
||||
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))
|
||||
$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));
|
||||
if ($new_parents) {
|
||||
$parent = $new_parents[0];
|
||||
logger('complete_conversation: adopting new parent '.$parent["id"].' for '.$itemid);
|
||||
logger('adopting new parent '.$parent["id"].' for '.$itemid);
|
||||
} else {
|
||||
$parent["id"] = 0;
|
||||
$parent["uri"] = $first_id;
|
||||
|
@ -144,6 +140,8 @@ function complete_conversation($itemid, $conversation_url, $only_add_conversatio
|
|||
if ($message_exists) {
|
||||
if ($parent["id"] != 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",
|
||||
intval($parent["id"]),
|
||||
dbesc($parent["uri"]),
|
||||
|
@ -153,12 +151,23 @@ function complete_conversation($itemid, $conversation_url, $only_add_conversatio
|
|||
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["network"] = NETWORK_OSTATUS;
|
||||
$arr["uri"] = $single_conv->id;
|
||||
$arr["plink"] = $single_conv->id;
|
||||
$arr["uid"] = $message["uid"];
|
||||
$arr["contact-id"] = $parent["contact-id"]; // To-Do
|
||||
$arr["contact-id"] = $contact_id;
|
||||
if ($parent["id"] != 0)
|
||||
$arr["parent"] = $parent["id"];
|
||||
$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 ($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",
|
||||
intval($message["uid"]), intval($newitem));
|
||||
if ($new_parents) {
|
||||
$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));*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -285,7 +285,13 @@ function poller_run(&$argv, &$argc){
|
|||
continue;
|
||||
}
|
||||
|
||||
// Don't run onepoll.php if the contact isn't pollable
|
||||
// This check also is inside the onepoll.php - but this will reduce the load
|
||||
if (in_array($contact["rel"], array(CONTACT_IS_SHARING, CONTACT_IS_FRIEND)) AND ($contact["poll"] != "")
|
||||
AND !in_array($contact['network'], array(NETWORK_DIASPORA, NETWORK_FACEBOOK, NETWORK_PUMPIO, NETWORK_TWITTER, NETWORK_APPNET))
|
||||
AND !$contact["self"] AND !$contact["blocked"] AND !$contact["readonly"] AND !$contact["archive"])
|
||||
proc_run('php','include/onepoll.php',$contact['id']);
|
||||
|
||||
if($interval)
|
||||
@time_sleep_until(microtime(true) + (float) $interval);
|
||||
}
|
||||
|
@ -295,6 +301,6 @@ function poller_run(&$argv, &$argc){
|
|||
}
|
||||
|
||||
if (array_search(__file__,get_included_files())===0){
|
||||
poller_run($argv,$argc);
|
||||
poller_run($_SERVER["argv"],$_SERVER["argc"]);
|
||||
killme();
|
||||
}
|
||||
|
|
|
@ -265,6 +265,6 @@ function queue_run(&$argv, &$argc){
|
|||
}
|
||||
|
||||
if (array_search(__file__,get_included_files())===0){
|
||||
queue_run($argv,$argc);
|
||||
queue_run($_SERVER["argv"],$_SERVER["argc"]);
|
||||
killme();
|
||||
}
|
||||
|
|
22
include/shadowupdate.php
Normal file
22
include/shadowupdate.php
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
require_once("boot.php");
|
||||
require_once("include/threads.php");
|
||||
|
||||
global $a, $db;
|
||||
|
||||
if(is_null($a))
|
||||
$a = new App;
|
||||
|
||||
if(is_null($db)) {
|
||||
@include(".htconfig.php");
|
||||
require_once("include/dba.php");
|
||||
$db = new dba($db_host, $db_user, $db_pass, $db_data);
|
||||
unset($db_host, $db_user, $db_pass, $db_data);
|
||||
}
|
||||
|
||||
load_config('config');
|
||||
load_config('system');
|
||||
|
||||
update_shadow_copy();
|
||||
killme();
|
||||
?>
|
|
@ -20,6 +20,9 @@ require_once('include/datetime.php');
|
|||
|
||||
|
||||
function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
|
||||
|
||||
require_once("include/html2bbcode.php");
|
||||
|
||||
$a = get_app();
|
||||
|
||||
if($cid) {
|
||||
|
@ -39,7 +42,7 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
|
|||
if(! $url)
|
||||
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);
|
||||
|
||||
|
@ -67,6 +70,12 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
|
|||
$profile_photo = '';
|
||||
$connect_url = '';
|
||||
$name = '';
|
||||
$network = '';
|
||||
$updated = '0000-00-00 00:00:00';
|
||||
$location = '';
|
||||
$about = '';
|
||||
$keywords = '';
|
||||
$gender = '';
|
||||
|
||||
$name = $entry->displayName;
|
||||
|
||||
|
@ -91,62 +100,157 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
|
|||
}
|
||||
}
|
||||
|
||||
if((! $name) || (! $profile_url) || (! $profile_photo))
|
||||
continue;
|
||||
if(isset($entry->updated))
|
||||
$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))
|
||||
$network = $entry->network;
|
||||
|
||||
if(isset($entry->currentLocation))
|
||||
$location = $entry->currentLocation;
|
||||
|
||||
if(isset($entry->aboutMe))
|
||||
$about = html2bbcode($entry->aboutMe);
|
||||
|
||||
if(isset($entry->gender))
|
||||
$gender = $entry->gender;
|
||||
|
||||
if(isset($entry->tags))
|
||||
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);
|
||||
|
||||
// Update the Friendica contacts. Diaspora is doing it via a message. (See include/diaspora.php)
|
||||
if (($location != "") OR ($about != "") OR ($keywords != "") OR ($gender != ""))
|
||||
q("UPDATE `contact` SET `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s'
|
||||
WHERE `nurl` = '%s' AND NOT `self` AND `network` = '%s'",
|
||||
dbesc($location),
|
||||
dbesc($about),
|
||||
dbesc($keywords),
|
||||
dbesc($gender),
|
||||
dbesc(normalise_link($profile_url)),
|
||||
dbesc(NETWORK_DFRN));
|
||||
}
|
||||
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",
|
||||
intval($cid),
|
||||
intval($uid),
|
||||
intval($zcid)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
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($x[0]['name'] != $name || $x[0]['photo'] != $profile_photo) {
|
||||
q("update gcontact set `name` = '%s', `photo` = '%s', `connect` = '%s', `url` = '%s'
|
||||
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`,`url`,`nurl`,`photo`,`connect`)
|
||||
values ( '%s', '%s', '%s', '%s','%s') ",
|
||||
} 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($connect_url),
|
||||
dbesc($updated),
|
||||
dbesc($location),
|
||||
dbesc($about),
|
||||
dbesc($keywords),
|
||||
dbesc($gender)
|
||||
);
|
||||
$x = q("select * from `gcontact` where `nurl` = '%s' limit 1",
|
||||
$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",
|
||||
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') ",
|
||||
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",
|
||||
} 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),
|
||||
|
@ -155,17 +259,39 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
|
|||
);
|
||||
}
|
||||
|
||||
}
|
||||
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",
|
||||
intval($cid),
|
||||
intval($uid),
|
||||
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) {
|
||||
|
||||
|
@ -289,16 +415,31 @@ function suggestion_query($uid, $start = 0, $limit = 80) {
|
|||
if(! $uid)
|
||||
return array();
|
||||
|
||||
$network = array(NETWORK_DFRN);
|
||||
|
||||
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 )
|
||||
and not gcontact.name in ( select name from contact 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),
|
||||
$sql_network,
|
||||
intval($start),
|
||||
intval($limit)
|
||||
);
|
||||
|
@ -311,17 +452,25 @@ function suggestion_query($uid, $start = 0, $limit = 80) {
|
|||
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.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 ",
|
||||
intval($uid),
|
||||
intval($uid),
|
||||
intval($uid),
|
||||
$sql_network,
|
||||
intval($start),
|
||||
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() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
function create_tags_from_item($itemid) {
|
||||
function create_tags_from_item($itemid, $dontcache = false) {
|
||||
global $a;
|
||||
|
||||
$profile_base = $a->get_baseurl();
|
||||
|
@ -26,6 +26,7 @@ function create_tags_from_item($itemid) {
|
|||
if ($message["deleted"])
|
||||
return;
|
||||
|
||||
if (!$dontcache) {
|
||||
$cachefile = get_cachefile(urlencode($message["guid"])."-".hash("md5", $message['body']));
|
||||
|
||||
if (($cachefile != '') AND !file_exists($cachefile)) {
|
||||
|
@ -35,6 +36,7 @@ function create_tags_from_item($itemid) {
|
|||
$a->save_timestamp($stamp1, "file");
|
||||
logger('create_tags_from_item: put item '.$message["id"].' into cachefile '.$cachefile);
|
||||
}
|
||||
}
|
||||
|
||||
$taglist = explode(",", $message["tag"]);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
require_once("include/template_processor.php");
|
||||
require_once("include/friendica_smarty.php");
|
||||
require_once("mod/proxy.php");
|
||||
|
||||
if(! function_exists('replace_macros')) {
|
||||
/**
|
||||
|
@ -275,17 +276,17 @@ function paginate_data(&$a, $count=null) {
|
|||
$stripped = trim($stripped,'/');
|
||||
$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);
|
||||
if (!strpos($stripped, "?")) {
|
||||
if ($pos = strpos($stripped, "&"))
|
||||
$stripped = substr($stripped, 0, $pos)."?".substr($stripped, $pos + 1);
|
||||
}
|
||||
|
||||
$url = $a->get_baseurl() . '/' . $stripped;
|
||||
|
||||
$data = array();
|
||||
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);
|
||||
}
|
||||
|
@ -928,7 +929,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
|
|||
. (($click) ? ' fakelink' : '') . '" '
|
||||
. (($redir) ? ' target="redir" ' : '')
|
||||
. (($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";
|
||||
}
|
||||
}}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
function add_thread($itemid) {
|
||||
function add_thread($itemid, $onlyshadow = false) {
|
||||
$items = q("SELECT `uid`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`, `moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`,
|
||||
`deleted`, `origin`, `forum_mode`, `mention`, `network` FROM `item` WHERE `id` = %d AND (`parent` = %d OR `parent` = 0) LIMIT 1", intval($itemid), intval($itemid));
|
||||
|
||||
|
@ -9,13 +9,71 @@ function add_thread($itemid) {
|
|||
$item = $items[0];
|
||||
$item['iid'] = $itemid;
|
||||
|
||||
if (!$onlyshadow) {
|
||||
$result = dbq("INSERT INTO `thread` (`"
|
||||
.implode("`, `", array_keys($item))
|
||||
."`) VALUES ('"
|
||||
.implode("', '", array_values($item))
|
||||
."')" );
|
||||
."')");
|
||||
|
||||
logger("add_thread: Add thread for item ".$itemid." - ".print_r($result, true), LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
// Store a shadow copy of public items for displaying a global community page?
|
||||
if (!get_config('system', 'global_community'))
|
||||
return;
|
||||
|
||||
// is it already a copy?
|
||||
if (($itemid == 0) OR ($item['uid'] == 0))
|
||||
return;
|
||||
|
||||
// Is it a visible public post?
|
||||
if (!$item["visible"] OR $item["deleted"] OR $item["moderated"] OR $item["private"])
|
||||
return;
|
||||
|
||||
// is it an entry from a connector? Only add an entry for natively connected networks
|
||||
if (!in_array($item["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, "")))
|
||||
return;
|
||||
|
||||
// Only do these checks if the post isn't a wall post
|
||||
if (!$item["wall"]) {
|
||||
// Check, if hide-friends is activated - then don't do a shadow entry
|
||||
$r = q("SELECT `hide-friends` FROM `profile` WHERE `is-default` AND `uid` = %d AND NOT `hide-friends`",
|
||||
$item['uid']);
|
||||
if (!count($r))
|
||||
return;
|
||||
// Check if the contact is hidden or blocked
|
||||
$r = q("SELECT `id` FROM `contact` WHERE NOT `hidden` AND NOT `blocked` AND `id` = %d",
|
||||
$item['contact-id']);
|
||||
if (!count($r))
|
||||
return;
|
||||
}
|
||||
|
||||
// Only add a shadow, if the profile isn't hidden
|
||||
$r = q("SELECT `uid` FROM `user` where `uid` = %d AND NOT `hidewall`", $item['uid']);
|
||||
if (!count($r))
|
||||
return;
|
||||
|
||||
$item = q("SELECT * FROM `item` WHERE `id` = %d",
|
||||
intval($itemid));
|
||||
|
||||
if (count($item) AND ($item[0]["allow_cid"] == '') AND ($item[0]["allow_gid"] == '') AND
|
||||
($item[0]["deny_cid"] == '') AND ($item[0]["deny_gid"] == '')) {
|
||||
|
||||
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = 0 LIMIT 1",
|
||||
dbesc($item['uri']));
|
||||
|
||||
if (!$r) {
|
||||
// Preparing public shadow (removing user specific data)
|
||||
require_once("include/items.php");
|
||||
unset($item[0]['id']);
|
||||
$item[0]['uid'] = 0;
|
||||
$item[0]['contact-id'] = 0;
|
||||
$public_shadow = item_store($item[0], false, false, true);
|
||||
|
||||
logger("add_thread: Stored public shadow for post ".$itemid." under id ".$public_shadow, LOGGER_DEBUG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function update_thread_uri($itemuri, $uid) {
|
||||
|
@ -27,7 +85,7 @@ function update_thread_uri($itemuri, $uid) {
|
|||
}
|
||||
|
||||
function update_thread($itemid, $setmention = false) {
|
||||
$items = q("SELECT `uid`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`, `moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`,
|
||||
$items = q("SELECT `uid`, `uri`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`, `moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`,
|
||||
`deleted`, `origin`, `forum_mode`, `network` FROM `item` WHERE `id` = %d AND (`parent` = %d OR `parent` = 0) LIMIT 1", intval($itemid), intval($itemid));
|
||||
|
||||
if (!$items)
|
||||
|
@ -40,16 +98,50 @@ function update_thread($itemid, $setmention = false) {
|
|||
|
||||
$sql = "";
|
||||
|
||||
foreach ($item AS $field => $data) {
|
||||
foreach ($item AS $field => $data)
|
||||
if ($field != "uri") {
|
||||
if ($sql != "")
|
||||
$sql .= ", ";
|
||||
|
||||
$sql .= "`".$field."` = '".$data."'";
|
||||
$sql .= "`".$field."` = '".dbesc($data)."'";
|
||||
}
|
||||
|
||||
$result = q("UPDATE `thread` SET ".$sql." WHERE `iid` = %d", $itemid);
|
||||
$result = q("UPDATE `thread` SET ".$sql." WHERE `iid` = %d", intval($itemid));
|
||||
|
||||
logger("update_thread: Update thread for item ".$itemid." - ".print_r($result, true)." ".print_r($item, true), LOGGER_DEBUG);
|
||||
|
||||
// Updating a shadow item entry
|
||||
$items = q("SELECT `id`, `title`, `body`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`,
|
||||
`moderated`, `visible`, `spam`, `starred`, `bookmark`, `deleted`, `origin`, `forum_mode`, `network`
|
||||
FROM `item` WHERE `uri` = '%s' AND `uid` = 0 LIMIT 1", dbesc($item["uri"]));
|
||||
|
||||
if (!$items)
|
||||
return;
|
||||
|
||||
$item = $items[0];
|
||||
|
||||
$result = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `network` = '%s' WHERE `id` = %d",
|
||||
dbesc($item["title"]),
|
||||
dbesc($item["body"]),
|
||||
dbesc($item["network"]),
|
||||
intval($item["id"])
|
||||
);
|
||||
logger("update_thread: Updating public shadow for post ".$item["id"]." Result: ".print_r($result, true), LOGGER_DEBUG);
|
||||
|
||||
/*
|
||||
$sql = "";
|
||||
|
||||
foreach ($item AS $field => $data)
|
||||
if ($field != "id") {
|
||||
if ($sql != "")
|
||||
$sql .= ", ";
|
||||
|
||||
$sql .= "`".$field."` = '".dbesc($data)."'";
|
||||
}
|
||||
//logger("update_thread: Updating public shadow for post ".$item["id"]." SQL: ".$sql, LOGGER_DEBUG);
|
||||
$result = q("UPDATE `item` SET ".$sql." WHERE `id` = %d", intval($item["id"]));
|
||||
logger("update_thread: Updating public shadow for post ".$item["id"]." Result: ".print_r($result, true), LOGGER_DEBUG);
|
||||
*/
|
||||
}
|
||||
|
||||
function delete_thread_uri($itemuri, $uid) {
|
||||
|
@ -57,13 +149,28 @@ function delete_thread_uri($itemuri, $uid) {
|
|||
|
||||
if(count($messages))
|
||||
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 `uid` 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);
|
||||
|
||||
if ($itemuri != "") {
|
||||
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND NOT (`uid` IN (%d, 0))",
|
||||
dbesc($itemuri),
|
||||
intval($item["uid"])
|
||||
);
|
||||
if (!count($r)) {
|
||||
$r = q("DELETE FROM `item` WHERE `uri` = '%s' AND `uid` = 0)",
|
||||
dbesc($itemuri)
|
||||
);
|
||||
logger("delete_thread: Deleted shadow for item ".$itemuri." - ".print_r($result, true), LOGGER_DEBUG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function update_threads() {
|
||||
|
@ -96,4 +203,21 @@ function update_threads_mention() {
|
|||
q("UPDATE `thread` SET `mention` = 1 WHERE `iid` = %d", $parent["parent"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function update_shadow_copy() {
|
||||
global $db;
|
||||
|
||||
logger("start");
|
||||
|
||||
$messages = $db->q(sprintf("SELECT `iid` FROM `thread` WHERE `uid` != 0 AND `network` IN ('', '%s', '%s', '%s')
|
||||
AND `visible` AND NOT `deleted` AND NOT `moderated` AND NOT `private` ORDER BY `created`",
|
||||
NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS), true);
|
||||
|
||||
logger("fetched messages: ".count($messages));
|
||||
while ($message = $db->qfetch())
|
||||
add_thread($message["iid"], true);
|
||||
|
||||
$db->qclose();
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -20,7 +20,12 @@ class HTML5_Parser
|
|||
|
||||
// Cleanup invalid HTML
|
||||
$doc = new DOMDocument();
|
||||
|
||||
if (mb_detect_encoding($text, "UTF-8", true) == "UTF-8")
|
||||
@$doc->loadHTML('<?xml encoding="UTF-8" ?>'.$text);
|
||||
else
|
||||
@$doc->loadHTML($text);
|
||||
|
||||
$text = $doc->saveHTML();
|
||||
|
||||
$tokenizer = new HTML5_Tokenizer($text, $builder);
|
||||
|
|
|
@ -1000,7 +1000,7 @@ function admin_page_users(&$a){
|
|||
'$users' => $users,
|
||||
'$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.")),
|
||||
'$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);
|
||||
return $o;
|
||||
|
|
46
mod/bookmarklet.php
Normal file
46
mod/bookmarklet.php
Normal 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;
|
||||
}
|
|
@ -114,6 +114,10 @@ function community_content(&$a, $update = 0) {
|
|||
}
|
||||
|
||||
function community_getitems($start, $itemspage) {
|
||||
// Work in progress
|
||||
if (get_config('system', 'global_community'))
|
||||
return(community_getpublicitems($start, $itemspage));
|
||||
|
||||
$r = q("SELECT `item`.`uri`, `item`.*, `item`.`id` AS `item_id`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
|
||||
|
@ -136,3 +140,19 @@ function community_getitems($start, $itemspage) {
|
|||
return($r);
|
||||
|
||||
}
|
||||
|
||||
function community_getpublicitems($start, $itemspage) {
|
||||
$r = q("SELECT `item`.`uri`, `item`.*, `item`.`id` AS `item_id`,
|
||||
`author-name` AS `name`, `owner-avatar` AS `photo`,
|
||||
`owner-link` AS `url`, `owner-avatar` AS `thumb`
|
||||
FROM `item` WHERE `item`.`uid` = 0
|
||||
AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
|
||||
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
|
||||
ORDER BY `item`.`received` DESC LIMIT %d, %d",
|
||||
intval($start),
|
||||
intval($itemspage)
|
||||
);
|
||||
|
||||
return($r);
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
require_once('include/Contact.php');
|
||||
require_once('include/socgraph.php');
|
||||
require_once('include/contact_selectors.php');
|
||||
require_once('mod/proxy.php');
|
||||
|
||||
function contacts_init(&$a) {
|
||||
if(! local_user())
|
||||
|
@ -419,7 +420,7 @@ function contacts_content(&$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')
|
||||
$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') : '');
|
||||
|
||||
|
@ -681,7 +682,7 @@ function contacts_content(&$a) {
|
|||
'id' => $rr['id'],
|
||||
'alt_text' => $alt_text,
|
||||
'dir_icon' => $dir_icon,
|
||||
'thumb' => $rr['thumb'],
|
||||
'thumb' => proxy_url($rr['thumb']),
|
||||
'name' => $rr['name'],
|
||||
'username' => $rr['name'],
|
||||
'sparkle' => $sparkle,
|
||||
|
|
|
@ -16,7 +16,7 @@ function display_init(&$a) {
|
|||
|
||||
// Does the local user have this item?
|
||||
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
|
||||
AND `guid` = '%s' AND `uid` = %d", $a->argv[1], local_user());
|
||||
if (count($r)) {
|
||||
|
@ -43,7 +43,7 @@ function display_init(&$a) {
|
|||
}
|
||||
if (count($r)) {
|
||||
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
|
||||
AND `id` = %d", $r[0]["parent"]);
|
||||
|
||||
|
@ -89,23 +89,28 @@ function display_fetchauthor($a, $item) {
|
|||
$profiledata["url"] = $item["author-link"];
|
||||
$profiledata["network"] = $item["network"];
|
||||
|
||||
// Fetching profile data from unique contacts
|
||||
// To-do: Extend "unique contacts" table for further contact data like location, ...
|
||||
$r = q("SELECT `avatar`, `nick` FROM `unique_contacts` WHERE `url` = '%s'", normalise_link($profiledata["url"]));
|
||||
if (count($r)) {
|
||||
$profiledata["photo"] = proxy_url($r[0]["avatar"]);
|
||||
if ($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"
|
||||
$r = q("SELECT `photo`, `nick` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d",
|
||||
normalise_link($profiledata["url"]), $itemuid);
|
||||
// Fetching further contact data from the contact table
|
||||
$r = q("SELECT `photo`, `nick`, `location`, `about` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d",
|
||||
normalise_link($profiledata["url"]), $item["uid"]);
|
||||
if (count($r)) {
|
||||
$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"] != "")
|
||||
$profiledata["nickname"] = $r[0]["nick"];
|
||||
}
|
||||
|
||||
// Fetching profile data from unique contacts
|
||||
$r = q("SELECT `avatar`, `nick`, `location`, `about` FROM `unique_contacts` WHERE `url` = '%s'", normalise_link($profiledata["url"]));
|
||||
if (count($r)) {
|
||||
if ($profiledata["photo"] == "")
|
||||
$profiledata["photo"] = proxy_url($r[0]["avatar"]);
|
||||
if ($profiledata["address"] == "")
|
||||
$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
|
||||
|
@ -158,6 +163,21 @@ function display_fetchauthor($a, $item) {
|
|||
|
||||
$profiledata["nickname"] = $profiledata["name"];
|
||||
$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()) {
|
||||
|
|
|
@ -231,11 +231,11 @@ function install_content(&$a) {
|
|||
|
||||
'$status' => $wizard_status,
|
||||
|
||||
'$dbhost' => array('dbhost', t('Database Server Name'), $dbhost, ''),
|
||||
'$dbuser' => array('dbuser', t('Database Login Name'), $dbuser, ''),
|
||||
'$dbpass' => array('dbpass', t('Database Login Password'), $dbpass, ''),
|
||||
'$dbdata' => array('dbdata', t('Database Name'), $dbdata, ''),
|
||||
'$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.')),
|
||||
'$dbhost' => array('dbhost', t('Database Server Name'), $dbhost, '', 'required'),
|
||||
'$dbuser' => array('dbuser', t('Database Login Name'), $dbuser, '', 'required', 'autofocus'),
|
||||
'$dbpass' => array('dbpass', t('Database Login Password'), $dbpass, '', 'required'),
|
||||
'$dbdata' => array('dbdata', t('Database Name'), $dbdata, '', 'required'),
|
||||
'$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.'), 'required', 'autofocus', 'email'),
|
||||
|
||||
|
||||
|
||||
|
@ -274,7 +274,7 @@ function install_content(&$a) {
|
|||
'$dbdata' => $dbdata,
|
||||
'$phpath' => $phpath,
|
||||
|
||||
'$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.')),
|
||||
'$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.'), 'required', 'autofocus', 'email'),
|
||||
|
||||
|
||||
'$timezone' => field_timezone('timezone', t('Please select a default timezone for your website'), $timezone, ''),
|
||||
|
|
25
mod/item.php
25
mod/item.php
|
@ -90,14 +90,14 @@ function item_post(&$a) {
|
|||
$r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1",
|
||||
intval($parent)
|
||||
);
|
||||
}
|
||||
elseif($parent_uri && local_user()) {
|
||||
} elseif($parent_uri && local_user()) {
|
||||
// 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",
|
||||
dbesc($parent_uri),
|
||||
intval(local_user())
|
||||
);
|
||||
}
|
||||
|
||||
// if this isn't the real parent of the conversation, find it
|
||||
if($r !== false && count($r)) {
|
||||
$parid = $r[0]['parent'];
|
||||
|
@ -127,8 +127,27 @@ function item_post(&$a) {
|
|||
intval($parent_item['contact-id']),
|
||||
intval($uid)
|
||||
);
|
||||
if(count($r))
|
||||
if(count($r)) {
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -369,7 +369,7 @@ function network_content(&$a, $update = 0) {
|
|||
if(feature_enabled(local_user(),'personal_tab')) {
|
||||
$tabs[] = array(
|
||||
'label' => t('Personal'),
|
||||
'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&conv=1',
|
||||
'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&conv=1',
|
||||
'sel' => $conv_active,
|
||||
'title' => t('Posts that mention or involve you'),
|
||||
);
|
||||
|
@ -387,7 +387,7 @@ function network_content(&$a, $update = 0) {
|
|||
if(feature_enabled(local_user(),'link_tab')) {
|
||||
$tabs[] = array(
|
||||
'label' => t('Shared Links'),
|
||||
'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&bmark=1',
|
||||
'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&bmark=1',
|
||||
'sel'=>$bookmarked_active,
|
||||
'title'=> t('Interesting Links'),
|
||||
);
|
||||
|
@ -396,7 +396,7 @@ function network_content(&$a, $update = 0) {
|
|||
if(feature_enabled(local_user(),'star_posts')) {
|
||||
$tabs[] = array(
|
||||
'label' => t('Starred'),
|
||||
'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&star=1',
|
||||
'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&star=1',
|
||||
'sel'=>$starred_active,
|
||||
'title' => t('Favourite Posts'),
|
||||
);
|
||||
|
|
|
@ -20,6 +20,7 @@ function oembed_content(&$a){
|
|||
echo "<html><body>";
|
||||
$url = base64url_decode($a->argv[1]);
|
||||
$j = oembed_fetch_url($url);
|
||||
|
||||
echo $j->html;
|
||||
// logger('mod-oembed ' . $j->html, LOGGER_ALL);
|
||||
echo "</body></html>";
|
||||
|
|
|
@ -73,7 +73,7 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co
|
|||
$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_NOBODY, 1);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
//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;
|
||||
}
|
||||
|
||||
// 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
|
||||
$charset = "";
|
||||
if (preg_match('/charset=(.*?)['."'".'"\s\n]/', $header, $matches))
|
||||
|
|
|
@ -1183,8 +1183,6 @@ function photos_content(&$a) {
|
|||
intval($a->pager['itemspage'])
|
||||
);
|
||||
|
||||
$o .= '<h3 id="photo-album-title">' . $album . '</h3>';
|
||||
|
||||
if($cmd === 'edit') {
|
||||
if(($album !== t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) {
|
||||
if($can_post) {
|
||||
|
@ -1211,25 +1209,18 @@ function photos_content(&$a) {
|
|||
else {
|
||||
if(($album !== t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) {
|
||||
if($can_post) {
|
||||
$o .= '<div id="album-edit-link"><a href="'. $a->get_baseurl() . '/photos/'
|
||||
. $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '/edit' . '">'
|
||||
. t('Edit Album') . '</a></div>';
|
||||
$edit = array(t('Edit Album'), $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '/edit');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($_GET['order'] === 'posted')
|
||||
$o .= '<div class="photos-upload-link" ><a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '" >' . t('Show Newest First') . '</a></div>';
|
||||
$order = array(t('Show Newest First'), $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album));
|
||||
else
|
||||
$o .= '<div class="photos-upload-link" ><a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '?f=&order=posted" >' . t('Show Oldest First') . '</a></div>';
|
||||
$order = array(t('Show Oldest First'), $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '?f=&order=posted');
|
||||
|
||||
$photos = array();
|
||||
|
||||
if($can_post) {
|
||||
$o .= '<div class="photos-upload-link" ><a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/upload/' . bin2hex($album) . '" >' . t('Upload New Photos') . '</a></div>';
|
||||
}
|
||||
|
||||
|
||||
$tpl = get_markup_template('photo_album.tpl');
|
||||
if(count($r))
|
||||
$twist = 'rotright';
|
||||
foreach($r as $rr) {
|
||||
|
@ -1249,19 +1240,30 @@ function photos_content(&$a) {
|
|||
$desc_e = $rr['desc'];
|
||||
}
|
||||
|
||||
$o .= replace_macros($tpl,array(
|
||||
'$id' => $rr['id'],
|
||||
'$twist' => ' ' . $twist . rand(2,4),
|
||||
'$photolink' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id']
|
||||
$photos[] = array(
|
||||
'id' => $rr['id'],
|
||||
'twist' => ' ' . $twist . rand(2,4),
|
||||
'link' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id']
|
||||
. (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''),
|
||||
'$phototitle' => t('View Photo'),
|
||||
'$imgsrc' => $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] . '.' .$ext,
|
||||
'$imgalt' => $imgalt_e,
|
||||
'$desc'=> $desc_e
|
||||
'title' => t('View Photo'),
|
||||
'src' => $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] . '.' .$ext,
|
||||
'alt' => $imgalt_e,
|
||||
'desc'=> $desc_e,
|
||||
'ext' => $ext,
|
||||
'hash'=> $rr['resource_id'],
|
||||
);
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('photo_album.tpl');
|
||||
$o .= replace_macros($tpl, array(
|
||||
'$photos' => $photos,
|
||||
'$album' => $album,
|
||||
'$can_post' => $can_post,
|
||||
'$upload' => array(t('Upload New Photos'), $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/upload/' . bin2hex($album)),
|
||||
'$order' => $order,
|
||||
'$edit' => $edit
|
||||
));
|
||||
|
||||
}
|
||||
$o .= '<div id="photo-album-end"></div>';
|
||||
$o .= paginate($a);
|
||||
|
||||
return $o;
|
||||
|
|
154
mod/poco.php
154
mod/poco.php
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
function poco_init(&$a) {
|
||||
require_once("include/bbcode.php");
|
||||
|
||||
$system_mode = false;
|
||||
|
||||
|
@ -12,7 +13,7 @@ function poco_init(&$a) {
|
|||
$user = notags(trim($a->argv[1]));
|
||||
}
|
||||
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))
|
||||
http_status_exit(401);
|
||||
$system_mode = true;
|
||||
|
@ -21,7 +22,12 @@ function poco_init(&$a) {
|
|||
$format = (($_GET['format']) ? $_GET['format'] : 'json');
|
||||
|
||||
$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')
|
||||
$justme = true;
|
||||
if($a->argc > 3 && $a->argv[3] === '@all')
|
||||
|
@ -32,7 +38,7 @@ function poco_init(&$a) {
|
|||
$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`
|
||||
where `user`.`nickname` = '%s' and `profile`.`is-default` = 1 limit 1",
|
||||
dbesc($user)
|
||||
|
@ -44,21 +50,37 @@ function poco_init(&$a) {
|
|||
}
|
||||
|
||||
if($justme)
|
||||
$sql_extra = " and `contact`.`self` = 1 ";
|
||||
else
|
||||
$sql_extra = " and `contact`.`self` = 0 ";
|
||||
$sql_extra = " AND `contact`.`self` = 1 ";
|
||||
// else
|
||||
// $sql_extra = " AND `contact`.`self` = 0 ";
|
||||
|
||||
if($cid)
|
||||
$sql_extra = sprintf(" and `contact`.`id` = %d ",intval($cid));
|
||||
$sql_extra = sprintf(" AND `contact`.`id` = %d ",intval($cid));
|
||||
|
||||
if($system_mode) {
|
||||
$r = q("SELECT count(*) as `total` from `contact` where self = 1
|
||||
and uid in (select uid from pconfig where cat = 'system' and k = 'suggestme' and v = 1) ");
|
||||
}
|
||||
else {
|
||||
$r = q("SELECT count(*) as `total` from `contact` where `uid` = %d and blocked = 0 and pending = 0 and hidden = 0 and archive = 0
|
||||
$sql_extra ",
|
||||
intval($user['uid'])
|
||||
if(x($_GET,'updatedSince'))
|
||||
$update_limit = date("Y-m-d H:i:s",strtotime($_GET['updatedSince']));
|
||||
|
||||
if ($global) {
|
||||
$r = q("SELECT count(*) AS `total` FROM `gcontact` WHERE `updated` >= '%s' AND `network` IN ('%s')",
|
||||
dbesc($update_limit),
|
||||
dbesc(NETWORK_DFRN)
|
||||
);
|
||||
} 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))
|
||||
|
@ -72,29 +94,45 @@ function poco_init(&$a) {
|
|||
$itemsPerPage = ((x($_GET,'count') && intval($_GET['count'])) ? intval($_GET['count']) : $totalResults);
|
||||
|
||||
|
||||
if($system_mode) {
|
||||
$r = q("SELECT * from contact where self = 1
|
||||
and uid in (select uid from pconfig where cat = 'system' and k = 'suggestme' and v = 1) limit %d, %d ",
|
||||
if ($global) {
|
||||
$r = q("SELECT * FROM `gcontact` WHERE `updated` > '%s' AND `network` IN ('%s') LIMIT %d, %d",
|
||||
dbesc($update_limit),
|
||||
dbesc(NETWORK_DFRN),
|
||||
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
|
||||
$sql_extra LIMIT %d, %d",
|
||||
} elseif($system_mode) {
|
||||
$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`
|
||||
WHERE `self` = 1 AND `network` IN ('%s', '%s', '%s', '%s', '') AND `profile`.`is-default`
|
||||
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']),
|
||||
dbesc(NETWORK_DFRN),
|
||||
dbesc(NETWORK_DIASPORA),
|
||||
dbesc(NETWORK_OSTATUS),
|
||||
dbesc(NETWORK_STATUSNET),
|
||||
intval($startIndex),
|
||||
intval($itemsPerPage)
|
||||
);
|
||||
}
|
||||
|
||||
$ret = array();
|
||||
if(x($_GET,'sorted'))
|
||||
$ret['sorted'] = 'false';
|
||||
$ret['sorted'] = false;
|
||||
if(x($_GET,'filtered'))
|
||||
$ret['filtered'] = 'false';
|
||||
if(x($_GET,'updatedSince'))
|
||||
$ret['updateSince'] = 'false';
|
||||
$ret['filtered'] = false;
|
||||
if(x($_GET,'updatedSince') AND !$global)
|
||||
$ret['updatedSince'] = false;
|
||||
|
||||
$ret['startIndex'] = (string) $startIndex;
|
||||
$ret['itemsPerPage'] = (string) $itemsPerPage;
|
||||
|
@ -106,8 +144,14 @@ function poco_init(&$a) {
|
|||
'id' => false,
|
||||
'displayName' => false,
|
||||
'urls' => false,
|
||||
'updated' => false,
|
||||
'preferredUsername' => false,
|
||||
'photos' => false
|
||||
'photos' => false,
|
||||
'aboutMe' => false,
|
||||
'currentLocation' => false,
|
||||
'network' => false,
|
||||
'gender' => false,
|
||||
'tags' => false
|
||||
);
|
||||
|
||||
if((! x($_GET,'fields')) || ($_GET['fields'] === '@all'))
|
||||
|
@ -122,11 +166,29 @@ function poco_init(&$a) {
|
|||
if(is_array($r)) {
|
||||
if(count($r)) {
|
||||
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();
|
||||
if($fields_ret['id'])
|
||||
$entry['id'] = $rr['id'];
|
||||
if($fields_ret['displayName'])
|
||||
$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']) {
|
||||
$entry['urls'] = array(array('value' => $rr['url'], 'type' => 'profile'));
|
||||
if($rr['addr'] && ($rr['network'] !== NETWORK_MAIL))
|
||||
|
@ -134,8 +196,46 @@ function poco_init(&$a) {
|
|||
}
|
||||
if($fields_ret['preferredUsername'])
|
||||
$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'])
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,6 +142,23 @@ function profiles_init(&$a) {
|
|||
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
if(! local_user()) {
|
||||
|
@ -212,8 +229,8 @@ function profiles_post(&$a) {
|
|||
$region = notags(trim($_POST['region']));
|
||||
$postal_code = notags(trim($_POST['postal_code']));
|
||||
$country_name = notags(trim($_POST['country_name']));
|
||||
$pub_keywords = notags(trim($_POST['pub_keywords']));
|
||||
$prv_keywords = notags(trim($_POST['prv_keywords']));
|
||||
$pub_keywords = profile_clean_keywords(notags(trim($_POST['pub_keywords'])));
|
||||
$prv_keywords = profile_clean_keywords(notags(trim($_POST['prv_keywords'])));
|
||||
$marital = notags(trim($_POST['marital']));
|
||||
$howlong = notags(trim($_POST['howlong']));
|
||||
|
||||
|
@ -468,6 +485,15 @@ function profiles_post(&$a) {
|
|||
}
|
||||
|
||||
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
|
||||
$url = $_SESSION['my_url'];
|
||||
if($url && strlen(get_config('system','directory_submit_url')))
|
||||
|
|
|
@ -223,7 +223,3 @@ function salmon_post(&$a) {
|
|||
|
||||
http_status_exit(200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -395,6 +395,8 @@ function settings_post(&$a) {
|
|||
$post_joingroup = (($_POST['post_joingroup'] == 1) ? 1: 0);
|
||||
$post_profilechange = (($_POST['post_profilechange'] == 1) ? 1: 0);
|
||||
|
||||
$email_textonly = (($_POST['email_textonly'] == 1) ? 1 : 0);
|
||||
|
||||
$notify = 0;
|
||||
|
||||
if(x($_POST,'notify1'))
|
||||
|
@ -495,6 +497,7 @@ function settings_post(&$a) {
|
|||
set_pconfig(local_user(),'system','post_joingroup', $post_joingroup);
|
||||
set_pconfig(local_user(),'system','post_profilechange', $post_profilechange);
|
||||
|
||||
set_pconfig(local_user(),'system','email_textonly', $email_textonly);
|
||||
|
||||
if($page_flags == PAGE_PRVGROUP) {
|
||||
$hidewall = 1;
|
||||
|
@ -1022,7 +1025,7 @@ function settings_content(&$a) {
|
|||
));
|
||||
|
||||
$hide_wall = replace_macros($opt_tpl,array(
|
||||
'$field' => array('hidewall', t('Hide your profile details from unknown viewers?'), $a->user['hidewall'], '', array(t('No'),t('Yes'))),
|
||||
'$field' => array('hidewall', t('Hide your profile details from unknown viewers?'), $a->user['hidewall'], t("If enabled, posting public messages to Diaspora and other networks isn't possible."), array(t('No'),t('Yes'))),
|
||||
|
||||
));
|
||||
|
||||
|
@ -1123,7 +1126,7 @@ function settings_content(&$a) {
|
|||
|
||||
'$h_basic' => t('Basic Settings'),
|
||||
'$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), ''),
|
||||
'$defloc' => array('defloc', t('Default Post Location:'), $defloc, ''),
|
||||
'$allowloc' => array('allow_location', t('Use Browser Location:'), ($a->user['allow_location'] == 1), ''),
|
||||
|
@ -1179,6 +1182,9 @@ function settings_content(&$a) {
|
|||
'$notify7' => array('notify7', t('You are tagged in a post'), ($notify & NOTIFY_TAGSELF), NOTIFY_TAGSELF, ''),
|
||||
'$notify8' => array('notify8', t('You are poked/prodded/etc. in a post'), ($notify & NOTIFY_POKE), NOTIFY_POKE, ''),
|
||||
|
||||
'$email_textonly' => array('email_textonly', t('Text-only notification emails'),
|
||||
get_pconfig(local_user(),'system','email_textonly'),
|
||||
t('Send text only notification emails, without the html part')),
|
||||
|
||||
'$h_advn' => t('Advanced Account/Page Type Settings'),
|
||||
'$h_descadvn' => t('Change the behaviour of this account for special situations'),
|
||||
|
|
|
@ -51,6 +51,8 @@ function suggest_init(&$a) {
|
|||
|
||||
function suggest_content(&$a) {
|
||||
|
||||
require_once("mod/proxy.php");
|
||||
|
||||
$o = '';
|
||||
if(! local_user()) {
|
||||
notice( t('Permission denied.') . EOL);
|
||||
|
@ -82,7 +84,7 @@ function suggest_content(&$a) {
|
|||
$o .= replace_macros($tpl,array(
|
||||
'$url' => zrl($rr['url']),
|
||||
'$name' => $rr['name'],
|
||||
'$photo' => $rr['photo'],
|
||||
'$photo' => proxy_url($rr['photo']),
|
||||
'$ignlnk' => $a->get_baseurl() . '/suggest?ignore=' . $rr['id'],
|
||||
'$ignid' => $rr['id'],
|
||||
'$conntxt' => t('Connect'),
|
||||
|
|
|
@ -13,6 +13,8 @@ function viewcontacts_init(&$a) {
|
|||
|
||||
function viewcontacts_content(&$a) {
|
||||
|
||||
require_once("mod/proxy.php");
|
||||
|
||||
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
|
||||
notice( t('Public access denied.') . EOL);
|
||||
return;
|
||||
|
@ -60,7 +62,7 @@ function viewcontacts_content(&$a) {
|
|||
$contacts[] = array(
|
||||
'id' => $rr['id'],
|
||||
'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),
|
||||
'username' => $rr['name'],
|
||||
'url' => $url,
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
|
||||
if(($argc > 1) && isset($argv[1]))
|
||||
echo $argv[1];
|
||||
if(($_SERVER["argc"] > 1) && isset($_SERVER["argv"][1]))
|
||||
echo $_SERVER["argv"][1];
|
||||
else
|
||||
echo '';
|
||||
|
|
23
update.php
23
update.php
|
@ -1,6 +1,6 @@
|
|||
<?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.
|
||||
*/
|
||||
|
||||
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"])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,11 +82,11 @@ Xgettext and .po workflow
|
|||
This script runs xgettext on source tree, extracting strings from t() and tt()
|
||||
functions, and creates a util/messages.po file.
|
||||
|
||||
% cd util; ./run_xgettext.sh ../view/{language}/messages.po
|
||||
|
||||
Replace {language} with the language you are working on - e.g. 'es', 'fr', 'de', etc.
|
||||
$ cd util; ./run_xgettext.sh
|
||||
|
||||
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
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
11254
util/messages.po
11254
util/messages.po
File diff suppressed because it is too large
Load diff
|
@ -124,5 +124,5 @@ function po2php_run(&$argv, &$argc) {
|
|||
}
|
||||
|
||||
if (array_search(__file__,get_included_files())===0){
|
||||
po2php_run($argv,$argc);
|
||||
po2php_run($_SERVER["argv"],$_SERVER["argc"]);
|
||||
}
|
||||
|
|
|
@ -30,18 +30,6 @@ F9KVERSION=$(sed -n "s/.*'FRIENDICA_VERSION'.*'\([0-9.]*\)'.*/\1/p" ../../boot.p
|
|||
|
||||
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"
|
||||
|
||||
echo "extract strings to $OUTFILE.."
|
||||
|
@ -50,7 +38,7 @@ for f in $(find "$FINDSTARTDIR" $FINDOPTS -name "*.php" -type f)
|
|||
do
|
||||
if [ ! -d "$f" ]
|
||||
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"
|
||||
fi
|
||||
done
|
||||
|
@ -75,4 +63,11 @@ else
|
|||
sed -i "s/^\"Plural-Forms.*$//g" "$OUTFILE"
|
||||
fi
|
||||
|
||||
if [ "" != "$1" -a "$ADDONMODE" == "" ]
|
||||
then
|
||||
UPDATEFILE="$(readlink -f ${FULLPATH}/$1)"
|
||||
echo "merging new strings to $UPDATEFILE.."
|
||||
msgmerge -U $OUTFILE $UPDATEFILE
|
||||
fi
|
||||
|
||||
echo "done."
|
||||
|
|
2279
util/strings.php
2279
util/strings.php
File diff suppressed because it is too large
Load diff
|
@ -12,25 +12,28 @@
|
|||
|
||||
$a = new App();
|
||||
|
||||
if(x($a->config,'php_path'))
|
||||
$phpath = $a->config['php_path'];
|
||||
else
|
||||
$phpath = 'php';
|
||||
|
||||
|
||||
echo "Directory: mod\n";
|
||||
$files = glob('mod/*.php');
|
||||
foreach($files as $file) {
|
||||
echo $file . "\n";
|
||||
include_once($file);
|
||||
passthru("$phpath -l $file", $ret); $ret===0 or die();
|
||||
}
|
||||
|
||||
echo "Directory: include\n";
|
||||
$files = glob('include/*.php');
|
||||
foreach($files as $file) {
|
||||
echo $file . "\n";
|
||||
include_once($file);
|
||||
passthru("$phpath -l $file", $ret); $ret===0 or die();
|
||||
}
|
||||
|
||||
echo "Directory: object\n";
|
||||
$files = glob('object/*.php');
|
||||
foreach($files as $file) {
|
||||
echo $file . "\n";
|
||||
include_once($file);
|
||||
passthru("$phpath -l $file", $ret); $ret===0 or die();
|
||||
}
|
||||
|
||||
echo "Directory: addon\n";
|
||||
|
@ -40,26 +43,17 @@
|
|||
$addon = basename($dir);
|
||||
$files = glob($dir . '/' . $addon . '.php');
|
||||
foreach($files as $file) {
|
||||
echo $file . "\n";
|
||||
include_once($file);
|
||||
passthru("$phpath -l $file", $ret); $ret===0 or die();
|
||||
}
|
||||
}
|
||||
|
||||
if(x($a->config,'php_path'))
|
||||
$phpath = $a->config['php_path'];
|
||||
else
|
||||
$phpath = 'php';
|
||||
|
||||
echo "String files\n";
|
||||
|
||||
echo 'util/strings.php' . "\n";
|
||||
include_once('util/strings.php');
|
||||
echo count($a->strings) . ' strings' . "\n";
|
||||
passthru("$phpath -l util/strings.php", $ret); $ret===0 or die();
|
||||
|
||||
$files = glob('view/*/strings.php');
|
||||
|
||||
foreach($files as $file) {
|
||||
echo $file . "\n";
|
||||
passthru($phpath . ' util/typohelper.php ' . $file);
|
||||
// include_once($file);
|
||||
passthru("$phpath -l $file", $ret); $ret===0 or die();
|
||||
}
|
||||
|
|
|
@ -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);
|
|
@ -28,6 +28,8 @@ sudo openssl x509 -req -days 365 -in "$SSL_DIR/xip.io.csr" -signkey "$SSL_DIR/xi
|
|||
|
||||
#Install apache2
|
||||
echo ">>> Installing Apache2 webserver"
|
||||
# The package python-software-properties provides add-apt-repository on Ubuntu Precise Server
|
||||
sudo apt-get install python-software-properties
|
||||
sudo add-apt-repository -y ppa:ondrej/apache2
|
||||
sudo apt-key update
|
||||
sudo apt-get update
|
||||
|
|
13697
view/cs/messages.po
13697
view/cs/messages.po
File diff suppressed because it is too large
Load diff
2738
view/cs/strings.php
2738
view/cs/strings.php
File diff suppressed because it is too large
Load diff
13690
view/de/messages.po
13690
view/de/messages.po
File diff suppressed because it is too large
Load diff
2722
view/de/strings.php
2722
view/de/strings.php
File diff suppressed because it is too large
Load diff
13927
view/fr/messages.po
13927
view/fr/messages.po
File diff suppressed because it is too large
Load diff
2742
view/fr/strings.php
2742
view/fr/strings.php
File diff suppressed because it is too large
Load diff
13745
view/it/messages.po
13745
view/it/messages.po
File diff suppressed because it is too large
Load diff
2741
view/it/strings.php
2741
view/it/strings.php
File diff suppressed because it is too large
Load diff
12280
view/ro/messages.po
12280
view/ro/messages.po
File diff suppressed because it is too large
Load diff
2528
view/ro/strings.php
2528
view/ro/strings.php
File diff suppressed because it is too large
Load diff
|
@ -40,3 +40,8 @@
|
|||
<li class='admin link button {{$admin.logs.2}}'><a href='{{$admin.logs.0}}'>{{$admin.logs.1}}</a></li>
|
||||
</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>
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
<h1>{{$title}} - {{$page}}</h1>
|
||||
|
||||
<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_input.tpl" field=$logfile}}
|
||||
{{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>
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
<h1>Friendica Update</h1>
|
||||
<div class="panel_text"></div>
|
||||
<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>
|
||||
|
@ -77,10 +77,10 @@
|
|||
<dl> <dt>New version:</dt><dd>{{$remoteversion}}</dd> </dl>
|
||||
|
||||
<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}}
|
||||
<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}}
|
||||
<h3>Your friendica installation is not writable by web server.</h3>
|
||||
{{if $canftp}}
|
||||
|
@ -89,7 +89,7 @@
|
|||
{{include file="field_input.tpl" field=$ftppath}}
|
||||
{{include file="field_input.tpl" field=$ftpuser}}
|
||||
{{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}}
|
||||
</form>
|
||||
|
|
|
@ -46,7 +46,10 @@
|
|||
|
||||
{{include file="field_input.tpl" field=$sitename}}
|
||||
{{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_input.tpl" field=$shortcut_icon}}
|
||||
{{include file="field_input.tpl" field=$touch_icon}}
|
||||
{{include file="field_textarea.tpl" field=$info}}
|
||||
{{include file="field_select.tpl" field=$language}}
|
||||
{{include file="field_select.tpl" field=$theme}}
|
||||
|
@ -58,7 +61,7 @@
|
|||
{{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>
|
||||
{{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_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>
|
||||
{{include file="field_input.tpl" field=$maximagesize}}
|
||||
|
@ -80,7 +83,8 @@
|
|||
{{include file="field_input.tpl" field=$allowed_email}}
|
||||
{{include file="field_checkbox.tpl" field=$block_public}}
|
||||
{{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_select.tpl" field=$ostatus_poll_interval}}
|
||||
{{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=$disable_embedded}}
|
||||
{{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>
|
||||
{{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=$basepath}}
|
||||
{{include file="field_checkbox.tpl" field=$suppress_language}}
|
||||
{{include file="field_checkbox.tpl" field=$suppress_tags}}
|
||||
|
||||
<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=$only_tag_search}}
|
||||
{{include file="field_input.tpl" field=$itemcache}}
|
||||
{{include file="field_input.tpl" field=$itemcache_duration}}
|
||||
{{include file="field_input.tpl" field=$max_comments}}
|
||||
{{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>
|
||||
|
||||
|
@ -125,8 +131,8 @@
|
|||
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
|
||||
<h3>{{$relocate}}</h3>
|
||||
{{include file="field_input.tpl" field=$relocate_url}}
|
||||
<input type="hidden" name="page_site" value="{{$submit}}">
|
||||
<div class="submit"><input type="submit" name="relocate" value="{{$submit}}" /></div>
|
||||
<input type="hidden" name="page_site" value="{{$submit|escape:'html'}}">
|
||||
<div class="submit"><input type="submit" name="relocate" value="{{$submit|escape:'html'}}" /></div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<dt>{{$plugins.0}}</dt>
|
||||
|
||||
{{foreach $plugins.1 as $p}}
|
||||
<dd>{{$p}}</dd>
|
||||
<dd><a href="/admin/plugins/{{$p}}/">{{$p}}</a></dd>
|
||||
{{/foreach}}
|
||||
|
||||
</dl>
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
</tbody>
|
||||
</table>
|
||||
<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}}
|
||||
<p>{{$no_pending}}</p>
|
||||
{{/if}}
|
||||
|
@ -88,7 +88,7 @@
|
|||
</tbody>
|
||||
</table>
|
||||
<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}}
|
||||
NO USERS?!?
|
||||
{{/if}}
|
||||
|
@ -133,6 +133,6 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</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>
|
||||
</div>
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
|
||||
|
||||
<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>
|
||||
|
||||
<input id="photo-album-edit-submit" type="submit" name="submit" value="{{$submit}}" />
|
||||
<input id="photo-album-edit-drop" type="submit" name="dropalbum" value="{{$dropsubmit}}" onclick="return confirmDelete();" />
|
||||
<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|escape:'html'}}" onclick="return confirmDelete();" />
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
<label id="dfrn-url-label" for="dfrn-url" >{{$your_address}}</label>
|
||||
{{if $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}}
|
||||
<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}}
|
||||
<div id="dfrn-request-url-end"></div>
|
||||
</div>
|
||||
|
@ -39,7 +39,7 @@
|
|||
</div>
|
||||
|
||||
<div id="dfrn-request-submit-wrapper">
|
||||
<input type="submit" name="submit" id="dfrn-request-submit-button" value="{{$submit}}" />
|
||||
<input type="submit" name="cancel" id="dfrn-request-cancel-button" value="{{$cancel}}" />
|
||||
<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|escape:'html'}}" />
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -22,14 +22,14 @@
|
|||
<select id="qcomment-select-{{$id}}" name="qcomment-{{$id}}" class="qcomment" onchange="qCommentInsert(this,{{$id}});" >
|
||||
<option value=""></option>
|
||||
{{foreach $qcomment as $qc}}
|
||||
<option value="{{$qc}}">{{$qc}}</option>
|
||||
<option value="{{$qc|escape:'html'}}">{{$qc}}</option>
|
||||
{{/foreach}}
|
||||
</select>
|
||||
{{/if}}
|
||||
|
||||
<div class="comment-edit-text-end"></div>
|
||||
<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}}
|
||||
<div id="comment-edit-preview-{{$id}}" class="comment-edit-preview" style="display:none;"></div>
|
||||
</div>
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
<span id="confirm-message">{{$message}}</span>
|
||||
{{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}}
|
||||
|
||||
<input class="confirm-button" id="confirm-submit-button" type="submit" name="{{$confirm_name}}" value="{{$confirm}}" />
|
||||
<input class="confirm-button" id="confirm-cancel-button" type="submit" name="canceled" value="{{$cancel}}" />
|
||||
<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|escape:'html'}}" />
|
||||
|
||||
</form>
|
||||
</center>
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
<div id="contact-edit-info-wrapper">
|
||||
<h4>{{$lbl_info1}}</h4>
|
||||
<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 id="contact-edit-info-end"></div>
|
||||
|
||||
|
@ -85,7 +85,7 @@
|
|||
{{$profile_select}}
|
||||
<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>
|
||||
</div>
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<div id="contacts-search-wrapper">
|
||||
<form id="contacts-search-form" action="{{$cmd}}" method="get" >
|
||||
<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="submit" name="submit" id="contacts-search-submit" value="{{$submit}}" />
|
||||
<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|escape:'html'}}" />
|
||||
</form>
|
||||
</div>
|
||||
<div id="contacts-search-end"></div>
|
||||
|
@ -21,7 +21,7 @@
|
|||
<div id="contact-edit-end"></div>
|
||||
<div id="contacts-actions">
|
||||
{{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}}
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -3,35 +3,35 @@
|
|||
<h4>{{$contact_name}}</h4>
|
||||
|
||||
<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>
|
||||
|
||||
<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>
|
||||
|
||||
<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>
|
||||
|
||||
<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>
|
||||
|
||||
<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>
|
||||
|
||||
<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>
|
||||
|
||||
<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>
|
||||
|
||||
<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>
|
||||
|
||||
<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}}
|
||||
{{/if}}
|
||||
|
||||
<input type="submit" name="submit" value="{{$lbl_submit}}" />
|
||||
<input type="submit" name="submit" value="{{$lbl_submit|escape:'html'}}" />
|
||||
|
||||
</form>
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
<input type="hidden" name="width" id="width" />
|
||||
|
||||
<div id="crop-image-submit-wrapper" >
|
||||
<input type="submit" name="submit" value="{{$done}}" />
|
||||
<input type="submit" name="submit" value="{{$done|escape:'html'}}" />
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
|
|
@ -17,6 +17,6 @@
|
|||
|
||||
|
||||
<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>
|
||||
</form>
|
|
@ -25,9 +25,9 @@
|
|||
<label id="dfrn-url-label" for="dfrn-url" >{{$your_address}}</label>
|
||||
{{if $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}}
|
||||
<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}}
|
||||
<div id="dfrn-request-url-end"></div>
|
||||
</div>
|
||||
|
@ -69,7 +69,7 @@
|
|||
</div>
|
||||
|
||||
<div id="dfrn-request-submit-wrapper">
|
||||
<input type="submit" name="submit" id="dfrn-request-submit-button" value="{{$submit}}" />
|
||||
<input type="submit" name="cancel" id="dfrn-request-cancel-button" value="{{$cancel}}" />
|
||||
<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|escape:'html'}}" />
|
||||
</div>
|
||||
</form>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue