mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-16 20:05:14 +02:00
Merge pull request #521 from fermionic/20121101-updates
Various updates
This commit is contained in:
commit
d3290f314f
51 changed files with 343 additions and 153 deletions
|
@ -701,7 +701,8 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
|||
'$edvideo' => t('Video'),
|
||||
'$preview' => t('Preview'),
|
||||
'$sourceapp' => t($a->sourcename),
|
||||
'$ww' => (($mode === 'network') ? $commentww : '')
|
||||
'$ww' => (($mode === 'network') ? $commentww : ''),
|
||||
'$rand_num' => random_digits(12)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
|
||||
function display_content(&$a) {
|
||||
function display_content(&$a, $update = 0) {
|
||||
|
||||
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
|
||||
notice( t('Public access denied.') . EOL);
|
||||
|
@ -19,10 +19,20 @@ function display_content(&$a) {
|
|||
$a->page['htmlhead'] .= get_markup_template('display-head.tpl');
|
||||
|
||||
|
||||
$nick = (($a->argc > 1) ? $a->argv[1] : '');
|
||||
if($update) {
|
||||
$nick = $_REQUEST['nick'];
|
||||
}
|
||||
else {
|
||||
$nick = (($a->argc > 1) ? $a->argv[1] : '');
|
||||
}
|
||||
profile_load($a,$nick);
|
||||
|
||||
$item_id = (($a->argc > 2) ? intval($a->argv[2]) : 0);
|
||||
if($update) {
|
||||
$item_id = $_REQUEST['item_id'];
|
||||
}
|
||||
else {
|
||||
$item_id = (($a->argc > 2) ? intval($a->argv[2]) : 0);
|
||||
}
|
||||
|
||||
if(! $item_id) {
|
||||
$a->error = 404;
|
||||
|
@ -97,6 +107,18 @@ function display_content(&$a) {
|
|||
|
||||
$sql_extra = item_permissions_sql($a->profile['uid'],$remote_contact,$groups);
|
||||
|
||||
if($update) {
|
||||
$r = q("SELECT id FROM item WHERE item.uid = %d
|
||||
AND `item`.`parent` = ( SELECT `parent` FROM `item` WHERE ( `id` = '%s' OR `uri` = '%s' ))
|
||||
$sql_extra AND unseen = 1",
|
||||
intval($a->profile['uid']),
|
||||
dbesc($item_id),
|
||||
dbesc($item_id)
|
||||
);
|
||||
if(!$r)
|
||||
return '';
|
||||
}
|
||||
|
||||
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
|
||||
|
@ -124,8 +146,10 @@ function display_content(&$a) {
|
|||
}
|
||||
|
||||
$items = conv_sort($r,"`commented`");
|
||||
|
||||
$o .= conversation($a,$items,'display', false);
|
||||
|
||||
if(!$update)
|
||||
$o .= "<script> var netargs = '?f=&nick=" . $nick . "&item_id=" . $item_id . "'; </script>";
|
||||
$o .= conversation($a,$items,'display', $update);
|
||||
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -139,7 +139,8 @@ function editpost_content(&$a) {
|
|||
'$preview' => t('Preview'),
|
||||
'$jotplugins' => $jotplugins,
|
||||
'$sourceapp' => t($a->sourcename),
|
||||
'$cancel' => t('Cancel')
|
||||
'$cancel' => t('Cancel'),
|
||||
'$rand_num' => random_digits(12)
|
||||
));
|
||||
|
||||
return $o;
|
||||
|
|
27
mod/item.php
27
mod/item.php
|
@ -46,6 +46,19 @@ function item_post(&$a) {
|
|||
$return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : '');
|
||||
$preview = ((x($_REQUEST,'preview')) ? intval($_REQUEST['preview']) : 0);
|
||||
|
||||
|
||||
// Check for doubly-submitted posts, and reject duplicates
|
||||
// Note that we have to ignore previews, otherwise nothing will post
|
||||
// after it's been previewed
|
||||
if(!$preview && x($_REQUEST['post_id_random'])) {
|
||||
if(x($_SESSION['post-random']) && $_SESSION['post-random'] == $_REQUEST['post_id_random']) {
|
||||
logger("item post: duplicate post", LOGGER_DEBUG);
|
||||
item_post_return($a->get_baseurl(), $api_source, $return_path);
|
||||
}
|
||||
else
|
||||
$_SESSION['post-random'] = $_REQUEST['post_id_random'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this a reply to something?
|
||||
*/
|
||||
|
@ -98,7 +111,7 @@ function item_post(&$a) {
|
|||
|
||||
// multi-level threading - preserve the info but re-parent to our single level threading
|
||||
//if(($parid) && ($parid != $parent))
|
||||
$thr_parent = $parent_uri;
|
||||
$thr_parent = $parent_uri;
|
||||
|
||||
if($parent_item['contact-id'] && $uid) {
|
||||
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
|
@ -873,30 +886,32 @@ function item_post(&$a) {
|
|||
|
||||
logger('post_complete');
|
||||
|
||||
item_post_return($a->get_baseurl(), $api_source, $return_path);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
function item_post_return($baseurl, $api_source, $return_path) {
|
||||
// figure out how to return, depending on from whence we came
|
||||
|
||||
if($api_source)
|
||||
return;
|
||||
|
||||
if($return_path) {
|
||||
goaway($a->get_baseurl() . "/" . $return_path);
|
||||
goaway($baseurl . "/" . $return_path);
|
||||
}
|
||||
|
||||
$json = array('success' => 1);
|
||||
if(x($_REQUEST,'jsreload') && strlen($_REQUEST['jsreload']))
|
||||
$json['reload'] = $a->get_baseurl() . '/' . $_REQUEST['jsreload'];
|
||||
$json['reload'] = $baseurl . '/' . $_REQUEST['jsreload'];
|
||||
|
||||
logger('post_json: ' . print_r($json,true), LOGGER_DEBUG);
|
||||
|
||||
echo json_encode($json);
|
||||
killme();
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function item_content(&$a) {
|
||||
|
||||
if((! local_user()) && (! remote_user()))
|
||||
|
|
|
@ -1406,7 +1406,8 @@ function photos_content(&$a) {
|
|||
'$submit' => t('Submit'),
|
||||
'$preview' => t('Preview'),
|
||||
'$sourceapp' => t($a->sourcename),
|
||||
'$ww' => ''
|
||||
'$ww' => '',
|
||||
'$rand_num' => random_digits(12)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -1449,7 +1450,8 @@ function photos_content(&$a) {
|
|||
'$submit' => t('Submit'),
|
||||
'$preview' => t('Preview'),
|
||||
'$sourceapp' => t($a->sourcename),
|
||||
'$ww' => ''
|
||||
'$ww' => '',
|
||||
'$rand_num' => random_digits(12)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -1520,7 +1522,8 @@ function photos_content(&$a) {
|
|||
'$submit' => t('Submit'),
|
||||
'$preview' => t('Preview'),
|
||||
'$sourceapp' => t($a->sourcename),
|
||||
'$ww' => ''
|
||||
'$ww' => '',
|
||||
'$rand_num' => random_digits(12)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
38
mod/update_display.php
Normal file
38
mod/update_display.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
// See update_profile.php for documentation
|
||||
|
||||
require_once('mod/display.php');
|
||||
require_once('include/group.php');
|
||||
|
||||
function update_display_content(&$a) {
|
||||
|
||||
$profile_uid = intval($_GET['p']);
|
||||
|
||||
header("Content-type: text/html");
|
||||
echo "<!DOCTYPE html><html><body>\r\n";
|
||||
echo (($_GET['msie'] == 1) ? '<div>' : '<section>');
|
||||
|
||||
|
||||
$text = display_content($a,$profile_uid);
|
||||
$pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
|
||||
$replace = "<img\${1} dst=\"\${2}\"";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
|
||||
$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
|
||||
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
|
||||
|
||||
echo str_replace("\t",' ',$text);
|
||||
echo (($_GET['msie'] == 1) ? '</div>' : '</section>');
|
||||
echo "</body></html>\r\n";
|
||||
killme();
|
||||
|
||||
}
|
|
@ -14,25 +14,25 @@ function update_network_content(&$a) {
|
|||
echo (($_GET['msie'] == 1) ? '<div>' : '<section>');
|
||||
|
||||
|
||||
$text = network_content($a,$profile_uid);
|
||||
$pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
|
||||
$replace = "<img\${1} dst=\"\${2}\"";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$text = network_content($a,$profile_uid);
|
||||
$pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
|
||||
$replace = "<img\${1} dst=\"\${2}\"";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
|
||||
$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
|
||||
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
|
||||
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
|
||||
|
||||
echo str_replace("\t",' ',$text);
|
||||
echo str_replace("\t",' ',$text);
|
||||
echo (($_GET['msie'] == 1) ? '</div>' : '</section>');
|
||||
echo "</body></html>\r\n";
|
||||
killme();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue