aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Hößl <tobias@hoessl.eu>2012-04-17 11:33:50 +0000
committerTobias Hößl <tobias@hoessl.eu>2012-04-17 11:33:50 +0000
commit720c8324c7572ebf51e4083430e060900cb30750 (patch)
tree8852cf4a64f42499825cbe46ba295082ce1cc515
parenta7421990350e2409ee90957dab37e1ff1fc272df (diff)
downloadvolse-hubzilla-720c8324c7572ebf51e4083430e060900cb30750.tar.gz
volse-hubzilla-720c8324c7572ebf51e4083430e060900cb30750.tar.bz2
volse-hubzilla-720c8324c7572ebf51e4083430e060900cb30750.zip
Some Bugfixes, and variable checks
-rw-r--r--include/Scrape.php2
-rw-r--r--include/conversation.php5
-rw-r--r--include/items.php55
-rw-r--r--include/network.php5
-rw-r--r--include/pgettext.php1
-rw-r--r--include/profile_advanced.php15
-rwxr-xr-xinclude/security.php1
-rw-r--r--mod/photo.php2
-rw-r--r--mod/photos.php1
9 files changed, 44 insertions, 43 deletions
diff --git a/include/Scrape.php b/include/Scrape.php
index 141c90dcf..b20d7d604 100644
--- a/include/Scrape.php
+++ b/include/Scrape.php
@@ -593,7 +593,7 @@ function probe_url($url, $mode = PROBE_NORMAL) {
logger('probe_url: fetch feed: ' . $poll . ' returns: ' . $xml, LOGGER_DATA);
$a = get_app();
- logger('probe_url: scrape_feed: headers: ' . $a->get_curl_headers(), $LOGGER_DATA);
+ logger('probe_url: scrape_feed: headers: ' . $a->get_curl_headers(), LOGGER_DATA);
$feed->set_raw_data($xml);
diff --git a/include/conversation.php b/include/conversation.php
index e5549a9c1..1b869b91e 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -342,7 +342,6 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
'body' => template_escape($body),
'text' => strip_tags(template_escape($body)),
'ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])),
- 'lock' => $lock,
'location' => template_escape($location),
'indent' => '',
'owner_name' => template_escape($owner_name),
@@ -400,6 +399,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
}
$comments_collapsed = false;
+ $comments_seen = 0;
$comment_lastcollapsed = false;
$comment_firstcollapsed = false;
$blowhard = 0;
@@ -709,7 +709,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
}
$page_template = get_markup_template("conversation.tpl");
- $o .= replace_macros($page_template, array(
+ $o = replace_macros($page_template, array(
'$baseurl' => $a->get_baseurl($ssl_state),
'$mode' => $mode,
'$user' => $a->user,
@@ -1074,7 +1074,6 @@ function find_thread_parent_index($arr,$x) {
}
function render_location_google($item) {
- $location = '';
$location = (($item['location']) ? '<a target="map" title="' . $item['location'] . '" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : '');
$coord = (($item['coord']) ? '<a target="map" title="' . $item['coord'] . '" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : '');
if($coord) {
diff --git a/include/items.php b/include/items.php
index e005ffaef..63450cff5 100644
--- a/include/items.php
+++ b/include/items.php
@@ -107,7 +107,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
if(! strlen($last_update))
$last_update = 'now -30 days';
- if(x($category)) {
+ if(isset($category)) {
$sql_extra .= file_tag_file_query('item',$category,'category');
}
@@ -588,20 +588,21 @@ function get_atom_elements($feed,$item) {
if($rawobj) {
$res['object'] = '<object>' . "\n";
- if($rawobj[0]['child'][NAMESPACE_ACTIVITY]['object-type'][0]['data']) {
- $res['object-type'] = $rawobj[0]['child'][NAMESPACE_ACTIVITY]['object-type'][0]['data'];
- $res['object'] .= '<type>' . $rawobj[0]['child'][NAMESPACE_ACTIVITY]['object-type'][0]['data'] . '</type>' . "\n";
+ $child = $rawobj[0]['child'];
+ if($child[NAMESPACE_ACTIVITY]['object-type'][0]['data']) {
+ $res['object-type'] = $child[NAMESPACE_ACTIVITY]['object-type'][0]['data'];
+ $res['object'] .= '<type>' . $child[NAMESPACE_ACTIVITY]['object-type'][0]['data'] . '</type>' . "\n";
}
- if($rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['id'][0]['data'])
- $res['object'] .= '<id>' . $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['id'][0]['data'] . '</id>' . "\n";
- if($rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'])
- $res['object'] .= '<link>' . encode_rel_links($rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']) . '</link>' . "\n";
- if($rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['title'][0]['data'])
- $res['object'] .= '<title>' . $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['title'][0]['data'] . '</title>' . "\n";
- if($rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['content'][0]['data']) {
- $body = $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['content'][0]['data'];
+ if(x($child[SIMPLEPIE_NAMESPACE_ATOM_10], 'id') && $child[SIMPLEPIE_NAMESPACE_ATOM_10]['id'][0]['data'])
+ $res['object'] .= '<id>' . $child[SIMPLEPIE_NAMESPACE_ATOM_10]['id'][0]['data'] . '</id>' . "\n";
+ if(x($child[SIMPLEPIE_NAMESPACE_ATOM_10], 'link') && $child[SIMPLEPIE_NAMESPACE_ATOM_10]['link'])
+ $res['object'] .= '<link>' . encode_rel_links($child[SIMPLEPIE_NAMESPACE_ATOM_10]['link']) . '</link>' . "\n";
+ if(x($child[SIMPLEPIE_NAMESPACE_ATOM_10], 'title') && $child[SIMPLEPIE_NAMESPACE_ATOM_10]['title'][0]['data'])
+ $res['object'] .= '<title>' . $child[SIMPLEPIE_NAMESPACE_ATOM_10]['title'][0]['data'] . '</title>' . "\n";
+ if(x($child[SIMPLEPIE_NAMESPACE_ATOM_10], 'content') && $child[SIMPLEPIE_NAMESPACE_ATOM_10]['content'][0]['data']) {
+ $body = $child[SIMPLEPIE_NAMESPACE_ATOM_10]['content'][0]['data'];
if(! $body)
- $body = $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['summary'][0]['data'];
+ $body = $child[SIMPLEPIE_NAMESPACE_ATOM_10]['summary'][0]['data'];
// preserve a copy of the original body content in case we later need to parse out any microformat information, e.g. events
$res['object'] .= '<orig>' . xmlify($body) . '</orig>' . "\n";
if((strpos($body,'<') !== false) || (strpos($body,'>') !== false)) {
@@ -626,20 +627,20 @@ function get_atom_elements($feed,$item) {
if($rawobj) {
$res['target'] = '<target>' . "\n";
- if($rawobj[0]['child'][NAMESPACE_ACTIVITY]['object-type'][0]['data']) {
- $res['target'] .= '<type>' . $rawobj[0]['child'][NAMESPACE_ACTIVITY]['object-type'][0]['data'] . '</type>' . "\n";
+ $child = $rawobj[0]['child'];
+ if($child[NAMESPACE_ACTIVITY]['object-type'][0]['data']) {
+ $res['target'] .= '<type>' . $child[NAMESPACE_ACTIVITY]['object-type'][0]['data'] . '</type>' . "\n";
}
- if($rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['id'][0]['data'])
- $res['target'] .= '<id>' . $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['id'][0]['data'] . '</id>' . "\n";
-
- if($rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'])
- $res['target'] .= '<link>' . encode_rel_links($rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']) . '</link>' . "\n";
- if($rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['title'][0]['data'])
- $res['target'] .= '<title>' . $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['title'][0]['data'] . '</title>' . "\n";
- if($rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['content'][0]['data']) {
- $body = $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['content'][0]['data'];
+ if(x($child[SIMPLEPIE_NAMESPACE_ATOM_10], 'id') && $child[SIMPLEPIE_NAMESPACE_ATOM_10]['id'][0]['data'])
+ $res['target'] .= '<id>' . $child[SIMPLEPIE_NAMESPACE_ATOM_10]['id'][0]['data'] . '</id>' . "\n";
+ if(x($child[SIMPLEPIE_NAMESPACE_ATOM_10], 'link') && $child[SIMPLEPIE_NAMESPACE_ATOM_10]['link'])
+ $res['target'] .= '<link>' . encode_rel_links($child[SIMPLEPIE_NAMESPACE_ATOM_10]['link']) . '</link>' . "\n";
+ if(x($child[SIMPLEPIE_NAMESPACE_ATOM_10], 'data') && $child[SIMPLEPIE_NAMESPACE_ATOM_10]['title'][0]['data'])
+ $res['target'] .= '<title>' . $child[SIMPLEPIE_NAMESPACE_ATOM_10]['title'][0]['data'] . '</title>' . "\n";
+ if(x($child[SIMPLEPIE_NAMESPACE_ATOM_10], 'data') && $child[SIMPLEPIE_NAMESPACE_ATOM_10]['content'][0]['data']) {
+ $body = $child[SIMPLEPIE_NAMESPACE_ATOM_10]['content'][0]['data'];
if(! $body)
- $body = $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['summary'][0]['data'];
+ $body = $child[SIMPLEPIE_NAMESPACE_ATOM_10]['summary'][0]['data'];
// preserve a copy of the original body content in case we later need to parse out any microformat information, e.g. events
$res['target'] .= '<orig>' . xmlify($body) . '</orig>' . "\n";
if((strpos($body,'<') !== false) || (strpos($body,'>') !== false)) {
@@ -2476,7 +2477,7 @@ function local_delivery($importer,$data) {
// find out if our user is involved in this conversation and wants to be notified.
- if($datarray['type'] != 'activity') {
+ if(!x($datarray['type']) || $datarray['type'] != 'activity') {
$myconv = q("SELECT `author-link`, `author-avatar`, `parent` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d AND `parent` != 0 ",
dbesc($parent_uri),
@@ -3048,7 +3049,7 @@ function item_expire($uid,$days) {
function drop_items($items) {
$uid = 0;
- if((! local_user()) && (! $remote_user()))
+ if(! local_user() && ! remote_user())
return;
if(count($items)) {
diff --git a/include/network.php b/include/network.php
index 8c678a443..4bec4a172 100644
--- a/include/network.php
+++ b/include/network.php
@@ -172,7 +172,7 @@ function post_url($url,$params, $headers = null, &$redirects = 0, $timeout = 0)
$url_parsed = @parse_url($newurl);
if (isset($url_parsed)) {
$redirects++;
- return fetch_url($newurl,$binary,$redirects,$timeout);
+ return fetch_url($newurl,false,$redirects,$timeout);
}
}
$a->set_curl_code($http_code);
@@ -206,6 +206,7 @@ function xml_status($st, $message = '') {
if(! function_exists('http_status_exit')) {
function http_status_exit($val) {
+ $err = '';
if($val >= 400)
$err = 'Error';
if($val >= 200 && $val < 300)
@@ -452,7 +453,7 @@ function lrdd($uri, $debug = false) {
logger('lrdd: parse error: ' . $e);
}
- if($dom) {
+ if(isset($dom) && $dom) {
$items = $dom->getElementsByTagName('link');
foreach($items as $item) {
$x = $item->getAttribute('rel');
diff --git a/include/pgettext.php b/include/pgettext.php
index 83e76ba9d..a079a4687 100644
--- a/include/pgettext.php
+++ b/include/pgettext.php
@@ -49,6 +49,7 @@ function get_language() {
if(isset($preferred))
return $preferred;
+ $a = get_app();
return ((isset($a->config['system']['language'])) ? $a->config['system']['language'] : 'en');
}}
diff --git a/include/profile_advanced.php b/include/profile_advanced.php
index 004a58524..bb9850cd0 100644
--- a/include/profile_advanced.php
+++ b/include/profile_advanced.php
@@ -2,7 +2,7 @@
function advanced_profile(&$a) {
- $o .= '';
+ $o = '';
$o .= '<h2>' . t('Profile') . '</h2>';
@@ -69,13 +69,12 @@ function advanced_profile(&$a) {
if($txt = prepare_text($a->profile['work'])) $profile['work'] = array( t('Work/employment:'), $txt);
if($txt = prepare_text($a->profile['education'])) $profile['education'] = array( t('School/education:'), $txt );
- }
-
-
- return replace_macros($tpl, array(
- '$title' => t('Profile'),
- '$profile' => $profile,
- ));
+ return replace_macros($tpl, array(
+ '$title' => t('Profile'),
+ '$profile' => $profile,
+ ));
+ }
+ return '';
}
diff --git a/include/security.php b/include/security.php
index fc816e5d7..a92400b5c 100755
--- a/include/security.php
+++ b/include/security.php
@@ -339,6 +339,7 @@ function check_form_security_token_redirectOnErr($err_redirect, $typename = '',
}
function check_form_security_token_ForbiddenOnErr($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);
header('HTTP/1.1 403 Forbidden');
diff --git a/mod/photo.php b/mod/photo.php
index ec53af899..1d38fe8e4 100644
--- a/mod/photo.php
+++ b/mod/photo.php
@@ -170,7 +170,7 @@ function photo_init(&$a) {
}
// Writing in cachefile
- if ($cachefile != '')
+ if (isset($cachefile) && $cachefile != '')
file_put_contents($cachefile, $data);
if(function_exists('header_remove')) {
diff --git a/mod/photos.php b/mod/photos.php
index 2a808cb41..8da94841e 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -330,7 +330,6 @@ function photos_post(&$a) {
// Create item container
$title = '';
- $basename = basename($filename);
$uri = item_new_uri($a->get_hostname(),$page_owner_uid);
$arr = array();