Merge remote-tracking branch 'friendica/master'

This commit is contained in:
Fabio Comuni 2012-03-19 12:24:40 +01:00
commit ea4be0db89
161 changed files with 3486 additions and 1041 deletions

3
.gitignore vendored
View file

@ -13,6 +13,9 @@ addon
#ignore documentation, it should be newly built #ignore documentation, it should be newly built
doc/api 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 #ignore config files from eclipse, we don't want IDE files in our repository
.project .project
.buildpath .buildpath

View file

@ -1,10 +1,13 @@
#Options -Indexes Options -Indexes
AddType application/x-java-archive .jar AddType application/x-java-archive .jar
AddType audio/ogg .oga AddType audio/ogg .oga
<FilesMatch "\.(out|log)$"> <FilesMatch "\.(out|log)$">
Deny from all Deny from all
</FilesMatch> </FilesMatch>
<Files "(include|library)">
Deny from all
</Files>
<IfModule mod_rewrite.c> <IfModule mod_rewrite.c>
RewriteEngine on RewriteEngine on

View file

@ -9,9 +9,9 @@ require_once('include/nav.php');
require_once('include/cache.php'); require_once('include/cache.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '2.3.1278' ); define ( 'FRIENDICA_VERSION', '2.3.1285' );
define ( 'DFRN_PROTOCOL_VERSION', '2.22' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1131 ); define ( 'DB_UPDATE_VERSION', 1132 );
define ( 'EOL', "<br />\r\n" ); define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
@ -286,7 +286,12 @@ class App {
startup(); 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')) { if(x($_SERVER,'SERVER_NAME')) {
$this->hostname = $_SERVER['SERVER_NAME']; $this->hostname = $_SERVER['SERVER_NAME'];
@ -379,11 +384,22 @@ class App {
$scheme = $this->scheme; $scheme = $this->scheme;
if(x($this->config,'ssl_policy')) { if((x($this->config,'system')) && (x($this->config['system'],'ssl_policy'))) {
if(($ssl) || ($this->config['ssl_policy'] == SSL_POLICY_FULL)) if(intval($this->config['system']['ssl_policy']) === intval(SSL_POLICY_FULL))
$scheme = 'https';
if(($this->config['ssl_policy'] == SSL_POLICY_SELFSIGN) && (local_user() || x($_POST,'auth-params')))
$scheme = 'https'; $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 : '' ); $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')) { if(! function_exists('login')) {
function login($register = false, $hiddens=false) { function login($register = false, $hiddens=false) {
$a = get_app();
$o = ""; $o = "";
$reg = false; $reg = false;
if ($register) { if ($register) {
@ -704,8 +721,11 @@ function login($register = false, $hiddens=false) {
} }
$dest_url = $a->get_baseurl(true) . '/' . $a->query_string;
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$dest_url' => $dest_url,
'$logout' => t('Logout'), '$logout' => t('Logout'),
'$login' => t('Login'), '$login' => t('Login'),
@ -1209,7 +1229,7 @@ function current_theme(){
$a = get_app(); $a = get_app();
$system_theme = ((isset($a->config['system']['theme'])) ? $a->config['system']['theme'] : ''); $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')) if($theme_name && file_exists('view/theme/' . $theme_name . '/style.css'))
return($theme_name); return($theme_name);
@ -1335,7 +1355,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
array( array(
'label' => t('Profile'), 'label' => t('Profile'),
'url' => $url.'/?tab=profile', 'url' => $url.'/?tab=profile',
'sel' => (($tab=='profile')?'active':''), 'sel' => ((isset($tab) && $tab=='profile')?'active':''),
), ),
array( array(
'label' => t('Photos'), 'label' => t('Photos'),

View file

@ -1,14 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project name="friendica" default="test"> <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 --> <!-- Target: test -->
<!-- this target runs all test files --> <!-- this target runs all test files -->
<!-- =================================== --> <!-- =================================== -->
<target name="test" depends="prepare-test">
<target name="test"> <!-- coverage-setup database="./report/coverage-database">
<!-- there are no tests by now, so, nothing to do --> <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> </target>
<!-- ===================================================== --> <!-- ===================================================== -->
@ -31,6 +66,9 @@
<docblox title="Friendica API" destdir="./doc/api"> <docblox title="Friendica API" destdir="./doc/api">
<fileset dir="."> <fileset dir=".">
<include name="**/*.php" /> <include name="**/*.php" />
<include name="README"/>
<include name="INSTALL.txt"/>
<include name="LICENSE"/>
</fileset> </fileset>
</docblox> </docblox>
</target> </target>

View file

@ -92,6 +92,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
`blocked` tinyint(1) NOT NULL DEFAULT '1', `blocked` tinyint(1) NOT NULL DEFAULT '1',
`readonly` tinyint(1) NOT NULL DEFAULT '0', `readonly` tinyint(1) NOT NULL DEFAULT '0',
`writable` 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', `hidden` tinyint(1) NOT NULL DEFAULT '0',
`pending` tinyint(1) NOT NULL DEFAULT '1', `pending` tinyint(1) NOT NULL DEFAULT '1',
`rating` tinyint(1) NOT NULL DEFAULT '0', `rating` tinyint(1) NOT NULL DEFAULT '0',
@ -116,6 +117,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
KEY `dfrn-id` (`dfrn-id`), KEY `dfrn-id` (`dfrn-id`),
KEY `blocked` (`blocked`), KEY `blocked` (`blocked`),
KEY `readonly` (`readonly`), KEY `readonly` (`readonly`),
KEY `forum` (`forum`),
KEY `hidden` (`hidden`), KEY `hidden` (`hidden`),
KEY `pending` (`pending`), KEY `pending` (`pending`),
KEY `closeness` (`closeness`) KEY `closeness` (`closeness`)
@ -636,6 +638,7 @@ CREATE TABLE IF NOT EXISTS `mailacct` (
`mailbox` CHAR( 255 ) NOT NULL, `mailbox` CHAR( 255 ) NOT NULL,
`user` CHAR( 255 ) NOT NULL , `user` CHAR( 255 ) NOT NULL ,
`pass` TEXT NOT NULL , `pass` TEXT NOT NULL ,
`reply_to` CHAR( 255 ) NOT NULL ,
`action` INT NOT NULL , `action` INT NOT NULL ,
`movetofolder` CHAR(255) NOT NULL , `movetofolder` CHAR(255) NOT NULL ,
`pubmail` TINYINT(1) NOT NULL DEFAULT '0', `pubmail` TINYINT(1) NOT NULL DEFAULT '0',

View file

@ -79,3 +79,9 @@ $a->config['system']['theme'] = 'duepuntozero';
// By default allow pseudonyms // By default allow pseudonyms
$a->config['system']['no_regfullname'] = true; $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'] = "";

View file

@ -114,10 +114,12 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
$sql_extra .= " AND `network` IN ( $str_nets ) "; $sql_extra .= " AND `network` IN ( $str_nets ) ";
} }
$tabindex = (x($options, 'tabindex') ? "tabindex=\"" . $options["tabindex"] . "\"" : "");
if($x['single']) 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 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` $r = q("SELECT `id`, `name`, `url`, `network` FROM `contact`
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `notify` != '' 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(); $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' ) "; $sql_extra .= " AND `network` IN ( 'dfrn', 'mail', 'face', 'dspr' ) ";
} }
$tabindex = ($tabindex > 0 ? "tabindex=\"$tabindex\"" : "");
if($privmail) 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 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` $r = q("SELECT `id`, `name`, `url`, `network` FROM `contact`
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `notify` != '' WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `notify` != ''

View file

@ -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,
));
}

View file

@ -186,6 +186,8 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
require_once('bbcode.php'); require_once('bbcode.php');
$ssl_state = ((local_user()) ? true : false);
$profile_owner = 0; $profile_owner = 0;
$page_writeable = false; $page_writeable = false;
@ -345,7 +347,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
'like' => '', 'like' => '',
'dislike' => '', 'dislike' => '',
'comment' => '', '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, 'previewing' => $previewing,
'wait' => t('Please wait'), 'wait' => t('Please wait'),
); );
@ -375,7 +377,8 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
$comments[$item['parent']] = 1; $comments[$item['parent']] = 1;
else else
$comments[$item['parent']] += 1; $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 // 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; $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']) $lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
|| strlen($item['deny_cid']) || strlen($item['deny_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')) $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); : False);
@ -559,8 +562,11 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
); );
$star = false; $star = false;
$filer = false;
$isstarred = "unstarred"; $isstarred = "unstarred";
if ($profile_owner == local_user() && $toplevelpost) { if ($profile_owner == local_user()) {
if($toplevelpost) {
$isstarred = (($item['starred']) ? "starred" : "unstarred"); $isstarred = (($item['starred']) ? "starred" : "unstarred");
$star = array( $star = array(
@ -574,7 +580,8 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
'classtagger' => "", 'classtagger' => "",
); );
} }
$filer = t("file as");
}
$photo = $item['photo']; $photo = $item['photo'];
@ -642,7 +649,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
// template to use to render item (wall, walltowall, search) // template to use to render item (wall, walltowall, search)
'template' => $template, 'template' => $template,
'type' => implode("",array_slice(split("/",$item['verb']),-1)), 'type' => implode("",array_slice(explode("/",$item['verb']),-1)),
'tags' => $tags, 'tags' => $tags,
'body' => template_escape($body), 'body' => template_escape($body),
'text' => strip_tags(template_escape($body)), 'text' => strip_tags(template_escape($body)),
@ -670,6 +677,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
'edpost' => $edpost, 'edpost' => $edpost,
'isstarred' => $isstarred, 'isstarred' => $isstarred,
'star' => $star, 'star' => $star,
'filer' => $filer,
'drop' => $drop, 'drop' => $drop,
'vote' => $likebuttons, 'vote' => $likebuttons,
'like' => $like, 'like' => $like,
@ -691,7 +699,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
$page_template = get_markup_template("conversation.tpl"); $page_template = get_markup_template("conversation.tpl");
$o .= replace_macros($page_template, array( $o .= replace_macros($page_template, array(
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl($ssl_state),
'$mode' => $mode, '$mode' => $mode,
'$user' => $a->user, '$user' => $a->user,
'$threads' => $threads, '$threads' => $threads,
@ -701,7 +709,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
return $o; return $o;
}} }}
function best_link_url($item,&$sparkle) { function best_link_url($item,&$sparkle,$ssl_state = false) {
$a = get_app(); $a = get_app();
@ -713,7 +721,7 @@ function best_link_url($item,&$sparkle) {
if((local_user()) && (local_user() == $item['uid'])) { if((local_user()) && (local_user() == $item['uid'])) {
if(isset($a->contacts) && x($a->contacts,$clean_url)) { if(isset($a->contacts) && x($a->contacts,$clean_url)) {
if($a->contacts[$clean_url]['network'] === NETWORK_DFRN) { 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; $sparkle = true;
} }
else else
@ -735,9 +743,13 @@ if(! function_exists('item_photo_menu')){
function item_photo_menu($item){ function item_photo_menu($item){
$a = get_app(); $a = get_app();
if (local_user() && (! count($a->contacts))) $ssl_state = false;
load_contact_links(local_user());
if(local_user()) {
$ssl_state = true;
if(! count($a->contacts))
load_contact_links(local_user());
}
$contact_url=""; $contact_url="";
$pm_url=""; $pm_url="";
$status_link=""; $status_link="";
@ -745,7 +757,7 @@ function item_photo_menu($item){
$posts_link=""; $posts_link="";
$sparkle = false; $sparkle = false;
$profile_link = best_link_url($item,$sparkle); $profile_link = best_link_url($item,$sparkle,$ssl_state);
if($profile_link === 'mailbox') if($profile_link === 'mailbox')
$profile_link = ''; $profile_link = '';
@ -754,7 +766,7 @@ function item_photo_menu($item){
$status_link = $profile_link . "?url=status"; $status_link = $profile_link . "?url=status";
$photos_link = $profile_link . "?url=photos"; $photos_link = $profile_link . "?url=photos";
$profile_link = $profile_link . "?url=profile"; $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 { else {
if(local_user() && local_user() == $item['uid'] && link_compare($item['url'],$item['author-link'])) { 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'])) { if(($cid) && (! $item['self'])) {
$contact_url = $a->get_baseurl() . '/contacts/' . $cid; $contact_url = $a->get_baseurl($ssl_state) . '/contacts/' . $cid;
$posts_link = $a->get_baseurl() . '/network/?cid=' . $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( $menu = Array(
@ -802,7 +825,7 @@ function like_puller($a,$item,&$arr,$mode) {
if((activity_match($item['verb'],$verb)) && ($item['id'] != $item['parent'])) { if((activity_match($item['verb'],$verb)) && ($item['id'] != $item['parent'])) {
$url = $item['author-link']; $url = $item['author-link'];
if((local_user()) && (local_user() == $item['uid']) && ($item['network'] === 'dfrn') && (! $item['self']) && (link_compare($item['author-link'],$item['url']))) { 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" '; $sparkle = ' class="sparkle" ';
} }
if(! ((isset($arr[$item['parent'] . '-l'])) && (is_array($arr[$item['parent'] . '-l'])))) 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( $a->page['htmlhead'] .= replace_macros($tpl, array(
'$newpost' => 'true', '$newpost' => 'true',
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$geotag' => $geotag, '$geotag' => $geotag,
'$nickname' => $x['nickname'], '$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:"), '$vidurl' => t("Please enter a video link/URL:"),
'$audurl' => t("Please enter an audio link/URL:"), '$audurl' => t("Please enter an audio link/URL:"),
'$term' => t('Tag term:'), '$term' => t('Tag term:'),
'$fileas' => t('File as:'),
'$whereareu' => t('Where are you right now?'), '$whereareu' => t('Where are you right now?'),
'$title' => t('Enter a title for this item') '$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( $o .= replace_macros($tpl,array(
'$return_path' => $a->cmd, '$return_path' => $a->cmd,
'$action' => $a->get_baseurl().'/item', '$action' => $a->get_baseurl(true) . '/item',
'$share' => (($x['button']) ? $x['button'] : t('Share')), '$share' => (x($x,'button') ? $x['button'] : t('Share')),
'$upload' => t('Upload photo'), '$upload' => t('Upload photo'),
'$shortupload' => t('upload photo'), '$shortupload' => t('upload photo'),
'$attach' => t('Attach file'), '$attach' => t('Attach file'),
@ -938,7 +962,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
'$ptyp' => (($notes_cid) ? 'note' : 'wall'), '$ptyp' => (($notes_cid) ? 'note' : 'wall'),
'$content' => '', '$content' => '',
'$post_id' => '', '$post_id' => '',
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$defloc' => $x['default_location'], '$defloc' => $x['default_location'],
'$visitor' => $x['visitor'], '$visitor' => $x['visitor'],
'$pvisit' => (($notes_cid) ? 'none' : $x['visitor']), '$pvisit' => (($notes_cid) ? 'none' : $x['visitor']),
@ -980,8 +1004,8 @@ function conv_sort($arr,$order) {
usort($parents,'sort_thr_commented'); usort($parents,'sort_thr_commented');
if(count($parents)) if(count($parents))
foreach($parents as $x) foreach($parents as $i=>$_x)
$x['children'] = array(); $parents[$i]['children'] = array();
foreach($arr as $x) { foreach($arr as $x) {
if($x['id'] != $x['parent']) { if($x['id'] != $x['parent']) {

View file

@ -1,5 +1,7 @@
<?php <?php
require_once('include/datetime.php');
/** /**
* *
* MySQL database class * MySQL database class
@ -104,7 +106,6 @@ class dba {
logger('dba: ' . $str ); logger('dba: ' . $str );
} }
else {
/** /**
* If dbfail.out exists, we will write any failed calls directly to it, * If dbfail.out exists, we will write any failed calls directly to it,
@ -115,8 +116,7 @@ class dba {
if($result === false) { if($result === false) {
logger('dba: ' . printable($sql) . ' returned false.'); logger('dba: ' . printable($sql) . ' returned false.');
if(file_exists('dbfail.out')) if(file_exists('dbfail.out'))
file_put_contents('dbfail.out', printable($sql) . ' returned false' . "\n", FILE_APPEND); file_put_contents('dbfail.out', datetime_convert() . "\n" . printable($sql) . ' returned false' . "\n", FILE_APPEND);
}
} }
if(($result === true) || ($result === false)) if(($result === true) || ($result === false))
@ -140,7 +140,7 @@ class dba {
if($this->debug) if($this->debug)
logger('dba: ' . printable(print_r($r, true)), LOGGER_DATA); logger('dba: ' . printable(print_r($r, true)));
return($r); return($r);
} }

View file

@ -256,7 +256,8 @@ function delivery_run($argv, $argc){
'$picdate' => xmlify(datetime_convert('UTC','UTC',$owner['avatar-date'] . '+00:00' , ATOM_TIME)) , '$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)) , '$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)) , '$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) { foreach($items as $item) {
@ -435,8 +436,8 @@ function delivery_run($argv, $argc){
$headers .= 'Reply-to: ' . $reply_to . "\n"; $headers .= 'Reply-to: ' . $reply_to . "\n";
// for testing purposes: Collect exported mails // for testing purposes: Collect exported mails
$file = tempnam("/tmp/friendica/", "mail-out-"); // $file = tempnam("/tmp/friendica/", "mail-out-");
file_put_contents($file, json_encode($it)); // file_put_contents($file, json_encode($it));
$headers .= 'Message-Id: <' . iri2msgid($it['uri']). '>' . "\n"; $headers .= 'Message-Id: <' . iri2msgid($it['uri']). '>' . "\n";
@ -448,28 +449,14 @@ function delivery_run($argv, $argc){
$headers .= 'References: <' . iri2msgid($it['parent-uri']) . '>' . "\n"; $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", $r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' LIMIT 1",
dbesc($it['parent-uri']) dbesc($it['parent-uri']));
);
if(count($r)) { if(count($r) AND ($r[0]['title'] != ''))
$subtitle = $r[0]['title']; $subject = $r[0]['title'];
if($subtitle) {
if(strncasecmp($subtitle,'RE:',3))
$subject = $subtitle;
else
$subject = 'Re: ' . $subtitle;
} }
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); email_send($addr, $subject, $headers, $it);
} }
break; break;

View file

@ -1159,6 +1159,48 @@ function diaspora_comment($importer,$xml,$msg) {
proc_run('php','include/notifier.php','comment',$message_id); 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; return;
} }

View file

@ -1,5 +1,7 @@
<?php <?php
require_once('include/html2plain.php'); require_once('include/html2plain.php');
require_once('include/msgclean.php');
require_once('include/quoteconvert.php');
function email_connect($mailbox,$username,$password) { function email_connect($mailbox,$username,$password) {
if(! function_exists('imap_open')) 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 = (($mbox && $uid) ? @imap_fetchheader($mbox,$uid,FT_UID) : '');
$raw_header = str_replace("\r",'',$raw_header); $raw_header = str_replace("\r",'',$raw_header);
$ret = array(); $ret = array();
$h = split("\n",$raw_header); $h = explode("\n",$raw_header);
if(count($h)) if(count($h))
foreach($h as $line ) { foreach($h as $line ) {
if (preg_match("/^[a-zA-Z]/", $line)) { if (preg_match("/^[a-zA-Z]/", $line)) {
@ -86,6 +88,7 @@ function email_get_msg($mbox,$uid) {
if(! $struc->parts) { if(! $struc->parts) {
$ret['body'] = email_get_part($mbox,$uid,$struc,0, 'html'); $ret['body'] = email_get_part($mbox,$uid,$struc,0, 'html');
$html = $ret['body'];
if (trim($ret['body']) == '') if (trim($ret['body']) == '')
$ret['body'] = email_get_part($mbox,$uid,$struc,0, 'plain'); $ret['body'] = email_get_part($mbox,$uid,$struc,0, 'plain');
@ -107,6 +110,17 @@ function email_get_msg($mbox,$uid) {
else else
$ret['body'] = $text; $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; return $ret;
} }

View file

@ -163,7 +163,7 @@ function bbtoevent($s) {
if(preg_match("/\[event\-adjust\](.*?)\[\/event\-adjust\]/is",$s,$match)) if(preg_match("/\[event\-adjust\](.*?)\[\/event\-adjust\]/is",$s,$match))
$ev['adjust'] = $match[1]; $ev['adjust'] = $match[1];
$match = ''; $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; return $ev;
} }

View file

@ -142,18 +142,22 @@ function html2bbcode($message)
node2bbcode($doc, 'span', array('style'=>'font-style: italic;'), '[i]', '[/i]'); node2bbcode($doc, 'span', array('style'=>'font-style: italic;'), '[i]', '[/i]');
node2bbcode($doc, 'span', array('style'=>'font-weight: bold;'), '[b]', '[/b]'); 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('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 ]+)/', '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 ]+)/', 'color'=>'/(.+)/'), '[font=$1][color=$3]', '[/color][/font]');
node2bbcode($doc, 'font', array('face'=>'/([\w ]+)/'), '[font=$1]', '[/font]'); node2bbcode($doc, 'font', array('face'=>'/([\w ]+)/'), '[font=$1]', '[/font]');
node2bbcode($doc, 'font', array('size'=>'/(\d+)/'), '[size=$1]', '[/size]'); node2bbcode($doc, 'font', array('size'=>'/(\d+)/'), '[size=$1]', '[/size]');
node2bbcode($doc, 'font', array('color'=>'/(.+)/'), '[color=$1]', '[/color]'); 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'=>'/.*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, '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+?)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-size:\s*(\d+?)px.*/'), '[font=$1][size=$2]', '[/size][/font]');
//node2bbcode($doc, 'div', array('style'=>'/.*font-family:\s*(.+?)[,;].*/'), '[font=$1]', '[/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, 'hr', array(), "[hr]", "");
//node2bbcode($doc, 'table', array(), "", ""); node2bbcode($doc, 'table', array(), "", "");
//node2bbcode($doc, 'tr', array(), "\n", ""); node2bbcode($doc, 'tr', array(), "\n", "");
//node2bbcode($doc, 'td', array(), "\t", ""); node2bbcode($doc, 'td', array(), "\t", "");
node2bbcode($doc, 'table', array(), "[table]", "[/table]"); //node2bbcode($doc, 'table', array(), "[table]", "[/table]");
node2bbcode($doc, 'th', array(), "[th]", "[/th]"); //node2bbcode($doc, 'th', array(), "[th]", "[/th]");
node2bbcode($doc, 'tr', array(), "[tr]", "[/tr]"); //node2bbcode($doc, 'tr', array(), "[tr]", "[/tr]");
node2bbcode($doc, 'td', array(), "[td]", "[/td]"); //node2bbcode($doc, 'td', array(), "[td]", "[/td]");
node2bbcode($doc, 'h1', array(), "\n\n[size=xx-large][b]", "[/b][/size]\n"); 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"); node2bbcode($doc, 'h2', array(), "\n\n[size=x-large][b]", "[/b][/size]\n");

View file

@ -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` = '' "; $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` FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid`
WHERE `contact`.`self` = 1 AND `user`.`nickname` = '%s' LIMIT 1", WHERE `contact`.`self` = 1 AND `user`.`nickname` = '%s' LIMIT 1",
dbesc($owner_nick) 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)) , '$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)) , '$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)) , '$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); call_hooks('atom_feed', $atom);
@ -682,7 +683,7 @@ function item_store($arr,$force_parent = false) {
unset($arr['dsprsig']); unset($arr['dsprsig']);
} }
if($arr['gravity']) if(x($arr, 'gravity'))
$arr['gravity'] = intval($arr['gravity']); $arr['gravity'] = intval($arr['gravity']);
elseif($arr['parent-uri'] === $arr['uri']) elseif($arr['parent-uri'] === $arr['uri'])
$arr['gravity'] = 0; $arr['gravity'] = 0;
@ -742,6 +743,7 @@ function item_store($arr,$force_parent = false) {
if($arr['parent-uri'] === $arr['uri']) { if($arr['parent-uri'] === $arr['uri']) {
$parent_id = 0; $parent_id = 0;
$parent_deleted = 0;
$allow_cid = $arr['allow_cid']; $allow_cid = $arr['allow_cid'];
$allow_gid = $arr['allow_gid']; $allow_gid = $arr['allow_gid'];
$deny_cid = $arr['deny_cid']; $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'); logger('item_store: item parent was not found - ignoring item');
return 0; return 0;
} }
$parent_deleted = 0;
} }
} }
@ -1043,6 +1047,22 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
if(! $rino_enable) if(! $rino_enable)
$rino = 0; $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' : ''); $url = $contact['notify'] . '&dfrn_id=' . $idtosend . '&dfrn_version=' . DFRN_PROTOCOL_VERSION . (($rino) ? '&rino=1' : '');
logger('dfrn_deliver: ' . $url); logger('dfrn_deliver: ' . $url);
@ -1074,6 +1094,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
$challenge = hex2bin((string) $res->challenge); $challenge = hex2bin((string) $res->challenge);
$dfrn_version = (float) (($res->dfrn_version) ? $res->dfrn_version : 2.0); $dfrn_version = (float) (($res->dfrn_version) ? $res->dfrn_version : 2.0);
$rino_allowed = ((intval($res->rino) === 1) ? 1 : 0); $rino_allowed = ((intval($res->rino) === 1) ? 1 : 0);
$page = (($owner['page-flags'] == PAGE_COMMUNITY) ? 1 : 0);
$final_dfrn_id = ''; $final_dfrn_id = '';
@ -1115,6 +1136,11 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
$postvars['perm'] = 'r'; $postvars['perm'] = 'r';
} }
$postvars['ssl_policy'] = $ssl_policy;
if($page)
$postvars['page'] = '1';
if($rino && $rino_allowed && (! $dissolve)) { if($rino && $rino_allowed && (! $dissolve)) {
$key = substr(random_string(),0,16); $key = substr(random_string(),0,16);
$data = bin2hex(aes_encrypt($postvars['data'],$key)); $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 // process any deleted entries
@ -1963,6 +2002,19 @@ function local_delivery($importer,$data) {
// NOTREACHED // 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()); logger('local_delivery: feed item count = ' . $feed->get_item_quantity());
// process any deleted entries // process any deleted entries
@ -2001,6 +2053,7 @@ function local_delivery($importer,$data) {
if(($item['verb'] === ACTIVITY_TAG) && ($item['object-type'] === ACTVITY_OBJ_TAGTERM)) { if(($item['verb'] === ACTIVITY_TAG) && ($item['object-type'] === ACTVITY_OBJ_TAGTERM)) {
$xo = parse_xml_string($item['object'],false); $xo = parse_xml_string($item['object'],false);
$xt = parse_xml_string($item['target'],false); $xt = parse_xml_string($item['target'],false);
if($xt->type === ACTIVITY_OBJ_NOTE) { if($xt->type === ACTIVITY_OBJ_NOTE) {
$i = q("select * from `item` where uri = '%s' and uid = %d limit 1", $i = q("select * from `item` where uri = '%s' and uid = %d limit 1",
dbesc($xt->id), dbesc($xt->id),

225
include/msgclean.php Normal file
View 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] != '') {
if (substr($lines[$lineno], -1) != ' ')
$lines[$lineno] .= ' ';
while ((strlen($line)>0) and ((substr($line, 0, 1) == '>')
or (substr($line, 0, 1) == ' '))) {
$line = ltrim(substr($line, 1));
}
}
//else
// $lines[$lineno] = $quotelevel.'-'.$len.'-'.$firstword.'-';
$lines[$lineno] .= $line;
//if ((($len + $firstword < 68) and (substr($line, -1, 1) != ' '))
// or ($quotelevel != $currquotelevel) or $specialchars)
if (((substr($line, -1, 1) != ' '))
or ($quotelevel != $currquotelevel))
$lineno++;
}
return(implode("\n", $lines));
}
?>

View file

@ -8,6 +8,8 @@ function nav(&$a) {
* *
*/ */
$ssl_state = ((local_user()) ? true : false);
if(!(x($a->page,'nav'))) if(!(x($a->page,'nav')))
$a->page['nav'] = ''; $a->page['nav'] = '';
@ -27,7 +29,7 @@ function nav(&$a) {
$myident = ((is_array($a->user) && isset($a->user['nickname'])) ? $a->user['nickname'] . '@' : ''); $myident = ((is_array($a->user) && isset($a->user['nickname'])) ? $a->user['nickname'] . '@' : '');
$sitelocation = $myident . substr($a->get_baseurl(),strpos($a->get_baseurl(),'//') + 2 ); $sitelocation = $myident . substr($a->get_baseurl($ssl_state),strpos($a->get_baseurl($ssl_state),'//') + 2 );
// nav links: array of array('href', 'text', 'extra css classes', 'title') // nav links: array of array('href', 'text', 'extra css classes', 'title')
@ -53,7 +55,7 @@ function nav(&$a) {
// user info // user info
$r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($a->user['uid'])); $r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($a->user['uid']));
$userinfo = array( $userinfo = array(
'icon' => (count($r) ? $r[0]['micro']: $a->get_baseurl()."/images/default-profile-mm.jpg"), 'icon' => (count($r) ? $r[0]['micro']: $a->get_baseurl($ssl_state)."/images/default-profile-mm.jpg"),
'name' => $a->user['username'], 'name' => $a->user['username'],
); );
@ -76,7 +78,7 @@ function nav(&$a) {
if(($a->config['register_policy'] == REGISTER_OPEN) && (! local_user()) && (! remote_user())) if(($a->config['register_policy'] == REGISTER_OPEN) && (! local_user()) && (! remote_user()))
$nav['register'] = array('register',t('Register'), "", t('Create an account')); $nav['register'] = array('register',t('Register'), "", t('Create an account'));
$help_url = $a->get_baseurl() . '/help'; $help_url = $a->get_baseurl($ssl_state) . '/help';
if(! get_config('system','hide_help')) if(! get_config('system','hide_help'))
$nav['help'] = array($help_url, t('Help'), "", t('Help and documentation')); $nav['help'] = array($help_url, t('Help'), "", t('Help and documentation'));

View file

@ -303,7 +303,7 @@ function webfinger_dfrn($s,&$hcard) {
if(! function_exists('webfinger')) { if(! function_exists('webfinger')) {
function webfinger($s) { function webfinger($s, $debug = false) {
$host = ''; $host = '';
if(strstr($s,'@')) { if(strstr($s,'@')) {
$host = substr($s,strpos($s,'@') + 1); $host = substr($s,strpos($s,'@') + 1);
@ -328,7 +328,7 @@ function webfinger($s) {
}} }}
if(! function_exists('lrdd')) { if(! function_exists('lrdd')) {
function lrdd($uri) { function lrdd($uri, $debug = false) {
$a = get_app(); $a = get_app();

View file

@ -337,7 +337,9 @@ function notifier_run($argv, $argc){
'$picdate' => xmlify(datetime_convert('UTC','UTC',$owner['avatar-date'] . '+00:00' , ATOM_TIME)) , '$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)) , '$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)) , '$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>' : '')
)); ));
if($mail) { if($mail) {
@ -648,8 +650,8 @@ function notifier_run($argv, $argc){
$headers .= 'Reply-to: ' . $reply_to . "\n"; $headers .= 'Reply-to: ' . $reply_to . "\n";
// for testing purposes: Collect exported mails // for testing purposes: Collect exported mails
$file = tempnam("/tmp/friendica/", "mail-out2-"); //$file = tempnam("/tmp/friendica/", "mail-out2-");
file_put_contents($file, json_encode($it)); //file_put_contents($file, json_encode($it));
$headers .= 'Message-Id: <' . iri2msgid($it['uri']) . '>' . "\n"; $headers .= 'Message-Id: <' . iri2msgid($it['uri']) . '>' . "\n";
@ -657,29 +659,14 @@ function notifier_run($argv, $argc){
$headers .= 'References: <' . iri2msgid($it['parent-uri']) . '>' . "\n"; $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", $r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' LIMIT 1",
dbesc($it['parent-uri']) dbesc($it['parent-uri']));
);
if(count($r)) {
$subtitle = $r[0]['title'];
if($subtitle) {
if(strncasecmp($subtitle,'RE:',3))
$subject = $subtitle;
else
$subject = 'Re: ' . $subtitle;
}
}
}
}
/*$headers .= 'MIME-Version: 1.0' . "\n"; if(count($r) AND ($r[0]['title'] != ''))
//$headers .= 'Content-Type: text/html; charset=UTF-8' . "\n"; $subject = $r[0]['title'];
$headers .= 'Content-Type: text/plain; charset=UTF-8' . "\n"; }
$headers .= 'Content-Transfer-Encoding: 8bit' . "\n\n"; if(strncasecmp($subject,'RE:',3))
$html = prepare_body($it); $subject = 'Re: '.$subject;
//$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); email_send($addr, $subject, $headers, $it);
} }
break; break;

View file

@ -1,6 +1,6 @@
<?php <?php
function oembed_replacecb($matches){ function oembed_replacecb($matches){
logger('oembedcb'); // logger('oembedcb');
$embedurl=$matches[1]; $embedurl=$matches[1];
$j = oembed_fetch_url($embedurl); $j = oembed_fetch_url($embedurl);
$s = oembed_format_object($j); $s = oembed_format_object($j);
@ -14,6 +14,9 @@ function oembed_fetch_url($embedurl){
$txt = Cache::get($embedurl); $txt = Cache::get($embedurl);
// These media files should now be caught in bbcode.php
// left here as a fallback in case this is called from another source
$noexts = array("mp3","mp4","ogg","ogv","oga","ogm","webm"); $noexts = array("mp3","mp4","ogg","ogv","oga","ogm","webm");
$ext = pathinfo(strtolower($embedurl),PATHINFO_EXTENSION); $ext = pathinfo(strtolower($embedurl),PATHINFO_EXTENSION);
@ -62,7 +65,7 @@ function oembed_fetch_url($embedurl){
function oembed_format_object($j){ function oembed_format_object($j){
$embedurl = $j->embedurl; $embedurl = $j->embedurl;
$jhtml = oembed_iframe($j->embedurl,$j->width,$j->height ); $jhtml = oembed_iframe($j->embedurl,(isset($j->width) ? $j->width : null), (isset($j->height) ? $j->height : null) );
$ret="<span class='oembed ".$j->type."'>"; $ret="<span class='oembed ".$j->type."'>";
switch ($j->type) { switch ($j->type) {
case "video": { case "video": {

View file

@ -1,7 +1,6 @@
<?php <?php
require_once("boot.php"); require_once("boot.php");
require_once("include/quoteconvert.php");
function poller_run($argv, $argc){ function poller_run($argv, $argc){
@ -70,6 +69,19 @@ function poller_run($argv, $argc){
// clear old cache // clear old cache
Cache::clear(); Cache::clear();
// clear item cache files if they are older than one day
$cache = get_config('system','itemcache');
if (($cache != '') and is_dir($cache)) {
if ($dh = opendir($cache)) {
while (($file = readdir($dh)) !== false) {
$fullpath = $cache."/".$file;
if ((filetype($fullpath) == "file") and filectime($fullpath) < (time() - 86400))
unlink($fullpath);
}
closedir($dh);
}
}
$manual_id = 0; $manual_id = 0;
$generation = 0; $generation = 0;
$hub_update = false; $hub_update = false;
@ -141,7 +153,10 @@ function poller_run($argv, $argc){
if($manual_id) if($manual_id)
$contact['last-update'] = '0000-00-00 00:00:00'; $contact['last-update'] = '0000-00-00 00:00:00';
if($contact['network'] === NETWORK_DFRN || $contact['network'] === NETWORK_OSTATUS) if($contact['network'] === NETWORK_DFRN)
$contact['priority'] = 2;
if(!get_config('system','ostatus_use_priority') and ($contact['network'] === NETWORK_OSTATUS))
$contact['priority'] = 2; $contact['priority'] = 2;
if($contact['priority'] || $contact['subhub']) { if($contact['priority'] || $contact['subhub']) {
@ -217,7 +232,7 @@ function poller_run($argv, $argc){
$importer_uid = $contact['uid']; $importer_uid = $contact['uid'];
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1", $r = q("SELECT `contact`.*, `user`.`page-flags` FROM `contact` LEFT JOIN `user` on `contact`.`uid` = `user`.`uid` WHERE `user`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1",
intval($importer_uid) intval($importer_uid)
); );
if(! count($r)) if(! count($r))
@ -494,7 +509,7 @@ function poller_run($argv, $argc){
logger("Mail: can't fetch msg ".$msg_uid); logger("Mail: can't fetch msg ".$msg_uid);
continue; continue;
} }
$datarray['body'] = escape_tags(convertquote($r['body'], false)); $datarray['body'] = escape_tags($r['body']);
logger("Mail: Importing ".$msg_uid); logger("Mail: Importing ".$msg_uid);

View file

@ -61,13 +61,18 @@ function queue_run($argv, $argc){
q("DELETE FROM `queue` WHERE `created` < UTC_TIMESTAMP() - INTERVAL 3 DAY"); q("DELETE FROM `queue` WHERE `created` < UTC_TIMESTAMP() - INTERVAL 3 DAY");
} }
if($queue_id) if($queue_id) {
$r = q("SELECT `id` FROM `queue` WHERE `id` = %d LIMIT 1", $r = q("SELECT `id` FROM `queue` WHERE `id` = %d LIMIT 1",
intval($queue_id) intval($queue_id)
); );
else }
$r = q("SELECT `id` FROM `queue` WHERE `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE "); else {
// For the first 12 hours we'll try to deliver every 15 minutes
// After that, we'll only attempt delivery once per hour.
$r = q("SELECT `id` FROM `queue` WHERE (( `created` > UTC_TIMESTAMP() - INTERVAL 12 HOUR && `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE ) OR ( `last` < UTC_TIMESTAMP() - INTERVAL 1 HOUR ))");
}
if(! count($r)){ if(! count($r)){
return; return;
} }

View file

@ -288,3 +288,59 @@ function item_permissions_sql($owner_id,$remote_verified = false,$groups = null)
} }
/*
* Functions used to protect against Cross-Site Request Forgery
* The security token has to base on at least one value that an attacker can't know - here it's the session ID and the private key.
* In this implementation, a security token is reusable (if the user submits a form, goes back and resubmits the form, maybe with small changes;
* or if the security token is used for ajax-calls that happen several times), but only valid for a certain amout of time (3hours).
* The "typename" seperates the security tokens of different types of forms. This could be relevant in the following case:
* A security token is used to protekt a link from CSRF (e.g. the "delete this profile"-link).
* If the new page contains by any chance external elements, then the used security token is exposed by the referrer.
* Actually, important actions should not be triggered by Links / GET-Requests at all, but somethimes they still are,
* so this mechanism brings in some damage control (the attacker would be able to forge a request to a form of this type, but not to forms of other types).
*/
function get_form_security_token($typename = '') {
$a = get_app();
$timestamp = time();
$sec_hash = hash('whirlpool', $a->user['guid'] . $a->user['prvkey'] . session_id() . $timestamp . $typename);
return $timestamp . '.' . $sec_hash;
}
function check_form_security_token($typename = '', $formname = 'form_security_token') {
if (!x($_REQUEST, $formname)) return false;
$hash = $_REQUEST[$formname];
$max_livetime = 10800; // 3 hours
$a = get_app();
$x = explode('.', $hash);
if (time() > (IntVal($x[0]) + $max_livetime)) return false;
$sec_hash = hash('whirlpool', $a->user['guid'] . $a->user['prvkey'] . session_id() . $x[0] . $typename);
return ($sec_hash == $x[1]);
}
function check_form_security_std_err_msg() {
return t('The form security token was not correct. This probably happened because the form has been opened for too long (>3 hours) before subitting it.') . EOL;
}
function check_form_security_token_redirectOnErr($err_redirect, $typename = '', $formname = 'form_security_token') {
if (!check_form_security_token($typename, $formname)) {
$a = get_app();
logger('check_form_security_token failed: user ' . $a->user['guid'] . ' - form element ' . $typename);
logger('check_form_security_token failed: _REQUEST data: ' . print_r($_REQUEST, true), LOGGER_DATA);
notice( check_form_security_std_err_msg() );
goaway($a->get_baseurl() . $err_redirect );
}
}
function check_form_security_token_ForbiddenOnErr($typename = '', $formname = 'form_security_token') {
if (!check_form_security_token($typename, $formname)) {
logger('check_form_security_token failed: user ' . $a->user['guid'] . ' - form element ' . $typename);
logger('check_form_security_token failed: _REQUEST data: ' . print_r($_REQUEST, true), LOGGER_DATA);
header('HTTP/1.1 403 Forbidden');
killme();
}
}

View file

@ -80,8 +80,13 @@
*/ */
private function _replcb_for($args){ private function _replcb_for($args){
$m = array_map('trim', explode(" as ", $args[2])); $m = array_map('trim', explode(" as ", $args[2]));
list($keyname, $varname) = explode("=>",$m[1]); $x = explode("=>",$m[1]);
if (is_null($varname)) { $varname=$keyname; $keyname=""; } if (count($x) == 1) {
$varname = $x[0];
$keyname = "";
} else {
list($keyname, $varname) = $x;
}
if ($m[0]=="" || $varname=="" || is_null($varname)) die("template error: 'for ".$m[0]." as ".$varname."'") ; if ($m[0]=="" || $varname=="" || is_null($varname)) die("template error: 'for ".$m[0]." as ".$varname."'") ;
//$vals = $this->r[$m[0]]; //$vals = $this->r[$m[0]];
$vals = $this->_get_var($m[0]); $vals = $this->_get_var($m[0]);
@ -91,7 +96,7 @@
$this->_push_stack(); $this->_push_stack();
$r = $this->r; $r = $this->r;
$r[$varname] = $v; $r[$varname] = $v;
if ($keyname!='') $r[$keyname] = $k; if ($keyname!='') $r[$keyname] = (($k === 0) ? '0' : $k);
$ret .= $this->replace($args[3], $r); $ret .= $this->replace($args[3], $r);
$this->_pop_stack(); $this->_pop_stack();
} }
@ -198,7 +203,7 @@
$os=$s; $count++; $os=$s; $count++;
$s = $this->var_replace($s); $s = $this->var_replace($s);
} }
return template_unescape($s); return $s;
} }
} }

View file

@ -20,7 +20,7 @@ function replace_macros($s,$r) {
//$a = get_app(); //$a = get_app();
//$a->page['debug'] .= "$tt <br>\n"; //$a->page['debug'] .= "$tt <br>\n";
return $r; return template_unescape($r);
}} }}
@ -638,7 +638,7 @@ if(! function_exists('search')) {
function search($s,$id='search-box',$url='/search',$save = false) { function search($s,$id='search-box',$url='/search',$save = false) {
$a = get_app(); $a = get_app();
$o = '<div id="' . $id . '">'; $o = '<div id="' . $id . '">';
$o .= '<form action="' . $a->get_baseurl() . $url . '" method="get" >'; $o .= '<form action="' . $a->get_baseurl((stristr($url,'network')) ? true : false) . $url . '" method="get" >';
$o .= '<input type="text" name="search" id="search-text" value="' . $s .'" />'; $o .= '<input type="text" name="search" id="search-text" value="' . $s .'" />';
$o .= '<input type="submit" name="submit" id="search-submit" value="' . t('Search') . '" />'; $o .= '<input type="submit" name="submit" id="search-submit" value="' . t('Search') . '" />';
if($save) if($save)
@ -694,8 +694,13 @@ function linkify($s) {
if(! function_exists('smilies')) { if(! function_exists('smilies')) {
function smilies($s, $sample = false) { function smilies($s, $sample = false) {
$a = get_app(); $a = get_app();
if(intval(get_config('system','no_smilies'))
|| (local_user() && intval(get_pconfig(local_user(),'system','no_smilies'))))
return $s;
$s = preg_replace_callback('/<pre>(.*?)<\/pre>/ism','smile_encode',$s); $s = preg_replace_callback('/<pre>(.*?)<\/pre>/ism','smile_encode',$s);
$s = preg_replace_callback('/<code>(.*?)<\/code>/ism','smile_encode',$s); $s = preg_replace_callback('/<code>(.*?)<\/code>/ism','smile_encode',$s);
@ -874,16 +879,30 @@ function link_compare($a,$b) {
if(! function_exists('prepare_body')) { if(! function_exists('prepare_body')) {
function prepare_body($item,$attach = false) { function prepare_body($item,$attach = false) {
$a = get_app();
call_hooks('prepare_body_init', $item); call_hooks('prepare_body_init', $item);
$cache = get_config('system','itemcache');
if (($cache != '')) {
$cachefile = $cache."/".$item["guid"]."-".strtotime($item["edited"])."-".hash("crc32", $item['body']);
if (file_exists($cachefile))
$s = file_get_contents($cachefile);
else {
$s = prepare_text($item['body']);
file_put_contents($cachefile, $s);
}
} else
$s = prepare_text($item['body']); $s = prepare_text($item['body']);
$prep_arr = array('item' => $item, 'html' => $s); $prep_arr = array('item' => $item, 'html' => $s);
call_hooks('prepare_body', $prep_arr); call_hooks('prepare_body', $prep_arr);
$s = $prep_arr['html']; $s = $prep_arr['html'];
if(! $attach) if(! $attach) {
return $s; return $s;
}
$arr = explode(',',$item['attach']); $arr = explode(',',$item['attach']);
if(count($arr)) { if(count($arr)) {
@ -913,10 +932,37 @@ function prepare_body($item,$attach = false) {
} }
$s .= '<div class="clear"></div></div>'; $s .= '<div class="clear"></div></div>';
} }
$matches = false;
$cnt = preg_match_all('/<(.*?)>/',$item['file'],$matches,PREG_SET_ORDER);
if($cnt) {
// logger('prepare_text: categories: ' . print_r($matches,true), LOGGER_DEBUG);
foreach($matches as $mtch) {
if(strlen($x))
$x .= ',';
$x .= file_tag_decode($mtch[1]);
}
if(strlen($x))
$s .= '<div class="categorytags"><span>' . t('Categories:') . ' </span>' . $x . '</div>';
}
$matches = false;
$x = '';
$cnt = preg_match_all('/\[(.*?)\]/',$item['file'],$matches,PREG_SET_ORDER);
if($cnt) {
// logger('prepare_text: filed_under: ' . print_r($matches,true), LOGGER_DEBUG);
foreach($matches as $mtch) {
if(strlen($x))
$x .= '&nbsp;&nbsp;&nbsp;';
$x .= file_tag_decode($mtch[1]). ' <a href="' . $a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&term=' . file_tag_decode($mtch[1]) . '" title="' . t('remove') . '" >' . t('[remove]') . '</a>';
}
if(strlen($x) && (local_user() == $item['uid']))
$s .= '<div class="filesavetags"><span>' . t('Filed under:') . ' </span>' . $x . '</div>';
}
$prep_arr = array('item' => $item, 'html' => $s); $prep_arr = array('item' => $item, 'html' => $s);
call_hooks('prepare_body_final', $prep_arr); call_hooks('prepare_body_final', $prep_arr);
return $prep_arr['html']; return $prep_arr['html'];
}} }}
@ -1267,7 +1313,7 @@ function file_tag_save_file($uid,$item,$file) {
if(count($r)) { if(count($r)) {
if(! stristr($r[0]['file'],'[' . file_tag_encode($file) . ']')) if(! stristr($r[0]['file'],'[' . file_tag_encode($file) . ']'))
q("update item set file = '%s' where id = %d and uid = %d limit 1", q("update item set file = '%s' where id = %d and uid = %d limit 1",
dbesc($r[0]['file'] . '[' . $file_tag_encode($file) . ']'), dbesc($r[0]['file'] . '[' . file_tag_encode($file) . ']'),
intval($item), intval($item),
intval($uid) intval($uid)
); );

View file

@ -486,9 +486,9 @@
return a.join(''); return a.join('');
} }
function groupChangeMember(gid,cid) { function groupChangeMember(gid, cid, sec_token) {
$('body .fakelink').css('cursor', 'wait'); $('body .fakelink').css('cursor', 'wait');
$.get('group/' + gid + '/' + cid, function(data) { $.get('group/' + gid + '/' + cid + "?t=" + sec_token, function(data) {
$('#group-update-wrapper').html(data); $('#group-update-wrapper').html(data);
$('body .fakelink').css('cursor', 'auto'); $('body .fakelink').css('cursor', 'auto');
}); });

View file

@ -79,6 +79,7 @@
/* oembed */ /* oembed */
function _h2b_cb(match) { function _h2b_cb(match) {
/*
function s_h2b(data) { function s_h2b(data) {
match = data; match = data;
} }
@ -90,6 +91,23 @@
success: s_h2b, success: s_h2b,
dataType: 'html' dataType: 'html'
}); });
*/
var f, g, tof = [], tor = [];
var find_spanc = /<span [^>]*class *= *[\"'](?:[^\"']* )*oembed(?: [^\"']*)*[\"'][^>]*>(.*?(?:<span[^>]*>(.*?)<\/span *>)*.*?)<\/span *>/ig;
while (f = find_spanc.exec(match)) {
var find_a = /<a([^>]* rel=[\"']oembed[\"'][^>]*)>.*?<\/a *>/ig;
if (g = find_a.exec(f[1])) {
var find_href = /href=[\"']([^\"']*)[\"']/ig;
var m2 = find_href.exec(g[1]);
if (m2[1]) {
tof.push(f[0]);
tor.push("[EMBED]" + m2[1] + "[/EMBED]");
}
}
}
for (var i = 0; i < tof.length; i++) match = match.replace(tof[i], tor[i]);
return match; return match;
} }
if (s.indexOf('class="oembed')>=0){ if (s.indexOf('class="oembed')>=0){

View file

@ -37,7 +37,7 @@ function admin_post(&$a){
$func($a); $func($a);
} }
} }
goaway($a->get_baseurl() . '/admin/plugins/' . $a->argv[2] ); goaway($a->get_baseurl(true) . '/admin/plugins/' . $a->argv[2] );
return; // NOTREACHED return; // NOTREACHED
break; break;
case 'logs': case 'logs':
@ -49,7 +49,7 @@ function admin_post(&$a){
} }
} }
goaway($a->get_baseurl() . '/admin' ); goaway($a->get_baseurl(true) . '/admin' );
return; // NOTREACHED return; // NOTREACHED
} }
@ -68,11 +68,11 @@ function admin_content(&$a) {
// array( url, name, extra css classes ) // array( url, name, extra css classes )
$aside = Array( $aside = Array(
'site' => Array($a->get_baseurl()."/admin/site/", t("Site") , "site"), 'site' => Array($a->get_baseurl(true)."/admin/site/", t("Site") , "site"),
'users' => Array($a->get_baseurl()."/admin/users/", t("Users") , "users"), 'users' => Array($a->get_baseurl(true)."/admin/users/", t("Users") , "users"),
'plugins'=> Array($a->get_baseurl()."/admin/plugins/", t("Plugins") , "plugins"), 'plugins'=> Array($a->get_baseurl(true)."/admin/plugins/", t("Plugins") , "plugins"),
'themes' => Array($a->get_baseurl()."/admin/themes/", t("Themes") , "themes"), 'themes' => Array($a->get_baseurl(true)."/admin/themes/", t("Themes") , "themes"),
'update' => Array($a->get_baseurl()."/admin/update/", t("Update") , "update") 'update' => Array($a->get_baseurl(true)."/admin/update/", t("Update") , "update")
); );
/* get plugins admin page */ /* get plugins admin page */
@ -81,18 +81,18 @@ function admin_content(&$a) {
$aside['plugins_admin']=Array(); $aside['plugins_admin']=Array();
foreach ($r as $h){ foreach ($r as $h){
$plugin =$h['name']; $plugin =$h['name'];
$aside['plugins_admin'][] = Array($a->get_baseurl()."/admin/plugins/".$plugin, $plugin, "plugin"); $aside['plugins_admin'][] = Array($a->get_baseurl(true)."/admin/plugins/".$plugin, $plugin, "plugin");
// temp plugins with admin // temp plugins with admin
$a->plugins_admin[] = $plugin; $a->plugins_admin[] = $plugin;
} }
$aside['logs'] = Array($a->get_baseurl()."/admin/logs/", t("Logs"), "logs"); $aside['logs'] = Array($a->get_baseurl(true)."/admin/logs/", t("Logs"), "logs");
$t = get_markup_template("admin_aside.tpl"); $t = get_markup_template("admin_aside.tpl");
$a->page['aside'] = replace_macros( $t, array( $a->page['aside'] = replace_macros( $t, array(
'$admin' => $aside, '$admin' => $aside,
'$h_pending' => t('User registrations waiting for confirmation'), '$h_pending' => t('User registrations waiting for confirmation'),
'$admurl'=> $a->get_baseurl()."/admin/" '$admurl'=> $a->get_baseurl(true)."/admin/"
)); ));
@ -152,10 +152,6 @@ function admin_page_summary(&$a) {
$r = q("SELECT COUNT(id) as `count` FROM `register`"); $r = q("SELECT COUNT(id) as `count` FROM `register`");
$pending = $r[0]['count']; $pending = $r[0]['count'];
$t = get_markup_template("admin_summary.tpl"); $t = get_markup_template("admin_summary.tpl");
return replace_macros($t, array( return replace_macros($t, array(
'$title' => t('Administration'), '$title' => t('Administration'),
@ -210,7 +206,7 @@ function admin_page_site_post(&$a){
$dfrn_only = ((x($_POST,'dfrn_only')) ? True : False); $dfrn_only = ((x($_POST,'dfrn_only')) ? True : False);
$ostatus_disabled = !((x($_POST,'ostatus_disabled')) ? True : False); $ostatus_disabled = !((x($_POST,'ostatus_disabled')) ? True : False);
$diaspora_enabled = ((x($_POST,'diaspora_enabled')) ? True : False); $diaspora_enabled = ((x($_POST,'diaspora_enabled')) ? True : False);
$ssl_policy = ((x($_POST,'ssl_policy')) ? intval($_POST['ssl_policy']) : 0);
set_config('config','sitename',$sitename); set_config('config','sitename',$sitename);
if ($banner==""){ if ($banner==""){
@ -222,6 +218,7 @@ function admin_page_site_post(&$a){
} else { } else {
set_config('system','banner', $banner); set_config('system','banner', $banner);
} }
set_config('system','ssl_policy',$ssl_policy);
set_config('system','language', $language); set_config('system','language', $language);
set_config('system','theme', $theme); set_config('system','theme', $theme);
set_config('system','maximagesize', $maximagesize); set_config('system','maximagesize', $maximagesize);
@ -258,7 +255,7 @@ function admin_page_site_post(&$a){
set_config('system','diaspora_enabled', $diaspora_enabled); set_config('system','diaspora_enabled', $diaspora_enabled);
info( t('Site settings updated.') . EOL); info( t('Site settings updated.') . EOL);
goaway($a->get_baseurl() . '/admin/site' ); goaway($a->get_baseurl(true) . '/admin/site' );
return; // NOTREACHED return; // NOTREACHED
} }
@ -306,6 +303,12 @@ function admin_page_site(&$a) {
REGISTER_OPEN => t("Open") REGISTER_OPEN => t("Open")
); );
$ssl_choices = array(
SSL_POLICY_NONE => t("No SSL policy, links will track page SSL state"),
SSL_POLICY_FULL => t("Force all links to use SSL"),
SSL_POLICY_SELFSIGN => t("Self-signed certificate, use SSL for local links only (discouraged)")
);
$t = get_markup_template("admin_site.tpl"); $t = get_markup_template("admin_site.tpl");
return replace_macros($t, array( return replace_macros($t, array(
'$title' => t('Administration'), '$title' => t('Administration'),
@ -316,13 +319,13 @@ function admin_page_site(&$a) {
'$corporate' => t('Policies'), '$corporate' => t('Policies'),
'$advanced' => t('Advanced'), '$advanced' => t('Advanced'),
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
// name, label, value, help string, extra data... // name, label, value, help string, extra data...
'$sitename' => array('sitename', t("Site name"), htmlentities($a->config['sitename'], ENT_QUOTES), ""), '$sitename' => array('sitename', t("Site name"), htmlentities($a->config['sitename'], ENT_QUOTES), ""),
'$banner' => array('banner', t("Banner/Logo"), $banner, ""), '$banner' => array('banner', t("Banner/Logo"), $banner, ""),
'$language' => array('language', t("System language"), get_config('system','language'), "", $lang_choices), '$language' => array('language', t("System language"), get_config('system','language'), "", $lang_choices),
'$theme' => array('theme', t("System theme"), get_config('system','theme'), t("Default system theme - may be over-ridden by user profiles"), $theme_choices), '$theme' => array('theme', t("System theme"), get_config('system','theme'), t("Default system theme - may be over-ridden by user profiles"), $theme_choices),
'$ssl_policy' => array('ssl_policy', t("SSL link policy"), (string) intval(get_config('system','ssl_policy')), t("Determines whether generated links should be forced to use SSL"), $ssl_choices),
'$maximagesize' => array('maximagesize', t("Maximum image size"), get_config('system','maximagesize'), t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")), '$maximagesize' => array('maximagesize', t("Maximum image size"), get_config('system','maximagesize'), t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")),
'$register_policy' => array('register_policy', t("Register policy"), $a->config['register_policy'], "", $register_choices), '$register_policy' => array('register_policy', t("Register policy"), $a->config['register_policy'], "", $register_choices),
@ -389,7 +392,7 @@ function admin_page_users_post(&$a){
user_deny($hash); user_deny($hash);
} }
} }
goaway($a->get_baseurl() . '/admin/users' ); goaway($a->get_baseurl(true) . '/admin/users' );
return; // NOTREACHED return; // NOTREACHED
} }
@ -399,7 +402,7 @@ function admin_page_users(&$a){
$user = q("SELECT * FROM `user` WHERE `uid`=%d", intval($uid)); $user = q("SELECT * FROM `user` WHERE `uid`=%d", intval($uid));
if (count($user)==0){ if (count($user)==0){
notice( 'User not found' . EOL); notice( 'User not found' . EOL);
goaway($a->get_baseurl() . '/admin/users' ); goaway($a->get_baseurl(true) . '/admin/users' );
return; // NOTREACHED return; // NOTREACHED
} }
switch($a->argv[2]){ switch($a->argv[2]){
@ -418,7 +421,7 @@ function admin_page_users(&$a){
notice( sprintf( ($user[0]['blocked']?t("User '%s' unblocked"):t("User '%s' blocked")) , $user[0]['username']) . EOL); notice( sprintf( ($user[0]['blocked']?t("User '%s' unblocked"):t("User '%s' blocked")) , $user[0]['username']) . EOL);
}; break; }; break;
} }
goaway($a->get_baseurl() . '/admin/users' ); goaway($a->get_baseurl(true) . '/admin/users' );
return; // NOTREACHED return; // NOTREACHED
} }
@ -497,7 +500,7 @@ function admin_page_users(&$a){
// values // // values //
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$pending' => $pending, '$pending' => $pending,
'$users' => $users, '$users' => $users,
@ -536,7 +539,7 @@ function admin_page_plugins(&$a){
info( sprintf( t("Plugin %s enabled."), $plugin ) ); info( sprintf( t("Plugin %s enabled."), $plugin ) );
} }
set_config("system","addon", implode(", ",$a->plugins)); set_config("system","addon", implode(", ",$a->plugins));
goaway($a->get_baseurl() . '/admin/plugins' ); goaway($a->get_baseurl(true) . '/admin/plugins' );
return; // NOTREACHED return; // NOTREACHED
} }
// display plugin details // display plugin details
@ -569,7 +572,7 @@ function admin_page_plugins(&$a){
'$page' => t('Plugins'), '$page' => t('Plugins'),
'$toggle' => t('Toggle'), '$toggle' => t('Toggle'),
'$settings' => t('Settings'), '$settings' => t('Settings'),
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$plugin' => $plugin, '$plugin' => $plugin,
'$status' => $status, '$status' => $status,
@ -607,7 +610,7 @@ function admin_page_plugins(&$a){
'$title' => t('Administration'), '$title' => t('Administration'),
'$page' => t('Plugins'), '$page' => t('Plugins'),
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$function' => 'plugins', '$function' => 'plugins',
'$plugins' => $plugins '$plugins' => $plugins
)); ));
@ -713,7 +716,7 @@ function admin_page_themes(&$a){
info( sprintf('Theme %s disabled.',$theme)); info( sprintf('Theme %s disabled.',$theme));
set_config('system','allowed_themes',$s); set_config('system','allowed_themes',$s);
goaway($a->get_baseurl() . '/admin/themes' ); goaway($a->get_baseurl(true) . '/admin/themes' );
return; // NOTREACHED return; // NOTREACHED
} }
@ -742,7 +745,7 @@ function admin_page_themes(&$a){
'$page' => t('Themes'), '$page' => t('Themes'),
'$toggle' => t('Toggle'), '$toggle' => t('Toggle'),
'$settings' => t('Settings'), '$settings' => t('Settings'),
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$plugin' => $theme, '$plugin' => $theme,
'$status' => $status, '$status' => $status,
@ -774,7 +777,7 @@ function admin_page_themes(&$a){
'$title' => t('Administration'), '$title' => t('Administration'),
'$page' => t('Themes'), '$page' => t('Themes'),
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$function' => 'themes', '$function' => 'themes',
'$plugins' => $xthemes, '$plugins' => $xthemes,
'$experimental' => t('[Experimental]'), '$experimental' => t('[Experimental]'),
@ -802,7 +805,7 @@ function admin_page_logs_post(&$a) {
} }
info( t("Log settings updated.") ); info( t("Log settings updated.") );
goaway($a->get_baseurl() . '/admin/logs' ); goaway($a->get_baseurl(true) . '/admin/logs' );
return; // NOTREACHED return; // NOTREACHED
} }
@ -856,7 +859,7 @@ readable.");
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$clear' => t('Clear'), '$clear' => t('Clear'),
'$data' => $data, '$data' => $data,
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$logname' => get_config('system','logfile'), '$logname' => get_config('system','logfile'),
// name, label, value, help string, extra data... // name, label, value, help string, extra data...
@ -901,7 +904,7 @@ function admin_page_remoteupdate(&$a) {
$tpl = get_markup_template("admin_remoteupdate.tpl"); $tpl = get_markup_template("admin_remoteupdate.tpl");
return replace_macros($tpl, array( return replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$submit' => t("Update now"), '$submit' => t("Update now"),
'$close' => t("Close"), '$close' => t("Close"),
'$localversion' => FRIENDICA_VERSION, '$localversion' => FRIENDICA_VERSION,

View file

@ -61,7 +61,7 @@ function contacts_post(&$a) {
if(! count($orig_record)) { if(! count($orig_record)) {
notice( t('Could not access contact record.') . EOL); notice( t('Could not access contact record.') . EOL);
goaway($a->get_baseurl() . '/contacts'); goaway($a->get_baseurl(true) . '/contacts');
return; // NOTREACHED return; // NOTREACHED
} }
@ -141,7 +141,7 @@ function contacts_content(&$a) {
if(! count($orig_record)) { if(! count($orig_record)) {
notice( t('Could not access contact record.') . EOL); notice( t('Could not access contact record.') . EOL);
goaway($a->get_baseurl() . '/contacts'); goaway($a->get_baseurl(true) . '/contacts');
return; // NOTREACHED return; // NOTREACHED
} }
@ -149,7 +149,7 @@ function contacts_content(&$a) {
// pull feed and consume it, which should subscribe to the hub. // pull feed and consume it, which should subscribe to the hub.
proc_run('php',"include/poller.php","$contact_id"); proc_run('php',"include/poller.php","$contact_id");
goaway($a->get_baseurl() . '/contacts/' . $contact_id); goaway($a->get_baseurl(true) . '/contacts/' . $contact_id);
// NOTREACHED // NOTREACHED
} }
@ -164,7 +164,7 @@ function contacts_content(&$a) {
//notice( t('Contact has been ') . (($blocked) ? t('blocked') : t('unblocked')) . EOL ); //notice( t('Contact has been ') . (($blocked) ? t('blocked') : t('unblocked')) . EOL );
info( (($blocked) ? t('Contact has been blocked') : t('Contact has been unblocked')) . EOL ); info( (($blocked) ? t('Contact has been blocked') : t('Contact has been unblocked')) . EOL );
} }
goaway($a->get_baseurl() . '/contacts/' . $contact_id); goaway($a->get_baseurl(true) . '/contacts/' . $contact_id);
return; // NOTREACHED return; // NOTREACHED
} }
@ -178,7 +178,7 @@ function contacts_content(&$a) {
if($r) { if($r) {
info( (($readonly) ? t('Contact has been ignored') : t('Contact has been unignored')) . EOL ); info( (($readonly) ? t('Contact has been ignored') : t('Contact has been unignored')) . EOL );
} }
goaway($a->get_baseurl() . '/contacts/' . $contact_id); goaway($a->get_baseurl(true) . '/contacts/' . $contact_id);
return; // NOTREACHED return; // NOTREACHED
} }
@ -220,9 +220,9 @@ function contacts_content(&$a) {
contact_remove($orig_record[0]['id']); contact_remove($orig_record[0]['id']);
info( t('Contact has been removed.') . EOL ); info( t('Contact has been removed.') . EOL );
if(x($_SESSION,'return_url')) if(x($_SESSION,'return_url'))
goaway($a->get_baseurl() . '/' . $_SESSION['return_url']); goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
else else
goaway($a->get_baseurl() . '/contacts'); goaway($a->get_baseurl(true) . '/contacts');
return; // NOTREACHED return; // NOTREACHED
} }
} }
@ -233,7 +233,7 @@ function contacts_content(&$a) {
$contact = $a->data['contact']; $contact = $a->data['contact'];
$tpl = get_markup_template('contact_head.tpl'); $tpl = get_markup_template('contact_head.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl())); $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl(true)));
require_once('include/contact_selectors.php'); require_once('include/contact_selectors.php');
@ -295,17 +295,17 @@ function contacts_content(&$a) {
$tabs = array( $tabs = array(
array( array(
'label' => (($contact['blocked']) ? t('Unblock') : t('Block') ), 'label' => (($contact['blocked']) ? t('Unblock') : t('Block') ),
'url' => $a->get_baseurl() . '/contacts/' . $contact_id . '/block', 'url' => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/block',
'sel' => '', 'sel' => '',
), ),
array( array(
'label' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ), 'label' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ),
'url' => $a->get_baseurl() . '/contacts/' . $contact_id . '/ignore', 'url' => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/ignore',
'sel' => '', 'sel' => '',
), ),
array( array(
'label' => t('Repair'), 'label' => t('Repair'),
'url' => $a->get_baseurl() . '/crepair/' . $contact_id, 'url' => $a->get_baseurl(true) . '/crepair/' . $contact_id,
'sel' => '', 'sel' => '',
) )
); );
@ -322,7 +322,7 @@ function contacts_content(&$a) {
'$lbl_info1' => t('Contact Information / Notes'), '$lbl_info1' => t('Contact Information / Notes'),
'$infedit' => t('Edit contact notes'), '$infedit' => t('Edit contact notes'),
'$common_text' => $common_text, '$common_text' => $common_text,
'$common_link' => $a->get_baseurl() . '/common/' . $contact['id'], '$common_link' => $a->get_baseurl(true) . '/common/' . $contact['id'],
'$all_friends' => $all_friends, '$all_friends' => $all_friends,
'$relation_text' => $relation_text, '$relation_text' => $relation_text,
'$visit' => sprintf( t('Visit %s\'s profile [%s]'),$contact['name'],$contact['url']), '$visit' => sprintf( t('Visit %s\'s profile [%s]'),$contact['name'],$contact['url']),
@ -397,30 +397,30 @@ function contacts_content(&$a) {
$tabs = array( $tabs = array(
array( array(
'label' => t('All Contacts'), 'label' => t('All Contacts'),
'url' => $a->get_baseurl() . '/contacts/all', 'url' => $a->get_baseurl(true) . '/contacts/all',
'sel' => ($all) ? 'active' : '', 'sel' => ($all) ? 'active' : '',
), ),
array( array(
'label' => t('Unblocked Contacts'), 'label' => t('Unblocked Contacts'),
'url' => $a->get_baseurl() . '/contacts', 'url' => $a->get_baseurl(true) . '/contacts',
'sel' => ((! $all) && (! $blocked) && (! $hidden) && (! $search) && (! $nets) && (! $ignored)) ? 'active' : '', 'sel' => ((! $all) && (! $blocked) && (! $hidden) && (! $search) && (! $nets) && (! $ignored)) ? 'active' : '',
), ),
array( array(
'label' => t('Blocked Contacts'), 'label' => t('Blocked Contacts'),
'url' => $a->get_baseurl() . '/contacts/blocked', 'url' => $a->get_baseurl(true) . '/contacts/blocked',
'sel' => ($blocked) ? 'active' : '', 'sel' => ($blocked) ? 'active' : '',
), ),
array( array(
'label' => t('Ignored Contacts'), 'label' => t('Ignored Contacts'),
'url' => $a->get_baseurl() . '/contacts/ignored', 'url' => $a->get_baseurl(true) . '/contacts/ignored',
'sel' => ($ignored) ? 'active' : '', 'sel' => ($ignored) ? 'active' : '',
), ),
array( array(
'label' => t('Hidden Contacts'), 'label' => t('Hidden Contacts'),
'url' => $a->get_baseurl() . '/contacts/hidden', 'url' => $a->get_baseurl(true) . '/contacts/hidden',
'sel' => ($hidden) ? 'active' : '', 'sel' => ($hidden) ? 'active' : '',
), ),
@ -445,7 +445,7 @@ function contacts_content(&$a) {
$r = q("SELECT COUNT(*) AS `total` FROM `contact` $r = q("SELECT COUNT(*) AS `total` FROM `contact`
WHERE `uid` = %d AND `pending` = 0 $sql_extra $sql_extra2 ", WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ",
intval($_SESSION['uid'])); intval($_SESSION['uid']));
if(count($r)) { if(count($r)) {
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
@ -454,7 +454,7 @@ function contacts_content(&$a) {
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `pending` = 0 $sql_extra $sql_extra2 ORDER BY `name` ASC LIMIT %d , %d ", $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ORDER BY `name` ASC LIMIT %d , %d ",
intval($_SESSION['uid']), intval($_SESSION['uid']),
intval($a->pager['start']), intval($a->pager['start']),
intval($a->pager['itemspage']) intval($a->pager['itemspage'])
@ -465,8 +465,6 @@ function contacts_content(&$a) {
if(count($r)) { if(count($r)) {
foreach($r as $rr) { foreach($r as $rr) {
if($rr['self'])
continue;
switch($rr['rel']) { switch($rr['rel']) {
case CONTACT_IS_FRIEND: case CONTACT_IS_FRIEND:

View file

@ -207,6 +207,9 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
if($duplex == 1) if($duplex == 1)
$params['duplex'] = 1; $params['duplex'] = 1;
if($user['page-flags'] == PAGE_COMMUNITY)
$params['page'] = 1;
logger('dfrn_confirm: Confirm: posting data to ' . $dfrn_confirm . ': ' . print_r($params,true), LOGGER_DATA); logger('dfrn_confirm: Confirm: posting data to ' . $dfrn_confirm . ': ' . print_r($params,true), LOGGER_DATA);
/** /**
@ -522,6 +525,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$source_url = ((x($_POST,'source_url')) ? hex2bin($_POST['source_url']) : ''); $source_url = ((x($_POST,'source_url')) ? hex2bin($_POST['source_url']) : '');
$aes_key = ((x($_POST,'aes_key')) ? $_POST['aes_key'] : ''); $aes_key = ((x($_POST,'aes_key')) ? $_POST['aes_key'] : '');
$duplex = ((x($_POST,'duplex')) ? intval($_POST['duplex']) : 0 ); $duplex = ((x($_POST,'duplex')) ? intval($_POST['duplex']) : 0 );
$page = ((x($_POST,'page')) ? intval($_POST['page']) : 0 );
$version_id = ((x($_POST,'dfrn_version')) ? (float) $_POST['dfrn_version'] : 2.0); $version_id = ((x($_POST,'dfrn_version')) ? (float) $_POST['dfrn_version'] : 2.0);
logger('dfrn_confirm: requestee contacted: ' . $node); logger('dfrn_confirm: requestee contacted: ' . $node);
@ -677,6 +681,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
`blocked` = 0, `blocked` = 0,
`pending` = 0, `pending` = 0,
`duplex` = %d, `duplex` = %d,
`forum` = %d,
`network` = '%s' WHERE `id` = %d LIMIT 1 `network` = '%s' WHERE `id` = %d LIMIT 1
", ",
dbesc($photos[0]), dbesc($photos[0]),
@ -687,6 +692,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc(datetime_convert()), dbesc(datetime_convert()),
intval($duplex), intval($duplex),
intval($page),
dbesc(NETWORK_DFRN), dbesc(NETWORK_DFRN),
intval($dfrn_record) intval($dfrn_record)
); );

View file

@ -14,6 +14,8 @@ function dfrn_notify_post(&$a) {
$key = ((x($_POST,'key')) ? $_POST['key'] : ''); $key = ((x($_POST,'key')) ? $_POST['key'] : '');
$dissolve = ((x($_POST,'dissolve')) ? intval($_POST['dissolve']) : 0); $dissolve = ((x($_POST,'dissolve')) ? intval($_POST['dissolve']) : 0);
$perm = ((x($_POST,'perm')) ? notags(trim($_POST['perm'])) : 'r'); $perm = ((x($_POST,'perm')) ? notags(trim($_POST['perm'])) : 'r');
$ssl_policy = ((x($_POST,'ssl_policy')) ? notags(trim($_POST['ssl_policy'])): 'none');
$page = ((x($_POST,'page')) ? intval($_POST['page']) : 0);
$writable = (-1); $writable = (-1);
if($dfrn_version >= 2.21) { if($dfrn_version >= 2.21) {
@ -86,12 +88,74 @@ function dfrn_notify_post(&$a) {
$importer = $r[0]; $importer = $r[0];
if(($writable != (-1)) && ($writable != $importer['writable'])) { if((($writable != (-1)) && ($writable != $importer['writable'])) || ($importer['forum'] != $page)) {
q("UPDATE `contact` SET `writable` = %d WHERE `id` = %d LIMIT 1", q("UPDATE `contact` SET `writable` = %d, forum = %d WHERE `id` = %d LIMIT 1",
intval($writable), intval(($writable == (-1)) ? $importer['writable'] : $writable),
intval($page),
intval($importer['id']) intval($importer['id'])
); );
if($writable != (-1))
$importer['writable'] = $writable; $importer['writable'] = $writable;
$importer['forum'] = $page;
}
// if contact's ssl policy changed, update our links
$ssl_changed = false;
if($ssl_policy == 'self' && strstr($importer['url'],'https:')) {
$ssl_changed = true;
$importer['url'] = str_replace('https:','http:',$importer['url']);
$importer['nurl'] = normalise_link($importer['url']);
$importer['photo'] = str_replace('https:','http:',$importer['photo']);
$importer['thumb'] = str_replace('https:','http:',$importer['thumb']);
$importer['micro'] = str_replace('https:','http:',$importer['micro']);
$importer['request'] = str_replace('https:','http:',$importer['request']);
$importer['notify'] = str_replace('https:','http:',$importer['notify']);
$importer['poll'] = str_replace('https:','http:',$importer['poll']);
$importer['confirm'] = str_replace('https:','http:',$importer['confirm']);
$importer['poco'] = str_replace('https:','http:',$importer['poco']);
}
if($ssl_policy == 'full' && strstr($importer['url'],'http:')) {
$ssl_changed = true;
$importer['url'] = str_replace('http:','https:',$importer['url']);
$importer['nurl'] = normalise_link($importer['url']);
$importer['photo'] = str_replace('http:','https:',$importer['photo']);
$importer['thumb'] = str_replace('http:','https:',$importer['thumb']);
$importer['micro'] = str_replace('http:','https:',$importer['micro']);
$importer['request'] = str_replace('http:','https:',$importer['request']);
$importer['notify'] = str_replace('http:','https:',$importer['notify']);
$importer['poll'] = str_replace('http:','https:',$importer['poll']);
$importer['confirm'] = str_replace('http:','https:',$importer['confirm']);
$importer['poco'] = str_replace('http:','https:',$importer['poco']);
}
if($ssl_changed) {
q("update contact set
url = '%s',
nurl = '%s',
photo = '%s',
thumb = '%s',
micro = '%s',
request = '%s',
notify = '%s',
poll = '%s',
confirm = '%s',
poco = '%s'
where id = %d limit 1",
dbesc($importer['url']),
dbesc($importer['nurl']),
dbesc($importer['photo']),
dbesc($importer['thumb']),
dbesc($importer['micro']),
dbesc($importer['request']),
dbesc($importer['notify']),
dbesc($importer['poll']),
dbesc($importer['confirm']),
dbesc($importer['poco']),
intval($importer['id'])
);
} }
logger('dfrn_notify: received notify from ' . $importer['name'] . ' for ' . $importer['username']); logger('dfrn_notify: received notify from ' . $importer['name'] . ' for ' . $importer['username']);

View file

@ -43,7 +43,7 @@ function dfrn_request_post(&$a) {
return; return;
if($_POST['cancel']) { if(x($_POST, 'cancel')) {
goaway(z_root()); goaway(z_root());
} }
@ -77,9 +77,10 @@ function dfrn_request_post(&$a) {
* Lookup the contact based on their URL (which is the only unique thing we have at the moment) * Lookup the contact based on their URL (which is the only unique thing we have at the moment)
*/ */
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `self` = 0 LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND (`url` = '%s' OR `nurl` = '%s') AND `self` = 0 LIMIT 1",
intval(local_user()), intval(local_user()),
dbesc($dfrn_url) dbesc($dfrn_url),
dbesc(normalise_link($dfrn_url))
); );
if(count($r)) { if(count($r)) {
@ -666,7 +667,25 @@ function dfrn_request_content(&$a) {
$page_desc = sprintf( t('Diaspora members: Please do not use this form. Instead, enter "%s" into your Diaspora search bar.'), $page_desc = sprintf( t('Diaspora members: Please do not use this form. Instead, enter "%s" into your Diaspora search bar.'),
$target_addr) . EOL . EOL; $target_addr) . EOL . EOL;
$page_desc .= t("Please enter your 'Identity Address' from one of the following supported social networks:"); $page_desc .= t("Please enter your 'Identity Address' from one of the following supported communications networks:");
// see if we are allowed to have NETWORK_MAIL2 contacts
$mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
if(get_config('system','dfrn_only'))
$mail_disabled = 1;
if(! $mail_disabled) {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
intval($a->profile['uid'])
);
if(! count($r))
$mail_disabled = 1;
}
$emailnet = (($mail_disabled) ? '' : t("<strike>Connect as an email follower</strike> \x28Coming soon\x29"));
$invite_desc = t('If you are not yet a member of the free social web, <a href="http://dir.friendica.com/siteinfo">follow this link to find a public Friendica site and join us today</a>.');
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$header' => t('Friend/Connection Request'), '$header' => t('Friend/Connection Request'),
@ -682,6 +701,8 @@ function dfrn_request_content(&$a) {
'$diaspora' => t('Diaspora'), '$diaspora' => t('Diaspora'),
'$diasnote' => t('- please share from your own site as noted above'), '$diasnote' => t('- please share from your own site as noted above'),
'$your_address' => t('Your Identity Address:'), '$your_address' => t('Your Identity Address:'),
'$invite_desc' => $invite_desc,
'$emailnet' => $emailnet,
'$submit' => t('Submit Request'), '$submit' => t('Submit Request'),
'$cancel' => t('Cancel'), '$cancel' => t('Cancel'),
'$nickname' => $a->argv[1], '$nickname' => $a->argv[1],

View file

@ -25,10 +25,6 @@ function directory_post(&$a) {
function directory_content(&$a) { function directory_content(&$a) {
$everything = (($a->argc > 1 && $a->argv[1] === 'all' && is_site_admin()) ? true : false);
if(x($_SESSION,'submanage') && intval($_SESSION['submanage']))
$everything = false;
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) { if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
notice( t('Public access denied.') . EOL); notice( t('Public access denied.') . EOL);
return; return;
@ -52,12 +48,6 @@ function directory_content(&$a) {
} }
$admin = ''; $admin = '';
if(is_site_admin()) {
if($everything)
$admin = '<ul><li><div id="directory-admin-link"><a href="' . $a->get_baseurl() . '/directory' . '">' . t('Normal site view') . '</a></div></li></ul>';
else
$admin = '<ul><li><div id="directory-admin-link"><a href="' . $a->get_baseurl() . '/directory/all' . '">' . t('Admin - View all site entries') . '</a></div></li></ul>';
}
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
'$search' => $search, '$search' => $search,
@ -73,16 +63,13 @@ function directory_content(&$a) {
$search = dbesc($search); $search = dbesc($search);
$sql_extra = ((strlen($search)) ? " AND MATCH (`profile`.`name`, `user`.`nickname`, `pdesc`, `locality`,`region`,`country-name`,`gender`,`marital`,`sexual`,`about`,`romance`,`work`,`education`,`pub_keywords`,`prv_keywords` ) AGAINST ('$search' IN BOOLEAN MODE) " : ""); $sql_extra = ((strlen($search)) ? " AND MATCH (`profile`.`name`, `user`.`nickname`, `pdesc`, `locality`,`region`,`country-name`,`gender`,`marital`,`sexual`,`about`,`romance`,`work`,`education`,`pub_keywords`,`prv_keywords` ) AGAINST ('$search' IN BOOLEAN MODE) " : "");
$publish = ((get_config('system','publish_all') || $everything) ? '' : " AND `publish` = 1 " ); $publish = ((get_config('system','publish_all')) ? '' : " AND `publish` = 1 " );
$r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra "); $r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra ");
if(count($r)) if(count($r))
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
if($everything)
$order = " ORDER BY `register_date` DESC ";
else
$order = " ORDER BY `name` ASC "; $order = " ORDER BY `name` ASC ";

View file

@ -16,7 +16,15 @@ function display_content(&$a) {
$o = '<div id="live-display"></div>' . "\r\n"; $o = '<div id="live-display"></div>' . "\r\n";
$a->page['htmlhead'] .= '<script>$(document).ready(function() { $(".comment-edit-wrapper textarea").contact_autocomplete(baseurl+"/acl"); });</script>'; $a->page['htmlhead'] .= <<<EOT
<script>
$(document).ready(function() {
$(".comment-edit-wrapper textarea").contact_autocomplete(baseurl+"/acl");
// make auto-complete work in more places
$(".wall-item-comment-wrapper textarea").contact_autocomplete(baseurl+"/acl");
});
</script>
EOT;
$nick = (($a->argc > 1) ? $a->argv[1] : ''); $nick = (($a->argc > 1) ? $a->argv[1] : '');

23
mod/filer.php Executable file
View file

@ -0,0 +1,23 @@
<?php
require_once('include/security.php');
require_once('include/bbcode.php');
require_once('include/items.php');
function filer_content(&$a) {
if(! local_user()) {
killme();
}
$term = notags(trim($_GET['term']));
$item_id = (($a->argc > 1) ? notags(trim($a->argv[1])) : 0);
logger('filer: tag ' . $term . ' item ' . $item_id);
if($item_id && strlen($term))
file_tag_save_file(local_user(),$item_id,$term);
killme();
}

21
mod/filerm.php Normal file
View file

@ -0,0 +1,21 @@
<?php
function filerm_content(&$a) {
if(! local_user()) {
killme();
}
$term = notags(trim($_GET['term']));
$item_id = (($a->argc > 1) ? notags(trim($a->argv[1])) : 0);
logger('filerm: tag ' . $term . ' item ' . $item_id);
if($item_id && strlen($term))
file_tag_unsave_file(local_user(),$item_id,$term);
if(x($_SESSION,'return_url'))
goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
killme();
}

View file

@ -21,6 +21,8 @@ function group_post(&$a) {
} }
if(($a->argc == 2) && ($a->argv[1] === 'new')) { if(($a->argc == 2) && ($a->argv[1] === 'new')) {
check_form_security_token_redirectOnErr('/group/new', 'group_edit');
$name = notags(trim($_POST['groupname'])); $name = notags(trim($_POST['groupname']));
$r = group_add(local_user(),$name); $r = group_add(local_user(),$name);
if($r) { if($r) {
@ -35,6 +37,8 @@ function group_post(&$a) {
return; // NOTREACHED return; // NOTREACHED
} }
if(($a->argc == 2) && (intval($a->argv[1]))) { if(($a->argc == 2) && (intval($a->argv[1]))) {
check_form_security_token_redirectOnErr('/group', 'group_edit');
$r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1", $r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($a->argv[1]), intval($a->argv[1]),
intval(local_user()) intval(local_user())
@ -62,6 +66,7 @@ function group_post(&$a) {
} }
function group_content(&$a) { function group_content(&$a) {
$change = false;
if(! local_user()) { if(! local_user()) {
notice( t('Permission denied') . EOL); notice( t('Permission denied') . EOL);
@ -83,14 +88,17 @@ function group_content(&$a) {
return replace_macros($tpl, $context + array( return replace_macros($tpl, $context + array(
'$title' => t('Create a group of contacts/friends.'), '$title' => t('Create a group of contacts/friends.'),
'$gname' => array('groupname',t('Group Name: '),$group['name'], ''), '$gname' => array('groupname',t('Group Name: '), '', ''),
'$gid' => 'new', '$gid' => 'new',
'$form_security_token' => get_form_security_token("group_edit"),
)); ));
} }
if(($a->argc == 3) && ($a->argv[1] === 'drop')) { if(($a->argc == 3) && ($a->argv[1] === 'drop')) {
check_form_security_token_redirectOnErr('/group', 'group_drop', 't');
if(intval($a->argv[2])) { if(intval($a->argv[2])) {
$r = q("SELECT `name` FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1", $r = q("SELECT `name` FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($a->argv[2]), intval($a->argv[2]),
@ -108,6 +116,8 @@ function group_content(&$a) {
} }
if(($a->argc > 2) && intval($a->argv[1]) && intval($a->argv[2])) { if(($a->argc > 2) && intval($a->argv[1]) && intval($a->argv[2])) {
check_form_security_token_ForbiddenOnErr('group_member_change', 't');
$r = q("SELECT `id` FROM `contact` WHERE `id` = %d AND `uid` = %d and `self` = 0 and `blocked` = 0 AND `pending` = 0 LIMIT 1", $r = q("SELECT `id` FROM `contact` WHERE `id` = %d AND `uid` = %d and `self` = 0 and `blocked` = 0 AND `pending` = 0 LIMIT 1",
intval($a->argv[2]), intval($a->argv[2]),
intval(local_user()) intval(local_user())
@ -155,7 +165,8 @@ function group_content(&$a) {
$drop_tpl = get_markup_template('group_drop.tpl'); $drop_tpl = get_markup_template('group_drop.tpl');
$drop_txt = replace_macros($drop_tpl, array( $drop_txt = replace_macros($drop_tpl, array(
'$id' => $group['id'], '$id' => $group['id'],
'$delete' => t('Delete') '$delete' => t('Delete'),
'$form_security_token' => get_form_security_token("group_drop"),
)); ));
$celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false); $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false);
@ -166,6 +177,7 @@ function group_content(&$a) {
'$gname' => array('groupname',t('Group Name: '),$group['name'], ''), '$gname' => array('groupname',t('Group Name: '),$group['name'], ''),
'$gid' => $group['id'], '$gid' => $group['id'],
'$drop' => $drop_txt, '$drop' => $drop_txt,
'$form_security_token' => get_form_security_token('group_edit'),
); );
} }
@ -177,14 +189,14 @@ function group_content(&$a) {
'label_members' => t('Members'), 'label_members' => t('Members'),
'members' => array(), 'members' => array(),
'label_contacts' => t('All Contacts'), 'label_contacts' => t('All Contacts'),
'contacts' => arraY(), 'contacts' => array(),
); );
$sec_token = addslashes(get_form_security_token('group_member_change'));
$textmode = (($switchtotext && (count($members) > $switchtotext)) ? true : false); $textmode = (($switchtotext && (count($members) > $switchtotext)) ? true : false);
foreach($members as $member) { foreach($members as $member) {
if($member['url']) { if($member['url']) {
$member['click'] = 'groupChangeMember(' . $group['id'] . ',' . $member['id'] . '); return true;'; $member['click'] = 'groupChangeMember(' . $group['id'] . ',' . $member['id'] . ',\'' . $sec_token . '\'); return true;';
$groupeditor['members'][] = micropro($member,true,'mpgroup', $textmode); $groupeditor['members'][] = micropro($member,true,'mpgroup', $textmode);
} }
else else
@ -199,7 +211,7 @@ function group_content(&$a) {
$textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false); $textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false);
foreach($r as $member) { foreach($r as $member) {
if(! in_array($member['id'],$preselected)) { if(! in_array($member['id'],$preselected)) {
$member['click'] = 'groupChangeMember(' . $group['id'] . ',' . $member['id'] . '); return true;'; $member['click'] = 'groupChangeMember(' . $group['id'] . ',' . $member['id'] . ',\'' . $sec_token . '\'); return true;';
$groupeditor['contacts'][] = micropro($member,true,'mpall', $textmode); $groupeditor['contacts'][] = micropro($member,true,'mpall', $textmode);
} }
} }

View file

@ -425,110 +425,7 @@ function item_post(&$a) {
if(count($tags)) { if(count($tags)) {
foreach($tags as $tag) { foreach($tags as $tag) {
handle_tag($a, $body, $inform, $str_tags, $profile_uid, $tag);
if(isset($profile))
unset($profile);
if(strpos($tag,'#') === 0) {
if(strpos($tag,'[url='))
continue;
$basetag = str_replace('_',' ',substr($tag,1));
$body = str_replace($tag,'#[url=' . $a->get_baseurl() . '/search?search=' . rawurlencode($basetag) . ']' . $basetag . '[/url]',$body);
$newtag = '#[url=' . $a->get_baseurl() . '/search?search=' . rawurlencode($basetag) . ']' . $basetag . '[/url]';
if(! stristr($str_tags,$newtag)) {
if(strlen($str_tags))
$str_tags .= ',';
$str_tags .= $newtag;
}
continue;
}
if(strpos($tag,'@') === 0) {
if(strpos($tag,'[url='))
continue;
$stat = false;
$name = substr($tag,1);
if((strpos($name,'@')) || (strpos($name,'http://'))) {
$newname = $name;
$links = @lrdd($name);
if(count($links)) {
foreach($links as $link) {
if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page')
$profile = $link['@attributes']['href'];
if($link['@attributes']['rel'] === 'salmon') {
if(strlen($inform))
$inform .= ',';
$inform .= 'url:' . str_replace(',','%2c',$link['@attributes']['href']);
}
}
}
}
else {
$newname = $name;
$alias = '';
$tagcid = 0;
if(strrpos($newname,'+')) {
$tagcid = intval(substr($newname,strrpos($newname,'+') + 1));
if(strpos($name,' '))
$name = substr($name,0,strpos($name,' '));
}
if($tagcid) {
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($tagcid),
intval($profile_uid)
);
}
elseif(strstr($name,'_') || strstr($name,' ')) {
$newname = str_replace('_',' ',$name);
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
dbesc($newname),
intval($profile_uid)
);
}
else {
$r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
dbesc($name),
dbesc($name),
intval($profile_uid)
);
}
if(count($r)) {
$profile = $r[0]['url'];
if($r[0]['network'] === 'stat') {
$newname = $r[0]['nick'];
$stat = true;
if($r[0]['alias'])
$alias = $r[0]['alias'];
}
else
$newname = $r[0]['name'];
if(strlen($inform))
$inform .= ',';
$inform .= 'cid:' . $r[0]['id'];
}
}
if($profile) {
$body = str_replace('@' . $name, '@' . '[url=' . $profile . ']' . $newname . '[/url]', $body);
$profile = str_replace(',','%2c',$profile);
$newtag = '@[url=' . $profile . ']' . $newname . '[/url]';
if(! stristr($str_tags,$newtag)) {
if(strlen($str_tags))
$str_tags .= ',';
$str_tags .= $newtag;
}
// Status.Net seems to require the numeric ID URL in a mention if the person isn't
// subscribed to you. But the nickname URL is OK if they are. Grrr. We'll tag both.
if(strlen($alias)) {
$newtag = '@[url=' . $alias . ']' . $newname . '[/url]';
if(! stristr($str_tags,$newtag)) {
if(strlen($str_tags))
$str_tags .= ',';
$str_tags .= $newtag;
}
}
}
}
} }
} }
@ -627,7 +524,7 @@ function item_post(&$a) {
if($preview) { if($preview) {
require_once('include/conversation.php'); require_once('include/conversation.php');
$o = conversation(&$a,array(array_merge($contact_record,$datarray)),'search',false,true); $o = conversation($a,array(array_merge($contact_record,$datarray)),'search',false,true);
logger('preview: ' . $o); logger('preview: ' . $o);
echo json_encode(array('preview' => $o)); echo json_encode(array('preview' => $o));
killme(); killme();
@ -922,3 +819,142 @@ function item_content(&$a) {
drop_item($a->argv[2]); drop_item($a->argv[2]);
} }
} }
/**
* This function removes the tag $tag from the text $body and replaces it with
* the appropiate link.
*
* @param unknown_type $body the text to replace the tag in
* @param unknown_type $inform a comma-seperated string containing everybody to inform
* @param unknown_type $str_tags string to add the tag to
* @param unknown_type $profile_uid
* @param unknown_type $tag the tag to replace
*/
function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
//is it a hash tag?
if(strpos($tag,'#') === 0) {
//if the tag is replaced...
if(strpos($tag,'[url='))
//...do nothing
return;
//base tag has the tags name only
$basetag = str_replace('_',' ',substr($tag,1));
//create text for link
$newtag = '#[url=' . $a->get_baseurl() . '/search?search=' . rawurlencode($basetag) . ']' . $basetag . '[/url]';
//replace tag by the link
$body = str_replace($tag, $newtag, $body);
//is the link already in str_tags?
if(! stristr($str_tags,$newtag)) {
//append or set str_tags
if(strlen($str_tags))
$str_tags .= ',';
$str_tags .= $newtag;
}
return;
}
//is it a person tag?
if(strpos($tag,'@') === 0) {
//is it already replaced?
if(strpos($tag,'[url='))
return;
$stat = false;
//get the person's name
$name = substr($tag,1);
//is it a link or a full dfrn address?
if((strpos($name,'@')) || (strpos($name,'http://'))) {
$newname = $name;
//get the profile links
$links = @lrdd($name);
if(count($links)) {
//for all links, collect how is to inform and how's profile is to link
foreach($links as $link) {
if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page')
$profile = $link['@attributes']['href'];
if($link['@attributes']['rel'] === 'salmon') {
if(strlen($inform))
$inform .= ',';
$inform .= 'url:' . str_replace(',','%2c',$link['@attributes']['href']);
}
}
}
} else { //if it is a name rather than an address
$newname = $name;
$alias = '';
$tagcid = 0;
//is it some generated name?
if(strrpos($newname,'+')) {
//get the id
$tagcid = intval(substr($newname,strrpos($newname,'+') + 1));
//remove the next word from tag's name
if(strpos($name,' ')) {
$name = substr($name,0,strpos($name,' '));
}
}
if($tagcid) { //if there was an id
//select contact with that id from the logged in user's contact list
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($tagcid),
intval($profile_uid)
);
} elseif(strstr($name,'_') || strstr($name,' ')) { //no id
//get the real name
$newname = str_replace('_',' ',$name);
//select someone from this user's contacts by name
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
dbesc($newname),
intval($profile_uid)
);
} else {
//select someone by attag or nick and the name passed in
$r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
dbesc($name),
dbesc($name),
intval($profile_uid)
);
}
//$r is set, if someone could be selected
if(count($r)) {
$profile = $r[0]['url'];
//set newname to nick, find alias
if($r[0]['network'] === 'stat') {
$newname = $r[0]['nick'];
$stat = true;
if($r[0]['alias'])
$alias = $r[0]['alias'];
}
else
$newname = $r[0]['name'];
//add person's id to $inform
if(strlen($inform))
$inform .= ',';
$inform .= 'cid:' . $r[0]['id'];
}
}
//if there is an url for this persons profile
if(isset($profile)) {
//create profile link
$profile = str_replace(',','%2c',$profile);
$newtag = '@[url=' . $profile . ']' . $newname . '[/url]';
$body = str_replace('@' . $name, $newtag, $body);
//append tag to str_tags
if(! stristr($str_tags,$newtag)) {
if(strlen($str_tags))
$str_tags .= ',';
$str_tags .= $newtag;
}
// Status.Net seems to require the numeric ID URL in a mention if the person isn't
// subscribed to you. But the nickname URL is OK if they are. Grrr. We'll tag both.
if(strlen($alias)) {
$newtag = '@[url=' . $alias . ']' . $newname . '[/url]';
if(! stristr($str_tags,$newtag)) {
if(strlen($str_tags))
$str_tags .= ',';
$str_tags .= $newtag;
}
}
}
}
}

View file

@ -74,7 +74,7 @@ function manage_post(&$a) {
if($limited_id) if($limited_id)
$_SESSION['submanage'] = $original_id; $_SESSION['submanage'] = $original_id;
goaway($a->get_baseurl() . '/profile/' . $a->user['nickname']); goaway($a->get_baseurl(true) . '/profile/' . $a->user['nickname']);
// NOTREACHED // NOTREACHED
} }

View file

@ -56,23 +56,23 @@ function message_content(&$a) {
return; return;
} }
$myprofile = $a->get_baseurl() . '/profile/' . $a->user['nickname']; $myprofile = $a->get_baseurl(true) . '/profile/' . $a->user['nickname'];
$tabs = array( $tabs = array(
array( array(
'label' => t('Inbox'), 'label' => t('Inbox'),
'url'=> $a->get_baseurl() . '/message', 'url'=> $a->get_baseurl(true) . '/message',
'sel'=> (($a->argc == 1) ? 'active' : ''), 'sel'=> (($a->argc == 1) ? 'active' : ''),
), ),
array( array(
'label' => t('Outbox'), 'label' => t('Outbox'),
'url' => $a->get_baseurl() . '/message/sent', 'url' => $a->get_baseurl(true) . '/message/sent',
'sel'=> (($a->argv[1] == 'sent') ? 'active' : ''), 'sel'=> (($a->argv[1] == 'sent') ? 'active' : ''),
), ),
array( array(
'label' => t('New Message'), 'label' => t('New Message'),
'url' => $a->get_baseurl() . '/message/new', 'url' => $a->get_baseurl(true) . '/message/new',
'sel'=> (($a->argv[1] == 'new') ? 'active' : ''), 'sel'=> (($a->argv[1] == 'new') ? 'active' : ''),
), ),
); );
@ -99,7 +99,7 @@ function message_content(&$a) {
if($r) { if($r) {
info( t('Message deleted.') . EOL ); info( t('Message deleted.') . EOL );
} }
goaway($a->get_baseurl() . '/message' ); goaway($a->get_baseurl(true) . '/message' );
} }
else { else {
$r = q("SELECT `parent-uri`,`convid` FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1", $r = q("SELECT `parent-uri`,`convid` FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1",
@ -129,7 +129,7 @@ function message_content(&$a) {
if($r) if($r)
info( t('Conversation removed.') . EOL ); info( t('Conversation removed.') . EOL );
} }
goaway($a->get_baseurl() . '/message' ); goaway($a->get_baseurl(true) . '/message' );
} }
} }
@ -146,7 +146,7 @@ function message_content(&$a) {
$tpl = get_markup_template('msg-header.tpl'); $tpl = get_markup_template('msg-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array( $a->page['htmlhead'] .= replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$nickname' => $a->user['nickname'], '$nickname' => $a->user['nickname'],
'$linkurl' => t('Please enter a link URL:') '$linkurl' => t('Please enter a link URL:')
@ -154,7 +154,7 @@ function message_content(&$a) {
$preselect = (isset($a->argv[2])?array($a->argv[2]):false); $preselect = (isset($a->argv[2])?array($a->argv[2]):false);
$select = contact_select('messageto','message-to-select', $preselect, 4, true); $select = contact_select('messageto','message-to-select', $preselect, 4, true, false, false, 10);
$tpl = get_markup_template('prv_message.tpl'); $tpl = get_markup_template('prv_message.tpl');
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$header' => t('Send Private Message'), '$header' => t('Send Private Message'),
@ -192,9 +192,9 @@ function message_content(&$a) {
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
$r = q("SELECT max(`mail`.`created`) AS `mailcreated`, min(`mail`.`seen`) AS `mailseen`, $r = q("SELECT max(`mail`.`created`) AS `mailcreated`, min(`mail`.`seen`) AS `mailseen`,
`mail`.* , `contact`.`name`, `contact`.`url`, `contact`.`thumb` `mail`.* , `contact`.`name`, `contact`.`url`, `contact`.`thumb` , `contact`.`network`
FROM `mail` LEFT JOIN `contact` ON `mail`.`contact-id` = `contact`.`id` FROM `mail` LEFT JOIN `contact` ON `mail`.`contact-id` = `contact`.`id`
WHERE `mail`.`uid` = %d AND `from-url` $eq '%s' GROUP BY `parent-uri` ORDER BY `created` DESC LIMIT %d , %d ", WHERE `mail`.`uid` = %d AND `from-url` $eq '%s' GROUP BY `parent-uri` ORDER BY `mailcreated` DESC LIMIT %d , %d ",
intval(local_user()), intval(local_user()),
dbesc($myprofile), dbesc($myprofile),
intval($a->pager['start']), intval($a->pager['start']),
@ -210,7 +210,7 @@ function message_content(&$a) {
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
'$id' => $rr['id'], '$id' => $rr['id'],
'$from_name' =>$rr['from-name'], '$from_name' =>$rr['from-name'],
'$from_url' => (($rr['network'] === NETWORK_DFRN) ? $a->get_baseurl() . '/redir/' . $rr['contact-id'] : $rr['url']), '$from_url' => (($rr['network'] === NETWORK_DFRN) ? $a->get_baseurl(true) . '/redir/' . $rr['contact-id'] : $rr['url']),
'$sparkle' => ' sparkle', '$sparkle' => ' sparkle',
'$from_photo' => $rr['thumb'], '$from_photo' => $rr['thumb'],
'$subject' => template_escape((($rr['mailseen']) ? $rr['title'] : '<strong>' . $rr['title'] . '</strong>')), '$subject' => template_escape((($rr['mailseen']) ? $rr['title'] : '<strong>' . $rr['title'] . '</strong>')),
@ -267,7 +267,7 @@ function message_content(&$a) {
$a->page['htmlhead'] .= replace_macros($tpl, array( $a->page['htmlhead'] .= replace_macros($tpl, array(
'$nickname' => $a->user['nickname'], '$nickname' => $a->user['nickname'],
'$baseurl' => $a->get_baseurl() '$baseurl' => $a->get_baseurl(true)
)); ));
@ -278,7 +278,7 @@ function message_content(&$a) {
$sparkle = ''; $sparkle = '';
} }
else { else {
$from_url = $a->get_baseurl() . '/redir/' . $message['contact-id']; $from_url = $a->get_baseurl(true) . '/redir/' . $message['contact-id'];
$sparkle = ' sparkle'; $sparkle = ' sparkle';
} }
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(

View file

@ -44,13 +44,16 @@ function network_init(&$a) {
} }
$a->page['aside'] .= group_side('network','network',true,$group_id); $a->page['aside'] .= group_side('network','network',true,$group_id);
$a->page['aside'] .= networks_widget($a->get_baseurl() . '/network',(($_GET['nets']) ? $_GET['nets'] : '')); $a->page['aside'] .= networks_widget($a->get_baseurl(true) . '/network',(x($_GET, 'nets') ? $_GET['nets'] : ''));
$a->page['aside'] .= saved_searches($search); $a->page['aside'] .= saved_searches($search);
$a->page['aside'] .= fileas_widget($a->get_baseurl(true) . '/network',(x($_GET, 'file') ? $_GET['file'] : ''));
} }
function saved_searches($search) { function saved_searches($search) {
$a = get_app();
$srchurl = '/network?f=' $srchurl = '/network?f='
. ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '')
. ((x($_GET,'star')) ? '&star=' . $_GET['star'] : '') . ((x($_GET,'star')) ? '&star=' . $_GET['star'] : '')
@ -132,15 +135,15 @@ function network_content(&$a, $update = 0) {
$starred_active = 'active'; $starred_active = 'active';
} }
if($_GET['bmark']) { if(x($_GET,'bmark')) {
$bookmarked_active = 'active'; $bookmarked_active = 'active';
} }
if($_GET['conv']) { if(x($_GET,'conv')) {
$conv_active = 'active'; $conv_active = 'active';
} }
if($_GET['spam']) { if(x($_GET,'spam')) {
$spam_active = 'active'; $spam_active = 'active';
} }
@ -166,38 +169,38 @@ function network_content(&$a, $update = 0) {
$tabs = array( $tabs = array(
array( array(
'label' => t('Commented Order'), 'label' => t('Commented Order'),
'url'=>$a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '?f=&cid=' . $_GET['cid'] : ''), 'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '?f=&cid=' . $_GET['cid'] : ''),
'sel'=>$all_active, 'sel'=>$all_active,
), ),
array( array(
'label' => t('Posted Order'), 'label' => t('Posted Order'),
'url'=>$a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''), 'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
'sel'=>$postord_active, 'sel'=>$postord_active,
), ),
array( array(
'label' => t('Personal'), 'label' => t('Personal'),
'url' => $a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&conv=1', 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&conv=1',
'sel' => $conv_active, 'sel' => $conv_active,
), ),
array( array(
'label' => t('New'), 'label' => t('New'),
'url' => $a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . '/new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''), 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . '/new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''),
'sel' => $new_active, 'sel' => $new_active,
), ),
array( array(
'label' => t('Starred'), 'label' => t('Starred'),
'url'=>$a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&star=1', 'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&star=1',
'sel'=>$starred_active, 'sel'=>$starred_active,
), ),
array( array(
'label' => t('Bookmarks'), 'label' => t('Shared Links'),
'url'=>$a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&bmark=1', 'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&bmark=1',
'sel'=>$bookmarked_active, 'sel'=>$bookmarked_active,
), ),
// array( // array(
// 'label' => t('Spam'), // 'label' => t('Spam'),
// 'url'=>$a->get_baseurl() . '/network?f=&spam=1' // 'url'=>$a->get_baseurl(true) . '/network?f=&spam=1'
// 'sel'=> $spam_active, // 'sel'=> $spam_active,
// ), // ),
@ -248,7 +251,7 @@ function network_content(&$a, $update = 0) {
$def_acl = array('allow_cid' => '<' . intval($cid) . '>'); $def_acl = array('allow_cid' => '<' . intval($cid) . '>');
if(! $update) { if(! $update) {
if(group) { if($group) {
if(($t = group_public_members($group)) && (! get_pconfig(local_user(),'system','nowarn_insecure'))) { if(($t = group_public_members($group)) && (! get_pconfig(local_user(),'system','nowarn_insecure'))) {
notice( sprintf( tt('Warning: This group contains %s member from an insecure network.', notice( sprintf( tt('Warning: This group contains %s member from an insecure network.',
'Warning: This group contains %s members from an insecure network.', 'Warning: This group contains %s members from an insecure network.',
@ -299,7 +302,7 @@ function network_content(&$a, $update = 0) {
if($update) if($update)
killme(); killme();
notice( t('No such group') . EOL ); notice( t('No such group') . EOL );
goaway($a->get_baseurl() . '/network'); goaway($a->get_baseurl(true) . '/network');
// NOTREACHED // NOTREACHED
} }
@ -331,7 +334,7 @@ function network_content(&$a, $update = 0) {
} }
else { else {
notice( t('Invalid contact.') . EOL); notice( t('Invalid contact.') . EOL);
goaway($a->get_baseurl() . '/network'); goaway($a->get_baseurl(true) . '/network');
// NOTREACHED // NOTREACHED
} }
} }
@ -498,6 +501,8 @@ function network_content(&$a, $update = 0) {
$items = conv_sort($items,$ordering); $items = conv_sort($items,$ordering);
} else {
$items = array();
} }
} }

View file

@ -42,12 +42,12 @@ function notifications_post(&$a) {
intval(local_user()) intval(local_user())
); );
} }
goaway($a->get_baseurl() . '/notifications/intros'); goaway($a->get_baseurl(true) . '/notifications/intros');
} }
if($_POST['submit'] == t('Ignore')) { if($_POST['submit'] == t('Ignore')) {
$r = q("UPDATE `intro` SET `ignore` = 1 WHERE `id` = %d LIMIT 1", $r = q("UPDATE `intro` SET `ignore` = 1 WHERE `id` = %d LIMIT 1",
intval($intro_id)); intval($intro_id));
goaway($a->get_baseurl() . '/notifications/intros'); goaway($a->get_baseurl(true) . '/notifications/intros');
} }
} }
} }
@ -69,32 +69,32 @@ function notifications_content(&$a) {
$tabs = array( $tabs = array(
array( array(
'label' => t('System'), 'label' => t('System'),
'url'=>$a->get_baseurl() . '/notifications/system', 'url'=>$a->get_baseurl(true) . '/notifications/system',
'sel'=> (($a->argv[1] == 'system') ? 'active' : ''), 'sel'=> (($a->argv[1] == 'system') ? 'active' : ''),
), ),
array( array(
'label' => t('Network'), 'label' => t('Network'),
'url'=>$a->get_baseurl() . '/notifications/network', 'url'=>$a->get_baseurl(true) . '/notifications/network',
'sel'=> (($a->argv[1] == 'network') ? 'active' : ''), 'sel'=> (($a->argv[1] == 'network') ? 'active' : ''),
), ),
array( array(
'label' => t('Personal'), 'label' => t('Personal'),
'url'=>$a->get_baseurl() . '/notifications/personal', 'url'=>$a->get_baseurl(true) . '/notifications/personal',
'sel'=> (($a->argv[1] == 'personal') ? 'active' : ''), 'sel'=> (($a->argv[1] == 'personal') ? 'active' : ''),
), ),
array( array(
'label' => t('Home'), 'label' => t('Home'),
'url' => $a->get_baseurl() . '/notifications/home', 'url' => $a->get_baseurl(true) . '/notifications/home',
'sel'=> (($a->argv[1] == 'home') ? 'active' : ''), 'sel'=> (($a->argv[1] == 'home') ? 'active' : ''),
), ),
array( array(
'label' => t('Introductions'), 'label' => t('Introductions'),
'url' => $a->get_baseurl() . '/notifications/intros', 'url' => $a->get_baseurl(true) . '/notifications/intros',
'sel'=> (($a->argv[1] == 'intros') ? 'active' : ''), 'sel'=> (($a->argv[1] == 'intros') ? 'active' : ''),
), ),
array( array(
'label' => t('Messages'), 'label' => t('Messages'),
'url' => $a->get_baseurl() . '/message', 'url' => $a->get_baseurl(true) . '/message',
'sel'=> '', 'sel'=> '',
), ),
); );
@ -244,7 +244,7 @@ function notifications_content(&$a) {
switch($it['verb']){ switch($it['verb']){
case ACTIVITY_LIKE: case ACTIVITY_LIKE:
$notif_content .= replace_macros($tpl_item_likes,array( $notif_content .= replace_macros($tpl_item_likes,array(
'$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']), '$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -253,7 +253,7 @@ function notifications_content(&$a) {
case ACTIVITY_DISLIKE: case ACTIVITY_DISLIKE:
$notif_content .= replace_macros($tpl_item_dislikes,array( $notif_content .= replace_macros($tpl_item_dislikes,array(
'$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']), '$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -267,7 +267,7 @@ function notifications_content(&$a) {
$it['fname'] = $obj->title; $it['fname'] = $obj->title;
$notif_content .= replace_macros($tpl_item_friends,array( $notif_content .= replace_macros($tpl_item_friends,array(
'$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']), '$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -281,7 +281,7 @@ function notifications_content(&$a) {
$tpl = (($it['id'] == $it['parent']) ? $tpl_item_posts : $tpl_item_comments); $tpl = (($it['id'] == $it['parent']) ? $tpl_item_posts : $tpl_item_comments);
$notif_content .= replace_macros($tpl,array( $notif_content .= replace_macros($tpl,array(
'$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => $item_text, '$item_text' => $item_text,
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -314,7 +314,7 @@ function notifications_content(&$a) {
if (count($r) > 0) { if (count($r) > 0) {
foreach ($r as $it) { foreach ($r as $it) {
$notif_content .= replace_macros($not_tpl,array( $notif_content .= replace_macros($not_tpl,array(
'$item_link' => $a->get_baseurl().'/notify/view/'. $it['id'], '$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'],
'$item_image' => $it['photo'], '$item_image' => $it['photo'],
'$item_text' => strip_tags(bbcode($it['msg'])), '$item_text' => strip_tags(bbcode($it['msg'])),
'$item_when' => relative_date($it['date']) '$item_when' => relative_date($it['date'])
@ -334,7 +334,7 @@ function notifications_content(&$a) {
$notif_tpl = get_markup_template('notifications.tpl'); $notif_tpl = get_markup_template('notifications.tpl');
$myurl = $a->get_baseurl() . '/profile/'. $a->user['nickname']; $myurl = $a->get_baseurl(true) . '/profile/'. $a->user['nickname'];
$myurl = substr($myurl,strpos($myurl,'://')+3); $myurl = substr($myurl,strpos($myurl,'://')+3);
$myurl = str_replace(array('www.','.'),array('','\\.'),$myurl); $myurl = str_replace(array('www.','.'),array('','\\.'),$myurl);
$diasp_url = str_replace('/profile/','/u/',$myurl); $diasp_url = str_replace('/profile/','/u/',$myurl);
@ -369,7 +369,7 @@ function notifications_content(&$a) {
switch($it['verb']){ switch($it['verb']){
case ACTIVITY_LIKE: case ACTIVITY_LIKE:
$notif_content .= replace_macros($tpl_item_likes,array( $notif_content .= replace_macros($tpl_item_likes,array(
'$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']), '$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -378,7 +378,7 @@ function notifications_content(&$a) {
case ACTIVITY_DISLIKE: case ACTIVITY_DISLIKE:
$notif_content .= replace_macros($tpl_item_dislikes,array( $notif_content .= replace_macros($tpl_item_dislikes,array(
'$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']), '$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -392,7 +392,7 @@ function notifications_content(&$a) {
$it['fname'] = $obj->title; $it['fname'] = $obj->title;
$notif_content .= replace_macros($tpl_item_friends,array( $notif_content .= replace_macros($tpl_item_friends,array(
'$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']), '$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -406,7 +406,7 @@ function notifications_content(&$a) {
$tpl = (($it['id'] == $it['parent']) ? $tpl_item_posts : $tpl_item_comments); $tpl = (($it['id'] == $it['parent']) ? $tpl_item_posts : $tpl_item_comments);
$notif_content .= replace_macros($tpl,array( $notif_content .= replace_macros($tpl,array(
'$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => $item_text, '$item_text' => $item_text,
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -456,7 +456,7 @@ function notifications_content(&$a) {
switch($it['verb']){ switch($it['verb']){
case ACTIVITY_LIKE: case ACTIVITY_LIKE:
$notif_content .= replace_macros($tpl_item_likes,array( $notif_content .= replace_macros($tpl_item_likes,array(
'$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']), '$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -465,7 +465,7 @@ function notifications_content(&$a) {
break; break;
case ACTIVITY_DISLIKE: case ACTIVITY_DISLIKE:
$notif_content .= replace_macros($tpl_item_dislikes,array( $notif_content .= replace_macros($tpl_item_dislikes,array(
'$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']), '$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -479,7 +479,7 @@ function notifications_content(&$a) {
$it['fname'] = $obj->title; $it['fname'] = $obj->title;
$notif_content .= replace_macros($tpl_item_friends,array( $notif_content .= replace_macros($tpl_item_friends,array(
'$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']), '$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -488,7 +488,7 @@ function notifications_content(&$a) {
break; break;
default: default:
$notif_content .= replace_macros($tpl_item_comments,array( $notif_content .= replace_macros($tpl_item_comments,array(
'$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s commented on %s's post"), $it['author-name'], $it['pname']), '$item_text' => sprintf( t("%s commented on %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])

View file

@ -20,7 +20,7 @@ function notify_init(&$a) {
goaway($r[0]['link']); goaway($r[0]['link']);
} }
goaway($a->get_baseurl()); goaway($a->get_baseurl(true));
} }
if($a->argc > 2 && $a->argv[1] === 'mark' && $a->argv[2] === 'all' ) { if($a->argc > 2 && $a->argv[1] === 'mark' && $a->argv[2] === 'all' ) {
@ -51,7 +51,7 @@ function notify_content(&$a) {
if (count($r) > 0) { if (count($r) > 0) {
foreach ($r as $it) { foreach ($r as $it) {
$notif_content .= replace_macros($not_tpl,array( $notif_content .= replace_macros($not_tpl,array(
'$item_link' => $a->get_baseurl().'/notify/view/'. $it['id'], '$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'],
'$item_image' => $it['photo'], '$item_image' => $it['photo'],
'$item_text' => strip_tags(bbcode($it['msg'])), '$item_text' => strip_tags(bbcode($it['msg'])),
'$item_when' => relative_date($it['date']) '$item_when' => relative_date($it['date'])

View file

@ -188,7 +188,7 @@ function parse_url_content(&$a) {
if(! $text) { if(! $text) {
logger('parsing meta'); logger('parsing meta');
$items = $domhead->getElementsByTagName('meta'); $items = (isset($domhead) && is_object($domhead) ? $domhead->getElementsByTagName('meta') : null);
if($items) { if($items) {
foreach($items as $item) { foreach($items as $item) {
$property = $item->getAttribute('property'); $property = $item->getAttribute('property');

View file

@ -1081,6 +1081,17 @@ function photos_content(&$a) {
} }
if(! $cmd !== 'edit') {
$a->page['htmlhead'] .= '<script>
$(document).keydown(function(event) {' . "\n";
if($prevlink)
$a->page['htmlhead'] .= 'if(event.ctrlKey && event.keyCode == 37) { event.preventDefault(); window.location.href = \'' . $prevlink . '\'; }' . "\n";
if($nextlink)
$a->page['htmlhead'] .= 'if(event.ctrlKey && event.keyCode == 39) { event.preventDefault(); window.location.href = \'' . $nextlink . '\'; }' . "\n";
$a->page['htmlhead'] .= '});</script>';
}
if($prevlink) if($prevlink)
$prevlink = array($prevlink, '<div class="icon prev"></div>') ; $prevlink = array($prevlink, '<div class="icon prev"></div>') ;

View file

@ -20,6 +20,8 @@ function profile_photo_post(&$a) {
return; return;
} }
check_form_security_token_redirectOnErr('/profile_photo', 'profile_photo');
if((x($_POST,'cropfinal')) && ($_POST['cropfinal'] == 1)) { if((x($_POST,'cropfinal')) && ($_POST['cropfinal'] == 1)) {
// phase 2 - we have finished cropping // phase 2 - we have finished cropping
@ -149,6 +151,8 @@ function profile_photo_content(&$a) {
return; return;
}; };
check_form_security_token_redirectOnErr('/profile_photo', 'profile_photo');
$resource_id = $a->argv[2]; $resource_id = $a->argv[2];
//die(":".local_user()); //die(":".local_user());
$r=q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s' ORDER BY `scale` ASC", $r=q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s' ORDER BY `scale` ASC",
@ -203,6 +207,7 @@ function profile_photo_content(&$a) {
'$lbl_upfile' => t('Upload File:'), '$lbl_upfile' => t('Upload File:'),
'$title' => t('Upload Profile Photo'), '$title' => t('Upload Profile Photo'),
'$submit' => t('Upload'), '$submit' => t('Upload'),
'$form_security_token' => get_form_security_token("profile_photo"),
'$select' => sprintf('%s %s', t('or'), ($newuser) ? '<a href="' . $a->get_baseurl() . '">' . t('skip this step') . '</a>' : '<a href="'. $a->get_baseurl() . '/photos/' . $a->user['nickname'] . '">' . t('select a photo from your photo albums') . '</a>') '$select' => sprintf('%s %s', t('or'), ($newuser) ? '<a href="' . $a->get_baseurl() . '">' . t('skip this step') . '</a>' : '<a href="'. $a->get_baseurl() . '/photos/' . $a->user['nickname'] . '">' . t('select a photo from your photo albums') . '</a>')
)); ));
@ -218,6 +223,7 @@ function profile_photo_content(&$a) {
'$image_url' => $a->get_baseurl() . '/photo/' . $filename, '$image_url' => $a->get_baseurl() . '/photo/' . $filename,
'$title' => t('Crop Image'), '$title' => t('Crop Image'),
'$desc' => t('Please adjust the image cropping for optimum viewing.'), '$desc' => t('Please adjust the image cropping for optimum viewing.'),
'$form_security_token' => get_form_security_token("profile_photo"),
'$done' => t('Done Editing') '$done' => t('Done Editing')
)); ));
return $o; return $o;

View file

@ -21,6 +21,9 @@ function profiles_post(&$a) {
notice( t('Profile not found.') . EOL); notice( t('Profile not found.') . EOL);
return; return;
} }
check_form_security_token_redirectOnErr('/profiles', 'profile_edit');
$is_default = (($orig[0]['is-default']) ? 1 : 0); $is_default = (($orig[0]['is-default']) ? 1 : 0);
$profile_name = notags(trim($_POST['profile_name'])); $profile_name = notags(trim($_POST['profile_name']));
@ -237,10 +240,12 @@ function profiles_content(&$a) {
); );
if(! count($r)) { if(! count($r)) {
notice( t('Profile not found.') . EOL); notice( t('Profile not found.') . EOL);
goaway($a->get_baseurl() . '/profiles'); goaway($a->get_baseurl(true) . '/profiles');
return; // NOTREACHED return; // NOTREACHED
} }
check_form_security_token_redirectOnErr('/profiles', 'profile_drop', 't');
// move every contact using this profile as their default to the user default // move every contact using this profile as their default to the user default
$r = q("UPDATE `contact` SET `profile-id` = (SELECT `profile`.`id` AS `profile-id` FROM `profile` WHERE `profile`.`is-default` = 1 AND `profile`.`uid` = %d LIMIT 1) WHERE `profile-id` = %d AND `uid` = %d ", $r = q("UPDATE `contact` SET `profile-id` = (SELECT `profile`.`id` AS `profile-id` FROM `profile` WHERE `profile`.`is-default` = 1 AND `profile`.`uid` = %d LIMIT 1) WHERE `profile-id` = %d AND `uid` = %d ",
@ -255,7 +260,7 @@ function profiles_content(&$a) {
if($r) if($r)
info( t('Profile deleted.') . EOL); info( t('Profile deleted.') . EOL);
goaway($a->get_baseurl() . '/profiles'); goaway($a->get_baseurl(true) . '/profiles');
return; // NOTREACHED return; // NOTREACHED
} }
@ -265,6 +270,8 @@ function profiles_content(&$a) {
if(($a->argc > 1) && ($a->argv[1] === 'new')) { if(($a->argc > 1) && ($a->argv[1] === 'new')) {
check_form_security_token_redirectOnErr('/profiles', 'profile_new', 't');
$r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d", $r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d",
intval(local_user())); intval(local_user()));
$num_profiles = count($r0); $num_profiles = count($r0);
@ -290,12 +297,15 @@ function profiles_content(&$a) {
info( t('New profile created.') . EOL); info( t('New profile created.') . EOL);
if(count($r3) == 1) if(count($r3) == 1)
goaway($a->get_baseurl() . '/profiles/' . $r3[0]['id']); goaway($a->get_baseurl(true) . '/profiles/' . $r3[0]['id']);
goaway($a->get_baseurl() . '/profiles');
goaway($a->get_baseurl(true) . '/profiles');
} }
if(($a->argc > 2) && ($a->argv[1] === 'clone')) { if(($a->argc > 2) && ($a->argv[1] === 'clone')) {
check_form_security_token_redirectOnErr('/profiles', 'profile_clone', 't');
$r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d", $r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d",
intval(local_user())); intval(local_user()));
$num_profiles = count($r0); $num_profiles = count($r0);
@ -329,8 +339,10 @@ function profiles_content(&$a) {
); );
info( t('New profile created.') . EOL); info( t('New profile created.') . EOL);
if(count($r3) == 1) if(count($r3) == 1)
goaway($a->get_baseurl() . '/profiles/' . $r3[0]['id']); goaway($a->get_baseurl(true) . '/profiles/' . $r3[0]['id']);
goaway($a->get_baseurl() . '/profiles');
goaway($a->get_baseurl(true) . '/profiles');
return; // NOTREACHED return; // NOTREACHED
} }
@ -361,7 +373,7 @@ function profiles_content(&$a) {
)); ));
$a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl())); $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl(true)));
$a->page['htmlhead'] .= "<script type=\"text/javascript\" src=\"js/country.js\" ></script>"; $a->page['htmlhead'] .= "<script type=\"text/javascript\" src=\"js/country.js\" ></script>";
$f = get_config('system','birthday_input_format'); $f = get_config('system','birthday_input_format');
@ -371,6 +383,9 @@ function profiles_content(&$a) {
$is_default = (($r[0]['is-default']) ? 1 : 0); $is_default = (($r[0]['is-default']) ? 1 : 0);
$tpl = get_markup_template("profile_edit.tpl"); $tpl = get_markup_template("profile_edit.tpl");
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$form_security_token' => get_form_security_token("profile_edit"),
'$profile_clone_link' => 'profiles/clone/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_clone"),
'$profile_drop_link' => 'profiles/drop/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_drop"),
'$banner' => t('Edit Profile Details'), '$banner' => t('Edit Profile Details'),
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$viewprof' => t('View this profile'), '$viewprof' => t('View this profile'),
@ -410,7 +425,7 @@ function profiles_content(&$a) {
'$lbl_work' => t('Work/employment'), '$lbl_work' => t('Work/employment'),
'$lbl_school' => t('School/education'), '$lbl_school' => t('School/education'),
'$disabled' => (($is_default) ? 'onclick="return false;" style="color: #BBBBFF;"' : ''), '$disabled' => (($is_default) ? 'onclick="return false;" style="color: #BBBBFF;"' : ''),
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$profile_id' => $r[0]['id'], '$profile_id' => $r[0]['id'],
'$profile_name' => $r[0]['profile-name'], '$profile_name' => $r[0]['profile-name'],
'$default' => (($is_default) ? '<p id="profile-edit-default-desc">' . t('This is your <strong>public</strong> profile.<br />It <strong>may</strong> be visible to anybody using the internet.') . '</p>' : ""), '$default' => (($is_default) ? '<p id="profile-edit-default-desc">' . t('This is your <strong>public</strong> profile.<br />It <strong>may</strong> be visible to anybody using the internet.') . '</p>' : ""),
@ -460,7 +475,8 @@ function profiles_content(&$a) {
$o .= replace_macros($tpl_header,array( $o .= replace_macros($tpl_header,array(
'$header' => t('Edit/Manage Profiles'), '$header' => t('Edit/Manage Profiles'),
'$chg_photo' => t('Change profile photo'), '$chg_photo' => t('Change profile photo'),
'$cr_new' => t('Create New Profile') '$cr_new' => t('Create New Profile'),
'$cr_new_link' => 'profiles/new?t=' . get_form_security_token("profile_new")
)); ));
@ -473,7 +489,7 @@ function profiles_content(&$a) {
'$alt' => t('Profile Image'), '$alt' => t('Profile Image'),
'$profile_name' => $rr['profile-name'], '$profile_name' => $rr['profile-name'],
'$visible' => (($rr['is-default']) ? '<strong>' . t('visible to everybody') . '</strong>' '$visible' => (($rr['is-default']) ? '<strong>' . t('visible to everybody') . '</strong>'
: '<a href="' . $a->get_baseurl() . '/profperm/' . $rr['id'] . '" />' . t('Edit visibility') . '</a>') : '<a href="' . $a->get_baseurl(true) . '/profperm/' . $rr['id'] . '" />' . t('Edit visibility') . '</a>')
)); ));
} }
} }

View file

@ -53,16 +53,20 @@ function settings_post(&$a) {
$old_page_flags = $a->user['page-flags']; $old_page_flags = $a->user['page-flags'];
if(($a->argc > 1) && ($a->argv[1] === 'oauth') && x($_POST,'remove')){ if(($a->argc > 1) && ($a->argv[1] === 'oauth') && x($_POST,'remove')){
check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth');
$key = $_POST['remove']; $key = $_POST['remove'];
q("DELETE FROM tokens WHERE id='%s' AND uid=%d", q("DELETE FROM tokens WHERE id='%s' AND uid=%d",
dbesc($key), dbesc($key),
local_user()); local_user());
goaway($a->get_baseurl()."/settings/oauth/"); goaway($a->get_baseurl(true)."/settings/oauth/");
return; return;
} }
if(($a->argc > 2) && ($a->argv[1] === 'oauth') && ($a->argv[2] === 'edit'||($a->argv[2] === 'add')) && x($_POST,'submit')) { if(($a->argc > 2) && ($a->argv[1] === 'oauth') && ($a->argv[2] === 'edit'||($a->argv[2] === 'add')) && x($_POST,'submit')) {
check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth');
$name = ((x($_POST,'name')) ? $_POST['name'] : ''); $name = ((x($_POST,'name')) ? $_POST['name'] : '');
$key = ((x($_POST,'key')) ? $_POST['key'] : ''); $key = ((x($_POST,'key')) ? $_POST['key'] : '');
$secret = ((x($_POST,'secret')) ? $_POST['secret'] : ''); $secret = ((x($_POST,'secret')) ? $_POST['secret'] : '');
@ -100,18 +104,23 @@ function settings_post(&$a) {
local_user()); local_user());
} }
} }
goaway($a->get_baseurl()."/settings/oauth/"); goaway($a->get_baseurl(true)."/settings/oauth/");
return; return;
} }
if(($a->argc > 1) && ($a->argv[1] == 'addon')) { if(($a->argc > 1) && ($a->argv[1] == 'addon')) {
check_form_security_token_redirectOnErr('/settings/addon', 'settings_addon');
call_hooks('plugin_settings_post', $_POST); call_hooks('plugin_settings_post', $_POST);
return; return;
} }
if(($a->argc > 1) && ($a->argv[1] == 'connectors')) { if(($a->argc > 1) && ($a->argv[1] == 'connectors')) {
if(x($_POST['imap-submit'])) { check_form_security_token_redirectOnErr('/settings/connectors', 'settings_connectors');
if(x($_POST, 'imap-submit')) {
$mail_server = ((x($_POST,'mail_server')) ? $_POST['mail_server'] : ''); $mail_server = ((x($_POST,'mail_server')) ? $_POST['mail_server'] : '');
$mail_port = ((x($_POST,'mail_port')) ? $_POST['mail_port'] : ''); $mail_port = ((x($_POST,'mail_port')) ? $_POST['mail_port'] : '');
$mail_ssl = ((x($_POST,'mail_ssl')) ? strtolower(trim($_POST['mail_ssl'])) : ''); $mail_ssl = ((x($_POST,'mail_ssl')) ? strtolower(trim($_POST['mail_ssl'])) : '');
@ -185,6 +194,7 @@ function settings_post(&$a) {
return; return;
} }
check_form_security_token_redirectOnErr('/settings', 'settings');
call_hooks('settings_post', $_POST); call_hooks('settings_post', $_POST);
@ -401,7 +411,7 @@ function settings_post(&$a) {
} }
goaway($a->get_baseurl() . '/settings' ); goaway($a->get_baseurl(true) . '/settings' );
return; // NOTREACHED return; // NOTREACHED
} }
@ -425,27 +435,27 @@ function settings_content(&$a) {
$tabs = array( $tabs = array(
array( array(
'label' => t('Account settings'), 'label' => t('Account settings'),
'url' => $a->get_baseurl().'/settings', 'url' => $a->get_baseurl(true).'/settings',
'sel' => (($a->argc == 1)?'active':''), 'sel' => (($a->argc == 1)?'active':''),
), ),
array( array(
'label' => t('Connector settings'), 'label' => t('Connector settings'),
'url' => $a->get_baseurl().'/settings/connectors', 'url' => $a->get_baseurl(true).'/settings/connectors',
'sel' => (($a->argc > 1) && ($a->argv[1] === 'connectors')?'active':''), 'sel' => (($a->argc > 1) && ($a->argv[1] === 'connectors')?'active':''),
), ),
array( array(
'label' => t('Plugin settings'), 'label' => t('Plugin settings'),
'url' => $a->get_baseurl().'/settings/addon', 'url' => $a->get_baseurl(true).'/settings/addon',
'sel' => (($a->argc > 1) && ($a->argv[1] === 'addon')?'active':''), 'sel' => (($a->argc > 1) && ($a->argv[1] === 'addon')?'active':''),
), ),
array( array(
'label' => t('Connections'), 'label' => t('Connections'),
'url' => $a->get_baseurl() . '/settings/oauth', 'url' => $a->get_baseurl(true) . '/settings/oauth',
'sel' => (($a->argc > 1) && ($a->argv[1] === 'oauth')?'active':''), 'sel' => (($a->argc > 1) && ($a->argv[1] === 'oauth')?'active':''),
), ),
array( array(
'label' => t('Export personal data'), 'label' => t('Export personal data'),
'url' => $a->get_baseurl() . '/uexport', 'url' => $a->get_baseurl(true) . '/uexport',
'sel' => '' 'sel' => ''
) )
); );
@ -460,6 +470,7 @@ function settings_content(&$a) {
if(($a->argc > 2) && ($a->argv[2] === 'add')) { if(($a->argc > 2) && ($a->argv[2] === 'add')) {
$tpl = get_markup_template("settings_oauth_edit.tpl"); $tpl = get_markup_template("settings_oauth_edit.tpl");
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_oauth"),
'$tabs' => $tabs, '$tabs' => $tabs,
'$title' => t('Add application'), '$title' => t('Add application'),
'$submit' => t('Submit'), '$submit' => t('Submit'),
@ -486,6 +497,7 @@ function settings_content(&$a) {
$tpl = get_markup_template("settings_oauth_edit.tpl"); $tpl = get_markup_template("settings_oauth_edit.tpl");
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_oauth"),
'$tabs' => $tabs, '$tabs' => $tabs,
'$title' => t('Add application'), '$title' => t('Add application'),
'$submit' => t('Update'), '$submit' => t('Update'),
@ -500,10 +512,12 @@ function settings_content(&$a) {
} }
if(($a->argc > 3) && ($a->argv[2] === 'delete')) { if(($a->argc > 3) && ($a->argv[2] === 'delete')) {
check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth', 't');
$r = q("DELETE FROM clients WHERE client_id='%s' AND uid=%d", $r = q("DELETE FROM clients WHERE client_id='%s' AND uid=%d",
dbesc($a->argv[3]), dbesc($a->argv[3]),
local_user()); local_user());
goaway($a->get_baseurl()."/settings/oauth/"); goaway($a->get_baseurl(true)."/settings/oauth/");
return; return;
} }
@ -518,7 +532,8 @@ function settings_content(&$a) {
$tpl = get_markup_template("settings_oauth.tpl"); $tpl = get_markup_template("settings_oauth.tpl");
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(), '$form_security_token' => get_form_security_token("settings_oauth"),
'$baseurl' => $a->get_baseurl(true),
'$title' => t('Connected Apps'), '$title' => t('Connected Apps'),
'$add' => t('Add application'), '$add' => t('Add application'),
'$edit' => t('Edit'), '$edit' => t('Edit'),
@ -544,6 +559,7 @@ function settings_content(&$a) {
$tpl = get_markup_template("settings_addons.tpl"); $tpl = get_markup_template("settings_addons.tpl");
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_addon"),
'$title' => t('Plugin Settings'), '$title' => t('Plugin Settings'),
'$tabs' => $tabs, '$tabs' => $tabs,
'$settings_addons' => $settings_addons '$settings_addons' => $settings_addons
@ -586,6 +602,8 @@ function settings_content(&$a) {
$tpl = get_markup_template("settings_connectors.tpl"); $tpl = get_markup_template("settings_connectors.tpl");
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_connectors"),
'$title' => t('Connector Settings'), '$title' => t('Connector Settings'),
'$tabs' => $tabs, '$tabs' => $tabs,
@ -607,8 +625,6 @@ function settings_content(&$a) {
'$mail_movetofolder' => array('mail_movetofolder', t('Move to folder:'), $mail_movetofolder, ''), '$mail_movetofolder' => array('mail_movetofolder', t('Move to folder:'), $mail_movetofolder, ''),
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$settings_connectors' => $settings_connectors '$settings_connectors' => $settings_connectors
)); ));
return $o; return $o;
@ -636,20 +652,20 @@ function settings_content(&$a) {
$blocktags = $a->user['blocktags']; $blocktags = $a->user['blocktags'];
$expire_items = get_pconfig(local_user(), 'expire','items'); $expire_items = get_pconfig(local_user(), 'expire','items');
$expire_items = (($expire_items===false)?1:$expire_items); // default if not set: 1 $expire_items = (($expire_items===false)? '1' : $expire_items); // default if not set: 1
$expire_notes = get_pconfig(local_user(), 'expire','notes'); $expire_notes = get_pconfig(local_user(), 'expire','notes');
$expire_notes = (($expire_notes===false)?1:$expire_notes); // default if not set: 1 $expire_notes = (($expire_notes===false)? '1' : $expire_notes); // default if not set: 1
$expire_starred = get_pconfig(local_user(), 'expire','starred'); $expire_starred = get_pconfig(local_user(), 'expire','starred');
$expire_starred = (($expire_starred===false)?1:$expire_starred); // default if not set: 1 $expire_starred = (($expire_starred===false)? '1' : $expire_starred); // default if not set: 1
$expire_photos = get_pconfig(local_user(), 'expire','photos'); $expire_photos = get_pconfig(local_user(), 'expire','photos');
$expire_photos = (($expire_photos===false)?0:$expire_photos); // default if not set: 0 $expire_photos = (($expire_photos===false)? '0' : $expire_photos); // default if not set: 0
$suggestme = get_pconfig(local_user(), 'system','suggestme'); $suggestme = get_pconfig(local_user(), 'system','suggestme');
$suggestme = (($suggestme===false)?0:$suggestme); // default if not set: 0 $suggestme = (($suggestme===false)? '0': $suggestme); // default if not set: 0
$browser_update = intval(get_pconfig(local_user(), 'system','update_interval')); $browser_update = intval(get_pconfig(local_user(), 'system','update_interval'));
$browser_update = (($browser_update == 0) ? 40 : $browser_update / 1000); // default if not set: 40 seconds $browser_update = (($browser_update == 0) ? 40 : $browser_update / 1000); // default if not set: 40 seconds
@ -720,13 +736,13 @@ function settings_content(&$a) {
)); ));
$blockwall = replace_macros($opt_tpl,array( $blockwall = replace_macros($opt_tpl,array(
'$field' => array('blockwall', t('Allow friends to post to your profile page?'), ! $a->user['blockwall'], '', array(t('No'),t('Yes'))), '$field' => array('blockwall', t('Allow friends to post to your profile page?'), (intval($a->user['blockwall']) ? '0' : '1'), '', array(t('No'),t('Yes'))),
)); ));
$blocktags = replace_macros($opt_tpl,array( $blocktags = replace_macros($opt_tpl,array(
'$field' => array('blocktags', t('Allow friends to tag your posts?'), ! $a->user['blocktags'], '', array(t('No'),t('Yes'))), '$field' => array('blocktags', t('Allow friends to tag your posts?'), (intval($a->user['blocktags']) ? '0' : '1'), '', array(t('No'),t('Yes'))),
)); ));
@ -773,7 +789,7 @@ function settings_content(&$a) {
$theme_selected = (!x($_SESSION,'theme')? $default_theme : $_SESSION['theme']); $theme_selected = (!x($_SESSION,'theme')? $default_theme : $_SESSION['theme']);
$subdir = ((strlen($a->get_path())) ? '<br />' . t('or') . ' ' . $a->get_baseurl() . '/profile/' . $nickname : ''); $subdir = ((strlen($a->get_path())) ? '<br />' . t('or') . ' ' . $a->get_baseurl(true) . '/profile/' . $nickname : '');
$tpl_addr = get_markup_template("settings_nick_set.tpl"); $tpl_addr = get_markup_template("settings_nick_set.tpl");
@ -803,8 +819,9 @@ function settings_content(&$a) {
'$ptitle' => t('Account Settings'), '$ptitle' => t('Account Settings'),
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$uid' => local_user(), '$uid' => local_user(),
'$form_security_token' => get_form_security_token("settings"),
'$nickname_block' => $prof_addr, '$nickname_block' => $prof_addr,

View file

@ -17,7 +17,7 @@ function share_init(&$a) {
$o = ''; $o = '';
if(local_user() && intval(get_pconfig(local_user(),'system','plaintext'))) { if(local_user() && intval(get_pconfig(local_user(),'system','plaintext'))) {
$o .= '&#x2672; [url=' . $r[0]['author-link'] . ']' . $r[0]['author-name'] . '[/url]'; $o .= "\xE2\x99\xb2" . ' [url=' . $r[0]['author-link'] . ']' . $r[0]['author-name'] . '[/url]' . "\n";
if($r[0]['title']) if($r[0]['title'])
$o .= '[b]' . $r[0]['title'] . '[/b]' . "\n"; $o .= '[b]' . $r[0]['title'] . '[/b]' . "\n";
$o .= $r[0]['body'] . "\n"; $o .= $r[0]['body'] . "\n";

73
tests/autoname_test.php Executable file
View file

@ -0,0 +1,73 @@
<?php
/**
* this file contains tests for the autoname function
*
* @package test.util
*/
/** required, it is the file under test */
require_once('include/text.php');
/**
* TestCase for the autoname function
*
* @author Alexander Kampmann
* @package test.util
*/
class AutonameTest extends PHPUnit_Framework_TestCase {
/**
*autonames should be random, even length
*/
public function testAutonameEven() {
$autoname1=autoname(10);
$autoname2=autoname(10);
$this->assertNotEquals($autoname1, $autoname2);
}
/**
*autonames should be random, odd length
*/
public function testAutonameOdd() {
$autoname1=autoname(9);
$autoname2=autoname(9);
$this->assertNotEquals($autoname1, $autoname2);
}
/**
* try to fail autonames
*/
public function testAutonameNoLength() {
$autoname1=autoname(0);
$this->assertEquals(0, count($autoname1));
}
/**
* try to fail it with invalid input
*
* TODO: What's corect behaviour here? An exception?
*/
public function testAutonameNegativeLength() {
$autoname1=autoname(-23);
$this->assertEquals(0, count($autoname1));
}
// public function testAutonameMaxLength() {
// $autoname2=autoname(PHP_INT_MAX);
// $this->assertEquals(PHP_INT_MAX, count($autoname2));
// }
/**
* test with a length, that may be too short
*/
public function testAutonameLength1() {
$autoname1=autoname(1);
$this->assertEquals(1, count($autoname1));
$autoname2=autoname(1);
$this->assertEquals(1, count($autoname2));
$this->assertFalse($autoname1==$autoname2);
}
}

View file

@ -0,0 +1,51 @@
<?php
/**
* this test tests the contains_attribute function
*
* @package test.util
*/
/** required, it is the file under test */
require_once('include/text.php');
/**
* TestCase for the contains_attribute function
*
* @author Alexander Kampmann
* @package test.util
*/
class ContainsAttributeTest extends PHPUnit_Framework_TestCase {
/**
* test attribute contains
*/
public function testAttributeContains1() {
$testAttr="class1 notclass2 class3";
$this->assertTrue(attribute_contains($testAttr, "class3"));
$this->assertFalse(attribute_contains($testAttr, "class2"));
}
/**
* test attribute contains
*/
public function testAttributeContains2() {
$testAttr="class1 not-class2 class3";
$this->assertTrue(attribute_contains($testAttr, "class3"));
$this->assertFalse(attribute_contains($testAttr, "class2"));
}
/**
* test with empty input
*/
public function testAttributeContainsEmpty() {
$testAttr="";
$this->assertFalse(attribute_contains($testAttr, "class2"));
}
/**
* test input with special chars
*/
public function testAttributeContainsSpecialChars() {
$testAttr="--... %\$ä() /(=?}";
$this->assertFalse(attribute_contains($testAttr, "class2"));
}
}

142
tests/expand_acl_test.php Executable file
View file

@ -0,0 +1,142 @@
<?php
/**
* this test tests the expand_acl function
*
* @package test.util
*/
/** required, it is the file under test */
require_once('include/text.php');
/**
* TestCase for the expand_acl function
*
* @author Alexander Kampmann
* @package test.util
*/
class ExpandAclTest extends PHPUnit_Framework_TestCase {
/**
* test expand_acl, perfect input
*/
public function testExpandAclNormal() {
$text='<1><2><3>';
$this->assertEquals(array(1, 2, 3), expand_acl($text));
}
/**
* test with a big number
*/
public function testExpandAclBigNumber() {
$text='<1><'.PHP_INT_MAX.'><15>';
$this->assertEquals(array(1, PHP_INT_MAX, 15), expand_acl($text));
}
/**
* test with a string in it.
*
* TODO: is this valid input? Otherwise: should there be an exception?
*/
public function testExpandAclString() {
$text="<1><279012><tt>";
$this->assertEquals(array(1, 279012, 'tt'), expand_acl($text));
}
/**
* test with a ' ' in it.
*
* TODO: is this valid input? Otherwise: should there be an exception?
*/
public function testExpandAclSpace() {
$text="<1><279 012><32>";
$this->assertEquals(array(1, "279 012", "32"), expand_acl($text));
}
/**
* test empty input
*/
public function testExpandAclEmpty() {
$text="";
$this->assertEquals(array(), expand_acl($text));
}
/**
* test invalid input, no < at all
*
* TODO: should there be an exception?
*/
public function testExpandAclNoBrackets() {
$text="According to documentation, that's invalid. "; //should be invalid
$this->assertEquals(array(), expand_acl($text));
}
/**
* test invalid input, just open <
*
* TODO: should there be an exception?
*/
public function testExpandAclJustOneBracket1() {
$text="<Another invalid string"; //should be invalid
$this->assertEquals(array(), expand_acl($text));
}
/**
* test invalid input, just close >
*
* TODO: should there be an exception?
*/
public function testExpandAclJustOneBracket2() {
$text="Another invalid> string"; //should be invalid
$this->assertEquals(array(), expand_acl($text));
}
/**
* test invalid input, just close >
*
* TODO: should there be an exception?
*/
public function testExpandAclCloseOnly() {
$text="Another> invalid> string>"; //should be invalid
$this->assertEquals(array(), expand_acl($text));
}
/**
* test invalid input, just open <
*
* TODO: should there be an exception?
*/
public function testExpandAclOpenOnly() {
$text="<Another< invalid string<"; //should be invalid
$this->assertEquals(array(), expand_acl($text));
}
/**
* test invalid input, open and close do not match
*
* TODO: should there be an exception?
*/
public function testExpandAclNoMatching1() {
$text="<Another<> invalid <string>"; //should be invalid
$this->assertEquals(array(), expand_acl($text));
}
/**
* test invalid input, open and close do not match
*
* TODO: should there be an exception?
*/
public function testExpandAclNoMatching2() {
$text="<1>2><3>";
$this->assertEquals(array(), expand_acl($text));
}
/**
* test invalid input, empty <>
*
* TODO: should there be an exception? Or array(1, 3)
*/
public function testExpandAclEmptyMatch() {
$text="<1><><3>";
$this->assertEquals(array(), expand_acl($text));
}
}

313
tests/get_tags_test.php Normal file
View file

@ -0,0 +1,313 @@
<?php
/**
* This file contains the tests for get_tags and the tag handling in item.php
*
* @package test.util
*/
/**
* required, because it contains the get_tags() function
*/
require_once 'include/text.php';
/**
* required, because it contains the tag handling
*/
require_once 'mod/item.php';
/**
* A class which can be used as replacement for an app if
* only get_baseurl is used.
*
* @author Alexander Kampmann
* @package test.util
*/
class MockApp {
function get_baseurl() {
return "baseurl";
}
};
/**
* the test should not rely on a database,
* so this is a replacement for the database access method q.
*
* It simulates the user with uid 11 has one contact, named Mike Lastname.
*
* @param string $sql
*/
function q($sql) {
$result=array(array('id'=>15,
'attag'=>'', 'network'=>'dfrn',
'name'=>'Mike Lastname', 'alias'=>'Mike',
'nick'=>'Mike', 'url'=>"http://justatest.de"));
$args=func_get_args();
//last parameter is always (in this test) uid, so, it should be 11
if($args[count($args)-1]!=11) {
return;
}
if(3==count($args)) {
//first call in handle_body, id only
if($result[0]['id']==$args[1]) {
return $result;
}
//second call in handle_body, name
if($result[0]['name']===$args[1]) {
return $result;
}
}
//third call in handle_body, nick or attag
if($result[0]['nick']===$args[2] || $result[0]['attag']===$args[1]) {
return $result;
}
}
/**
* replacement for dbesc.
* I don't want to test dbesc here, so
* I just return the input. It won't be a problem, because
* the test does not use a real database.
*
* DON'T USE HAT FUNCTION OUTSIDE A TEST!
*
* @param string $str
* @return input
*/
function dbesc($str) {
return $str;
}
/**
* TestCase for tag handling.
*
* @author alexander
* @package test.util
*/
class GetTagsTest extends PHPUnit_Framework_TestCase {
/** the mock to use as app */
private $a;
/**
* initialize the test. That's a phpUnit function,
* don't change its name.
*/
public function setUp() {
$this->a=new MockApp();
}
/**
* test with one Person tag
*/
public function testGetTagsShortPerson() {
$text="hi @Mike";
$tags=get_tags($text);
$inform='';
$str_tags='';
foreach($tags as $tag) {
handle_tag($this->a, $text, $inform, $str_tags, 11, $tag);
}
//correct tags found?
$this->assertEquals(1, count($tags));
$this->assertTrue(in_array("@Mike", $tags));
//correct output from handle_tag?
$this->assertEquals("cid:15", $inform);
$this->assertEquals("@[url=http://justatest.de]Mike Lastname[/url]", $str_tags);
$this->assertEquals("hi @[url=http://justatest.de]Mike Lastname[/url]", $text);
}
/**
* test with one Person tag.
* There's a minor spelling mistake...
*/
public function testGetTagsShortPersonSpelling() {
$text="hi @Mike.because";
$tags=get_tags($text);
//correct tags found?
$this->assertEquals(1, count($tags));
$this->assertTrue(in_array("@Mike.because", $tags));
$inform='';
$str_tags='';
handle_tag($this->a, $text, $inform, $str_tags, 11, $tags[0]);
$this->assertEquals("cid:15", $inform);
$this->assertEquals("@[url=http://justatest.de]Mike Lastname[/url]", $str_tags);
$this->assertEquals("hi @[url=http://justatest.de]Mike Lastname[/url].because", $text);
}
/**
* test with two Person tags.
* There's a minor spelling mistake...
*/
public function testGetTagsPerson2Spelling() {
$text="hi @Mike@campino@friendica.eu";
$tags=get_tags($text);
$this->assertEquals(2, count($tags));
$this->assertTrue(in_array("@Mike", $tags));
$this->assertTrue(in_array("@campino@friendica.eu", $tags));
}
/**
* Test with one hash tag.
*/
public function testGetTagsShortTag() {
$text="This is a #test_case";
$tags=get_tags($text);
$this->assertEquals(1, count($tags));
$this->assertTrue(in_array("#test_case", $tags));
}
/**
* test with a person and a hash tag
*/
public function testGetTagsShortTagAndPerson() {
$text="hi @Mike This is a #test_case";
$tags=get_tags($text);
$this->assertEquals(3, count($tags));
$this->assertTrue(in_array("@Mike", $tags));
$this->assertTrue(in_array("@Mike This", $tags));
$this->assertTrue(in_array("#test_case", $tags));
$inform='';
$str_tags='';
foreach($tags as $tag) {
handle_tag($this->a, $text, $inform, $str_tags, 11, $tag);
}
$this->assertEquals("cid:15", $inform);
$this->assertEquals("@[url=http://justatest.de]Mike Lastname[/url],#[url=baseurl/search?search=test%20case]test case[/url]", $str_tags);
$this->assertEquals("hi @[url=http://justatest.de]Mike Lastname[/url] This is a #[url=baseurl/search?search=test%20case]test case[/url]", $text);
}
/**
* test with a person, a hash tag and some special chars.
*/
public function testGetTagsShortTagAndPersonSpecialChars() {
$text="hi @Mike, This is a #test_case.";
$tags=get_tags($text);
$this->assertEquals(2, count($tags));
$this->assertTrue(in_array("@Mike", $tags));
$this->assertTrue(in_array("#test_case", $tags));
}
/**
* Test with a person tag and text behind it.
*/
public function testGetTagsPersonOnly() {
$text="@Test I saw the Theme Dev group was created.";
$tags=get_tags($text);
$this->assertEquals(2, count($tags));
$this->assertTrue(in_array("@Test I", $tags));
$this->assertTrue(in_array("@Test", $tags));
}
/**
* this test demonstrates strange behaviour by intval.
* It makes the next test fail.
*/
public function testIntval() {
$this->assertEquals(15, intval("15 it"));
}
/**
* test a tag with an id in it
*/
public function testIdTag() {
$text="Test with @mike+15 id tag";
$tags=get_tags($text);
$this->assertEquals(2, count($tags));
$this->assertTrue(in_array("@mike+15", $tags));
//happens right now, but it shouldn't be necessary
$this->assertTrue(in_array("@mike+15 id", $tags));
$inform='';
$str_tags='';
foreach($tags as $tag) {
handle_tag($this->a, $text, $inform, $str_tags, 11, $tag);
}
$this->assertEquals("Test with @[url=http://justatest.de]Mike Lastname[/url] id tag", $text);
$this->assertEquals("@[url=http://justatest.de]Mike Lastname[/url]", $str_tags);
$this->assertEquals("cid:15", $inform);
}
/**
* test with two persons and one special tag.
*/
public function testGetTags2Persons1TagSpecialChars() {
$text="hi @Mike, I'm just writing #test_cases, so"
." so @somebody@friendica.com may change #things.";
$tags=get_tags($text);
$this->assertEquals(5, count($tags));
$this->assertTrue(in_array("@Mike", $tags));
$this->assertTrue(in_array("#test_cases", $tags));
$this->assertTrue(in_array("@somebody@friendica.com", $tags));
$this->assertTrue(in_array("@somebody@friendica.com may", $tags));
$this->assertTrue(in_array("#things", $tags));
}
/**
* test with a long text.
*/
public function testGetTags() {
$text="hi @Mike, I'm just writing #test_cases, "
." so @somebody@friendica.com may change #things. Of course I "
."look for a lot of #pitfalls, like #tags at the end of a sentence "
."@comment. I hope noone forgets about @fullstops.because that might"
." break #things. @Mike@campino@friendica.eu is also #nice, isn't it? "
."Now, add a @first_last tag. ";
$tags=get_tags($text);
$this->assertTrue(in_array("@Mike", $tags));
$this->assertTrue(in_array("#test_cases", $tags));
$this->assertTrue(in_array("@somebody@friendica.com", $tags));
$this->assertTrue(in_array("#things", $tags));
$this->assertTrue(in_array("#pitfalls", $tags));
$this->assertTrue(in_array("#tags", $tags));
$this->assertTrue(in_array("@comment", $tags));
$this->assertTrue(in_array("@fullstops.because", $tags));
$this->assertTrue(in_array("#things", $tags));
$this->assertTrue(in_array("@Mike", $tags));
$this->assertTrue(in_array("#nice", $tags));
$this->assertTrue(in_array("@first_last", $tags));
//right now, none of the is matched
$this->assertFalse(in_array("@Mike@campino@friendica.eu", $tags));
$this->assertTrue(in_array("@campino@friendica.eu", $tags));
$this->assertTrue(in_array("@campino@friendica.eu is", $tags));
}
/**
* test with an empty string
*/
public function testGetTagsEmpty() {
$tags=get_tags("");
$this->assertEquals(0, count($tags));
}
}

50
tests/xss_filter_test.php Normal file
View file

@ -0,0 +1,50 @@
<?php
/**
* tests several functions which are used to prevent xss attacks
*
* @package test.util
*/
require_once('include/text.php');
class AntiXSSTest extends PHPUnit_Framework_TestCase {
/**
* test, that tags are escaped
*/
public function testEscapeTags() {
$invalidstring='<submit type="button" onclick="alert(\'failed!\');" />';
$validstring=notags($invalidstring);
$escapedString=escape_tags($invalidstring);
$this->assertEquals('[submit type="button" onclick="alert(\'failed!\');" /]', $validstring);
$this->assertEquals("&lt;submit type=&quot;button&quot; onclick=&quot;alert('failed!');&quot; /&gt;", $escapedString);
}
/**
*xmlify and unxmlify
*/
public function testXmlify() {
$text="<tag>I want to break\n this!11!<?hard?></tag>";
$xml=xmlify($text); //test whether it actually may be part of a xml document
$retext=unxmlify($text);
$this->assertEquals($text, $retext);
}
/**
* test hex2bin and reverse
*/
public function testHex2Bin() {
$this->assertEquals(-3, hex2bin(bin2hex(-3)));
$this->assertEquals(0, hex2bin(bin2hex(0)));
$this->assertEquals(12, hex2bin(bin2hex(12)));
$this->assertEquals(PHP_INT_MAX, hex2bin(bin2hex(PHP_INT_MAX)));
}
//function qp, quick and dirty??
//get_mentions
//get_contact_block, bis Zeile 538
}
?>

View file

@ -1,6 +1,6 @@
<?php <?php
define( 'UPDATE_VERSION' , 1131 ); define( 'UPDATE_VERSION' , 1132 );
/** /**
* *
@ -1122,3 +1122,8 @@ function update_1130() {
q("ALTER TABLE `item` ADD `file` MEDIUMTEXT NOT NULL AFTER `inform`, ADD FULLTEXT KEY (`file`) "); q("ALTER TABLE `item` ADD `file` MEDIUMTEXT NOT NULL AFTER `inform`, ADD FULLTEXT KEY (`file`) ");
} }
function update_1131() {
q("ALTER TABLE `contact` ADD `forum` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `writable` , ADD INDEX ( `forum` ) ");
}

View file

@ -26,7 +26,7 @@ echo "New DB VERSION: " . DB_UPDATE_VERSION . "\n";
if($build != DB_UPDATE_VERSION) { if($build != DB_UPDATE_VERSION) {
echo "Updating database..."; echo "Updating database...";
check_config(); check_config($a);
echo "Done\n"; echo "Done\n";
} }

View file

@ -7,6 +7,7 @@
{{ inc field_textarea.tpl with $field=$banner }}{{ endinc }} {{ inc field_textarea.tpl with $field=$banner }}{{ endinc }}
{{ inc field_select.tpl with $field=$language }}{{ endinc }} {{ inc field_select.tpl with $field=$language }}{{ endinc }}
{{ inc field_select.tpl with $field=$theme }}{{ endinc }} {{ inc field_select.tpl with $field=$theme }}{{ endinc }}
{{ inc field_select.tpl with $field=$ssl_policy }}{{ endinc }}
<div class="submit"><input type="submit" name="page_site" value="$submit" /></div> <div class="submit"><input type="submit" name="page_site" value="$submit" /></div>

View file

@ -16,6 +16,7 @@
<link rel="license" href="http://creativecommons.org/licenses/by/3.0/" /> <link rel="license" href="http://creativecommons.org/licenses/by/3.0/" />
$hub $hub
$salmon $salmon
$community
<updated>$feed_updated</updated> <updated>$feed_updated</updated>

View file

@ -12,10 +12,11 @@
<id>$feed_id</id> <id>$feed_id</id>
<title>$feed_title</title> <title>$feed_title</title>
<generator uri="http://friendika.com" version="$version">Friendika</generator> <generator uri="http://friendica.com" version="$version">Friendica</generator>
<link rel="license" href="http://creativecommons.org/licenses/by/3.0/" /> <link rel="license" href="http://creativecommons.org/licenses/by/3.0/" />
$hub $hub
$salmon $salmon
$community
<updated>$feed_updated</updated> <updated>$feed_updated</updated>

View file

@ -7,8 +7,15 @@ $page_desc<br />
<li><a href="http://friendica.com" title="$friendica">$friendica</a></li> <li><a href="http://friendica.com" title="$friendica">$friendica</a></li>
<li><a href="http://joindiaspora.com" title="$diaspora">$diaspora</a> $diasnote</li> <li><a href="http://joindiaspora.com" title="$diaspora">$diaspora</a> $diasnote</li>
<li><a href="http://ostatus.org" title="$public_net" >$statusnet</a></li> <li><a href="http://ostatus.org" title="$public_net" >$statusnet</a></li>
<li>$emailnet</li>
</ul> </ul>
</p> </p>
<p>
$invite_desc
</p>
<p>
$desc
</p>
<form action="dfrn_request/$nickname" method="post" /> <form action="dfrn_request/$nickname" method="post" />

View file

@ -40,6 +40,7 @@ $desc
</script> </script>
<form action="profile_photo/$resource" id="crop-image-form" method="post" /> <form action="profile_photo/$resource" id="crop-image-form" method="post" />
<input type='hidden' name='form_security_token' value='$form_security_token'>
<input type="hidden" name="cropfinal" value="1" /> <input type="hidden" name="cropfinal" value="1" />
<input type="hidden" name="xstart" id="x1" /> <input type="hidden" name="xstart" id="x1" />

View file

@ -4,23 +4,23 @@ function string_plural_select_de($n){
return ($n != 1); return ($n != 1);
} }
; ;
$a->strings["Post successful."] = "Beitrag erfolgreich veröffentlicht."; $a->strings["Post successful."] = "Beitrag erfolgreich ver<EFBFBD>ffentlicht.";
$a->strings["[Embedded content - reload page to view]"] = "[Eingebetteter Inhalt - Seite neu laden zum Betrachten]"; $a->strings["[Embedded content - reload page to view]"] = "[Eingebetteter Inhalt - Seite neu laden zum Betrachten]";
$a->strings["Contact settings applied."] = "Einstellungen zum Kontakt angewandt."; $a->strings["Contact settings applied."] = "Einstellungen zum Kontakt angewandt.";
$a->strings["Contact update failed."] = "Konnte den Kontakt nicht aktualisieren."; $a->strings["Contact update failed."] = "Konnte den Kontakt nicht aktualisieren.";
$a->strings["Permission denied."] = "Zugriff verweigert."; $a->strings["Permission denied."] = "Zugriff verweigert.";
$a->strings["Contact not found."] = "Kontakt nicht gefunden."; $a->strings["Contact not found."] = "Kontakt nicht gefunden.";
$a->strings["Repair Contact Settings"] = "Kontakt-Einstellungen reparieren"; $a->strings["Repair Contact Settings"] = "Kontakt-Einstellungen reparieren";
$a->strings["<strong>WARNING: This is highly advanced</strong> and if you enter incorrect information your communications with this contact may stop working."] = "<strong>ACHTUNG: Das sind Experten-Einstellungen!</strong> Wenn Du etwas Falsches eingibst, funktioniert die Kommunikation mit diesem Kontakt evtl. nicht mehr."; $a->strings["<strong>WARNING: This is highly advanced</strong> and if you enter incorrect information your communications with this contact may stop working."] = "<strong>ACHTUNG: Das sind Experten-Einstellungen!</strong> Wenn Du etwas falsches eingibst, funktioniert die Kommunikation mit diesem Kontakt evtl. nicht mehr.";
$a->strings["Please use your browser 'Back' button <strong>now</strong> if you are uncertain what to do on this page."] = "Bitte nutze den Zurück-Button deines Browsers <strong>jetzt</strong>, wenn du dir unsicher bist, was du tun willst."; $a->strings["Please use your browser 'Back' button <strong>now</strong> if you are uncertain what to do on this page."] = "Bitte nutze den Zur<EFBFBD>ck-Button deines Browsers <strong>jetzt</strong>, wenn du dir unsicher bist, was auf dieser Seite gemacht wird.";
$a->strings["Return to contact editor"] = "Zurück zum Kontakteditor"; $a->strings["Return to contact editor"] = "Zur<EFBFBD>ck zum Kontakteditor";
$a->strings["Name"] = "Name"; $a->strings["Name"] = "Name";
$a->strings["Account Nickname"] = "Account-Spitzname"; $a->strings["Account Nickname"] = "Account-Spitzname";
$a->strings["@Tagname - overrides Name/Nickname"] = "@Tagname - überschreibt Name/Spitzname"; $a->strings["@Tagname - overrides Name/Nickname"] = "@Tagname - <EFBFBD>berschreibt Name/Spitzname";
$a->strings["Account URL"] = "Account-URL"; $a->strings["Account URL"] = "Account-URL";
$a->strings["Friend Request URL"] = "URL für Freundschaftsanfragen"; $a->strings["Friend Request URL"] = "URL f<EFBFBD>r Freundschaftsanfragen";
$a->strings["Friend Confirm URL"] = "URL für Bestätigungen von Freundschaftsanfragen"; $a->strings["Friend Confirm URL"] = "URL f<EFBFBD>r Best<73>tigungen von Freundschaftsanfragen";
$a->strings["Notification Endpoint URL"] = "URL-Endpunkt für Benachrichtigungen"; $a->strings["Notification Endpoint URL"] = "URL-Endpunkt f<EFBFBD>r Benachrichtigungen";
$a->strings["Poll/Feed URL"] = "Pull/Feed-URL"; $a->strings["Poll/Feed URL"] = "Pull/Feed-URL";
$a->strings["New photo from this URL"] = "Neues Foto von dieser URL"; $a->strings["New photo from this URL"] = "Neues Foto von dieser URL";
$a->strings["Submit"] = "Senden"; $a->strings["Submit"] = "Senden";
@ -28,7 +28,7 @@ $a->strings["Help:"] = "Hilfe:";
$a->strings["Help"] = "Hilfe"; $a->strings["Help"] = "Hilfe";
$a->strings["Not Found"] = "Nicht gefunden"; $a->strings["Not Found"] = "Nicht gefunden";
$a->strings["Page not found."] = "Seite nicht gefunden."; $a->strings["Page not found."] = "Seite nicht gefunden.";
$a->strings["File exceeds size limit of %d"] = "Die Datei ist größer als das erlaubte Limit von %d"; $a->strings["File exceeds size limit of %d"] = "Die Datei ist gr<EFBFBD><EFBFBD>er als das erlaubte Limit von %d";
$a->strings["File upload failed."] = "Hochladen der Datei fehlgeschlagen."; $a->strings["File upload failed."] = "Hochladen der Datei fehlgeschlagen.";
$a->strings["Friend suggestion sent."] = "Kontaktvorschlag gesendet."; $a->strings["Friend suggestion sent."] = "Kontaktvorschlag gesendet.";
$a->strings["Suggest Friends"] = "Kontakte vorschlagen"; $a->strings["Suggest Friends"] = "Kontakte vorschlagen";
@ -40,7 +40,7 @@ $a->strings["link to source"] = "Link zum Originalbeitrag";
$a->strings["Events"] = "Veranstaltungen"; $a->strings["Events"] = "Veranstaltungen";
$a->strings["Create New Event"] = "Neue Veranstaltung erstellen"; $a->strings["Create New Event"] = "Neue Veranstaltung erstellen";
$a->strings["Previous"] = "Vorherige"; $a->strings["Previous"] = "Vorherige";
$a->strings["Next"] = "Nächste"; $a->strings["Next"] = "N<EFBFBD>chste";
$a->strings["hour:minute"] = "Stunde:Minute"; $a->strings["hour:minute"] = "Stunde:Minute";
$a->strings["Event details"] = "Veranstaltungsdetails"; $a->strings["Event details"] = "Veranstaltungsdetails";
$a->strings["Format is %s %s. Starting date and Description are required."] = "Format ist %s %s. Anfangsdatum und Beschreibung sind notwendig."; $a->strings["Format is %s %s. Starting date and Description are required."] = "Format ist %s %s. Anfangsdatum und Beschreibung sind notwendig.";

View file

@ -7,7 +7,11 @@ $page_desc<br />
<li><a href="http://friendica.com" title="$friendica">$friendica</a></li> <li><a href="http://friendica.com" title="$friendica">$friendica</a></li>
<li><a href="http://joindiaspora.com" title="$diaspora">$diaspora</a> $diasnote</li> <li><a href="http://joindiaspora.com" title="$diaspora">$diaspora</a> $diasnote</li>
<li><a href="http://ostatus.org" title="$public_net" >$statusnet</a></li> <li><a href="http://ostatus.org" title="$public_net" >$statusnet</a></li>
<li>$emailnet</li>
</ul> </ul>
$invite_desc
</p>
<p>
$desc $desc
</p> </p>

12
view/fileas_widget.tpl Executable file
View file

@ -0,0 +1,12 @@
<div id="fileas-sidebar" class="widget">
<h3>$title</h3>
<div id="nets-desc">$desc</div>
<ul class="fileas-ul">
<li class="tool"><a href="$base" class="fileas-link fileas-all{{ if $sel_all }} fileas-selected{{ endif }}">$all</a></li>
{{ for $terms as $term }}
<li class="tool"><a href="$base?f=&file=$term.name" class="fileas-link{{ if $term.selected }} fileas-selected{{ endif }}">$term.name</a></li>
{{ endfor }}
</ul>
</div>

View file

@ -1,5 +1,5 @@
<div class="group-delete-wrapper button" id="group-delete-wrapper-$id" > <div class="group-delete-wrapper button" id="group-delete-wrapper-$id" >
<a href="group/drop/$id" <a href="group/drop/$id?t=$form_security_token"
onclick="return confirmDelete();" onclick="return confirmDelete();"
id="group-delete-icon-$id" id="group-delete-icon-$id"
class="icon drophide group-delete-icon" class="icon drophide group-delete-icon"

View file

@ -3,6 +3,7 @@
<div id="group-edit-wrapper" > <div id="group-edit-wrapper" >
<form action="group/$gid" id="group-edit-form" method="post" > <form action="group/$gid" id="group-edit-form" method="post" >
<input type='hidden' name='form_security_token' value='$form_security_token'>
{{ inc field_input.tpl with $field=$gname }}{{ endinc }} {{ inc field_input.tpl with $field=$gname }}{{ endinc }}
{{ if $drop }}$drop{{ endif }} {{ if $drop }}$drop{{ endif }}

View file

@ -262,6 +262,18 @@ function enableOnUser(){
} }
} }
function itemFiler(id) {
reply = prompt("$fileas");
if(reply && reply.length) {
commentBusy = true;
$('body').css('cursor', 'wait');
$.get('filer/' + id + '?term=' + reply);
if(timer) clearTimeout(timer);
timer = setTimeout(NavUpdate,3000);
liking = 1;
}
}
function jotClearLocation() { function jotClearLocation() {
$('#jot-coord').val(''); $('#jot-coord').val('');
$('#profile-nolocation-wrapper').hide(); $('#profile-nolocation-wrapper').hide();

View file

@ -1,5 +1,5 @@
<form action="" method="post" > <form action="$dest_url" method="post" >
<input type="hidden" name="auth-params" value="login" /> <input type="hidden" name="auth-params" value="login" />
<div id="login_standard"> <div id="login_standard">

View file

@ -1,4 +1,4 @@
<form action="" method="post" > <form action="$dest_url" method="post" >
<div class="logout-wrapper"> <div class="logout-wrapper">
<input type="hidden" name="auth-params" value="logout" /> <input type="hidden" name="auth-params" value="logout" />
<input type="submit" name="submit" id="logout-button" value="$logout" /> <input type="submit" name="submit" id="logout-button" value="$logout" />

2
view/mail_list.tpl Executable file → Normal file
View file

@ -1,6 +1,6 @@
<div class="mail-list-outside-wrapper"> <div class="mail-list-outside-wrapper">
<div class="mail-list-sender" > <div class="mail-list-sender" >
<a href="$from_url" class="mail-list-sender-url" ><img class="mail-list-sender-photo$sparkle" src="$from_photo" height="80 width="80" alt="$from_name" /></a> <a href="$from_url" class="mail-list-sender-url" ><img class="mail-list-sender-photo$sparkle" src="$from_photo" height="80" width="80" alt="$from_name" /></a>
</div> </div>
<div class="mail-list-detail"> <div class="mail-list-detail">
<div class="mail-list-sender-name" >$from_name</div> <div class="mail-list-sender-name" >$from_name</div>

View file

@ -30,6 +30,12 @@ if(plaintext != 'none') {
setup : function(ed) { setup : function(ed) {
ed.onInit.add(function(ed) { ed.onInit.add(function(ed) {
ed.pasteAsPlainText = true; ed.pasteAsPlainText = true;
var editorId = ed.editorId;
var textarea = $('#'+editorId);
if (typeof(textarea.attr('tabindex')) != "undefined") {
$('#'+editorId+'_ifr').attr('tabindex', textarea.attr('tabindex'));
textarea.attr('tabindex', null);
}
}); });
} }
}); });

View file

@ -5,9 +5,9 @@ $default
<div id="profile-edit-links"> <div id="profile-edit-links">
<ul> <ul>
<li><a href="profile/$profile_id/view?tab=profile" id="profile-edit-view-link" title="$viewprof">$viewprof</a></li> <li><a href="profile/$profile_id/view?tab=profile" id="profile-edit-view-link" title="$viewprof">$viewprof</a></li>
<li><a href="profiles/clone/$profile_id" id="profile-edit-clone-link" title="$cr_prof">$cl_prof</a></li> <li><a href="$profile_clone_link" id="profile-edit-clone-link" title="$cr_prof">$cl_prof</a></li>
<li></li> <li></li>
<li><a href="profiles/drop/$profile_id" id="profile-edit-drop-link" title="$del_prof" $disabled >$del_prof</a></li> <li><a href="$profile_drop_link" id="profile-edit-drop-link" title="$del_prof" $disabled >$del_prof</a></li>
</ul> </ul>
</div> </div>
@ -17,6 +17,7 @@ $default
<div id="profile-edit-wrapper" > <div id="profile-edit-wrapper" >
<form id="profile-edit-form" name="form1" action="profiles/$profile_id" method="post" > <form id="profile-edit-form" name="form1" action="profiles/$profile_id" method="post" >
<input type='hidden' name='form_security_token' value='$form_security_token'>
<div id="profile-edit-profile-name-wrapper" > <div id="profile-edit-profile-name-wrapper" >
<label id="profile-edit-profile-name-label" for="profile-edit-profile-name" >$lbl_profname </label> <label id="profile-edit-profile-name-label" for="profile-edit-profile-name" >$lbl_profname </label>

View file

@ -3,6 +3,6 @@
<a href="profile_photo" >$chg_photo</a> <a href="profile_photo" >$chg_photo</a>
</p> </p>
<div id="profile-listing-new-link-wrapper" class="button" > <div id="profile-listing-new-link-wrapper" class="button" >
<a href="profiles/new" id="profile-listing-new-link" title="$cr_new" >$cr_new</a> <a href="$cr_new_link" id="profile-listing-new-link" title="$cr_new" >$cr_new</a>
</div> </div>

View file

@ -1,6 +1,7 @@
<h1>$title</h1> <h1>$title</h1>
<form enctype="multipart/form-data" action="profile_photo" method="post"> <form enctype="multipart/form-data" action="profile_photo" method="post">
<input type='hidden' name='form_security_token' value='$form_security_token'>
<div id="profile-photo-upload-wrapper"> <div id="profile-photo-upload-wrapper">
<label id="profile-photo-upload-label" for="profile-photo-upload">$lbl_upfile </label> <label id="profile-photo-upload-label" for="profile-photo-upload">$lbl_upfile </label>

View file

@ -10,14 +10,14 @@ $parent
$select $select
<div id="prvmail-subject-label">$subject</div> <div id="prvmail-subject-label">$subject</div>
<input type="text" size="64" maxlength="255" id="prvmail-subject" name="subject" value="$subjtxt" $readonly /> <input type="text" size="64" maxlength="255" id="prvmail-subject" name="subject" value="$subjtxt" $readonly tabindex="11" />
<div id="prvmail-message-label">$yourmessage</div> <div id="prvmail-message-label">$yourmessage</div>
<textarea rows="8" cols="72" class="prvmail-text" id="prvmail-text" name="body" >$text</textarea> <textarea rows="8" cols="72" class="prvmail-text" id="prvmail-text" name="body" tabindex="12">$text</textarea>
<div id="prvmail-submit-wrapper" > <div id="prvmail-submit-wrapper" >
<input type="submit" id="prvmail-submit" name="submit" value="Submit" /> <input type="submit" id="prvmail-submit" name="submit" value="Submit" tabindex="13" />
<div id="prvmail-upload-wrapper" > <div id="prvmail-upload-wrapper" >
<div id="prvmail-upload" class="icon border camera" title="$upload" ></div> <div id="prvmail-upload" class="icon border camera" title="$upload" ></div>
</div> </div>

View file

@ -5,7 +5,7 @@ $tabs
$nickname_block $nickname_block
<form action="settings" id="settings-form" method="post" autocomplete="off" > <form action="settings" id="settings-form" method="post" autocomplete="off" >
<input type='hidden' name='form_security_token' value='$form_security_token'>
<h3 class="settings-heading">$h_pass</h3> <h3 class="settings-heading">$h_pass</h3>

View file

@ -4,6 +4,7 @@ $tabs
<form action="settings/addon" method="post" autocomplete="off"> <form action="settings/addon" method="post" autocomplete="off">
<input type='hidden' name='form_security_token' value='$form_security_token'>
$settings_addons $settings_addons

View file

@ -6,6 +6,7 @@ $tabs
<div class="connector_statusmsg">$ostat_enabled</div> <div class="connector_statusmsg">$ostat_enabled</div>
<form action="settings/connectors" method="post" autocomplete="off"> <form action="settings/connectors" method="post" autocomplete="off">
<input type='hidden' name='form_security_token' value='$form_security_token'>
$settings_connectors $settings_connectors

View file

@ -4,6 +4,7 @@ $tabs
<form action="settings/oauth" method="post" autocomplete="off"> <form action="settings/oauth" method="post" autocomplete="off">
<input type='hidden' name='form_security_token' value='$form_security_token'>
<div id="profile-edit-links"> <div id="profile-edit-links">
<ul> <ul>
@ -24,7 +25,7 @@ $tabs
{{ endif }} {{ endif }}
{{ if $app.my }} {{ if $app.my }}
<a href="$baseurl/settings/oauth/edit/$app.client_id" class="icon s22 edit" title="$edit">&nbsp;</a> <a href="$baseurl/settings/oauth/edit/$app.client_id" class="icon s22 edit" title="$edit">&nbsp;</a>
<a href="$baseurl/settings/oauth/delete/$app.client_id" class="icon s22 delete" title="$delete">&nbsp;</a> <a href="$baseurl/settings/oauth/delete/$app.client_id?t=$form_security_token" class="icon s22 delete" title="$delete">&nbsp;</a>
{{ endif }} {{ endif }}
</div> </div>
{{ endfor }} {{ endfor }}

View file

@ -3,6 +3,8 @@ $tabs
<h1>$title</h1> <h1>$title</h1>
<form method="POST"> <form method="POST">
<input type='hidden' name='form_security_token' value='$form_security_token'>
{{ inc field_input.tpl with $field=$name }}{{ endinc }} {{ inc field_input.tpl with $field=$name }}{{ endinc }}
{{ inc field_input.tpl with $field=$key }}{{ endinc }} {{ inc field_input.tpl with $field=$key }}{{ endinc }}
{{ inc field_input.tpl with $field=$secret }}{{ endinc }} {{ inc field_input.tpl with $field=$secret }}{{ endinc }}

View file

@ -1,4 +1,22 @@
<?php <?php
/*
* Name: Dark Bubble
* Version: 1.0
* Maintainer: Mike Macgirvin <mike@macgirvin.com>
*/
$a->theme_info = array( $a->theme_info = array(
'extends' => 'testbubble', 'extends' => 'testbubble',
); );
$a->page['htmlhead'] .= <<< EOT
<script>
$(document).ready(function() {
$('html').click(function() { $("#nav-notifications-menu" ).hide(); });
});
</script>
EOT;

View file

@ -15,6 +15,8 @@ $a->page['htmlhead'] .= <<< EOT
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('html').click(function() { $("#nav-notifications-menu" ).hide(); });
$('.group-edit-icon').hover( $('.group-edit-icon').hover(
function() { function() {
$(this).addClass('icon'); $(this).removeClass('iconspacer');}, $(this).addClass('icon'); $(this).removeClass('iconspacer');},

View file

@ -16,6 +16,8 @@ $a->page['htmlhead'] .= <<< EOT
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('html').click(function() { $("#nav-notifications-menu" ).hide(); });
$('.group-edit-icon').hover( $('.group-edit-icon').hover(
function() { function() {
$(this).addClass('icon'); $(this).removeClass('iconspacer');}, $(this).addClass('icon'); $(this).removeClass('iconspacer');},

View file

@ -0,0 +1,29 @@
<div id="group-sidebar" class="widget">
<div class="title tool">
<h3 class="label">$title</h3>
<a href="group/new" title="$createtext" class="action"><span class="icon text s16 add"></span></a>
</div>
<div id="sidebar-group-list">
<ul>
{{ for $groups as $group }}
<li class="tool {{ if $group.selected }}selected{{ endif }}">
<a href="$group.href" class="label">
$group.text
</a>
{{ if $group.edit }}
<a href="$group.edit.href" class="action"><span class="icon text s10 edit"></span></a>
{{ endif }}
{{ if $group.cid }}
<input type="checkbox"
class="{{ if $group.selected }}ticked{{ else }}unticked {{ endif }} action"
onclick="contactgroupChangeMember('$group.id','$group.cid');return true;"
{{ if $group.ismember }}checked="checked"{{ endif }}
/>
{{ endif }}
</li>
{{ endfor }}
</ul>
</div>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 664 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 710 B

BIN
view/theme/diabook-blue/icons/toogle_off.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 391 B

After

Width:  |  Height:  |  Size: 834 B

BIN
view/theme/diabook-blue/icons/toogle_on.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 429 B

After

Width:  |  Height:  |  Size: 715 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 798 B

View file

@ -0,0 +1,7 @@
<div class="photo-album-image-wrapper" id="photo-album-image-wrapper-$id">
<a href="$imgsrc" rel="gallery" class="fancy-album" id="photo-album-photo-link-$id" title="$phototitle">
<img src="$imgsrc" alt="$imgalt" title="$phototitle" class="photo-album-photo lframe resize" id="photo-album-photo-$id" />
<p class='caption'>$desc</p>
</a>
</div>
<div class="photo-album-image-wrapper-end"></div>

View file

@ -0,0 +1,7 @@
<div class="photo-top-image-wrapper lframe" id="photo-top-image-wrapper-$id">
<a href="$photo.src" rel="$photo.album.name" class="fancy-album" id="photo-top-photo-link-$photo.id" title="$photo.title">
<img src="$photo.src" alt="$photo.alt" title="$photo.title" class="photo-top-album-img" id="photo-top-photo-$photo.id" />
</a>
<div class="photo-top-album-name"><a href="$photo.album.link" class="photo-top-album-link" title="$photo.album.alt" >$photo.album.name</a></div>
</div>

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