mirror of
https://github.com/friendica/friendica
synced 2025-02-13 01:56:21 +01:00
Merge remote-tracking branch 'friendica/master'
This commit is contained in:
commit
ea4be0db89
161 changed files with 3486 additions and 1041 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -13,6 +13,9 @@ addon
|
|||
#ignore documentation, it should be newly built
|
||||
doc/api
|
||||
|
||||
#ignore reports, should be generted with every build
|
||||
report/
|
||||
|
||||
#ignore config files from eclipse, we don't want IDE files in our repository
|
||||
.project
|
||||
.buildpath
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
#Options -Indexes
|
||||
Options -Indexes
|
||||
AddType application/x-java-archive .jar
|
||||
AddType audio/ogg .oga
|
||||
|
||||
<FilesMatch "\.(out|log)$">
|
||||
Deny from all
|
||||
</FilesMatch>
|
||||
<Files "(include|library)">
|
||||
Deny from all
|
||||
</Files>
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine on
|
||||
|
|
54
boot.php
54
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.1278' );
|
||||
define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
|
||||
define ( 'DB_UPDATE_VERSION', 1131 );
|
||||
define ( 'FRIENDICA_VERSION', '2.3.1285' );
|
||||
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
||||
define ( 'DB_UPDATE_VERSION', 1132 );
|
||||
|
||||
define ( 'EOL', "<br />\r\n" );
|
||||
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
||||
|
@ -286,7 +286,12 @@ class App {
|
|||
|
||||
startup();
|
||||
|
||||
$this->scheme = ((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'])) ? 'https' : 'http' );
|
||||
$this->scheme = 'http';
|
||||
if(x($_SERVER,'HTTPS') && $_SERVER['HTTPS'])
|
||||
$this->scheme = 'https';
|
||||
elseif(x($_SERVER,'SERVER_PORT') && (intval($_SERVER['SERVER_PORT']) == 443))
|
||||
$this->scheme = 'https';
|
||||
|
||||
|
||||
if(x($_SERVER,'SERVER_NAME')) {
|
||||
$this->hostname = $_SERVER['SERVER_NAME'];
|
||||
|
@ -379,11 +384,22 @@ class App {
|
|||
|
||||
$scheme = $this->scheme;
|
||||
|
||||
if(x($this->config,'ssl_policy')) {
|
||||
if(($ssl) || ($this->config['ssl_policy'] == SSL_POLICY_FULL))
|
||||
$scheme = 'https';
|
||||
if(($this->config['ssl_policy'] == SSL_POLICY_SELFSIGN) && (local_user() || x($_POST,'auth-params')))
|
||||
if((x($this->config,'system')) && (x($this->config['system'],'ssl_policy'))) {
|
||||
if(intval($this->config['system']['ssl_policy']) === intval(SSL_POLICY_FULL))
|
||||
$scheme = 'https';
|
||||
|
||||
// We need to populate the $ssl flag across the entire program before turning this on.
|
||||
// Basically, we'll have $ssl = true on any links which can only be seen by a logged in user
|
||||
// (and also the login link). Anything seen by an outsider will have it turned off.
|
||||
// At present, setting SSL_POLICY_SELFSIGN will only force remote contacts to update their
|
||||
// contact links to this site with "http:" if they are currently using "https:"
|
||||
|
||||
// if($this->config['system']['ssl_policy'] == SSL_POLICY_SELFSIGN) {
|
||||
// if($ssl)
|
||||
// $scheme = 'https';
|
||||
// else
|
||||
// $scheme = 'http';
|
||||
// }
|
||||
}
|
||||
|
||||
$this->baseurl = $scheme . "://" . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' );
|
||||
|
@ -685,6 +701,7 @@ function get_guid($size=16) {
|
|||
|
||||
if(! function_exists('login')) {
|
||||
function login($register = false, $hiddens=false) {
|
||||
$a = get_app();
|
||||
$o = "";
|
||||
$reg = false;
|
||||
if ($register) {
|
||||
|
@ -704,23 +721,26 @@ function login($register = false, $hiddens=false) {
|
|||
|
||||
}
|
||||
|
||||
$dest_url = $a->get_baseurl(true) . '/' . $a->query_string;
|
||||
|
||||
$o .= replace_macros($tpl,array(
|
||||
'$logout' => t('Logout'),
|
||||
'$login' => t('Login'),
|
||||
|
||||
'$dest_url' => $dest_url,
|
||||
'$logout' => t('Logout'),
|
||||
'$login' => t('Login'),
|
||||
|
||||
'$lname' => array('username', t('Nickname or Email address: ') , '', ''),
|
||||
'$lpassword' => array('password', t('Password: '), '', ''),
|
||||
|
||||
'$openid' => !$noid,
|
||||
'$lopenid' => array('openid_url', t('Or login using OpenID: '),'',''),
|
||||
'$lopenid' => array('openid_url', t('Or login using OpenID: '),'',''),
|
||||
|
||||
'$hiddens' => $hiddens,
|
||||
'$hiddens' => $hiddens,
|
||||
|
||||
'$register' => $reg,
|
||||
'$register' => $reg,
|
||||
|
||||
'$lostpass' => t('Forgot your password?'),
|
||||
'$lostlink' => t('Password Reset'),
|
||||
'$lostpass' => t('Forgot your password?'),
|
||||
'$lostlink' => t('Password Reset'),
|
||||
));
|
||||
|
||||
call_hooks('login_hook',$o);
|
||||
|
@ -1209,7 +1229,7 @@ function current_theme(){
|
|||
$a = get_app();
|
||||
|
||||
$system_theme = ((isset($a->config['system']['theme'])) ? $a->config['system']['theme'] : '');
|
||||
$theme_name = ((is_array($_SESSION) && x($_SESSION,'theme')) ? $_SESSION['theme'] : $system_theme);
|
||||
$theme_name = ((isset($_SESSION) && x($_SESSION,'theme')) ? $_SESSION['theme'] : $system_theme);
|
||||
|
||||
if($theme_name && file_exists('view/theme/' . $theme_name . '/style.css'))
|
||||
return($theme_name);
|
||||
|
@ -1335,7 +1355,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
|
|||
array(
|
||||
'label' => t('Profile'),
|
||||
'url' => $url.'/?tab=profile',
|
||||
'sel' => (($tab=='profile')?'active':''),
|
||||
'sel' => ((isset($tab) && $tab=='profile')?'active':''),
|
||||
),
|
||||
array(
|
||||
'label' => t('Photos'),
|
||||
|
|
46
build.xml
46
build.xml
|
@ -1,14 +1,49 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project name="friendica" default="test">
|
||||
|
||||
<!-- ====================================================== -->
|
||||
<!-- Target: clean-test -->
|
||||
<!-- deletes directories with old test reports -->
|
||||
<!-- ====================================================== -->
|
||||
<target name="clean-test">
|
||||
<delete dir="report" />
|
||||
</target>
|
||||
|
||||
<!-- ====================================================== -->
|
||||
<!-- Target: prepare-test -->
|
||||
<!-- creates directories for test reports -->
|
||||
<!-- ====================================================== -->
|
||||
<target name="prepare-test" depends="clean-test">
|
||||
<mkdir dir="report" />
|
||||
</target>
|
||||
|
||||
<!-- =================================== -->
|
||||
<!-- Target: test -->
|
||||
<!-- this target runs all test files -->
|
||||
<!-- =================================== -->
|
||||
|
||||
<target name="test">
|
||||
<!-- there are no tests by now, so, nothing to do -->
|
||||
<target name="test" depends="prepare-test">
|
||||
<!-- coverage-setup database="./report/coverage-database">
|
||||
<fileset dir=".">
|
||||
<include name="**/*.php" />
|
||||
<exclude name="*test.php"/>
|
||||
<exclude name="index.php"/>
|
||||
<exclude name="library/**"/>
|
||||
<exclude name="doc/**"/>
|
||||
<exclude name=".."/>
|
||||
</fileset>
|
||||
</coverage-setup -->
|
||||
<phpunit printsummary="true">
|
||||
<batchtest>
|
||||
<fileset dir="tests">
|
||||
<include name="*test.php" />
|
||||
</fileset>
|
||||
</batchtest>
|
||||
<formatter type="xml" todir="report" outfile="testlog.xml" />
|
||||
</phpunit>
|
||||
<phpunitreport infile="report/testlog.xml" todir="report" />
|
||||
<!-- coverage-report outfile="report/coverage-database">
|
||||
<report todir="report" styledir="/home/phing/etc" />
|
||||
</coverage-report -->
|
||||
</target>
|
||||
|
||||
<!-- ===================================================== -->
|
||||
|
@ -31,6 +66,9 @@
|
|||
<docblox title="Friendica API" destdir="./doc/api">
|
||||
<fileset dir=".">
|
||||
<include name="**/*.php" />
|
||||
<include name="README"/>
|
||||
<include name="INSTALL.txt"/>
|
||||
<include name="LICENSE"/>
|
||||
</fileset>
|
||||
</docblox>
|
||||
</target>
|
||||
|
|
|
@ -92,6 +92,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
|
|||
`blocked` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`readonly` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`writable` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`forum` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`hidden` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`pending` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`rating` tinyint(1) NOT NULL DEFAULT '0',
|
||||
|
@ -116,6 +117,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
|
|||
KEY `dfrn-id` (`dfrn-id`),
|
||||
KEY `blocked` (`blocked`),
|
||||
KEY `readonly` (`readonly`),
|
||||
KEY `forum` (`forum`),
|
||||
KEY `hidden` (`hidden`),
|
||||
KEY `pending` (`pending`),
|
||||
KEY `closeness` (`closeness`)
|
||||
|
@ -636,6 +638,7 @@ CREATE TABLE IF NOT EXISTS `mailacct` (
|
|||
`mailbox` CHAR( 255 ) NOT NULL,
|
||||
`user` CHAR( 255 ) NOT NULL ,
|
||||
`pass` TEXT NOT NULL ,
|
||||
`reply_to` CHAR( 255 ) NOT NULL ,
|
||||
`action` INT NOT NULL ,
|
||||
`movetofolder` CHAR(255) NOT NULL ,
|
||||
`pubmail` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
|
|
|
@ -79,3 +79,9 @@ $a->config['system']['theme'] = 'duepuntozero';
|
|||
// By default allow pseudonyms
|
||||
|
||||
$a->config['system']['no_regfullname'] = true;
|
||||
|
||||
// If set to true the priority settings of ostatus contacts are used
|
||||
$a->config['system']['ostatus_use_priority'] = false;
|
||||
|
||||
// If enabled all items are cached in the given directory
|
||||
$a->config['system']['itemcache'] = "";
|
||||
|
|
|
@ -113,11 +113,13 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
|
|||
$str_nets = implode(',',$x['networks']);
|
||||
$sql_extra .= " AND `network` IN ( $str_nets ) ";
|
||||
}
|
||||
|
||||
$tabindex = (x($options, 'tabindex') ? "tabindex=\"" . $options["tabindex"] . "\"" : "");
|
||||
|
||||
if($x['single'])
|
||||
$o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"" . $x['size'] . "\" >\r\n";
|
||||
$o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"" . $x['size'] . "\" $tabindex >\r\n";
|
||||
else
|
||||
$o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"" . $x['size'] . "$\" >\r\n";
|
||||
$o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"" . $x['size'] . "$\" $tabindex >\r\n";
|
||||
|
||||
$r = q("SELECT `id`, `name`, `url`, `network` FROM `contact`
|
||||
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `notify` != ''
|
||||
|
@ -156,7 +158,7 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
|
|||
|
||||
|
||||
|
||||
function contact_select($selname, $selclass, $preselected = false, $size = 4, $privmail = false, $celeb = false, $privatenet = false) {
|
||||
function contact_select($selname, $selclass, $preselected = false, $size = 4, $privmail = false, $celeb = false, $privatenet = false, $tabindex = null) {
|
||||
|
||||
$a = get_app();
|
||||
|
||||
|
@ -178,12 +180,12 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
|
|||
$sql_extra .= " AND `network` IN ( 'dfrn', 'mail', 'face', 'dspr' ) ";
|
||||
}
|
||||
|
||||
|
||||
$tabindex = ($tabindex > 0 ? "tabindex=\"$tabindex\"" : "");
|
||||
|
||||
if($privmail)
|
||||
$o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"$size\" >\r\n";
|
||||
$o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"$size\" $tabindex >\r\n";
|
||||
else
|
||||
$o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\" >\r\n";
|
||||
$o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\" $tabindex >\r\n";
|
||||
|
||||
$r = q("SELECT `id`, `name`, `url`, `network` FROM `contact`
|
||||
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `notify` != ''
|
||||
|
|
|
@ -75,4 +75,33 @@ function networks_widget($baseurl,$selected = '') {
|
|||
));
|
||||
}
|
||||
|
||||
function fileas_widget($baseurl,$selected = '') {
|
||||
$a = get_app();
|
||||
if(! local_user())
|
||||
return '';
|
||||
|
||||
$saved = get_pconfig(local_user(),'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 = 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'),
|
||||
'$desc' => '',
|
||||
'$sel_all' => (($selected == '') ? 'selected' : ''),
|
||||
'$all' => t('Everything'),
|
||||
'$terms' => $terms,
|
||||
'$base' => $baseurl,
|
||||
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -186,6 +186,8 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
|
||||
require_once('bbcode.php');
|
||||
|
||||
$ssl_state = ((local_user()) ? true : false);
|
||||
|
||||
$profile_owner = 0;
|
||||
$page_writeable = false;
|
||||
|
||||
|
@ -345,7 +347,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
'like' => '',
|
||||
'dislike' => '',
|
||||
'comment' => '',
|
||||
'conv' => (($preview) ? '' : array('href'=> $a->get_baseurl() . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))),
|
||||
'conv' => (($preview) ? '' : array('href'=> $a->get_baseurl($ssl_state) . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))),
|
||||
'previewing' => $previewing,
|
||||
'wait' => t('Please wait'),
|
||||
);
|
||||
|
@ -375,7 +377,8 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
$comments[$item['parent']] = 1;
|
||||
else
|
||||
$comments[$item['parent']] += 1;
|
||||
}
|
||||
} elseif(! x($comments,$item['parent']))
|
||||
$comments[$item['parent']] = 0; // avoid notices later on
|
||||
}
|
||||
|
||||
// map all the like/dislike activities for each parent item
|
||||
|
@ -460,7 +463,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
$comment_lastcollapsed = true;
|
||||
}
|
||||
|
||||
$redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
|
||||
$redirect_url = $a->get_baseurl($ssl_state) . '/redir/' . $item['cid'] ;
|
||||
|
||||
$lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
|
||||
|| strlen($item['deny_cid']) || strlen($item['deny_gid']))))
|
||||
|
@ -542,7 +545,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
}
|
||||
|
||||
$edpost = (((($profile_owner == local_user()) && ($toplevelpost) && (intval($item['wall']) == 1)) || ($mode === 'notes'))
|
||||
? array($a->get_baseurl()."/editpost/".$item['id'], t("Edit"))
|
||||
? array($a->get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit"))
|
||||
: False);
|
||||
|
||||
|
||||
|
@ -559,24 +562,28 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
);
|
||||
|
||||
$star = false;
|
||||
$filer = false;
|
||||
|
||||
$isstarred = "unstarred";
|
||||
if ($profile_owner == local_user() && $toplevelpost) {
|
||||
$isstarred = (($item['starred']) ? "starred" : "unstarred");
|
||||
if ($profile_owner == local_user()) {
|
||||
if($toplevelpost) {
|
||||
$isstarred = (($item['starred']) ? "starred" : "unstarred");
|
||||
|
||||
$star = array(
|
||||
'do' => t("add star"),
|
||||
'undo' => t("remove star"),
|
||||
'toggle' => t("toggle star status"),
|
||||
'classdo' => (($item['starred']) ? "hidden" : ""),
|
||||
'classundo' => (($item['starred']) ? "" : "hidden"),
|
||||
'starred' => t('starred'),
|
||||
'tagger' => t("add tag"),
|
||||
'classtagger' => "",
|
||||
);
|
||||
$star = array(
|
||||
'do' => t("add star"),
|
||||
'undo' => t("remove star"),
|
||||
'toggle' => t("toggle star status"),
|
||||
'classdo' => (($item['starred']) ? "hidden" : ""),
|
||||
'classundo' => (($item['starred']) ? "" : "hidden"),
|
||||
'starred' => t('starred'),
|
||||
'tagger' => t("add tag"),
|
||||
'classtagger' => "",
|
||||
);
|
||||
}
|
||||
$filer = t("file as");
|
||||
}
|
||||
|
||||
|
||||
|
||||
$photo = $item['photo'];
|
||||
$thumb = $item['thumb'];
|
||||
|
||||
|
@ -642,7 +649,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
// template to use to render item (wall, walltowall, search)
|
||||
'template' => $template,
|
||||
|
||||
'type' => implode("",array_slice(split("/",$item['verb']),-1)),
|
||||
'type' => implode("",array_slice(explode("/",$item['verb']),-1)),
|
||||
'tags' => $tags,
|
||||
'body' => template_escape($body),
|
||||
'text' => strip_tags(template_escape($body)),
|
||||
|
@ -670,6 +677,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
'edpost' => $edpost,
|
||||
'isstarred' => $isstarred,
|
||||
'star' => $star,
|
||||
'filer' => $filer,
|
||||
'drop' => $drop,
|
||||
'vote' => $likebuttons,
|
||||
'like' => $like,
|
||||
|
@ -691,7 +699,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
|
||||
$page_template = get_markup_template("conversation.tpl");
|
||||
$o .= replace_macros($page_template, array(
|
||||
'$baseurl' => $a->get_baseurl(),
|
||||
'$baseurl' => $a->get_baseurl($ssl_state),
|
||||
'$mode' => $mode,
|
||||
'$user' => $a->user,
|
||||
'$threads' => $threads,
|
||||
|
@ -701,7 +709,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
return $o;
|
||||
}}
|
||||
|
||||
function best_link_url($item,&$sparkle) {
|
||||
function best_link_url($item,&$sparkle,$ssl_state = false) {
|
||||
|
||||
$a = get_app();
|
||||
|
||||
|
@ -713,7 +721,7 @@ function best_link_url($item,&$sparkle) {
|
|||
if((local_user()) && (local_user() == $item['uid'])) {
|
||||
if(isset($a->contacts) && x($a->contacts,$clean_url)) {
|
||||
if($a->contacts[$clean_url]['network'] === NETWORK_DFRN) {
|
||||
$best_url = $a->get_baseurl() . '/redir/' . $a->contacts[$clean_url]['id'];
|
||||
$best_url = $a->get_baseurl($ssl_state) . '/redir/' . $a->contacts[$clean_url]['id'];
|
||||
$sparkle = true;
|
||||
}
|
||||
else
|
||||
|
@ -734,10 +742,14 @@ function best_link_url($item,&$sparkle) {
|
|||
if(! function_exists('item_photo_menu')){
|
||||
function item_photo_menu($item){
|
||||
$a = get_app();
|
||||
|
||||
if (local_user() && (! count($a->contacts)))
|
||||
load_contact_links(local_user());
|
||||
|
||||
$ssl_state = false;
|
||||
|
||||
if(local_user()) {
|
||||
$ssl_state = true;
|
||||
if(! count($a->contacts))
|
||||
load_contact_links(local_user());
|
||||
}
|
||||
$contact_url="";
|
||||
$pm_url="";
|
||||
$status_link="";
|
||||
|
@ -745,7 +757,7 @@ function item_photo_menu($item){
|
|||
$posts_link="";
|
||||
|
||||
$sparkle = false;
|
||||
$profile_link = best_link_url($item,$sparkle);
|
||||
$profile_link = best_link_url($item,$sparkle,$ssl_state);
|
||||
if($profile_link === 'mailbox')
|
||||
$profile_link = '';
|
||||
|
||||
|
@ -754,7 +766,7 @@ function item_photo_menu($item){
|
|||
$status_link = $profile_link . "?url=status";
|
||||
$photos_link = $profile_link . "?url=photos";
|
||||
$profile_link = $profile_link . "?url=profile";
|
||||
$pm_url = $a->get_baseurl() . '/message/new/' . $cid;
|
||||
$pm_url = $a->get_baseurl($ssl_state) . '/message/new/' . $cid;
|
||||
}
|
||||
else {
|
||||
if(local_user() && local_user() == $item['uid'] && link_compare($item['url'],$item['author-link'])) {
|
||||
|
@ -765,8 +777,19 @@ function item_photo_menu($item){
|
|||
}
|
||||
}
|
||||
if(($cid) && (! $item['self'])) {
|
||||
$contact_url = $a->get_baseurl() . '/contacts/' . $cid;
|
||||
$posts_link = $a->get_baseurl() . '/network/?cid=' . $cid;
|
||||
$contact_url = $a->get_baseurl($ssl_state) . '/contacts/' . $cid;
|
||||
$posts_link = $a->get_baseurl($ssl_state) . '/network/?cid=' . $cid;
|
||||
|
||||
$clean_url = normalise_link($item['author-link']);
|
||||
|
||||
if((local_user()) && (local_user() == $item['uid'])) {
|
||||
if(isset($a->contacts) && x($a->contacts,$clean_url)) {
|
||||
if($a->contacts[$clean_url]['network'] === NETWORK_DIASPORA) {
|
||||
$pm_url = $a->get_baseurl($ssl_state) . '/message/new/' . $cid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$menu = Array(
|
||||
|
@ -802,7 +825,7 @@ function like_puller($a,$item,&$arr,$mode) {
|
|||
if((activity_match($item['verb'],$verb)) && ($item['id'] != $item['parent'])) {
|
||||
$url = $item['author-link'];
|
||||
if((local_user()) && (local_user() == $item['uid']) && ($item['network'] === 'dfrn') && (! $item['self']) && (link_compare($item['author-link'],$item['url']))) {
|
||||
$url = $a->get_baseurl() . '/redir/' . $item['contact-id'];
|
||||
$url = $a->get_baseurl(true) . '/redir/' . $item['contact-id'];
|
||||
$sparkle = ' class="sparkle" ';
|
||||
}
|
||||
if(! ((isset($arr[$item['parent'] . '-l'])) && (is_array($arr[$item['parent'] . '-l']))))
|
||||
|
@ -864,7 +887,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
|
|||
|
||||
$a->page['htmlhead'] .= replace_macros($tpl, array(
|
||||
'$newpost' => 'true',
|
||||
'$baseurl' => $a->get_baseurl(),
|
||||
'$baseurl' => $a->get_baseurl(true),
|
||||
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
|
||||
'$geotag' => $geotag,
|
||||
'$nickname' => $x['nickname'],
|
||||
|
@ -873,6 +896,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:'),
|
||||
'$whereareu' => t('Where are you right now?'),
|
||||
'$title' => t('Enter a title for this item')
|
||||
));
|
||||
|
@ -914,8 +938,8 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
|
|||
|
||||
$o .= replace_macros($tpl,array(
|
||||
'$return_path' => $a->cmd,
|
||||
'$action' => $a->get_baseurl().'/item',
|
||||
'$share' => (($x['button']) ? $x['button'] : t('Share')),
|
||||
'$action' => $a->get_baseurl(true) . '/item',
|
||||
'$share' => (x($x,'button') ? $x['button'] : t('Share')),
|
||||
'$upload' => t('Upload photo'),
|
||||
'$shortupload' => t('upload photo'),
|
||||
'$attach' => t('Attach file'),
|
||||
|
@ -938,7 +962,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
|
|||
'$ptyp' => (($notes_cid) ? 'note' : 'wall'),
|
||||
'$content' => '',
|
||||
'$post_id' => '',
|
||||
'$baseurl' => $a->get_baseurl(),
|
||||
'$baseurl' => $a->get_baseurl(true),
|
||||
'$defloc' => $x['default_location'],
|
||||
'$visitor' => $x['visitor'],
|
||||
'$pvisit' => (($notes_cid) ? 'none' : $x['visitor']),
|
||||
|
@ -980,8 +1004,8 @@ function conv_sort($arr,$order) {
|
|||
usort($parents,'sort_thr_commented');
|
||||
|
||||
if(count($parents))
|
||||
foreach($parents as $x)
|
||||
$x['children'] = array();
|
||||
foreach($parents as $i=>$_x)
|
||||
$parents[$i]['children'] = array();
|
||||
|
||||
foreach($arr as $x) {
|
||||
if($x['id'] != $x['parent']) {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
require_once('include/datetime.php');
|
||||
|
||||
/**
|
||||
*
|
||||
* MySQL database class
|
||||
|
@ -104,19 +106,17 @@ class dba {
|
|||
|
||||
logger('dba: ' . $str );
|
||||
}
|
||||
else {
|
||||
|
||||
/**
|
||||
* If dbfail.out exists, we will write any failed calls directly to it,
|
||||
* regardless of any logging that may or may nor be in effect.
|
||||
* These usually indicate SQL syntax errors that need to be resolved.
|
||||
*/
|
||||
/**
|
||||
* If dbfail.out exists, we will write any failed calls directly to it,
|
||||
* regardless of any logging that may or may nor be in effect.
|
||||
* These usually indicate SQL syntax errors that need to be resolved.
|
||||
*/
|
||||
|
||||
if($result === false) {
|
||||
logger('dba: ' . printable($sql) . ' returned false.');
|
||||
if(file_exists('dbfail.out'))
|
||||
file_put_contents('dbfail.out', printable($sql) . ' returned false' . "\n", FILE_APPEND);
|
||||
}
|
||||
if($result === false) {
|
||||
logger('dba: ' . printable($sql) . ' returned false.');
|
||||
if(file_exists('dbfail.out'))
|
||||
file_put_contents('dbfail.out', datetime_convert() . "\n" . printable($sql) . ' returned false' . "\n", FILE_APPEND);
|
||||
}
|
||||
|
||||
if(($result === true) || ($result === false))
|
||||
|
@ -140,7 +140,7 @@ class dba {
|
|||
|
||||
|
||||
if($this->debug)
|
||||
logger('dba: ' . printable(print_r($r, true)), LOGGER_DATA);
|
||||
logger('dba: ' . printable(print_r($r, true)));
|
||||
return($r);
|
||||
}
|
||||
|
||||
|
|
|
@ -256,7 +256,8 @@ function delivery_run($argv, $argc){
|
|||
'$picdate' => xmlify(datetime_convert('UTC','UTC',$owner['avatar-date'] . '+00:00' , ATOM_TIME)) ,
|
||||
'$uridate' => xmlify(datetime_convert('UTC','UTC',$owner['uri-date'] . '+00:00' , ATOM_TIME)) ,
|
||||
'$namdate' => xmlify(datetime_convert('UTC','UTC',$owner['name-date'] . '+00:00' , ATOM_TIME)) ,
|
||||
'$birthday' => $birthday
|
||||
'$birthday' => $birthday,
|
||||
'$community' => (($owner['page-flags'] == PAGE_COMMUNITY) ? '<dfrn:community>1</dfrn:community>' : '')
|
||||
));
|
||||
|
||||
foreach($items as $item) {
|
||||
|
@ -435,8 +436,8 @@ function delivery_run($argv, $argc){
|
|||
$headers .= 'Reply-to: ' . $reply_to . "\n";
|
||||
|
||||
// for testing purposes: Collect exported mails
|
||||
$file = tempnam("/tmp/friendica/", "mail-out-");
|
||||
file_put_contents($file, json_encode($it));
|
||||
// $file = tempnam("/tmp/friendica/", "mail-out-");
|
||||
// file_put_contents($file, json_encode($it));
|
||||
|
||||
$headers .= 'Message-Id: <' . iri2msgid($it['uri']). '>' . "\n";
|
||||
|
||||
|
@ -446,30 +447,16 @@ function delivery_run($argv, $argc){
|
|||
|
||||
if($it['uri'] !== $it['parent-uri']) {
|
||||
$headers .= 'References: <' . iri2msgid($it['parent-uri']) . '>' . "\n";
|
||||
if(! strlen($it['title'])) {
|
||||
if(!strlen($it['title'])) {
|
||||
$r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' LIMIT 1",
|
||||
dbesc($it['parent-uri'])
|
||||
);
|
||||
if(count($r)) {
|
||||
$subtitle = $r[0]['title'];
|
||||
if($subtitle) {
|
||||
if(strncasecmp($subtitle,'RE:',3))
|
||||
$subject = $subtitle;
|
||||
else
|
||||
$subject = 'Re: ' . $subtitle;
|
||||
}
|
||||
}
|
||||
dbesc($it['parent-uri']));
|
||||
|
||||
if(count($r) AND ($r[0]['title'] != ''))
|
||||
$subject = $r[0]['title'];
|
||||
}
|
||||
if(strncasecmp($subject,'RE:',3))
|
||||
$subject = 'Re: '.$subject;
|
||||
}
|
||||
/*$headers .= 'MIME-Version: 1.0' . "\n";
|
||||
//$headers .= 'Content-Type: text/html; charset=UTF-8' . "\n";
|
||||
$headers .= 'Content-Type: text/plain; charset=UTF-8' . "\n";
|
||||
$headers .= 'Content-Transfer-Encoding: 8bit' . "\n\n";
|
||||
$html = prepare_body($it);
|
||||
//$message = '<html><body>' . $html . '</body></html>';
|
||||
$message = html2plain($html);
|
||||
logger('notifier: email delivery to ' . $addr);
|
||||
mail($addr, $subject, $message, $headers);*/
|
||||
email_send($addr, $subject, $headers, $it);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -1159,6 +1159,48 @@ function diaspora_comment($importer,$xml,$msg) {
|
|||
|
||||
proc_run('php','include/notifier.php','comment',$message_id);
|
||||
}
|
||||
|
||||
$myconv = q("SELECT `author-link`, `author-avatar`, `parent` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d AND `parent` != 0 ",
|
||||
dbesc($parent_item['uri']),
|
||||
intval($importer['uid'])
|
||||
);
|
||||
|
||||
if(count($myconv)) {
|
||||
$importer_url = $a->get_baseurl() . '/profile/' . $importer['nickname'];
|
||||
|
||||
foreach($myconv as $conv) {
|
||||
|
||||
// now if we find a match, it means we're in this conversation
|
||||
|
||||
if(! link_compare($conv['author-link'],$importer_url))
|
||||
continue;
|
||||
|
||||
require_once('include/enotify.php');
|
||||
|
||||
$conv_parent = $conv['parent'];
|
||||
|
||||
notification(array(
|
||||
'type' => NOTIFY_COMMENT,
|
||||
'notify_flags' => $importer['notify-flags'],
|
||||
'language' => $importer['language'],
|
||||
'to_name' => $importer['username'],
|
||||
'to_email' => $importer['email'],
|
||||
'uid' => $importer['uid'],
|
||||
'item' => $datarray,
|
||||
'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id,
|
||||
'source_name' => $datarray['author-name'],
|
||||
'source_link' => $datarray['author-link'],
|
||||
'source_photo' => $datarray['author-avatar'],
|
||||
'verb' => ACTIVITY_POST,
|
||||
'otype' => 'item',
|
||||
'parent' => $conv_parent,
|
||||
|
||||
));
|
||||
|
||||
// only send one notification
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
require_once('include/html2plain.php');
|
||||
require_once('include/msgclean.php');
|
||||
require_once('include/quoteconvert.php');
|
||||
|
||||
function email_connect($mailbox,$username,$password) {
|
||||
if(! function_exists('imap_open'))
|
||||
|
@ -54,7 +56,7 @@ function email_msg_headers($mbox,$uid) {
|
|||
$raw_header = (($mbox && $uid) ? @imap_fetchheader($mbox,$uid,FT_UID) : '');
|
||||
$raw_header = str_replace("\r",'',$raw_header);
|
||||
$ret = array();
|
||||
$h = split("\n",$raw_header);
|
||||
$h = explode("\n",$raw_header);
|
||||
if(count($h))
|
||||
foreach($h as $line ) {
|
||||
if (preg_match("/^[a-zA-Z]/", $line)) {
|
||||
|
@ -86,6 +88,7 @@ function email_get_msg($mbox,$uid) {
|
|||
|
||||
if(! $struc->parts) {
|
||||
$ret['body'] = email_get_part($mbox,$uid,$struc,0, 'html');
|
||||
$html = $ret['body'];
|
||||
|
||||
if (trim($ret['body']) == '')
|
||||
$ret['body'] = email_get_part($mbox,$uid,$struc,0, 'plain');
|
||||
|
@ -107,6 +110,17 @@ function email_get_msg($mbox,$uid) {
|
|||
else
|
||||
$ret['body'] = $text;
|
||||
}
|
||||
|
||||
$ret['body'] = removegpg($ret['body']);
|
||||
$msg = removesig($ret['body']);
|
||||
$ret['body'] = $msg['body'];
|
||||
$ret['body'] = convertquote($ret['body'], false);
|
||||
|
||||
if (trim($html) != '')
|
||||
$ret['body'] = removelinebreak($ret['body']);
|
||||
|
||||
$ret['body'] = unifyattributionline($ret['body']);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ function bbtoevent($s) {
|
|||
if(preg_match("/\[event\-adjust\](.*?)\[\/event\-adjust\]/is",$s,$match))
|
||||
$ev['adjust'] = $match[1];
|
||||
$match = '';
|
||||
$ev['nofinish'] = (($ev['start'] && (!x($ev, 'finish') || !$ev['finish'])) ? 1 : 0);
|
||||
$ev['nofinish'] = (((x($ev, 'start') && $ev['start']) && (!x($ev, 'finish') || !$ev['finish'])) ? 1 : 0);
|
||||
return $ev;
|
||||
|
||||
}
|
||||
|
|
|
@ -142,18 +142,22 @@ function html2bbcode($message)
|
|||
node2bbcode($doc, 'span', array('style'=>'font-style: italic;'), '[i]', '[/i]');
|
||||
node2bbcode($doc, 'span', array('style'=>'font-weight: bold;'), '[b]', '[/b]');
|
||||
|
||||
node2bbcode($doc, 'font', array('face'=>'/([\w ]+)/', 'size'=>'/(\d+)/', 'color'=>'/(.+)/'), '[font=$1][size=$2][color=$3]', '[/color][/size][/font]');
|
||||
/*node2bbcode($doc, 'font', array('face'=>'/([\w ]+)/', 'size'=>'/(\d+)/', 'color'=>'/(.+)/'), '[font=$1][size=$2][color=$3]', '[/color][/size][/font]');
|
||||
node2bbcode($doc, 'font', array('size'=>'/(\d+)/', 'color'=>'/(.+)/'), '[size=$1][color=$2]', '[/color][/size]');
|
||||
node2bbcode($doc, 'font', array('face'=>'/([\w ]+)/', 'size'=>'/(.+)/'), '[font=$1][size=$2]', '[/size][/font]');
|
||||
node2bbcode($doc, 'font', array('face'=>'/([\w ]+)/', 'color'=>'/(.+)/'), '[font=$1][color=$3]', '[/color][/font]');
|
||||
node2bbcode($doc, 'font', array('face'=>'/([\w ]+)/'), '[font=$1]', '[/font]');
|
||||
node2bbcode($doc, 'font', array('size'=>'/(\d+)/'), '[size=$1]', '[/size]');
|
||||
node2bbcode($doc, 'font', array('color'=>'/(.+)/'), '[color=$1]', '[/color]');
|
||||
*/
|
||||
// Untested
|
||||
//node2bbcode($doc, 'span', array('style'=>'/.*font-size:\s*(.+?)[,;].*font-family:\s*(.+?)[,;].*color:\s*(.+?)[,;].*/'), '[size=$1][font=$2][color=$3]', '[/color][/font][/size]');
|
||||
//node2bbcode($doc, 'span', array('style'=>'/.*font-size:\s*(\d+)[,;].*/'), '[size=$1]', '[/size]');
|
||||
//node2bbcode($doc, 'span', array('style'=>'/.*font-size:\s*(.+?)[,;].*/'), '[size=$1]', '[/size]');
|
||||
|
||||
node2bbcode($doc, 'span', array('style'=>'/.*color:\s*(.+?)[,;].*/'), '[color="$1"]', '[/color]');
|
||||
node2bbcode($doc, 'span', array('style'=>'/.*font-size:\s*(\d+)/'), '[size=$1]', '[/size]');
|
||||
|
||||
//node2bbcode($doc, 'span', array('style'=>'/.*font-family:\s*(.+?)[,;].*/'), '[font=$1]', '[/font]');
|
||||
|
||||
//node2bbcode($doc, 'div', array('style'=>'/.*font-family:\s*(.+?)[,;].*font-size:\s*(\d+?)pt.*/'), '[font=$1][size=$2]', '[/size][/font]');
|
||||
//node2bbcode($doc, 'div', array('style'=>'/.*font-family:\s*(.+?)[,;].*font-size:\s*(\d+?)px.*/'), '[font=$1][size=$2]', '[/size][/font]');
|
||||
//node2bbcode($doc, 'div', array('style'=>'/.*font-family:\s*(.+?)[,;].*/'), '[font=$1]', '[/font]');
|
||||
|
@ -187,13 +191,13 @@ function html2bbcode($message)
|
|||
|
||||
node2bbcode($doc, 'hr', array(), "[hr]", "");
|
||||
|
||||
//node2bbcode($doc, 'table', array(), "", "");
|
||||
//node2bbcode($doc, 'tr', array(), "\n", "");
|
||||
//node2bbcode($doc, 'td', array(), "\t", "");
|
||||
node2bbcode($doc, 'table', array(), "[table]", "[/table]");
|
||||
node2bbcode($doc, 'th', array(), "[th]", "[/th]");
|
||||
node2bbcode($doc, 'tr', array(), "[tr]", "[/tr]");
|
||||
node2bbcode($doc, 'td', array(), "[td]", "[/td]");
|
||||
node2bbcode($doc, 'table', array(), "", "");
|
||||
node2bbcode($doc, 'tr', array(), "\n", "");
|
||||
node2bbcode($doc, 'td', array(), "\t", "");
|
||||
//node2bbcode($doc, 'table', array(), "[table]", "[/table]");
|
||||
//node2bbcode($doc, 'th', array(), "[th]", "[/th]");
|
||||
//node2bbcode($doc, 'tr', array(), "[tr]", "[/tr]");
|
||||
//node2bbcode($doc, 'td', array(), "[td]", "[/td]");
|
||||
|
||||
node2bbcode($doc, 'h1', array(), "\n\n[size=xx-large][b]", "[/b][/size]\n");
|
||||
node2bbcode($doc, 'h2', array(), "\n\n[size=x-large][b]", "[/b][/size]\n");
|
||||
|
|
|
@ -28,7 +28,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
|
|||
|
||||
$sql_extra = " AND `allow_cid` = '' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = '' ";
|
||||
|
||||
$r = q("SELECT `contact`.*, `user`.`uid` AS `user_uid`, `user`.`nickname`, `user`.`timezone`
|
||||
$r = q("SELECT `contact`.*, `user`.`uid` AS `user_uid`, `user`.`nickname`, `user`.`timezone`, `user`.`page-flags`
|
||||
FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid`
|
||||
WHERE `contact`.`self` = 1 AND `user`.`nickname` = '%s' LIMIT 1",
|
||||
dbesc($owner_nick)
|
||||
|
@ -156,7 +156,8 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
|
|||
'$picdate' => xmlify(datetime_convert('UTC','UTC',$owner['avatar-date'] . '+00:00' , ATOM_TIME)) ,
|
||||
'$uridate' => xmlify(datetime_convert('UTC','UTC',$owner['uri-date'] . '+00:00' , ATOM_TIME)) ,
|
||||
'$namdate' => xmlify(datetime_convert('UTC','UTC',$owner['name-date'] . '+00:00' , ATOM_TIME)) ,
|
||||
'$birthday' => ((strlen($birthday)) ? '<dfrn:birthday>' . xmlify($birthday) . '</dfrn:birthday>' : '')
|
||||
'$birthday' => ((strlen($birthday)) ? '<dfrn:birthday>' . xmlify($birthday) . '</dfrn:birthday>' : ''),
|
||||
'$community' => (($owner['page-flags'] == PAGE_COMMUNITY) ? '<dfrn:community>1</dfrn:community>' : '')
|
||||
));
|
||||
|
||||
call_hooks('atom_feed', $atom);
|
||||
|
@ -682,7 +683,7 @@ function item_store($arr,$force_parent = false) {
|
|||
unset($arr['dsprsig']);
|
||||
}
|
||||
|
||||
if($arr['gravity'])
|
||||
if(x($arr, 'gravity'))
|
||||
$arr['gravity'] = intval($arr['gravity']);
|
||||
elseif($arr['parent-uri'] === $arr['uri'])
|
||||
$arr['gravity'] = 0;
|
||||
|
@ -742,6 +743,7 @@ function item_store($arr,$force_parent = false) {
|
|||
|
||||
if($arr['parent-uri'] === $arr['uri']) {
|
||||
$parent_id = 0;
|
||||
$parent_deleted = 0;
|
||||
$allow_cid = $arr['allow_cid'];
|
||||
$allow_gid = $arr['allow_gid'];
|
||||
$deny_cid = $arr['deny_cid'];
|
||||
|
@ -800,6 +802,8 @@ function item_store($arr,$force_parent = false) {
|
|||
logger('item_store: item parent was not found - ignoring item');
|
||||
return 0;
|
||||
}
|
||||
|
||||
$parent_deleted = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1043,6 +1047,22 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
|
|||
if(! $rino_enable)
|
||||
$rino = 0;
|
||||
|
||||
$ssl_val = intval(get_config('system','ssl_policy'));
|
||||
$ssl_policy = '';
|
||||
|
||||
switch($ssl_val){
|
||||
case SSL_POLICY_FULL:
|
||||
$ssl_policy = 'full';
|
||||
break;
|
||||
case SSL_POLICY_SELFSIGN:
|
||||
$ssl_policy = 'self';
|
||||
break;
|
||||
case SSL_POLICY_NONE:
|
||||
default:
|
||||
$ssl_policy = 'none';
|
||||
break;
|
||||
}
|
||||
|
||||
$url = $contact['notify'] . '&dfrn_id=' . $idtosend . '&dfrn_version=' . DFRN_PROTOCOL_VERSION . (($rino) ? '&rino=1' : '');
|
||||
|
||||
logger('dfrn_deliver: ' . $url);
|
||||
|
@ -1074,6 +1094,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
|
|||
$challenge = hex2bin((string) $res->challenge);
|
||||
$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 = '';
|
||||
|
||||
|
@ -1115,6 +1136,11 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
|
|||
$postvars['perm'] = 'r';
|
||||
}
|
||||
|
||||
$postvars['ssl_policy'] = $ssl_policy;
|
||||
|
||||
if($page)
|
||||
$postvars['page'] = '1';
|
||||
|
||||
if($rino && $rino_allowed && (! $dissolve)) {
|
||||
$key = substr(random_string(),0,16);
|
||||
$data = bin2hex(aes_encrypt($postvars['data'],$key));
|
||||
|
@ -1379,6 +1405,19 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
|||
|
||||
}
|
||||
|
||||
$community_page = 0;
|
||||
$rawtags = $feed->get_feed_tags( NAMESPACE_DFRN, 'community');
|
||||
if($rawtags) {
|
||||
$community_page = intval($rawtags[0]['data']);
|
||||
}
|
||||
if(is_array($contact) && intval($contact['forum']) != $community_page) {
|
||||
q("update contact set forum = %d where id = %d limit 1",
|
||||
intval($community_page),
|
||||
intval($contact['id'])
|
||||
);
|
||||
$contact['forum'] = (string) $community_page;
|
||||
}
|
||||
|
||||
|
||||
// process any deleted entries
|
||||
|
||||
|
@ -1962,6 +2001,19 @@ function local_delivery($importer,$data) {
|
|||
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
$community_page = 0;
|
||||
$rawtags = $feed->get_feed_tags( NAMESPACE_DFRN, 'community');
|
||||
if($rawtags) {
|
||||
$community_page = intval($rawtags[0]['data']);
|
||||
}
|
||||
if(intval($importer['forum']) != $community_page) {
|
||||
q("update contact set forum = %d where id = %d limit 1",
|
||||
intval($community_page),
|
||||
intval($importer['id'])
|
||||
);
|
||||
$importer['forum'] = (string) $community_page;
|
||||
}
|
||||
|
||||
logger('local_delivery: feed item count = ' . $feed->get_item_quantity());
|
||||
|
||||
|
@ -2001,6 +2053,7 @@ function local_delivery($importer,$data) {
|
|||
if(($item['verb'] === ACTIVITY_TAG) && ($item['object-type'] === ACTVITY_OBJ_TAGTERM)) {
|
||||
$xo = parse_xml_string($item['object'],false);
|
||||
$xt = parse_xml_string($item['target'],false);
|
||||
|
||||
if($xt->type === ACTIVITY_OBJ_NOTE) {
|
||||
$i = q("select * from `item` where uri = '%s' and uid = %d limit 1",
|
||||
dbesc($xt->id),
|
||||
|
|
225
include/msgclean.php
Normal file
225
include/msgclean.php
Normal file
|
@ -0,0 +1,225 @@
|
|||
<?php
|
||||
|
||||
function savereplace($pattern, $replace, $text)
|
||||
{
|
||||
$save = $text;
|
||||
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
|
||||
if ($text == '')
|
||||
$text = $save;
|
||||
return($text);
|
||||
}
|
||||
|
||||
function unifyattributionline($message)
|
||||
{
|
||||
$quotestr = array('quote', 'collapsed');
|
||||
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);
|
||||
$message = savereplace('/----- Original Message -----\s.*?From: "([^<"].*?)" <(.*?)>\s.*?To: (.*?)\s*?Sent: (.*?)\s.*?Subject: ([^\n].*)\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
|
||||
|
||||
$message = savereplace('/-------- Original-Nachricht --------\s*\['.$quote.'\]\nDatum: (.*?)\nVon: (.*?) <(.*?)>\nAn: (.*?)\nBetreff: (.*?)\n/i', "[".$quote."='$2']\n", $message);
|
||||
$message = savereplace('/-------- Original-Nachricht --------\s*\['.$quote.'\]\sDatum: (.*?)\s.*Von: "([^<"].*?)" <(.*?)>\s.*An: (.*?)\n.*/i', "[".$quote."='$2']\n", $message);
|
||||
$message = savereplace('/-------- Original-Nachricht --------\s*\['.$quote.'\]\nDatum: (.*?)\nVon: (.*?)\nAn: (.*?)\nBetreff: (.*?)\n/i', "[".$quote."='$2']\n", $message);
|
||||
|
||||
$message = savereplace('/-----Urspr.*?ngliche Nachricht-----\sVon: "([^<"].*?)" <(.*?)>\s.*Gesendet: (.*?)\s.*An: (.*?)\s.*Betreff: ([^\n].*?).*:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
|
||||
$message = savereplace('/-----Urspr.*?ngliche Nachricht-----\sVon: "([^<"].*?)" <(.*?)>\s.*Gesendet: (.*?)\s.*An: (.*?)\s.*Betreff: ([^\n].*?)\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
|
||||
|
||||
$message = savereplace('/Am (.*?), schrieb (.*?):\s*\['.$quote.'\]/i', "[".$quote."='$2']\n", $message);
|
||||
|
||||
$message = savereplace('/Am .*?, \d+ .*? \d+ \d+:\d+:\d+ \+\d+\sschrieb\s(.*?)\s<(.*?)>:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
|
||||
|
||||
$message = savereplace('/Am (.*?) schrieb (.*?) <(.*?)>:\s*\['.$quote.'\]/i', "[".$quote."='$2']\n", $message);
|
||||
$message = savereplace('/Am (.*?) schrieb <(.*?)>:\s*\['.$quote.'\]/i', "[".$quote."='$2']\n", $message);
|
||||
$message = savereplace('/Am (.*?) schrieb (.*?):\s*\['.$quote.'\]/i', "[".$quote."='$2']\n", $message);
|
||||
$message = savereplace('/Am (.*?) schrieb (.*?)\n(.*?):\s*\['.$quote.'\]/i', "[".$quote."='$2']\n", $message);
|
||||
|
||||
$message = savereplace('/(\d+)\/(\d+)\/(\d+) ([^<"].*?) <(.*?)>\s*\['.$quote.'\]/i', "[".$quote."='$4']\n", $message);
|
||||
|
||||
$message = savereplace('/On .*?, \d+ .*? \d+ \d+:\d+:\d+ \+\d+\s(.*?)\s<(.*?)>\swrote:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
|
||||
|
||||
$message = savereplace('/On (.*?) at (.*?), (.*?)\s<(.*?)>\swrote:\s*\['.$quote.'\]/i', "[".$quote."='$3']\n", $message);
|
||||
$message = savereplace('/On (.*?)\n([^<].*?)\s<(.*?)>\swrote:\s*\['.$quote.'\]/i', "[".$quote."='$2']\n", $message);
|
||||
$message = savereplace('/On (.*?), (.*?), (.*?)\s<(.*?)>\swrote:\s*\['.$quote.'\]/i', "[".$quote."='$3']\n", $message);
|
||||
$message = savereplace('/On ([^,].*?), (.*?)\swrote:\s*\['.$quote.'\]/i', "[".$quote."='$2']\n", $message);
|
||||
$message = savereplace('/On (.*?), (.*?)\swrote\s*\['.$quote.'\]/i', "[".$quote."='$2']\n", $message);
|
||||
|
||||
// Der loescht manchmal den Body - was eigentlich unmoeglich ist
|
||||
$message = savereplace('/On (.*?),(.*?),(.*?),(.*?), (.*?) wrote:\s*\['.$quote.'\]/i', "[".$quote."='$5']\n", $message);
|
||||
|
||||
$message = savereplace('/Zitat von ([^<].*?) <(.*?)>:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
|
||||
|
||||
$message = savereplace('/Quoting ([^<].*?) <(.*?)>:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
|
||||
|
||||
$message = savereplace('/From: "([^<"].*?)" <(.*?)>\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
|
||||
$message = savereplace('/From: <(.*?)>\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
|
||||
|
||||
$message = savereplace('/Du \(([^)].*?)\) schreibst:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
|
||||
|
||||
$message = savereplace('/--- (.*?) <.*?> schrieb am (.*?):\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
|
||||
$message = savereplace('/--- (.*?) schrieb am (.*?):\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
|
||||
|
||||
$message = savereplace('/\* (.*?) <(.*?)> hat geschrieben:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
|
||||
|
||||
$message = savereplace('/(.*?) <(.*?)> schrieb (.*?)\):\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
|
||||
$message = savereplace('/(.*?) <(.*?)> schrieb am (.*?) um (.*):\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
|
||||
$message = savereplace('/(.*?) schrieb am (.*?) um (.*):\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
|
||||
$message = savereplace('/(.*?) \((.*?)\) schrieb:\s*\['.$quote.'\]/i', "[".$quote."='$2']\n", $message);
|
||||
$message = savereplace('/(.*?) schrieb:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
|
||||
|
||||
$message = savereplace('/(.*?) <(.*?)> writes:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
|
||||
$message = savereplace('/(.*?) \((.*?)\) writes:\s*\['.$quote.'\]/i', "[".$quote."='$2']\n", $message);
|
||||
$message = savereplace('/(.*?) writes:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
|
||||
|
||||
$message = savereplace('/\* (.*?) wrote:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
|
||||
$message = savereplace('/(.*?) wrote \(.*?\):\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
|
||||
$message = savereplace('/(.*?) wrote:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
|
||||
|
||||
$message = savereplace('/([^<].*?) <.*?> hat am (.*?)\sum\s(.*)\sgeschrieben:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
|
||||
|
||||
$message = savereplace('/(\d+)\/(\d+)\/(\d+) ([^<"].*?) <(.*?)>:\s*\['.$quote.'\]/i', "[".$quote."='$4']\n", $message);
|
||||
$message = savereplace('/(\d+)\/(\d+)\/(\d+) (.*?) <(.*?)>\s*\['.$quote.'\]/i', "[".$quote."='$4']\n", $message);
|
||||
$message = savereplace('/(\d+)\/(\d+)\/(\d+) <(.*?)>:\s*\['.$quote.'\]/i', "[".$quote."='$4']\n", $message);
|
||||
$message = savereplace('/(\d+)\/(\d+)\/(\d+) <(.*?)>\s*\['.$quote.'\]/i', "[".$quote."='$4']\n", $message);
|
||||
|
||||
$message = savereplace('/(.*?) <(.*?)> schrubselte:\s*\['.$quote.'\]/i', "[".$quote."='$1']\n", $message);
|
||||
$message = savereplace('/(.*?) \((.*?)\) schrubselte:\s*\['.$quote.'\]/i', "[".$quote."='$2']\n", $message);
|
||||
|
||||
}
|
||||
return($message);
|
||||
}
|
||||
|
||||
function removegpg($message)
|
||||
{
|
||||
|
||||
$pattern = '/(.*)\s*-----BEGIN PGP SIGNED MESSAGE-----\s*[\r\n].*Hash:.*?[\r\n](.*)'.
|
||||
'[\r\n]\s*-----BEGIN PGP SIGNATURE-----\s*[\r\n].*'.
|
||||
'[\r\n]\s*-----END PGP SIGNATURE-----(.*)/is';
|
||||
|
||||
preg_match($pattern, $message, $result);
|
||||
|
||||
$cleaned = trim($result[1].$result[2].$result[3]);
|
||||
|
||||
$cleaned = str_replace(array("\n- --\n", "\n- -"), array("\n-- \n", "\n-"), $cleaned);
|
||||
|
||||
|
||||
if ($cleaned == '')
|
||||
$cleaned = $message;
|
||||
|
||||
return($cleaned);
|
||||
}
|
||||
|
||||
function removesig($message)
|
||||
{
|
||||
$sigpos = strrpos($message, "\n-- \n");
|
||||
$quotepos = strrpos($message, "[/quote]");
|
||||
|
||||
if ($sigpos == 0) {
|
||||
// Speziell fuer web.de, die das als Trenner verwenden
|
||||
$message = str_replace("\n___________________________________________________________\n", "\n-- \n", $message);
|
||||
$sigpos = strrpos($message, "\n-- \n");
|
||||
$quotepos = strrpos($message, "[/quote]");
|
||||
}
|
||||
|
||||
// Sollte sich der Signaturtrenner innerhalb eines Quotes befinden
|
||||
// wird keine Signaturtrennung ausgefuehrt
|
||||
if (($sigpos < $quotepos) and ($sigpos != 0))
|
||||
return(array('body' => $message, 'sig' => ''));
|
||||
|
||||
// To-Do: Regexp umstellen, so dass auf 1 oder kein Leerzeichen
|
||||
// geprueft wird
|
||||
//$message = str_replace("\n--\n", "\n-- \n", $message);
|
||||
|
||||
$pattern = '/(.*)[\r\n]-- [\r\n](.*)/is';
|
||||
|
||||
preg_match($pattern, $message, $result);
|
||||
|
||||
if (($result[1] != '') and ($result[2] != '')) {
|
||||
$cleaned = trim($result[1])."\n";
|
||||
$sig = trim($result[2]);
|
||||
// '[hr][size=x-small][color=darkblue]'.trim($result[2]).'[/color][/size]';
|
||||
} else {
|
||||
$cleaned = $message;
|
||||
$sig = '';
|
||||
}
|
||||
|
||||
return(array('body' => $cleaned, 'sig' => $sig));
|
||||
}
|
||||
|
||||
function removelinebreak($message)
|
||||
{
|
||||
$arrbody = explode("\n", trim($message));
|
||||
|
||||
$lines = array();
|
||||
$lineno = 0;
|
||||
|
||||
foreach($arrbody as $i => $line) {
|
||||
$currquotelevel = 0;
|
||||
$currline = $line;
|
||||
while ((strlen($currline)>0) and ((substr($currline, 0, 1) == '>')
|
||||
or (substr($currline, 0, 1) == ' '))) {
|
||||
if (substr($currline, 0, 1) == '>')
|
||||
$currquotelevel++;
|
||||
|
||||
$currline = ltrim(substr($currline, 1));
|
||||
}
|
||||
|
||||
$quotelevel = 0;
|
||||
$nextline = trim($arrbody[$i+1]);
|
||||
while ((strlen($nextline)>0) and ((substr($nextline, 0, 1) == '>')
|
||||
or (substr($nextline, 0, 1) == ' '))) {
|
||||
if (substr($nextline, 0, 1) == '>')
|
||||
$quotelevel++;
|
||||
|
||||
$nextline = ltrim(substr($nextline, 1));
|
||||
}
|
||||
|
||||
$len = strlen($line);
|
||||
$firstword = strpos($nextline.' ', ' ');
|
||||
|
||||
$specialchars = ((substr(trim($nextline), 0, 1) == '-') or
|
||||
(substr(trim($nextline), 0, 1) == '=') or
|
||||
(substr(trim($nextline), 0, 1) == '*') or
|
||||
(substr(trim($nextline), 0, 1) == '·') or
|
||||
(substr(trim($nextline), 0, 4) == '[url') or
|
||||
(substr(trim($nextline), 0, 5) == '[size') or
|
||||
(substr(trim($nextline), 0, 7) == 'http://') or
|
||||
(substr(trim($nextline), 0, 8) == 'https://'));
|
||||
|
||||
if (!$specialchars)
|
||||
$specialchars = ((substr(rtrim($line), -1) == '-') or
|
||||
(substr(rtrim($line), -1) == '=') or
|
||||
(substr(rtrim($line), -1) == '*') or
|
||||
(substr(rtrim($line), -1) == '·') or
|
||||
(substr(rtrim($line), -6) == '[/url]') or
|
||||
(substr(rtrim($line), -7) == '[/size]'));
|
||||
|
||||
//if ($specialchars)
|
||||
// echo ("Special\n");
|
||||
|
||||
if ($lines[$lineno] != '') {
|
||||