diff --git a/.gitignore b/.gitignore
old mode 100755
new mode 100644
diff --git a/.htaccess b/.htaccess
old mode 100755
new mode 100644
diff --git a/INSTALL.txt b/INSTALL.txt
old mode 100755
new mode 100644
diff --git a/LICENSE b/LICENSE
old mode 100755
new mode 100644
diff --git a/boot.php b/boot.php
index 56548160da..680ebde55c 100644
--- a/boot.php
+++ b/boot.php
@@ -9,9 +9,9 @@ require_once('include/nav.php');
require_once('include/cache.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica');
-define ( 'FRIENDICA_VERSION', '2.3.1288' );
+define ( 'FRIENDICA_VERSION', '2.3.1302' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
-define ( 'DB_UPDATE_VERSION', 1134 );
+define ( 'DB_UPDATE_VERSION', 1135 );
define ( 'EOL', " \r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
@@ -90,13 +90,14 @@ define ( 'PAGE_SOAPBOX', 1 );
define ( 'PAGE_COMMUNITY', 2 );
define ( 'PAGE_FREELOVE', 3 );
define ( 'PAGE_BLOG', 4 );
+define ( 'PAGE_PRVGROUP', 5 );
/**
* Network and protocol family types
*/
-define ( 'NETWORK_ZOT', 'zot!'); // Zot!
define ( 'NETWORK_DFRN', 'dfrn'); // Friendica, Mistpark, other DFRN implementations
+define ( 'NETWORK_ZOT', 'zot!'); // Zot!
define ( 'NETWORK_OSTATUS', 'stat'); // status.net, identi.ca, GNU-social, other OStatus implementations
define ( 'NETWORK_FEED', 'feed'); // RSS/Atom feeds with no known "post/notify" protocol
define ( 'NETWORK_DIASPORA', 'dspr'); // Diaspora
@@ -108,6 +109,28 @@ define ( 'NETWORK_XMPP', 'xmpp'); // XMPP
define ( 'NETWORK_MYSPACE', 'mysp'); // MySpace
define ( 'NETWORK_GPLUS', 'goog'); // Google+
+/*
+ * These numbers are used in stored permissions
+ * and existing allocations MUST NEVER BE CHANGED
+ * OR RE-ASSIGNED! You may only add to them.
+ */
+
+$netgroup_ids = array(
+ NETWORK_DFRN => (-1),
+ NETWORK_ZOT => (-2),
+ NETWORK_OSTATUS => (-3),
+ NETWORK_FEED => (-4),
+ NETWORK_DIASPORA => (-5),
+ NETWORK_MAIL => (-6),
+ NETWORK_MAIL2 => (-7),
+ NETWORK_FACEBOOK => (-8),
+ NETWORK_LINKEDIN => (-9),
+ NETWORK_XMPP => (-10),
+ NETWORK_MYSPACE => (-11),
+ NETWORK_GPLUS => (-12),
+);
+
+
/**
* Maximum number of "people who like (or don't like) this" that we will list by name
*/
@@ -135,6 +158,9 @@ define ( 'NOTIFY_PROFILE', 0x0040 );
define ( 'NOTIFY_TAGSELF', 0x0080 );
define ( 'NOTIFY_TAGSHARE', 0x0100 );
+define ( 'NOTIFY_SYSTEM', 0x8000 );
+
+
/**
* various namespaces we may need to parse
*/
@@ -268,6 +294,8 @@ class App {
public $nav_sel;
+ public $category;
+
private $scheme;
private $hostname;
private $baseurl;
@@ -352,6 +380,9 @@ class App {
$this->argc = count($this->argv);
if((array_key_exists('0',$this->argv)) && strlen($this->argv[0])) {
$this->module = str_replace(".", "_", $this->argv[0]);
+ if(array_key_exists('2',$this->argv)) {
+ $this->category = $this->argv[2];
+ }
}
else {
$this->argc = 1;
@@ -560,6 +591,10 @@ function absurl($path) {
return $path;
}
+function is_ajax() {
+ return (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
+}
+
// Primarily involved with database upgrade, but also sets the
// base url for use in cmdline programs which don't have
@@ -955,6 +990,12 @@ function profile_sidebar($profile, $block = 0) {
if((remote_user()) && ($_SESSION['visitor_visiting'] == $profile['uid']))
$connect = False;
+ if(get_my_url() && $profile['unkmail'])
+ $wallmessage = t('Message');
+ else
+ $wallmessage = false;
+
+
// show edit profile to yourself
if ($profile['uid'] == local_user()) {
@@ -1037,6 +1078,7 @@ function profile_sidebar($profile, $block = 0) {
$o .= replace_macros($tpl, array(
'$profile' => $profile,
'$connect' => $connect,
+ '$wallmessage' => $wallmessage,
'$location' => template_escape($location),
'$gender' => $gender,
'$pdesc' => $pdesc,
@@ -1232,17 +1274,20 @@ function current_theme(){
$system_theme = ((isset($a->config['system']['theme'])) ? $a->config['system']['theme'] : '');
$theme_name = ((isset($_SESSION) && x($_SESSION,'theme')) ? $_SESSION['theme'] : $system_theme);
- if($theme_name && file_exists('view/theme/' . $theme_name . '/style.css'))
+ if($theme_name &&
+ (file_exists('view/theme/' . $theme_name . '/style.css') ||
+ file_exists('view/theme/' . $theme_name . '/style.php')))
return($theme_name);
foreach($app_base_themes as $t) {
- if(file_exists('view/theme/' . $t . '/style.css'))
+ if(file_exists('view/theme/' . $t . '/style.css')||
+ file_exists('view/theme/' . $t . '/style.php'))
return($t);
}
- $fallback = glob('view/theme/*/style.css');
+ $fallback = glob('view/theme/*/style.[css|php]');
if(count($fallback))
- return (str_replace('view/theme/','', str_replace("/style.css","",$fallback[0])));
+ return (str_replace('view/theme/','', substr($fallback[0],0,-10)));
}}
@@ -1254,6 +1299,8 @@ if(! function_exists('current_theme_url')) {
function current_theme_url() {
global $a;
$t = current_theme();
+ if (file_exists('view/theme/' . $t . '/style.php'))
+ return($a->get_baseurl() . '/view/theme/' . $t . '/style.pcss');
return($a->get_baseurl() . '/view/theme/' . $t . '/style.css');
}}
@@ -1279,8 +1326,12 @@ function feed_birthday($uid,$tz) {
*
*/
+
$birthday = '';
+ if(! strlen($tz))
+ $tz = 'UTC';
+
$p = q("SELECT `dob` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
intval($uid)
);
@@ -1378,6 +1429,29 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
);
}
+
+ $arr = array('is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => (($tab) ? $tab : false), 'tabs' => $tabs);
+ call_hooks('profile_tabs', $arr);
+
$tpl = get_markup_template('common_tabs.tpl');
- return replace_macros($tpl,array('$tabs'=>$tabs));
+
+ return replace_macros($tpl,array('$tabs' => $arr['tabs']));
}}
+
+function get_my_url() {
+ if(x($_SESSION,'my_url'))
+ return $_SESSION['my_url'];
+ return false;
+}
+
+function zrl($s) {
+ if(! strlen($s))
+ return $s;
+ if(! strpos($s,'/profile/'))
+ return $s;
+ $achar = strpos($s,'?') ? '&' : '?';
+ $mine = get_my_url();
+ if($mine and ! link_compare($mine,$s))
+ return $s . $achar . 'zrl=' . urlencode($mine);
+ return $s;
+}
diff --git a/database.sql b/database.sql
index a039746e8e..010c63bb24 100644
--- a/database.sql
+++ b/database.sql
@@ -290,9 +290,10 @@ CREATE TABLE IF NOT EXISTS `mail` (
`convid` int(10) unsigned NOT NULL,
`title` char(255) NOT NULL,
`body` mediumtext NOT NULL,
- `seen` tinyint(1) NOT NULL,
+ `seen` tinyint(1) NOT NULL DEFAULT '0',
`reply` tinyint(1) NOT NULL DEFAULT '0',
- `replied` tinyint(1) NOT NULL,
+ `replied` tinyint(1) NOT NULL DEFAULT '0',
+ `unknown` tinyint(1) NOT NULL DEFAULT '0',
`uri` char(255) NOT NULL,
`parent-uri` char(255) NOT NULL,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -301,6 +302,7 @@ CREATE TABLE IF NOT EXISTS `mail` (
KEY `guid` (`guid`),
KEY `convid` (`convid`),
KEY `reply` (`reply`),
+ KEY `unknown` (`unknown`),
KEY `uri` (`uri`),
KEY `parent-uri` (`parent-uri`),
KEY `created` (`created`)
@@ -454,6 +456,8 @@ CREATE TABLE IF NOT EXISTS `user` (
`blockwall` tinyint(1) unsigned NOT NULL DEFAULT '0',
`hidewall` tinyint(1) unsigned NOT NULL DEFAULT '0',
`blocktags` tinyint(1) unsigned NOT NULL DEFAULT '0',
+ `unkmail` tinyint(1) unsigned NOT NULL DEFAULT '0',
+ `cntunkmail` int(11) unsigned NOT NULL DEFAULT '10',
`notify-flags` int(11) unsigned NOT NULL DEFAULT '65535',
`page-flags` int(11) unsigned NOT NULL DEFAULT '0',
`prvnets` tinyint(1) NOT NULL DEFAULT '0',
@@ -473,6 +477,8 @@ CREATE TABLE IF NOT EXISTS `user` (
KEY `account_expired` (`account_expired`),
KEY `hidewall` (`hidewall`),
KEY `blockwall` (`blockwall`),
+ KEY `unkmail` (`unkmail`),
+ KEY `cntunkmail` (`cntunkmail`),
KEY `blocked` (`blocked`),
KEY `verified` (`verified`),
KEY `login_date` (`login_date`)
diff --git a/doc/Account-Basics.md b/doc/Account-Basics.md
old mode 100755
new mode 100644
diff --git a/doc/Bugs-and-Issues.md b/doc/Bugs-and-Issues.md
old mode 100755
new mode 100644
diff --git a/doc/Connectors.md b/doc/Connectors.md
old mode 100755
new mode 100644
diff --git a/doc/Developers.md b/doc/Developers.md
old mode 100755
new mode 100644
diff --git a/doc/Home.md b/doc/Home.md
old mode 100755
new mode 100644
index 56abe8075c..30efc93f7d
--- a/doc/Home.md
+++ b/doc/Home.md
@@ -5,6 +5,7 @@ Friendica Documentation and Resources
**Contents**
* [Account Basics](help/Account-Basics)
+* [New User Quick Start](help/guide)
* [Profiles](help/Profiles)
* [Connectors](help/Connectors)
* [Making Friends](help/Making-Friends)
diff --git a/doc/Install.md b/doc/Install.md
old mode 100755
new mode 100644
diff --git a/doc/Installing-Connectors.md b/doc/Installing-Connectors.md
old mode 100755
new mode 100644
diff --git a/doc/Making-Friends.md b/doc/Making-Friends.md
old mode 100755
new mode 100644
diff --git a/doc/Message-Flow.md b/doc/Message-Flow.md
old mode 100755
new mode 100644
diff --git a/doc/Pages.md b/doc/Pages.md
old mode 100755
new mode 100644
diff --git a/doc/Plugins.md b/doc/Plugins.md
old mode 100755
new mode 100644
diff --git a/doc/Profiles.md b/doc/Profiles.md
old mode 100755
new mode 100644
diff --git a/doc/Remove-Account.md b/doc/Remove-Account.md
old mode 100755
new mode 100644
diff --git a/doc/Settings.md b/doc/Settings.md
old mode 100755
new mode 100644
diff --git a/doc/Tags-and-Mentions.md b/doc/Tags-and-Mentions.md
old mode 100755
new mode 100644
diff --git a/doc/andfinally.md b/doc/andfinally.md
new file mode 100644
index 0000000000..cd8a6994ba
--- /dev/null
+++ b/doc/andfinally.md
@@ -0,0 +1,24 @@
+And that brings the Quick Start to an end.
+
+Here are some more things to help get you started:
+
+**Groups**
+
+
+- New Here - a group for people new to Friendica
+
+- Friendica Support - problems? This is the place to ask.
+
+- Public Stream - a place to talk about anything to anyone.
+
+- Let's Talk a group for finding people and groups who share similar interests.
+
+- Local Friendica a page for local Friendica groups
+
+
+**Documentation**
+
+- Connecting to more networks
+- Help Index
+
+
diff --git a/doc/groupsandpages.md b/doc/groupsandpages.md
new file mode 100644
index 0000000000..418e682c83
--- /dev/null
+++ b/doc/groupsandpages.md
@@ -0,0 +1,11 @@
+This is the global directory. If you get lost, you can click this link to bring yourself back here.
+
+On this page, you'll find a collection of groups, forums and celebrity pages. Groups are not real people. Connecting to them is similar to "liking" something on Facebook, or signing up for a new forum. You don't have to feel awkward about introducing yourself to a new person, because they're not people!
+
+When you connect to a group, all messages to that group will start appearing in your network tab. You can comment on these posts, or post to the group yourself without ever having to add any of the groups members. This is a great way to make friends dynamically - you'll find people you like and add each other naturally instead of adding random strangers. Simply find a group you're interested in, and connect to it the same way you did with people in the last section. There are a lot of groups, and you're likely to get lost. Remember the link at the top of this page will bring you back here.
+
+Once you've added some groups, move on to the next section.
+
+
+
+
diff --git a/doc/guide.md b/doc/guide.md
new file mode 100644
index 0000000000..178170c4e2
--- /dev/null
+++ b/doc/guide.md
@@ -0,0 +1,13 @@
+First things first, let's make sure you're logged in to your account. If you're not already logged in, do so in the frame below.
+
+Once you've logged in (or if you are already logged in), you'll now be looking at your profile page.
+
+This is a bit like your Facebook wall. It's where all your status messgages are kept, and where your friends come to post on your wall. To write your status, simply click in the box that says "share". When you do this, the box will expand. You can see some formatting options at the top such as Bold, Italics and Underline, as well as ways to add links and pictures. At the bottom you'll find some more links. You can use these to upload pictures and files from your computer, share websites with a bit of preview text, or embed video and audio files from elsewhere on the web. You can also set your post location here.
+
+Once you've finished writing your post, click on the padlock icon to select who can see it. If you do not use the padlock icon, your post will be public. This means it will appear to anybody who views your profile, and in the community tab if your site has it enabled, as well as in the network tab of any of your contacts.
+
+Play around with this a bit, then when you're ready to move on, we'll take a look at the Network Tab
+
+
+
+
diff --git a/doc/makingnewfriends.md b/doc/makingnewfriends.md
new file mode 100644
index 0000000000..35befaa365
--- /dev/null
+++ b/doc/makingnewfriends.md
@@ -0,0 +1,11 @@
+This is your Suggested Friends page. If you get lost, you can click this link to bring yourself back here.
+
+This is a bit like the Friend Suggestions page of Facebook. Everybody on this list has agreed that they may be suggested as a friend. This means they're unlikely to refuse an introduction you send, and they want to meet new people too!
+
+See somebody you like the look of? Click the connect button beneath their photograph. This will bring you to the introductions page. Fill in the form as instructed, and add a small note (optional). Now, wait a bit and they'll accept your request - note that these are real people, and it might take a while. Now you've added one, you're probably lost. Click the link at the top of this page to go back to the suggested friends list and add some more.
+
+Feel uncomfortable adding people you don't know? Don't worry - that's where Groups and Pages come in!
+
+
+
+
diff --git a/doc/network.md b/doc/network.md
new file mode 100644
index 0000000000..f445b0055e
--- /dev/null
+++ b/doc/network.md
@@ -0,0 +1,9 @@
+This is your Network Tab. If you get lost, you can click this link to bring yourself back here.
+
+This is a bit like the Newsfeed at Facebook or the Stream at Diaspora. It's where all the posts from your contacts, groups, and feeds will appear. If you're new, you won't see anything in this page, unless you posted your status in the last step. If you've already added a few friends, you'll be able to see their posts. Here, you can comment, like, or dislike posts, or click on somebody's name to visit their profile page where you can write on their wall.
+
+Now we need to fill it up, the first step, is to add people you already know from Facebook.
+
+
+
+
diff --git a/doc/peopleyouknow.md b/doc/peopleyouknow.md
new file mode 100644
index 0000000000..143c492176
--- /dev/null
+++ b/doc/peopleyouknow.md
@@ -0,0 +1,13 @@
+This is your connector settings page. If you get lost, you can click this link to bring yourself back here.
+
+This is the bit that makes Friendica unique. You can connect to anybody on the internet from your Friendica account using this page! The available connectors varies depending on which plugins you have installed, but for now, we'll walk you through Facebook. Note that not all servers have the Facebook connector installed. If you can't find it in the list below, don't worry, we'll look at ways of connecting to more people in the following pages.
+
+The biggest of all social networks is Facebook. Fortunately, this connector is really easy. Scroll down the page, and click Facebook Connector Settings. Enter your Facebook user name and password and let the application (the connector) do everything the options suggest. You can fine tune this or experiment with the other connectors too. If you need help, you can always ask at Friendica Support or see the instructions here.
+
+When you're ready, we can move on to making new friends.
+
+
+
+
+
+
diff --git a/htconfig.php b/htconfig.php
old mode 100755
new mode 100644
diff --git a/images/article.gif b/images/article.gif
old mode 100755
new mode 100644
diff --git a/images/audio.gif b/images/audio.gif
old mode 100755
new mode 100644
diff --git a/images/b_block.gif b/images/b_block.gif
old mode 100755
new mode 100644
diff --git a/images/b_drop.gif b/images/b_drop.gif
old mode 100755
new mode 100644
diff --git a/images/b_drop.png b/images/b_drop.png
old mode 100755
new mode 100644
diff --git a/images/b_drophide.gif b/images/b_drophide.gif
old mode 100755
new mode 100644
diff --git a/images/b_dropshow.gif b/images/b_dropshow.gif
old mode 100755
new mode 100644
diff --git a/images/b_edit.gif b/images/b_edit.gif
old mode 100755
new mode 100644
diff --git a/images/b_edit.png b/images/b_edit.png
old mode 100755
new mode 100644
diff --git a/images/blank.png b/images/blank.png
new file mode 100644
index 0000000000..67d3919667
Binary files /dev/null and b/images/blank.png differ
diff --git a/images/calendar.png b/images/calendar.png
old mode 100755
new mode 100644
diff --git a/images/camera-icon.gif b/images/camera-icon.gif
old mode 100755
new mode 100644
diff --git a/images/connect-bg.png b/images/connect-bg.png
old mode 100755
new mode 100644
diff --git a/images/content-types.png b/images/content-types.png
old mode 100755
new mode 100644
diff --git a/images/default-group-mm.png b/images/default-group-mm.png
old mode 100755
new mode 100644
diff --git a/images/default-profile-mm.jpg b/images/default-profile-mm.jpg
old mode 100755
new mode 100644
diff --git a/images/default-profile-sm.jpg b/images/default-profile-sm.jpg
old mode 100755
new mode 100644
diff --git a/images/default-profile.jpg b/images/default-profile.jpg
old mode 100755
new mode 100644
diff --git a/images/diaspora.png b/images/diaspora.png
old mode 100755
new mode 100644
diff --git a/images/dislike.gif b/images/dislike.gif
old mode 100755
new mode 100644
diff --git a/images/document.gif b/images/document.gif
old mode 100755
new mode 100644
diff --git a/images/ff-128.jpg b/images/ff-128.jpg
old mode 100755
new mode 100644
diff --git a/images/ff-16.jpg b/images/ff-16.jpg
old mode 100755
new mode 100644
diff --git a/images/ff-256.jpg b/images/ff-256.jpg
old mode 100755
new mode 100644
diff --git a/images/ff-32.jpg b/images/ff-32.jpg
old mode 100755
new mode 100644
diff --git a/images/ff-64.jpg b/images/ff-64.jpg
old mode 100755
new mode 100644
diff --git a/images/ff.xcf b/images/ff.xcf
old mode 100755
new mode 100644
diff --git a/images/friendica-128.jpg b/images/friendica-128.jpg
old mode 100755
new mode 100644
diff --git a/images/friendica-128.png b/images/friendica-128.png
old mode 100755
new mode 100644
diff --git a/images/friendica-16.jpg b/images/friendica-16.jpg
old mode 100755
new mode 100644
diff --git a/images/friendica-16.png b/images/friendica-16.png
old mode 100755
new mode 100644
diff --git a/images/friendica-1600.png b/images/friendica-1600.png
old mode 100755
new mode 100644
diff --git a/images/friendica-256.jpg b/images/friendica-256.jpg
old mode 100755
new mode 100644
diff --git a/images/friendica-256.png b/images/friendica-256.png
old mode 100755
new mode 100644
diff --git a/images/friendica-32.jpg b/images/friendica-32.jpg
old mode 100755
new mode 100644
diff --git a/images/friendica-32.png b/images/friendica-32.png
old mode 100755
new mode 100644
diff --git a/images/friendica-48.png b/images/friendica-48.png
old mode 100755
new mode 100644
diff --git a/images/friendica-64.jpg b/images/friendica-64.jpg
old mode 100755
new mode 100644
diff --git a/images/friendica-64.png b/images/friendica-64.png
old mode 100755
new mode 100644
diff --git a/images/friendica-96.png b/images/friendica-96.png
old mode 100755
new mode 100644
diff --git a/images/friendica.svg b/images/friendica.svg
old mode 100755
new mode 100644
diff --git a/images/friendika-128.jpg b/images/friendika-128.jpg
old mode 100755
new mode 100644
diff --git a/images/friendika-128.png b/images/friendika-128.png
old mode 100755
new mode 100644
diff --git a/images/friendika-16.jpg b/images/friendika-16.jpg
old mode 100755
new mode 100644
diff --git a/images/friendika-16.png b/images/friendika-16.png
old mode 100755
new mode 100644
diff --git a/images/friendika-1600.png b/images/friendika-1600.png
old mode 100755
new mode 100644
diff --git a/images/friendika-256.jpg b/images/friendika-256.jpg
old mode 100755
new mode 100644
diff --git a/images/friendika-256.png b/images/friendika-256.png
old mode 100755
new mode 100644
diff --git a/images/friendika-32.jpg b/images/friendika-32.jpg
old mode 100755
new mode 100644
diff --git a/images/friendika-32.png b/images/friendika-32.png
old mode 100755
new mode 100644
diff --git a/images/friendika-48.png b/images/friendika-48.png
old mode 100755
new mode 100644
diff --git a/images/friendika-64.jpg b/images/friendika-64.jpg
old mode 100755
new mode 100644
diff --git a/images/friendika-64.png b/images/friendika-64.png
old mode 100755
new mode 100644
diff --git a/images/friendika-96.png b/images/friendika-96.png
old mode 100755
new mode 100644
diff --git a/images/friendika.svg b/images/friendika.svg
old mode 100755
new mode 100644
diff --git a/images/globe.gif b/images/globe.gif
old mode 100755
new mode 100644
diff --git a/images/hide_off.png b/images/hide_off.png
old mode 100755
new mode 100644
diff --git a/images/hide_on.png b/images/hide_on.png
old mode 100755
new mode 100644
diff --git a/images/icons.png b/images/icons.png
old mode 100755
new mode 100644
diff --git a/images/icons/10/add.png b/images/icons/10/add.png
old mode 100755
new mode 100644
diff --git a/images/icons/10/delete.png b/images/icons/10/delete.png
old mode 100755
new mode 100644
diff --git a/images/icons/10/edit.png b/images/icons/10/edit.png
old mode 100755
new mode 100644
diff --git a/images/icons/10/feed.png b/images/icons/10/feed.png
old mode 100755
new mode 100644
diff --git a/images/icons/10/gear.png b/images/icons/10/gear.png
old mode 100755
new mode 100644
diff --git a/images/icons/10/group.png b/images/icons/10/group.png
old mode 100755
new mode 100644
diff --git a/images/icons/10/info.png b/images/icons/10/info.png
old mode 100755
new mode 100644
diff --git a/images/icons/10/link.png b/images/icons/10/link.png
old mode 100755
new mode 100644
diff --git a/images/icons/10/lock.png b/images/icons/10/lock.png
old mode 100755
new mode 100644
diff --git a/images/icons/10/menu.png b/images/icons/10/menu.png
old mode 100755
new mode 100644
diff --git a/images/icons/10/notice.png b/images/icons/10/notice.png
old mode 100755
new mode 100644
diff --git a/images/icons/10/notify_off.png b/images/icons/10/notify_off.png
old mode 100755
new mode 100644
diff --git a/images/icons/10/notify_on.png b/images/icons/10/notify_on.png
old mode 100755
new mode 100644
diff --git a/images/icons/10/play.png b/images/icons/10/play.png
old mode 100755
new mode 100644
diff --git a/images/icons/10/plugin.png b/images/icons/10/plugin.png
old mode 100755
new mode 100644
diff --git a/images/icons/10/star.png b/images/icons/10/star.png
old mode 100755
new mode 100644
diff --git a/images/icons/10/unlock.png b/images/icons/10/unlock.png
old mode 100755
new mode 100644
diff --git a/images/icons/10/user.png b/images/icons/10/user.png
old mode 100755
new mode 100644
diff --git a/images/icons/16/add.png b/images/icons/16/add.png
old mode 100755
new mode 100644
diff --git a/images/icons/16/delete.png b/images/icons/16/delete.png
old mode 100755
new mode 100644
diff --git a/images/icons/16/edit.png b/images/icons/16/edit.png
old mode 100755
new mode 100644
diff --git a/images/icons/16/feed.png b/images/icons/16/feed.png
old mode 100755
new mode 100644
diff --git a/images/icons/16/gear.png b/images/icons/16/gear.png
old mode 100755
new mode 100644
diff --git a/images/icons/16/group.png b/images/icons/16/group.png
old mode 100755
new mode 100644
diff --git a/images/icons/16/info.png b/images/icons/16/info.png
old mode 100755
new mode 100644
diff --git a/images/icons/16/link.png b/images/icons/16/link.png
old mode 100755
new mode 100644
diff --git a/images/icons/16/lock.png b/images/icons/16/lock.png
old mode 100755
new mode 100644
diff --git a/images/icons/16/menu.png b/images/icons/16/menu.png
old mode 100755
new mode 100644
diff --git a/images/icons/16/notice.png b/images/icons/16/notice.png
old mode 100755
new mode 100644
diff --git a/images/icons/16/notify_off.png b/images/icons/16/notify_off.png
old mode 100755
new mode 100644
diff --git a/images/icons/16/notify_on.png b/images/icons/16/notify_on.png
old mode 100755
new mode 100644
diff --git a/images/icons/16/play.png b/images/icons/16/play.png
old mode 100755
new mode 100644
diff --git a/images/icons/16/plugin.png b/images/icons/16/plugin.png
old mode 100755
new mode 100644
diff --git a/images/icons/16/star.png b/images/icons/16/star.png
old mode 100755
new mode 100644
diff --git a/images/icons/16/unlock.png b/images/icons/16/unlock.png
old mode 100755
new mode 100644
diff --git a/images/icons/16/user.png b/images/icons/16/user.png
old mode 100755
new mode 100644
diff --git a/images/icons/22/add.png b/images/icons/22/add.png
old mode 100755
new mode 100644
diff --git a/images/icons/22/delete.png b/images/icons/22/delete.png
old mode 100755
new mode 100644
diff --git a/images/icons/22/edit.png b/images/icons/22/edit.png
old mode 100755
new mode 100644
diff --git a/images/icons/22/feed.png b/images/icons/22/feed.png
old mode 100755
new mode 100644
diff --git a/images/icons/22/gear.png b/images/icons/22/gear.png
old mode 100755
new mode 100644
diff --git a/images/icons/22/group.png b/images/icons/22/group.png
old mode 100755
new mode 100644
diff --git a/images/icons/22/info.png b/images/icons/22/info.png
old mode 100755
new mode 100644
diff --git a/images/icons/22/link.png b/images/icons/22/link.png
old mode 100755
new mode 100644
diff --git a/images/icons/22/lock.png b/images/icons/22/lock.png
old mode 100755
new mode 100644
diff --git a/images/icons/22/menu.png b/images/icons/22/menu.png
old mode 100755
new mode 100644
diff --git a/images/icons/22/notice.png b/images/icons/22/notice.png
old mode 100755
new mode 100644
diff --git a/images/icons/22/notify_off.png b/images/icons/22/notify_off.png
old mode 100755
new mode 100644
diff --git a/images/icons/22/notify_on.png b/images/icons/22/notify_on.png
old mode 100755
new mode 100644
diff --git a/images/icons/22/play.png b/images/icons/22/play.png
old mode 100755
new mode 100644
diff --git a/images/icons/22/plugin.png b/images/icons/22/plugin.png
old mode 100755
new mode 100644
diff --git a/images/icons/22/star.png b/images/icons/22/star.png
old mode 100755
new mode 100644
diff --git a/images/icons/22/unlock.png b/images/icons/22/unlock.png
old mode 100755
new mode 100644
diff --git a/images/icons/22/user.png b/images/icons/22/user.png
old mode 100755
new mode 100644
diff --git a/images/icons/48/add.png b/images/icons/48/add.png
old mode 100755
new mode 100644
diff --git a/images/icons/48/delete.png b/images/icons/48/delete.png
old mode 100755
new mode 100644
diff --git a/images/icons/48/edit.png b/images/icons/48/edit.png
old mode 100755
new mode 100644
diff --git a/images/icons/48/feed.png b/images/icons/48/feed.png
old mode 100755
new mode 100644
diff --git a/images/icons/48/gear.png b/images/icons/48/gear.png
old mode 100755
new mode 100644
diff --git a/images/icons/48/group.png b/images/icons/48/group.png
old mode 100755
new mode 100644
diff --git a/images/icons/48/info.png b/images/icons/48/info.png
old mode 100755
new mode 100644
diff --git a/images/icons/48/link.png b/images/icons/48/link.png
old mode 100755
new mode 100644
diff --git a/images/icons/48/lock.png b/images/icons/48/lock.png
old mode 100755
new mode 100644
diff --git a/images/icons/48/menu.png b/images/icons/48/menu.png
old mode 100755
new mode 100644
diff --git a/images/icons/48/notice.png b/images/icons/48/notice.png
old mode 100755
new mode 100644
diff --git a/images/icons/48/notify_off.png b/images/icons/48/notify_off.png
old mode 100755
new mode 100644
diff --git a/images/icons/48/notify_on.png b/images/icons/48/notify_on.png
old mode 100755
new mode 100644
diff --git a/images/icons/48/play.png b/images/icons/48/play.png
old mode 100755
new mode 100644
diff --git a/images/icons/48/plugin.png b/images/icons/48/plugin.png
old mode 100755
new mode 100644
diff --git a/images/icons/48/star.png b/images/icons/48/star.png
old mode 100755
new mode 100644
diff --git a/images/icons/48/unlock.png b/images/icons/48/unlock.png
old mode 100755
new mode 100644
diff --git a/images/icons/48/user.png b/images/icons/48/user.png
old mode 100755
new mode 100644
diff --git a/images/icons/Makefile b/images/icons/Makefile
old mode 100755
new mode 100644
diff --git a/images/icons/add.png b/images/icons/add.png
old mode 100755
new mode 100644
diff --git a/images/icons/delete.png b/images/icons/delete.png
old mode 100755
new mode 100644
diff --git a/images/icons/edit.png b/images/icons/edit.png
old mode 100755
new mode 100644
diff --git a/images/icons/feed.png b/images/icons/feed.png
old mode 100755
new mode 100644
diff --git a/images/icons/gear.png b/images/icons/gear.png
old mode 100755
new mode 100644
diff --git a/images/icons/group.png b/images/icons/group.png
old mode 100755
new mode 100644
diff --git a/images/icons/info.png b/images/icons/info.png
old mode 100755
new mode 100644
diff --git a/images/icons/link.png b/images/icons/link.png
old mode 100755
new mode 100644
diff --git a/images/icons/lock.png b/images/icons/lock.png
old mode 100755
new mode 100644
diff --git a/images/icons/menu.png b/images/icons/menu.png
old mode 100755
new mode 100644
diff --git a/images/icons/notice.png b/images/icons/notice.png
old mode 100755
new mode 100644
diff --git a/images/icons/notify_off.png b/images/icons/notify_off.png
old mode 100755
new mode 100644
diff --git a/images/icons/notify_on.png b/images/icons/notify_on.png
old mode 100755
new mode 100644
diff --git a/images/icons/play.png b/images/icons/play.png
old mode 100755
new mode 100644
diff --git a/images/icons/plugin.png b/images/icons/plugin.png
old mode 100755
new mode 100644
diff --git a/images/icons/star.png b/images/icons/star.png
old mode 100755
new mode 100644
diff --git a/images/icons/unlock.png b/images/icons/unlock.png
old mode 100755
new mode 100644
diff --git a/images/icons/user.png b/images/icons/user.png
old mode 100755
new mode 100644
diff --git a/images/larrow.gif b/images/larrow.gif
old mode 100755
new mode 100644
diff --git a/images/larrw.gif b/images/larrw.gif
old mode 100755
new mode 100644
diff --git a/images/like.gif b/images/like.gif
old mode 100755
new mode 100644
diff --git a/images/link-icon.gif b/images/link-icon.gif
old mode 100755
new mode 100644
diff --git a/images/lock_icon.gif b/images/lock_icon.gif
old mode 100755
new mode 100644
diff --git a/images/logo.png b/images/logo.png
old mode 100755
new mode 100644
diff --git a/images/lrarrow.gif b/images/lrarrow.gif
old mode 100755
new mode 100644
diff --git a/images/mapicon.gif b/images/mapicon.gif
old mode 100755
new mode 100644
diff --git a/images/no.gif b/images/no.gif
old mode 100755
new mode 100644
diff --git a/images/noglobe.gif b/images/noglobe.gif
old mode 100755
new mode 100644
diff --git a/images/nosign.jpg b/images/nosign.jpg
old mode 100755
new mode 100644
diff --git a/images/onoff.jpg b/images/onoff.jpg
old mode 100755
new mode 100644
diff --git a/images/pause.gif b/images/pause.gif
old mode 100755
new mode 100644
diff --git a/images/pen.png b/images/pen.png
old mode 100755
new mode 100644
diff --git a/images/pencil.gif b/images/pencil.gif
old mode 100755
new mode 100644
diff --git a/images/penhover.png b/images/penhover.png
old mode 100755
new mode 100644
diff --git a/images/people.gif b/images/people.gif
old mode 100755
new mode 100644
diff --git a/images/play.gif b/images/play.gif
old mode 100755
new mode 100644
diff --git a/images/plugin.png b/images/plugin.png
old mode 100755
new mode 100644
diff --git a/images/rarrow.gif b/images/rarrow.gif
old mode 100755
new mode 100644
diff --git a/images/rarrw.gif b/images/rarrw.gif
old mode 100755
new mode 100644
diff --git a/images/recycle.gif b/images/recycle.gif
old mode 100755
new mode 100644
diff --git a/images/remote-link.gif b/images/remote-link.gif
old mode 100755
new mode 100644
diff --git a/images/rotator.gif b/images/rotator.gif
old mode 100755
new mode 100644
diff --git a/images/search_18.png b/images/search_18.png
old mode 100755
new mode 100644
diff --git a/images/selected.png b/images/selected.png
old mode 100755
new mode 100644
diff --git a/images/share.gif b/images/share.gif
old mode 100755
new mode 100644
diff --git a/images/show_all_off.png b/images/show_all_off.png
old mode 100755
new mode 100644
diff --git a/images/show_all_on.png b/images/show_all_on.png
old mode 100755
new mode 100644
diff --git a/images/show_off.png b/images/show_off.png
old mode 100755
new mode 100644
diff --git a/images/show_on.png b/images/show_on.png
old mode 100755
new mode 100644
diff --git a/images/smiley-Oo.gif b/images/smiley-Oo.gif
old mode 100755
new mode 100644
diff --git a/images/smiley-brokenheart.gif b/images/smiley-brokenheart.gif
old mode 100755
new mode 100644
diff --git a/images/smiley-cool.gif b/images/smiley-cool.gif
old mode 100755
new mode 100644
diff --git a/images/smiley-cry.gif b/images/smiley-cry.gif
old mode 100755
new mode 100644
diff --git a/images/smiley-embarassed.gif b/images/smiley-embarassed.gif
old mode 100755
new mode 100644
diff --git a/images/smiley-foot-in-mouth.gif b/images/smiley-foot-in-mouth.gif
old mode 100755
new mode 100644
diff --git a/images/smiley-frown.gif b/images/smiley-frown.gif
old mode 100755
new mode 100644
diff --git a/images/smiley-heart.gif b/images/smiley-heart.gif
old mode 100755
new mode 100644
diff --git a/images/smiley-innocent.gif b/images/smiley-innocent.gif
old mode 100755
new mode 100644
diff --git a/images/smiley-kiss.gif b/images/smiley-kiss.gif
old mode 100755
new mode 100644
diff --git a/images/smiley-laughing.gif b/images/smiley-laughing.gif
old mode 100755
new mode 100644
diff --git a/images/smiley-money-mouth.gif b/images/smiley-money-mouth.gif
old mode 100755
new mode 100644
diff --git a/images/smiley-sealed.gif b/images/smiley-sealed.gif
old mode 100755
new mode 100644
diff --git a/images/smiley-smile.gif b/images/smiley-smile.gif
old mode 100755
new mode 100644
diff --git a/images/smiley-surprised.gif b/images/smiley-surprised.gif
old mode 100755
new mode 100644
diff --git a/images/smiley-thumbsup.gif b/images/smiley-thumbsup.gif
old mode 100755
new mode 100644
diff --git a/images/smiley-tongue-out.gif b/images/smiley-tongue-out.gif
old mode 100755
new mode 100644
diff --git a/images/smiley-undecided.gif b/images/smiley-undecided.gif
old mode 100755
new mode 100644
diff --git a/images/smiley-wink.gif b/images/smiley-wink.gif
old mode 100755
new mode 100644
diff --git a/images/smiley-yell.gif b/images/smiley-yell.gif
old mode 100755
new mode 100644
diff --git a/images/spencil.gif b/images/spencil.gif
old mode 100755
new mode 100644
diff --git a/images/star.png b/images/star.png
old mode 100755
new mode 100644
diff --git a/images/tag.png b/images/tag.png
old mode 100755
new mode 100644
diff --git a/images/tag_b.png b/images/tag_b.png
old mode 100755
new mode 100644
diff --git a/images/tools.png b/images/tools.png
old mode 100755
new mode 100644
diff --git a/images/twopeople.png b/images/twopeople.png
old mode 100755
new mode 100644
diff --git a/images/unlock_icon.gif b/images/unlock_icon.gif
old mode 100755
new mode 100644
diff --git a/images/video.gif b/images/video.gif
old mode 100755
new mode 100644
diff --git a/images/youtube_icon.gif b/images/youtube_icon.gif
old mode 100755
new mode 100644
diff --git a/include/Contact.php b/include/Contact.php
old mode 100755
new mode 100644
diff --git a/include/EmailNotification.php b/include/EmailNotification.php
old mode 100755
new mode 100644
diff --git a/include/Photo.php b/include/Photo.php
old mode 100755
new mode 100644
diff --git a/include/Scrape.php b/include/Scrape.php
old mode 100755
new mode 100644
diff --git a/include/acl_selectors.php b/include/acl_selectors.php
old mode 100755
new mode 100644
diff --git a/include/api.php b/include/api.php
old mode 100755
new mode 100644
index 013f4b97ae..065f14cffb
--- a/include/api.php
+++ b/include/api.php
@@ -3,6 +3,7 @@
require_once("datetime.php");
require_once("conversation.php");
require_once("oauth.php");
+ require_once("html2plain.php");
/*
* Twitter-Like API
*
@@ -82,7 +83,7 @@
$record = $r[0];
} else {
logger('API_login failure: ' . print_r($_SERVER,true), LOGGER_DEBUG);
- header('WWW-Authenticate: Basic realm="Friendika"');
+ header('WWW-Authenticate: Basic realm="Friendica"');
header('HTTP/1.0 401 Unauthorized');
die('This api requires login');
}
@@ -306,10 +307,10 @@
}
$ret = Array(
+ 'id' => intval($uinfo[0]['cid']),
'self' => intval($uinfo[0]['self']),
'uid' => intval($uinfo[0]['uid']),
- 'id' => intval($uinfo[0]['cid']),
- 'name' => $uinfo[0]['name'],
+ 'name' => (($uinfo[0]['name']) ? $uinfo[0]['name'] : $uinfo[0]['nick']),
'screen_name' => (($uinfo[0]['nick']) ? $uinfo[0]['nick'] : $uinfo[0]['name']),
'location' => ($usr) ? $usr[0]['default-location'] : '',
'profile_image_url' => $uinfo[0]['micro'],
@@ -347,6 +348,8 @@
}
function api_item_get_user(&$a, $item) {
+ global $usercache;
+
// The author is our direct contact, in a conversation with us.
if(link_compare($item['url'],$item['author-link'])) {
return api_get_user($a,$item['cid']);
@@ -362,27 +365,40 @@
list($nick, $name) = array_map("trim",explode("(",$item['author-name']));
$name=str_replace(")","",$name);
-
+
+ if ($name == '')
+ $name = $nick;
+
+ if ($nick == '')
+ $nick = $name;
+
+ // Generating a random ID
+ if (!array_key_exists($nick, $usercache))
+ $usercache[$nick] = mt_rand(2000000, 2100000);
+
$ret = array(
- 'uid' => 0,
- 'id' => 0,
+ 'id' => $usercache[$nick],
'name' => $name,
'screen_name' => $nick,
'location' => '', //$uinfo[0]['default-location'],
+ 'description' => '',
'profile_image_url' => $item['author-avatar'],
'url' => $item['author-link'],
- 'contact_url' => 0,
'protected' => false, #
+ 'followers_count' => 0,
'friends_count' => 0,
'created_at' => '',
+ 'favourites_count' => 0,
'utc_offset' => 0, #XXX: fix me
'time_zone' => '', //$uinfo[0]['timezone'],
- 'geo_enabled' => false,
'statuses_count' => 0,
+ 'following' => 1,
+ 'statusnet_blocking' => false,
+ 'notifications' => false,
+ 'uid' => 0,
+ 'contact_url' => 0,
+ 'geo_enabled' => false,
'lang' => 'en', #XXX: fix me
- 'description' => '',
- 'followers_count' => 0,
- 'favourites_count' => 0,
'contributors_enabled' => false,
'follow_request_sent' => false,
'profile_background_color' => 'cfe8f6',
@@ -393,7 +409,6 @@
'profile_background_image_url' => '',
'profile_background_tile' => false,
'profile_use_background_image' => false,
- 'notifications' => false,
'verified' => true, #XXX: fix me
'followers' => '', #XXX: fix me
'status' => array()
@@ -591,16 +606,16 @@
$in_reply_to_screen_name = $lastwall['reply_author'];
}
$status_info = array(
- 'created_at' => api_date($lastwall['created']),
- 'id' => $lastwall['contact-id'],
- 'text' => strip_tags(bbcode($lastwall['body'])),
- 'source' => (($lastwall['app']) ? $lastwall['app'] : 'web'),
+ 'text' => html2plain(bbcode($lastwall['body']), 0),
'truncated' => false,
+ 'created_at' => api_date($lastwall['created']),
'in_reply_to_status_id' => $in_reply_to_status_id,
+ 'source' => (($lastwall['app']) ? $lastwall['app'] : 'web'),
+ 'id' => $lastwall['contact-id'],
'in_reply_to_user_id' => $in_reply_to_user_id,
- 'favorited' => false,
'in_reply_to_screen_name' => $in_reply_to_screen_name,
'geo' => '',
+ 'favorited' => false,
'coordinates' => $lastwall['coord'],
'place' => $lastwall['location'],
'contributors' => ''
@@ -650,7 +665,7 @@
$user_info['status'] = array(
'created_at' => api_date($lastwall['created']),
'id' => $lastwall['contact-id'],
- 'text' => strip_tags(bbcode($lastwall['body'])),
+ 'text' => html2plain(bbcode($lastwall['body']), 0),
'source' => (($lastwall['app']) ? $lastwall['app'] : 'web'),
'truncated' => false,
'in_reply_to_status_id' => $in_reply_to_status_id,
@@ -686,10 +701,17 @@
$count = (x($_REQUEST,'count')?$_REQUEST['count']:20);
$page = (x($_REQUEST,'page')?$_REQUEST['page']-1:0);
if ($page<0) $page=0;
- $since_id = 0;//$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
+ $since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
+ $max_id = (x($_REQUEST,'max_id')?$_REQUEST['max_id']:0);
+ //$since_id = 0;//$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
$start = $page*$count;
+ //$include_entities = (x($_REQUEST,'include_entities')?$_REQUEST['include_entities']:false);
+
+ if ($max_id > 0)
+ $sql_extra = 'AND `item`.`id` <= '.intval($max_id);
+
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
@@ -722,6 +744,48 @@
api_register_func('api/statuses/home_timeline','api_statuses_home_timeline', true);
api_register_func('api/statuses/friends_timeline','api_statuses_home_timeline', true);
+ /**
+ *
+ */
+ function api_statuses_show(&$a, $type){
+ if (local_user()===false) return false;
+
+ $user_info = api_get_user($a);
+
+ // params
+ $id = intval($a->argv[3]);
+
+ logger('API: api_statuses_show: '.$id);
+
+ //$include_entities = (x($_REQUEST,'include_entities')?$_REQUEST['include_entities']:false);
+
+ $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
+ `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
+ `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
+ `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
+ FROM `item`, `contact`
+ WHERE `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0
+ AND `contact`.`id` = `item`.`contact-id`
+ AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
+ $sql_extra
+ AND `item`.`id`=%d",
+ intval($id)
+ );
+
+ $ret = api_format_items($r,$user_info);
+
+ $data = array('$status' => $ret[0]);
+ /*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/statuses/show','api_statuses_show', true);
+
+ //api_register_func('api/statuses/mentions','api_statuses_mentions', true);
+ //api_register_func('api/statuses/replies','api_statuses_mentions', true);
function api_statuses_user_timeline(&$a, $type){
@@ -740,7 +804,8 @@
$count = (x($_REQUEST,'count')?$_REQUEST['count']:20);
$page = (x($_REQUEST,'page')?$_REQUEST['page']-1:0);
if ($page<0) $page=0;
- $since_id = 0;//$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
+ $since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
+ //$since_id = 0;//$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
$start = $page*$count;
@@ -846,33 +911,64 @@
foreach($r as $item) {
localize_item($item);
$status_user = (($item['cid']==$user_info['id'])?$user_info: api_item_get_user($a,$item));
+
+ if ($item['parent']!=$item['id']) {
+ $r = q("select id from item where parent=%s and id<%s order by id desc limit 1",
+ intval($item['parent']), intval($item['id']));
+ if ($r)
+ $in_reply_to_status_id = $r[0]['id'];
+ else
+ $in_reply_to_status_id = $item['parent'];
+
+ $r = q("select `item`.`contact-id`, `contact`.nick, `item`.`author-name` from item, contact
+ where `contact`.`id` = `item`.`contact-id` and `item`.id=%d", intval($in_reply_to_status_id));
+
+ $in_reply_to_screen_name = $r[0]['author-name'];
+ $in_reply_to_user_id = $r[0]['contact-id'];
+
+ } else {
+ $in_reply_to_screen_name = '';
+ $in_reply_to_user_id = 0;
+ $in_reply_to_status_id = 0;
+ }
+
$status = array(
- 'created_at'=> api_date($item['created']),
- 'published' => api_date($item['created']),
- 'updated' => api_date($item['edited']),
- 'id' => intval($item['id']),
- 'message_id' => $item['uri'],
- 'text' => strip_tags(bbcode($item['body'])),
- 'statusnet_html' => bbcode($item['body']),
- 'source' => (($item['app']) ? $item['app'] : 'web'),
- 'url' => ($item['plink']!=''?$item['plink']:$item['author-link']),
+ 'text' => trim($item['title']." \n".html2plain(bbcode($item['body']), 0)),
'truncated' => False,
- 'in_reply_to_status_id' => ($item['parent']!=$item['id']? intval($item['parent']):''),
- 'in_reply_to_user_id' => '',
- 'favorited' => $item['starred'] ? true : false,
- 'in_reply_to_screen_name' => '',
+ 'created_at'=> api_date($item['created']),
+ 'in_reply_to_status_id' => $in_reply_to_status_id,
+ 'source' => (($item['app']) ? $item['app'] : 'web'),
+ 'id' => intval($item['id']),
+ 'in_reply_to_user_id' => $in_reply_to_user_id,
+ 'in_reply_to_screen_name' => $in_reply_to_screen_name,
'geo' => '',
- 'coordinates' => $item['coord'],
- 'place' => $item['location'],
- 'contributors' => '',
- 'annotations' => '',
- 'entities' => '',
+ 'favorited' => $item['starred'] ? true : false,
'user' => $status_user ,
- 'objecttype' => (($item['object-type']) ? $item['object-type'] : ACTIVITY_OBJ_NOTE),
- 'verb' => (($item['verb']) ? $item['verb'] : ACTIVITY_POST),
- 'self' => $a->get_baseurl()."/api/statuses/show/".$item['id'].".".$type,
- 'edit' => $a->get_baseurl()."/api/statuses/show/".$item['id'].".".$type,
+ 'statusnet_html' => bbcode($item['body']),
+ 'statusnet_conversation_id' => 0,
);
+
+ // Seesmic doesn't like the following content
+ if ($_SERVER['HTTP_USER_AGENT'] != 'Seesmic') {
+ $status2 = array(
+ 'updated' => api_date($item['edited']),
+ 'published' => api_date($item['created']),
+ 'message_id' => $item['uri'],
+ 'url' => ($item['plink']!=''?$item['plink']:$item['author-link']),
+ 'coordinates' => $item['coord'],
+ 'place' => $item['location'],
+ 'contributors' => '',
+ 'annotations' => '',
+ 'entities' => '',
+ 'objecttype' => (($item['object-type']) ? $item['object-type'] : ACTIVITY_OBJ_NOTE),
+ 'verb' => (($item['verb']) ? $item['verb'] : ACTIVITY_POST),
+ 'self' => $a->get_baseurl()."/api/statuses/show/".$item['id'].".".$type,
+ 'edit' => $a->get_baseurl()."/api/statuses/show/".$item['id'].".".$type,
+ );
+
+ $status = array_merge($status, $status2);
+ }
+
$ret[]=$status;
};
return $ret;
@@ -882,17 +978,31 @@
function api_account_rate_limit_status(&$a,$type) {
$hash = array(
+ 'reset_time_in_seconds' => strtotime('now + 1 hour'),
'remaining_hits' => (string) 150,
'hourly_limit' => (string) 150,
'reset_time' => datetime_convert('UTC','UTC','now + 1 hour',ATOM_TIME),
- 'reset_time_in_seconds' => strtotime('now + 1 hour')
);
+ if ($type == "xml")
+ $hash['resettime_in_seconds'] = $hash['reset_time_in_seconds'];
return api_apply_template('ratelimit', $type, array('$hash' => $hash));
}
api_register_func('api/account/rate_limit_status','api_account_rate_limit_status',true);
+ function api_help_test(&$a,$type) {
+
+ if ($type == 'xml')
+ $ok = "true";
+ else
+ $ok = "ok";
+
+ return api_apply_template('test', $type, array('$ok' => $ok));
+
+ }
+ api_register_func('api/help/test','api_help_test',true);
+
/**
* https://dev.twitter.com/docs/api/1/get/statuses/friends
* This function is deprecated by Twitter
@@ -1075,7 +1185,7 @@
'recipient_screen_name'=> $recipient['screen_name'],
'recipient'=> $recipient,
- 'text'=> $item['title']."\n".strip_tags(bbcode($item['body'])) ,
+ 'text'=> $item['title']."\n".html2plain(bbcode($item['body']), 0) ,
);
@@ -1144,7 +1254,7 @@
'recipient_screen_name'=> $recipient['screen_name'],
'recipient'=> $recipient,
- 'text'=> $item['title']."\n".strip_tags(bbcode($item['body'])) ,
+ 'text'=> $item['title']."\n".html2plain(bbcode($item['body']), 0) ,
);
@@ -1197,4 +1307,36 @@
api_register_func('api/oauth/request_token', 'api_oauth_request_token', false);
api_register_func('api/oauth/access_token', 'api_oauth_access_token', false);
+/*
+Not implemented by now:
+statuses/public_timeline
+statuses/mentions
+statuses/replies
+statuses/retweets_of_me
+statuses/destroy
+statuses/retweet
+friendships/create
+friendships/destroy
+friendships/exists
+friendships/show
+account/update_location
+account/update_profile_background_image
+account/update_profile_image
+favorites
+favorites/create
+favorites/destroy
+blocks/create
+blocks/destroy
+oauth/authorize
+Not implemented in status.net:
+statuses/retweeted_to_me
+statuses/retweeted_by_me
+direct_messages/destroy
+account/end_session
+account/update_delivery_device
+notifications/follow
+notifications/leave
+blocks/exists
+blocks/blocking
+*/
diff --git a/include/attach.php b/include/attach.php
old mode 100755
new mode 100644
diff --git a/include/auth.php b/include/auth.php
old mode 100755
new mode 100644
index 835616a829..1341f3bb8a
--- a/include/auth.php
+++ b/include/auth.php
@@ -94,13 +94,17 @@ else {
// Otherwise it's probably an openid.
+ try {
require_once('library/openid.php');
$openid = new LightOpenID;
$openid->identity = $openid_url;
$_SESSION['openid'] = $openid_url;
$a = get_app();
$openid->returnUrl = $a->get_baseurl(true) . '/openid';
- goaway($openid->authUrl());
+ goaway($openid->authUrl());
+ } catch (Exception $e) {
+ notice( t('We encountered a problem while logging in with the OpenID you provided. Please check the correct spelling of the ID.').'
'. t('The error message was:').' '.$e->getMessage());
+ }
// NOTREACHED
}
}
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
old mode 100755
new mode 100644
diff --git a/include/bbcode.php b/include/bbcode.php
index d69cb263f8..9befbd0f79 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -189,8 +189,29 @@ function bbcode($Text,$preserve_nl = false) {
// Check for [code] text
$Text = preg_replace("/\[code\](.*?)\[\/code\]/ism","$CodeLayout", $Text);
+ // Declare the format for [spoiler] layout
+ $SpoilerLayout = '
$1
';
+
+ // Check for [spoiler] text
+ // handle nested quotes
+ $endlessloop = 0;
+ while ((strpos($Text, "[/spoiler]") !== false) and (strpos($Text, "[spoiler]") !== false) and (++$endlessloop < 20))
+ $Text = preg_replace("/\[spoiler\](.*?)\[\/spoiler\]/ism","$SpoilerLayout", $Text);
+
+ // Check for [spoiler=Author] text
+
+ $t_wrote = t('$1 wrote:');
+
+ // handle nested quotes
+ $endlessloop = 0;
+ while ((strpos($Text, "[/spoiler]")!== false) and (strpos($Text, "[spoiler=") !== false) and (++$endlessloop < 20))
+ $Text = preg_replace("/\[spoiler=[\"\']*(.*?)[\"\']*\](.*?)\[\/spoiler\]/ism",
+ " " . $t_wrote . "
$2
",
+ $Text);
+
// Declare the format for [quote] layout
$QuoteLayout = '
$1
';
+
// Check for [quote] text
// handle nested quotes
$endlessloop = 0;
@@ -205,7 +226,7 @@ function bbcode($Text,$preserve_nl = false) {
$endlessloop = 0;
while ((strpos($Text, "[/quote]")!== false) and (strpos($Text, "[quote=") !== false) and (++$endlessloop < 20))
$Text = preg_replace("/\[quote=[\"\']*(.*?)[\"\']*\](.*?)\[\/quote\]/ism",
- "
" . $t_wrote . " $2
",
+ " " . $t_wrote . "
$2
",
$Text);
// [img=widthxheight]image source[/img]
diff --git a/include/cache.php b/include/cache.php
old mode 100755
new mode 100644
diff --git a/include/config.php b/include/config.php
index f93cb52c95..c999b76f2e 100644
--- a/include/config.php
+++ b/include/config.php
@@ -81,11 +81,13 @@ if(! function_exists('get_config')) {
* Return the value, or false if the database update failed
*/
if(! function_exists('set_config')) {
- function set_config($family,$key,$value) {
- global $a;
- // manage array value
- $dbvalue = (is_array($value)?serialize($value):$value);
+function set_config($family,$key,$value) {
+ global $a;
+
+ // manage array value
+ $dbvalue = (is_array($value)?serialize($value):$value);
+ $dbvalue = (is_bool($value) ? intval($value) : $value);
$a->config[$family][$key] = $value;
$ret = q("REPLACE INTO `config` ( `cat`, `k`, `v` ) VALUES ( '%s', '%s', '%s' ) ",
@@ -191,6 +193,7 @@ if(! function_exists('set_pconfig')) {
// manage array value
$dbvalue = (is_array($value)?serialize($value):$value);
+ $dbvalue = (is_bool($value)?serialize($value):$value);
$a->config[$uid][$family][$key] = $value;
diff --git a/include/contact_selectors.php b/include/contact_selectors.php
old mode 100755
new mode 100644
diff --git a/include/contact_widgets.php b/include/contact_widgets.php
old mode 100755
new mode 100644
index 605a3eb78e..e0f37f078f
--- a/include/contact_widgets.php
+++ b/include/contact_widgets.php
@@ -15,8 +15,6 @@ function findpeople_widget() {
$a = get_app();
- $inv = (($a->config['register_policy'] != REGISTER_CLOSED) ? t('Invite Friends') : '');
-
if(get_config('system','invitation_only')) {
$x = get_pconfig(local_user(),'system','invites_remaining');
if($x || is_site_admin()) {
@@ -34,7 +32,7 @@ function findpeople_widget() {
'$findthem' => t('Find'),
'$suggest' => t('Friend Suggestions'),
'$similar' => t('Similar Interests'),
- '$inv' => $inv
+ '$inv' => t('Invite Friends')
));
}
@@ -48,7 +46,7 @@ function networks_widget($baseurl,$selected = '') {
return '';
- $r = q("select distinct(network) from contact where uid = %d",
+ $r = q("select distinct(network) from contact where uid = %d and self = 0",
intval(local_user())
);
@@ -89,13 +87,41 @@ function fileas_widget($baseurl,$selected = '') {
$cnt = preg_match_all('/\[(.*?)\]/',$saved,$matches,PREG_SET_ORDER);
if($cnt) {
foreach($matches as $mtch) {
- $unescaped = file_tag_decode($mtch[1]);
+ $unescaped = xmlify(file_tag_decode($mtch[1]));
$terms[] = array('name' => $unescaped,'selected' => (($selected == $unescaped) ? 'selected' : ''));
}
}
return replace_macros(get_markup_template('fileas_widget.tpl'),array(
- '$title' => t('File Selections'),
+ '$title' => t('Saved Folders'),
+ '$desc' => '',
+ '$sel_all' => (($selected == '') ? 'selected' : ''),
+ '$all' => t('Everything'),
+ '$terms' => $terms,
+ '$base' => $baseurl,
+
+ ));
+}
+
+function categories_widget($baseurl,$selected = '') {
+ $a = get_app();
+
+ $saved = get_pconfig($a->profile['profile_uid'],'system','filetags');
+ if(! strlen($saved))
+ return;
+
+ $matches = false;
+ $terms = array();
+ $cnt = preg_match_all('/<(.*?)>/',$saved,$matches,PREG_SET_ORDER);
+ if($cnt) {
+ foreach($matches as $mtch) {
+ $unescaped = xmlify(file_tag_decode($mtch[1]));
+ $terms[] = array('name' => $unescaped,'selected' => (($selected == $unescaped) ? 'selected' : ''));
+ }
+ }
+
+ return replace_macros(get_markup_template('categories_widget.tpl'),array(
+ '$title' => t('Categories'),
'$desc' => '',
'$sel_all' => (($selected == '') ? 'selected' : ''),
'$all' => t('Everything'),
diff --git a/include/conversation.php b/include/conversation.php
old mode 100755
new mode 100644
index 5de4fcb51a..df92a40ed0
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -94,9 +94,9 @@ function localize_item(&$item){
}
- $A = '[url=' . $Alink . ']' . $Aname . '[/url]';
- $B = '[url=' . $Blink . ']' . $Bname . '[/url]';
- if ($Bphoto!="") $Bphoto = '[url=' . $Blink . '][img]' . $Bphoto . '[/img][/url]';
+ $A = '[url=' . zrl($Alink) . ']' . $Aname . '[/url]';
+ $B = '[url=' . zrl($Blink) . ']' . $Bname . '[/url]';
+ if ($Bphoto!="") $Bphoto = '[url=' . zrl($Blink) . '][img]' . $Bphoto . '[/img][/url]';
$item['body'] = sprintf( t('%1$s is now friends with %2$s'), $A, $B)."\n\n\n".$Bphoto;
@@ -108,8 +108,8 @@ function localize_item(&$item){
if(count($r)==0) return;
$obj=$r[0];
- $author = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
- $objauthor = '[url=' . $obj['author-link'] . ']' . $obj['author-name'] . '[/url]';
+ $author = '[url=' . zrl($item['author-link']) . ']' . $item['author-name'] . '[/url]';
+ $objauthor = '[url=' . zrl($obj['author-link']) . ']' . $obj['author-name'] . '[/url]';
switch($obj['verb']){
case ACTIVITY_POST:
@@ -158,14 +158,21 @@ function localize_item(&$item){
$target = $r[0];
$Bname = $target['author-name'];
$Blink = $target['author-link'];
- $A = '[url=' . $Alink . ']' . $Aname . '[/url]';
- $B = '[url=' . $Blink . ']' . $Bname . '[/url]';
+ $A = '[url=' . zrl($Alink) . ']' . $Aname . '[/url]';
+ $B = '[url=' . zrl($Blink) . ']' . $Bname . '[/url]';
$P = '[url=' . $target['plink'] . ']' . t('post/item') . '[/url]';
$item['body'] = sprintf( t('%1$s marked %2$s\'s %3$s as favorite'), $A, $B, $P)."\n";
}
}
}
+ $matches = null;
+ if(preg_match_all('/@\[url=(.*?)\]/is',$item['body'],$matches,PREG_SET_ORDER)) {
+ foreach($matches as $mtch) {
+ if(! strpos($mtch[1],'zrl='))
+ $item['body'] = str_replace($mtch[0],'@[url=' . zrl($mtch[1]). ']',$item['body']);
+ }
+ }
}
@@ -243,7 +250,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
$threads = array();
$threadsid = -1;
- if(count($items)) {
+ if($items && count($items)) {
if($mode === 'network-new' || $mode === 'search' || $mode === 'community') {
@@ -276,13 +283,16 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
if($item['author-link'] && (! $item['author-name']))
$profile_name = $item['author-link'];
+
+
$sp = false;
$profile_link = best_link_url($item,$sp);
- if($sp)
- $sparkle = ' sparkle';
if($profile_link === 'mailbox')
$profile_link = '';
-
+ if($sp)
+ $sparkle = ' sparkle';
+ else
+ $profile_link = zrl($profile_link);
$normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
if(($normalised != 'mailbox') && (x($a->contacts[$normalised])))
@@ -484,7 +494,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
// This will have been stored in $a->page_contact by our calling page.
// Put this person on the left of the wall-to-wall notice.
- $owner_url = $a->page_contact['url'];
+ $owner_url = zrl($a->page_contact['url']);
$owner_photo = $a->page_contact['thumb'];
$owner_name = $a->page_contact['name'];
$template = $wallwall;
@@ -501,10 +511,12 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
$commentww = 'ww';
// If it is our contact, use a friendly redirect link
if((link_compare($item['owner-link'],$item['url']))
- && ($item['network'] === 'dfrn')) {
+ && ($item['network'] === NETWORK_DFRN)) {
$owner_url = $redirect_url;
$osparkle = ' sparkle';
}
+ else
+ $owner_url = zrl($owner_url);
}
}
@@ -520,9 +532,12 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
if ($shareable) $likebuttons['share'] = array( t('Share this'), t('share'));
}
+ $qc = $qcomment = null;
- $qc = ((local_user()) ? get_pconfig(local_user(),'qcomment','words') : null);
- $qcomment = (($qc) ? explode("\n",$qc) : null);
+ if(in_array('qcomment',$a->plugins)) {
+ $qc = ((local_user()) ? get_pconfig(local_user(),'qcomment','words') : null);
+ $qcomment = (($qc) ? explode("\n",$qc) : null);
+ }
if(($show_comment_box) || (($show_comment_box == false) && ($override_comment_box == false) && ($item['last-child']))) {
$comment = replace_macros($cmnt_tpl,array(
@@ -580,7 +595,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
'classtagger' => "",
);
}
- $filer = t("file as");
+ $filer = t("save to folder");
}
@@ -596,14 +611,14 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
if($item['author-link'] && (! $item['author-name']))
$profile_name = $item['author-link'];
-
$sp = false;
$profile_link = best_link_url($item,$sp);
- if($sp)
- $sparkle = ' sparkle';
-
if($profile_link === 'mailbox')
$profile_link = '';
+ if($sp)
+ $sparkle = ' sparkle';
+ else
+ $profile_link = zrl($profile_link);
$normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
if(($normalised != 'mailbox') && (x($a->contacts,$normalised)))
@@ -767,8 +782,10 @@ function item_photo_menu($item){
$photos_link = $profile_link . "?url=photos";
$profile_link = $profile_link . "?url=profile";
$pm_url = $a->get_baseurl($ssl_state) . '/message/new/' . $cid;
+ $zurl = '';
}
else {
+ $profile_link = zrl($profile_link);
if(local_user() && local_user() == $item['uid'] && link_compare($item['url'],$item['author-link'])) {
$cid = $item['contact-id'];
}
@@ -795,7 +812,7 @@ function item_photo_menu($item){
$menu = Array(
t("View status") => $status_link,
t("View profile") => $profile_link,
- t("View photos") => $photos_link,
+ t("View photos") => $photos_link,
t("View recent") => $posts_link,
t("Edit contact") => $contact_url,
t("Send PM") => $pm_url,
@@ -828,6 +845,8 @@ function like_puller($a,$item,&$arr,$mode) {
$url = $a->get_baseurl(true) . '/redir/' . $item['contact-id'];
$sparkle = ' class="sparkle" ';
}
+ else
+ $url = zrl($url);
if(! ((isset($arr[$item['parent'] . '-l'])) && (is_array($arr[$item['parent'] . '-l']))))
$arr[$item['parent'] . '-l'] = array();
if(! isset($arr[$item['parent']]))
@@ -896,7 +915,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
'$vidurl' => t("Please enter a video link/URL:"),
'$audurl' => t("Please enter an audio link/URL:"),
'$term' => t('Tag term:'),
- '$fileas' => t('File as:'),
+ '$fileas' => t('Save to Folder:'),
'$whereareu' => t('Where are you right now?')
));
@@ -955,6 +974,8 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
'$shortnoloc' => t('clear location'),
'$title' => "",
'$placeholdertitle' => t('Set title'),
+ '$category' => "",
+ '$placeholdercategory' => t('Categories (comma-separated list)'),
'$wait' => t('Please wait'),
'$permset' => t('Permission settings'),
'$shortpermset' => t('permissions'),
diff --git a/include/cronhooks.php b/include/cronhooks.php
old mode 100755
new mode 100644
diff --git a/include/crypto.php b/include/crypto.php
old mode 100755
new mode 100644
diff --git a/include/datetime.php b/include/datetime.php
old mode 100755
new mode 100644
diff --git a/include/dba.php b/include/dba.php
old mode 100755
new mode 100644
index 5beea7a3ac..76cc0bc7b9
--- a/include/dba.php
+++ b/include/dba.php
@@ -207,8 +207,10 @@ function q($sql) {
unset($args[0]);
if($db && $db->connected) {
- $ret = $db->q(vsprintf($sql,$args));
- return $ret;
+ $stmt = vsprintf($sql,$args);
+ if($stmt === false)
+ logger('dba: vsprintf error: ' . print_r(debug_backtrace(),true));
+ return $db->q($stmt);
}
/**
diff --git a/include/delivery.php b/include/delivery.php
old mode 100755
new mode 100644
index 532dcd6991..794b8f27a3
--- a/include/delivery.php
+++ b/include/delivery.php
@@ -321,6 +321,14 @@ function delivery_run($argv, $argc){
$x[0]['writable'] = 1;
}
+ $ssl_policy = get_config('system','ssl_policy');
+ fix_contact_ssl_policy($x[0],$ssl_policy);
+
+ // If we are setup as a soapbox we aren't accepting input from this person
+
+ if($x[0]['page-flags'] == PAGE_SOAPBOX)
+ break;
+
require_once('library/simplepie/simplepie.inc');
logger('mod-delivery: local delivery');
local_delivery($x[0],$atom);
diff --git a/include/diaspora.php b/include/diaspora.php
old mode 100755
new mode 100644
index 1b5af42cd9..06df9c24a4
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -9,6 +9,12 @@ require_once('include/queue_fn.php');
function diaspora_dispatch_public($msg) {
+ $enabled = intval(get_config('system','diaspora_enabled'));
+ if(! $enabled) {
+ logger('mod-diaspora: disabled');
+ return;
+ }
+
$r = q("SELECT `user`.* FROM `user` WHERE `user`.`uid` IN ( SELECT `contact`.`uid` FROM `contact` WHERE `contact`.`network` = '%s' AND `contact`.`addr` = '%s' ) AND `account_expired` = 0 ",
dbesc(NETWORK_DIASPORA),
dbesc($msg['author'])
@@ -29,6 +35,12 @@ function diaspora_dispatch($importer,$msg) {
$ret = 0;
+ $enabled = intval(get_config('system','diaspora_enabled'));
+ if(! $enabled) {
+ logger('mod-diaspora: disabled');
+ return;
+ }
+
// php doesn't like dashes in variable names
$msg['message'] = str_replace(
@@ -688,9 +700,9 @@ function diaspora_post($importer,$xml) {
// don't link tags that are already embedded in links
- if(preg_match('/\[(.*?)' . preg_quote($tag) . '(.*?)\]/',$body))
+ if(preg_match('/\[(.*?)' . preg_quote($tag,'/') . '(.*?)\]/',$body))
continue;
- if(preg_match('/\[(.*?)\]\((.*?)' . preg_quote($tag) . '(.*?)\)/',$body))
+ if(preg_match('/\[(.*?)\]\((.*?)' . preg_quote($tag,'/') . '(.*?)\)/',$body))
continue;
$basetag = str_replace('_',' ',substr($tag,1));
@@ -853,9 +865,9 @@ function diaspora_reshare($importer,$xml) {
// don't link tags that are already embedded in links
- if(preg_match('/\[(.*?)' . preg_quote($tag) . '(.*?)\]/',$body))
+ if(preg_match('/\[(.*?)' . preg_quote($tag,'/') . '(.*?)\]/',$body))
continue;
- if(preg_match('/\[(.*?)\]\((.*?)' . preg_quote($tag) . '(.*?)\)/',$body))
+ if(preg_match('/\[(.*?)\]\((.*?)' . preg_quote($tag,'/') . '(.*?)\)/',$body))
continue;
@@ -1094,9 +1106,9 @@ function diaspora_comment($importer,$xml,$msg) {
// don't link tags that are already embedded in links
- if(preg_match('/\[(.*?)' . preg_quote($tag) . '(.*?)\]/',$body))
+ if(preg_match('/\[(.*?)' . preg_quote($tag,'/') . '(.*?)\]/',$body))
continue;
- if(preg_match('/\[(.*?)\]\((.*?)' . preg_quote($tag) . '(.*?)\)/',$body))
+ if(preg_match('/\[(.*?)\]\((.*?)' . preg_quote($tag,'/') . '(.*?)\)/',$body))
continue;
@@ -1737,7 +1749,7 @@ function diaspora_retraction($importer,$xml) {
contact_remove($contact['id']);
}
elseif($type === 'Post') {
- $r = q("select * from item where guid = '%s' and uid = %d limit 1",
+ $r = q("select * from item where guid = '%s' and uid = %d and not file like '%%[%%' limit 1",
dbesc('guid'),
intval($importer['uid'])
);
@@ -1785,7 +1797,7 @@ function diaspora_signed_retraction($importer,$xml,$msg) {
}
if($type === 'StatusMessage') {
- $r = q("select * from item where guid = '%s' and uid = %d limit 1",
+ $r = q("select * from item where guid = '%s' and uid = %d and not file like '%%[%%' limit 1",
dbesc($guid),
intval($importer['uid'])
);
@@ -1920,6 +1932,7 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
$images = array();
+ $title = $item['title'];
$body = $item['body'];
/*
@@ -1944,9 +1957,12 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
}
}
*/
-
$body = xmlify(html_entity_decode(bb2diaspora($body)));
+ if(strlen($title))
+ $body = xmlify('**' . html_entity_decode($title) . '**' . "\n") . $body;
+
+
if($item['attach']) {
$cnt = preg_match_all('/href=\"(.*?)\"(.*?)title=\"(.*?)\"/ism',$item['attach'],$matches,PREG_SET_ORDER);
if(cnt) {
@@ -2267,6 +2283,11 @@ function diaspora_send_mail($item,$owner,$contact) {
function diaspora_transmit($owner,$contact,$slap,$public_batch) {
+ $enabled = intval(get_config('system','diaspora_enabled'));
+ if(! $enabled) {
+ return 200;
+ }
+
$a = get_app();
$logid = random_string(4);
$dest_url = (($public_batch) ? $contact['batch'] : $contact['notify']);
diff --git a/include/directory.php b/include/directory.php
old mode 100755
new mode 100644
diff --git a/include/email.php b/include/email.php
old mode 100755
new mode 100644
index 8ea8145fb6..b43ae0dc1c
--- a/include/email.php
+++ b/include/email.php
@@ -74,7 +74,7 @@ function email_msg_headers($mbox,$uid) {
}
-function email_get_msg($mbox,$uid) {
+function email_get_msg($mbox,$uid, $reply) {
$ret = array();
$struc = (($mbox && $uid) ? @imap_fetchstructure($mbox,$uid,FT_UID) : null);
@@ -114,7 +114,7 @@ function email_get_msg($mbox,$uid) {
$ret['body'] = removegpg($ret['body']);
$msg = removesig($ret['body']);
$ret['body'] = $msg['body'];
- $ret['body'] = convertquote($ret['body'], false);
+ $ret['body'] = convertquote($ret['body'], $reply);
if (trim($html) != '')
$ret['body'] = removelinebreak($ret['body']);
@@ -250,7 +250,7 @@ function email_header_encode($in_str, $charset) {
// remove trailing spacer and
// add start and end delimiters
- $spacer = preg_quote($spacer);
+ $spacer = preg_quote($spacer,'/');
$out_str = preg_replace("/" . $spacer . "$/", "", $out_str);
$out_str = $start . $out_str . $end;
}
diff --git a/include/enotify.php b/include/enotify.php
old mode 100755
new mode 100644
index a505f1f040..8385bdec59
--- a/include/enotify.php
+++ b/include/enotify.php
@@ -5,6 +5,12 @@ function notification($params) {
logger('notification: entry', LOGGER_DEBUG);
$a = get_app();
+
+ // from here on everything is in the recipients language
+
+ push_lang($params['language']);
+
+
$banner = t('Friendica Notification');
$product = FRIENDICA_PLATFORM;
$siteurl = z_path();
@@ -153,9 +159,33 @@ function notification($params) {
}
- // from here on everything is in the recipients language
+ if($params['type'] == NOTIFY_SYSTEM) {
+
+ }
+
+ $h = array(
+ 'params' => $params,
+ 'subject' => $subject,
+ 'preamble' => $preamble,
+ 'epreamble' => $epreamble,
+ 'body' => $body,
+ 'sitelink' => $sitelink,
+ 'tsitelink' => $tsitelink,
+ 'hsitelink' => $hsitelink,
+ 'itemlink' => $itemlink
+ );
+
+ call_hooks('enotify',$h);
+
+ $subject = $h['subject'];
+ $preamble = $h['preamble'];
+ $epreamble = $h['epreamble'];
+ $body = $h['body'];
+ $sitelink = $h['sitelink'];
+ $tsitelink = $h['tsitelink'];
+ $hsitelink = $h['hsitelink'];
+ $itemlink = $h['itemlink'];
- push_lang($params['language']);
require_once('include/html2bbcode.php');
@@ -207,8 +237,10 @@ function notification($params) {
);
if($r)
$notify_id = $r[0]['id'];
- else
+ else {
+ pop_lang();
return;
+ }
$itemlink = $a->get_baseurl() . '/notify/view/' . $notify_id;
$msg = replace_macros($epreamble,array('$itemlink' => $itemlink));
@@ -219,11 +251,10 @@ function notification($params) {
);
-
// send email notification if notification preferences permit
require_once('bbcode.php');
- if(intval($params['notify_flags']) & intval($params['type'])) {
+ if((intval($params['notify_flags']) & intval($params['type'])) || $params['type'] == NOTIFY_SYSTEM) {
logger('notification: sending notification email');
diff --git a/include/event.php b/include/event.php
old mode 100755
new mode 100644
diff --git a/include/expire.php b/include/expire.php
old mode 100755
new mode 100644
diff --git a/include/fcontact.php b/include/fcontact.php
old mode 100755
new mode 100644
diff --git a/include/group.php b/include/group.php
old mode 100755
new mode 100644
diff --git a/include/html2bbcode.php b/include/html2bbcode.php
old mode 100755
new mode 100644
diff --git a/include/html2plain.php b/include/html2plain.php
index 2a4cf66391..fe0e3326e8 100644
--- a/include/html2plain.php
+++ b/include/html2plain.php
@@ -1,9 +1,15 @@
(.*?)<\/a>/is';
+ preg_match_all($pattern, $message, $result, PREG_SET_ORDER);
+
+ $urls = array();
+ foreach ($result as $treffer) {
+ // A list of some links that should be ignored
+ $list = array("/user/", "/tag/", "/profile/", "/search?search=", "mailto:", "/u/", "/node/",
+ "//facebook.com/profile.php?id=", "//plus.google.com/");
+ foreach ($list as $listitem)
+ if (strpos($treffer[1], $listitem) !== false)
+ $ignore = true;
+
+ if (!$ignore)
+ $urls[$treffer[1]] = $treffer[1];
+ }
+ return($urls);
+}
+
+function html2plain($html, $wraplength = 75, $compact = false)
{
global $lang;
@@ -93,22 +118,16 @@ function html2plain($html)
$message = str_replace(array("\n<", ">\n", "\r", "\n", "\xC3\x82\xC2\xA0"), array("<", ">", " ", " ", ""), $message);
$message = preg_replace('= [\s]*=i', " ", $message);
- // nach ... suchen, die ... miteinander vergleichen und bei Gleichheit durch ein einzelnes ... ersetzen.
- $pattern = '/(.*?)<\/a>/is';
- preg_match_all($pattern, $message, $result, PREG_SET_ORDER);
+ // Collecting all links
+ $urls = collecturls($message);
- foreach ($result as $treffer) {
- if ($treffer[1] == $treffer[2]) {
- $search = ''.$treffer[1].'';
- $message = str_replace($search, $treffer[1], $message);
- }
- }
@$doc->loadHTML($message);
node2bbcode($doc, 'html', array(), '', '');
node2bbcode($doc, 'body', array(), '', '');
// MyBB-Auszeichnungen
+ /*
node2bbcode($doc, 'span', array('style'=>'text-decoration: underline;'), '_', '_');
node2bbcode($doc, 'span', array('style'=>'font-style: italic;'), '/', '/');
node2bbcode($doc, 'span', array('style'=>'font-weight: bold;'), '*', '*');
@@ -117,8 +136,12 @@ function html2plain($html)
node2bbcode($doc, 'b', array(), '*', '*');
node2bbcode($doc, 'i', array(), '/', '/');
node2bbcode($doc, 'u', array(), '_', '_');
+ */
- node2bbcode($doc, 'blockquote', array(), '[quote]', "[/quote]\n");
+ if ($compact)
+ node2bbcode($doc, 'blockquote', array(), "»", "«");
+ else
+ node2bbcode($doc, 'blockquote', array(), '[quote]', "[/quote]\n");
node2bbcode($doc, 'br', array(), "\n", '');
@@ -143,16 +166,25 @@ function html2plain($html)
node2bbcode($doc, 'h5', array(), "\n\n*", "*\n");
node2bbcode($doc, 'h6', array(), "\n\n*", "*\n");
- node2bbcode($doc, 'a', array('href'=>'/(.+)/'), ' $1', '', true);
- node2bbcode($doc, 'img', array('alt'=>'/(.+)/'), '$1', '');
- node2bbcode($doc, 'img', array('title'=>'/(.+)/'), '$1', '');
- node2bbcode($doc, 'img', array(), '', '');
- node2bbcode($doc, 'img', array('src'=>'/(.+)/'), '[img]$1', '[/img]');
+ // Problem: there is no reliable way to detect if it is a link to a tag or profile
+ //node2bbcode($doc, 'a', array('href'=>'/(.+)/'), ' $1 ', '', true);
+ node2bbcode($doc, 'a', array('href'=>'/(.+)/', 'rel'=>'oembed'), ' $1 ', '', true);
+ //node2bbcode($doc, 'img', array('alt'=>'/(.+)/'), '$1', '');
+ //node2bbcode($doc, 'img', array('title'=>'/(.+)/'), '$1', '');
+ //node2bbcode($doc, 'img', array(), '', '');
+ if (!$compact)
+ node2bbcode($doc, 'img', array('src'=>'/(.+)/'), '[img]$1', '[/img]');
+ else
+ node2bbcode($doc, 'img', array('src'=>'/(.+)/'), '', '');
+
+ node2bbcode($doc, 'iframe', array('src'=>'/(.+)/'), ' $1 ', '', true);
$message = $doc->saveHTML();
- $message = str_replace("[img]", "", $message);
- $message = str_replace("[/img]", "", $message);
+ if (!$compact) {
+ $message = str_replace("[img]", "", $message);
+ $message = str_replace("[/img]", "", $message);
+ }
// was ersetze ich da?
// Irgendein stoerrisches UTF-Zeug
@@ -168,12 +200,20 @@ function html2plain($html)
$message = html_entity_decode($message, ENT_QUOTES, 'UTF-8');
+ if (!$compact) {
+ $counter = 1;
+ foreach ($urls as $id=>$url)
+ if (strpos($message, $url) == false)
+ $message .= "\n".$url." ";
+ //$message .= "\n[".($counter++)."] ".$url;
+ }
+
do {
$oldmessage = $message;
$message = str_replace("\n\n\n", "\n\n", $message);
} while ($oldmessage != $message);
- $message = quotelevel(trim($message));
+ $message = quotelevel(trim($message), $wraplength);
return(trim($message));
}
diff --git a/include/items.php b/include/items.php
old mode 100755
new mode 100644
index 5a297c83ef..ee69605349
--- a/include/items.php
+++ b/include/items.php
@@ -7,14 +7,11 @@ require_once('include/crypto.php');
function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0) {
- // default permissions - anonymous user
-
- if(! strlen($owner_nick))
- killme();
+ $sitefeed = ((strlen($owner_nick)) ? false : true); // not yet implemented, need to rewrite huge chunks of following logic
$public_feed = (($dfrn_id) ? false : true);
- $starred = false;
- $converse = false;
+ $starred = false; // not yet implemented, possible security issues
+ $converse = false;
if($public_feed && $a->argc > 2) {
for($x = 2; $x < $a->argc; $x++) {
@@ -25,6 +22,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
}
}
+ // default permissions - anonymous user
$sql_extra = " AND `allow_cid` = '' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = '' ";
@@ -418,7 +416,7 @@ function get_atom_elements($feed,$item) {
// the wild, by sanitising it and converting supported tags to bbcode before we rip out any remaining
// html.
- if((strpos($res['body'],'<') !== false) || (strpos($res['body'],'>') !== false)) {
+ if((strpos($res['body'],'<') !== false) && (strpos($res['body'],'>') !== false)) {
$res['body'] = reltoabs($res['body'],$base_url);
@@ -431,13 +429,21 @@ function get_atom_elements($feed,$item) {
// we shouldn't need a whitelist, because the bbcode converter
// will strip out any unsupported tags.
- // $config->set('HTML.Allowed', 'p,b,a[href],i');
$purifier = new HTMLPurifier($config);
$res['body'] = $purifier->purify($res['body']);
- $res['body'] = html2bbcode($res['body']);
+ $res['body'] = @html2bbcode($res['body']);
}
+ elseif(! $have_real_body) {
+
+ // it's not one of our messages and it has no tags
+ // so it's probably just text. We'll escape it just to be safe.
+
+ $res['body'] = escape_tags($res['body']);
+ }
+
+ // this tag is obsolete but we keep it for really old sites
$allow = $item->get_item_tags(NAMESPACE_DFRN,'comment-allow');
if($allow && $allow[0]['data'] == 1)
@@ -1092,12 +1098,23 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
$postvars = array();
$sent_dfrn_id = hex2bin((string) $res->dfrn_id);
$challenge = hex2bin((string) $res->challenge);
+ $perm = (($res->perm) ? $res->perm : null);
$dfrn_version = (float) (($res->dfrn_version) ? $res->dfrn_version : 2.0);
$rino_allowed = ((intval($res->rino) === 1) ? 1 : 0);
$page = (($owner['page-flags'] == PAGE_COMMUNITY) ? 1 : 0);
$final_dfrn_id = '';
+ if($perm) {
+ if((($perm == 'rw') && (! intval($contact['writable'])))
+ || (($perm == 'r') && (intval($contact['writable'])))) {
+ q("update contact set writable = %d where id = %d limit 1",
+ intval(($perm == 'rw') ? 1 : 0),
+ intval($contact['id'])
+ );
+ $contact['writable'] = (string) 1 - intval($contact['writable']);
+ }
+ }
if(($contact['duplex'] && strlen($contact['pubkey']))
|| ($owner['page-flags'] == PAGE_COMMUNITY && strlen($contact['pubkey']))
@@ -1437,7 +1454,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
}
if($deleted && is_array($contact)) {
$r = q("SELECT `item`.*, `contact`.`self` FROM `item` left join `contact` on `item`.`contact-id` = `contact`.`id`
- WHERE `uri` = '%s' AND `item`.`uid` = %d AND `contact-id` = %d LIMIT 1",
+ WHERE `uri` = '%s' AND `item`.`uid` = %d AND `contact-id` = %d AND NOT `item`.`file` LIKE '%%[%%' LIMIT 1",
dbesc($uri),
intval($importer['uid']),
intval($contact['id'])
@@ -1582,9 +1599,10 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
if(count($r)) {
if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {
- $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+ $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($datarray['title']),
dbesc($datarray['body']),
+ dbesc($datarray['tag']),
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
dbesc($item_id),
intval($importer['uid'])
@@ -1727,9 +1745,10 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
if(count($r)) {
if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {
- $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+ $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($datarray['title']),
dbesc($datarray['body']),
+ dbesc($datarray['tag']),
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
dbesc($item_id),
intval($importer['uid'])
@@ -1800,7 +1819,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
// but otherwise there's a possible data mixup on the sender's system.
// the tgroup delivery code called from item_store will correct it if it's a forum,
// but we're going to unconditionally correct it here so that the post will always be owned by our contact.
- logger('local_delivery: Correcting item owner.', LOGGER_DEBUG);
+ logger('consume_feed: Correcting item owner.', LOGGER_DEBUG);
$datarray['owner-name'] = $contact['name'];
$datarray['owner-link'] = $contact['url'];
$datarray['owner-avatar'] = $contact['thumb'];
@@ -1896,6 +1915,14 @@ function local_delivery($importer,$data) {
);
if(count($r)) {
$fid = $r[0]['id'];
+
+ // OK, we do. Do we already have an introduction for this person ?
+ $r = q("select id from intro where uid = %d and fid = %d limit 1",
+ intval($fsugg['uid']),
+ intval($fid)
+ );
+ if(count($r))
+ return 0;
}
if(! $fid)
$r = q("INSERT INTO `fcontact` ( `name`,`url`,`photo`,`request` ) VALUES ( '%s', '%s', '%s', '%s' ) ",
@@ -1916,6 +1943,7 @@ function local_delivery($importer,$data) {
else
return 0;
+
$hash = random_string();
$r = q("INSERT INTO `intro` ( `uid`, `fid`, `contact-id`, `note`, `hash`, `datetime`, `blocked` )
@@ -2036,7 +2064,7 @@ function local_delivery($importer,$data) {
if($deleted) {
$r = q("SELECT `item`.*, `contact`.`self` FROM `item` left join contact on `item`.`contact-id` = `contact`.`id`
- WHERE `uri` = '%s' AND `item`.`uid` = %d AND `contact-id` = %d LIMIT 1",
+ WHERE `uri` = '%s' AND `item`.`uid` = %d AND `contact-id` = %d AND NOT `item`.`file` LIKE '%%[%%' LIMIT 1",
dbesc($uri),
intval($importer['importer_uid']),
intval($importer['id'])
@@ -2332,9 +2360,10 @@ function local_delivery($importer,$data) {
if(count($r)) {
if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {
- $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+ $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($datarray['title']),
dbesc($datarray['body']),
+ dbesc($datarray['tag']),
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
dbesc($item_id),
intval($importer['importer_uid'])
@@ -2497,9 +2526,10 @@ function local_delivery($importer,$data) {
if(count($r)) {
if((x($datarray,'edited') !== false) && (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {
- $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+ $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($datarray['title']),
dbesc($datarray['body']),
+ dbesc($datarray['tag']),
dbesc(datetime_convert('UTC','UTC',$datarray['edited'])),
dbesc($item_id),
intval($importer['importer_uid'])
@@ -2925,6 +2955,11 @@ function item_expire($uid,$days) {
foreach($r as $item) {
+ // don't expire filed items
+
+ if(strpos($item['file'],'[') !== false)
+ continue;
+
// Only expire posts, not photos and photo comments
if($expire_photos==0 && strlen($item['resource-id']))
diff --git a/include/message.php b/include/message.php
old mode 100755
new mode 100644
index 7ad80ae9c6..377d7c715b
--- a/include/message.php
+++ b/include/message.php
@@ -1,4 +1,5 @@
get_baseurl() . ':' . local_user() . ':' . $hash ;
+
+ $convid = 0;
+ $reply = false;
+
+ require_once('include/Scrape.php');
+
+ $me = probe_url($replyto);
+
+ if(! $me['name'])
+ return -2;
+
+ $conv_guid = get_guid();
+
+ $recip_handle = $recipient['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3);
+
+ $sender_nick = basename($replyto);
+ $sender_host = substr($replyto,strpos($replyto,'://')+3);
+ $sender_host = substr($sender_host,0,strpos($sender_host,'/'));
+ $sender_handle = $sender_nick . '@' . $sender_host;
+
+ $handles = $recip_handle . ';' . $sender_handle;
+
+ $r = q("insert into conv (uid,guid,creator,created,updated,subject,recips) values(%d, '%s', '%s', '%s', '%s', '%s', '%s') ",
+ intval(local_user()),
+ dbesc($conv_guid),
+ dbesc($sender_handle),
+ dbesc(datetime_convert()),
+ dbesc(datetime_convert()),
+ dbesc($subject),
+ dbesc($handles)
+ );
+
+ $r = q("select * from conv where guid = '%s' and uid = %d limit 1",
+ dbesc($conv_guid),
+ intval($recipient['uid'])
+ );
+ if(count($r))
+ $convid = $r[0]['id'];
+
+ if(! $convid) {
+ logger('send message: conversation not found.');
+ return -4;
+ }
+
+ $r = q("INSERT INTO `mail` ( `uid`, `guid`, `convid`, `from-name`, `from-photo`, `from-url`,
+ `contact-id`, `title`, `body`, `seen`, `reply`, `replied`, `uri`, `parent-uri`, `created`, `unknown`)
+ VALUES ( %d, '%s', %d, '%s', '%s', '%s', %d, '%s', '%s', %d, %d, %d, '%s', '%s', '%s', %d )",
+ intval($recipient['uid']),
+ dbesc(get_guid()),
+ intval($convid),
+ dbesc($me['name']),
+ dbesc($me['photo']),
+ dbesc($me['url']),
+ 0,
+ dbesc($subject),
+ dbesc($body),
+ 0,
+ 0,
+ 0,
+ dbesc($uri),
+ dbesc($replyto),
+ datetime_convert(),
+ 1
+ );
+
+ return 0;
+
+}
diff --git a/include/msgclean.php b/include/msgclean.php
index 284ad1ce4b..eabb47788a 100644
--- a/include/msgclean.php
+++ b/include/msgclean.php
@@ -13,7 +13,7 @@ function savereplace($pattern, $replace, $text)
function unifyattributionline($message)
{
- $quotestr = array('quote', 'collapsed');
+ $quotestr = array('quote', 'spoiler');
foreach ($quotestr as $quote) {
$message = savereplace('/----- Original Message -----\s.*?From: "([^<"].*?)" <(.*?)>\s.*?To: (.*?)\s*?Cc: (.*?)\s*?Sent: (.*?)\s.*?Subject: ([^\n].*)\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
diff --git a/include/nav.php b/include/nav.php
old mode 100755
new mode 100644
index f40e92dbce..2c9c643a92
--- a/include/nav.php
+++ b/include/nav.php
@@ -69,7 +69,9 @@ function nav(&$a) {
* "Home" should also take you home from an authenticated remote profile connection
*/
- $homelink = ((x($_SESSION,'visitor_home')) ? $_SESSION['visitor_home'] : '');
+ $homelink = get_my_url();
+ if(! $homelink)
+ $homelink = ((x($_SESSION,'visitor_home')) ? $_SESSION['visitor_home'] : '');
if(($a->module != 'home') && (! (local_user())))
$nav['home'] = array($homelink, t('Home'), "", t('Home Page'));
diff --git a/include/network.php b/include/network.php
old mode 100755
new mode 100644
index 22157ff188..38d0980d50
--- a/include/network.php
+++ b/include/network.php
@@ -364,6 +364,9 @@ function lrdd($uri, $debug = false) {
logger('lrdd: host_meta: ' . $xml, LOGGER_DATA);
+ if(! stristr($xml,'query("//link[@type='application/json+oembed']");
foreach($entries as $e){
$href = $e->getAttributeNode("href")->nodeValue;
- $txt = fetch_url($href);
+ $txt = fetch_url($href . '&maxwidth=425');
+ break;
}
}
}
@@ -46,7 +47,7 @@ function oembed_fetch_url($embedurl){
if ($txt==false || $txt==""){
// try oohembed service
- $ourl = "http://oohembed.com/oohembed/?url=".urlencode($embedurl);
+ $ourl = "http://oohembed.com/oohembed/?url=".urlencode($embedurl).'&maxwidth=425';
$txt = fetch_url($ourl);
}
diff --git a/include/pgettext.php b/include/pgettext.php
old mode 100755
new mode 100644
diff --git a/include/plugin.php b/include/plugin.php
old mode 100755
new mode 100644
index 8280b1022e..e37ae84357
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -249,6 +249,7 @@ function get_theme_info($theme){
list($k,$v) = array_map("trim", explode(":",$l,2));
$k= strtolower($k);
if ($k=="author"){
+
$r=preg_match("|([^<]+)<([^>]+)>|", $v, $m);
if ($r) {
$info['author'][] = array('name'=>$m[1], 'link'=>$m[2]);
@@ -276,3 +277,13 @@ function get_theme_info($theme){
return $info;
}}
+
+function get_theme_screenshot($theme) {
+ $a = get_app();
+ $exts = array('.png','.jpg');
+ foreach($exts as $ext) {
+ if(file_exists('view/theme/' . $theme . '/screenshot' . $ext))
+ return($a->get_baseurl() . '/view/theme/' . $theme . '/screenshot' . $ext);
+ }
+ return($a->get_baseurl() . '/images/blank.png');
+}
diff --git a/include/poller.php b/include/poller.php
old mode 100755
new mode 100644
index 8262c1d605..90a97867c2
--- a/include/poller.php
+++ b/include/poller.php
@@ -504,7 +504,12 @@ function poller_run($argv, $argc){
//$datarray['title'] = notags(trim($meta->subject));
$datarray['created'] = datetime_convert('UTC','UTC',$meta->date);
- $r = email_get_msg($mbox,$msg_uid);
+ // Is it reply?
+ $reply = ((substr(strtolower($datarray['title']), 0, 3) == "re:") or
+ (substr(strtolower($datarray['title']), 0, 3) == "re-") or
+ (raw_refs != ""));
+
+ $r = email_get_msg($mbox,$msg_uid, $reply);
if(! $r) {
logger("Mail: can't fetch msg ".$msg_uid);
continue;
diff --git a/include/profile_advanced.php b/include/profile_advanced.php
old mode 100755
new mode 100644
diff --git a/include/profile_selectors.php b/include/profile_selectors.php
old mode 100755
new mode 100644
diff --git a/include/profile_update.php b/include/profile_update.php
old mode 100755
new mode 100644
diff --git a/include/queue.php b/include/queue.php
old mode 100755
new mode 100644
diff --git a/include/queue_fn.php b/include/queue_fn.php
old mode 100755
new mode 100644
diff --git a/include/quoteconvert.php b/include/quoteconvert.php
index 3aee93234f..2a6d28370a 100644
--- a/include/quoteconvert.php
+++ b/include/quoteconvert.php
@@ -124,7 +124,7 @@ function removetofu($message)
}
if ($quotestart != 0) {
- $message = trim(substr($message, 0, $quotestart))."\n[collapsed]\n".substr($message, $quotestart+7, -8).'[/collapsed]';
+ $message = trim(substr($message, 0, $quotestart))."\n[spoiler]".substr($message, $quotestart+7, -8).'[/spoiler]';
}
return($message);
diff --git a/include/remoteupdate.php b/include/remoteupdate.php
old mode 100755
new mode 100644
diff --git a/include/salmon.php b/include/salmon.php
old mode 100755
new mode 100644
diff --git a/include/security.php b/include/security.php
old mode 100755
new mode 100644
index 19e91eb63d..66622fd331
--- a/include/security.php
+++ b/include/security.php
@@ -9,6 +9,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive
$_SESSION['authenticated'] = 1;
$_SESSION['page_flags'] = $user_record['page-flags'];
$_SESSION['my_url'] = $a->get_baseurl() . '/profile/' . $user_record['nickname'];
+ $_SESSION['my_address'] = $user_record['nickname'] . '@' . substr($a->get_baseurl(),strpos($a->get_baseurl(),'://')+3);
$_SESSION['addr'] = $_SERVER['REMOTE_ADDR'];
$a->user = $user_record;
diff --git a/include/session.php b/include/session.php
old mode 100755
new mode 100644
diff --git a/include/socgraph.php b/include/socgraph.php
old mode 100755
new mode 100644
index b2f5455094..3f51940492
--- a/include/socgraph.php
+++ b/include/socgraph.php
@@ -237,12 +237,14 @@ function suggestion_query($uid, $start = 0, $limit = 80) {
$r = q("SELECT count(glink.gcid) as `total`, gcontact.* from gcontact
left join glink on glink.gcid = gcontact.id
- where uid = %d and not gcontact.nurl in ( select nurl from contact where uid = %d)
+ where uid = %d and not gcontact.nurl in ( select nurl from contact where uid = %d )
+ and not gcontact.name in ( select name from contact where uid = %d )
and not gcontact.id in ( select gcid from gcign where uid = %d )
group by glink.gcid order by total desc limit %d, %d ",
intval($uid),
intval($uid),
intval($uid),
+ intval($uid),
intval($start),
intval($limit)
);
@@ -252,11 +254,13 @@ function suggestion_query($uid, $start = 0, $limit = 80) {
$r2 = q("SELECT gcontact.* from gcontact
left join glink on glink.gcid = gcontact.id
- where glink.uid = 0 and glink.cid = 0 and not gcontact.nurl in ( select nurl from contact where uid = %d)
+ where glink.uid = 0 and glink.cid = 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 )
order by rand() limit %d, %d ",
intval($uid),
intval($uid),
+ intval($uid),
intval($start),
intval($limit)
);
diff --git a/include/system_unavailable.php b/include/system_unavailable.php
old mode 100755
new mode 100644
diff --git a/include/template_processor.php b/include/template_processor.php
old mode 100755
new mode 100644
diff --git a/include/text.php b/include/text.php
index 92a74eb49e..5456b5ad3e 100644
--- a/include/text.php
+++ b/include/text.php
@@ -205,7 +205,6 @@ function hex2bin($s) {
return '';
if(! ctype_xdigit($s)) {
- logger('hex2bin: illegal input: ' . print_r(debug_backtrace(), true));
return($s);
}
@@ -226,6 +225,9 @@ if(! function_exists('paginate')) {
function paginate(&$a) {
$o = '';
$stripped = preg_replace('/(&page=[0-9]*)/','',$a->query_string);
+
+// $stripped = preg_replace('/&zrl=(.*?)([\?&]|$)/ism','',$stripped);
+
$stripped = str_replace('q=','',$stripped);
$stripped = trim($stripped,'/');
$pagenum = $a->pager['page'];
@@ -610,6 +612,8 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
$url = $redirect_url;
$sparkle = ' sparkle';
}
+ else
+ $url = zrl($url);
}
$click = ((x($contact,'click')) ? ' onclick="' . $contact['click'] . '" ' : '');
if($click)
@@ -724,6 +728,8 @@ function smilies($s, $sample = false) {
'\\o/',
'o.O',
'O.o',
+ 'o_O',
+ 'O_o',
":'(",
":-!",
":-/",
@@ -758,6 +764,8 @@ function smilies($s, $sample = false) {
'',
'',
'',
+ '',
+ '',
'',
'',
'',
@@ -919,7 +927,7 @@ function prepare_body($item,$attach = false) {
foreach($matches as $mtch) {
if(strlen($x))
$x .= ',';
- $x .= file_tag_decode($mtch[1]);
+ $x .= xmlify(file_tag_decode($mtch[1]));
}
if(strlen($x))
$s .= '