aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/conversation.php20
-rwxr-xr-xinclude/items.php74
-rwxr-xr-xinclude/plugin.php19
-rw-r--r--include/security.php18
-rw-r--r--include/session.php23
5 files changed, 136 insertions, 18 deletions
diff --git a/include/conversation.php b/include/conversation.php
index 1ade8ed3a..e2dfccac9 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1595,8 +1595,17 @@ function profile_tabs($a, $is_owner = false, $nickname = null){
if (is_null($nickname))
$nickname = $channel['channel_address'];
+
$uid = (($a->profile['profile_uid']) ? $a->profile['profile_uid'] : local_channel());
+ if($uid == local_channel()) {
+ $cal_link = '/events';
+ }
+ else {
+ $cal_link = '/cal/' . $nickname;
+ }
+
+
if (get_pconfig($uid, 'system', 'noprofiletabs'))
return;
@@ -1644,6 +1653,17 @@ function profile_tabs($a, $is_owner = false, $nickname = null){
);
}
+ if($p['view_stream']) {
+ $tabs[] = array(
+ 'label' => t('Events'),
+ 'url' => $a->get_baseurl() . $cal_link,
+ 'sel' => ((argv(0) == 'cal' || argv(0) == 'events') ? 'active' : ''),
+ 'title' => t('Events'),
+ 'id' => 'event-tab',
+ );
+ }
+
+
if ($p['chat']) {
require_once('include/chat.php');
$has_chats = chatroom_list_count($uid);
diff --git a/include/items.php b/include/items.php
index 363563278..bb4d1108e 100755
--- a/include/items.php
+++ b/include/items.php
@@ -3724,10 +3724,6 @@ function mail_store($arr) {
/**
* @brief Process atom feed and update anything/everything we might need to update.
*
- * $hub = should we find a hub declation in the feed, pass it back to our calling process, who might (or
- * might not) try and subscribe to it.
- * $datedir sorts in reverse order
- *
* @param array $xml
* The (atom) feed to consume - RSS isn't as fully supported but may work for simple feeds.
* @param $importer
@@ -3766,7 +3762,7 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
if(($chn_expire != 0) && ($chn_expire < $sys_expire))
$expire_days = $chn_expire;
-logger('expire_days: ' . $expire_days);
+ // logger('expire_days: ' . $expire_days);
$feed = new SimplePie();
$feed->set_raw_data($xml);
@@ -3987,6 +3983,72 @@ logger('expire_days: ' . $expire_days);
}
}
+
+/**
+ * @brief Process atom feed and return the first post and structure
+ *
+ * @param array $xml
+ * The (atom) feed to consume - RSS isn't as fully supported but may work for simple feeds.
+ * @param $importer
+ * The contact_record (joined to user_record) of the local user who owns this
+ * relationship. It is this person's stuff that is going to be updated.
+ */
+
+function process_salmon_feed($xml, $importer) {
+
+ $ret = array();
+
+ require_once('library/simplepie/simplepie.inc');
+
+ if(! strlen($xml)) {
+ logger('process_feed: empty input');
+ return;
+ }
+
+ $feed = new SimplePie();
+ $feed->set_raw_data($xml);
+ $feed->init();
+
+ if($feed->error())
+ logger('Error parsing XML: ' . $feed->error());
+
+ $permalink = $feed->get_permalink();
+
+ if($feed->get_item_quantity()) {
+
+ // this should be exactly one
+
+ logger('feed item count = ' . $feed->get_item_quantity(), LOGGER_DEBUG);
+
+ $items = $feed->get_items();
+
+ foreach($items as $item) {
+
+ $item_id = base64url_encode($item->get_id());
+
+ logger('processing ' . $item_id, LOGGER_DEBUG);
+
+ $rawthread = $item->get_item_tags( NAMESPACE_THREAD,'in-reply-to');
+ if(isset($rawthread[0]['attribs']['']['ref'])) {
+ $is_reply = true;
+ $parent_mid = base64url_encode($rawthread[0]['attribs']['']['ref']);
+ }
+
+ if($is_reply)
+ $ret['is_reply'] = true;
+
+ $ret['author'] = array();
+
+ $datarray = get_atom_elements($feed,$item,$ret['author']);
+
+ $ret['item'] = $datarray;
+ }
+ }
+
+ return $ret;
+}
+
+
function update_feed_item($uid,$datarray) {
logger('update_feed_item: not implemented! ' . $uid . ' ' . print_r($datarray,true), LOGGER_DATA);
}
@@ -4070,7 +4132,7 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) {
$o .= '<thr:in-reply-to ref="' . xmlify($parent_item) . '" type="text/html" href="' . xmlify($item['plink']) . '" />' . "\r\n";
}
- if(activity_compare($item['obj_type'],ACTIVITY_OBJ_EVENT) && activity_compare($item['verb'],ACTIVITY_POST)) {
+ if(activity_match($item['obj_type'],ACTIVITY_OBJ_EVENT) && activity_match($item['verb'],ACTIVITY_POST)) {
$obj = ((is_array($item['obj'])) ? $item['object'] : json_decode($item['object'],true));
$o .= '<title>' . xmlify($item['title']) . '</title>' . "\r\n";
diff --git a/include/plugin.php b/include/plugin.php
index 5afded542..bd844442f 100755
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -325,7 +325,8 @@ function get_plugin_info($plugin){
'description' => '',
'author' => array(),
'maintainer' => array(),
- 'version' => ''
+ 'version' => '',
+ 'requires' => ''
);
if (!is_file("addon/$plugin/$plugin.php"))
@@ -383,6 +384,22 @@ function check_plugin_versions($info) {
}
}
+ if(array_key_exists('requires',$info)) {
+ $arr = explode(',',$info['requires']);
+ $found = true;
+ if($arr) {
+ foreach($arr as $test) {
+ $test = trim($test);
+ if(! $test)
+ continue;
+ if(! in_array($test,get_app()->plugins))
+ $found = false;
+ }
+ }
+ if(! $found)
+ return false;
+ }
+
return true;
}
diff --git a/include/security.php b/include/security.php
index ee94dba82..215cc92cb 100644
--- a/include/security.php
+++ b/include/security.php
@@ -148,7 +148,7 @@ function change_channel($change_channel) {
* @return string additional SQL where statement
*/
-function permissions_sql($owner_id, $remote_observer = null) {
+function permissions_sql($owner_id, $remote_observer = null, $table = '') {
$local_channel = local_channel();
@@ -158,10 +158,14 @@ function permissions_sql($owner_id, $remote_observer = null) {
* default permissions - anonymous user
*/
- $sql = " AND allow_cid = ''
- AND allow_gid = ''
- AND deny_cid = ''
- AND deny_gid = ''
+ if($table)
+ $table .= '.';
+
+
+ $sql = " AND {$table}allow_cid = ''
+ AND {$table}allow_gid = ''
+ AND {$table}deny_cid = ''
+ AND {$table}deny_gid = ''
";
/**
@@ -193,8 +197,8 @@ function permissions_sql($owner_id, $remote_observer = null) {
}
$regexop = db_getfunc('REGEXP');
$sql = sprintf(
- " AND ( NOT (deny_cid like '%s' OR deny_gid $regexop '%s')
- AND ( allow_cid like '%s' OR allow_gid $regexop '%s' OR ( allow_cid = '' AND allow_gid = '') )
+ " AND ( NOT ({$table}deny_cid like '%s' OR {$table}deny_gid $regexop '%s')
+ AND ( {$table}allow_cid like '%s' OR {$table}allow_gid $regexop '%s' OR ( {$table}allow_cid = '' AND {$table}allow_gid = '') )
)
",
dbesc(protect_sprintf( '%<' . $observer . '>%')),
diff --git a/include/session.php b/include/session.php
index 92004bc18..182805980 100644
--- a/include/session.php
+++ b/include/session.php
@@ -1,4 +1,5 @@
<?php
+
/**
* @file include/session.php
*
@@ -14,8 +15,8 @@ $session_expire = 180000;
function new_cookie($time) {
$old_sid = session_id();
-// ??? This shouldn't have any effect if called after session_start()
-// We probably need to set the session expiration and change the PHPSESSID cookie.
+ // ??? This shouldn't have any effect if called after session_start()
+ // We probably need to set the session expiration and change the PHPSESSID cookie.
session_set_cookie_params($time);
session_regenerate_id(false);
@@ -108,8 +109,9 @@ ini_set('session.use_only_cookies', 1);
ini_set('session.cookie_httponly', 1);
/*
- * PHP function which sets our user-level session storage functions.
+ * Set our session storage functions.
*/
+
session_set_save_handler(
'ref_session_open',
'ref_session_close',
@@ -117,4 +119,17 @@ session_set_save_handler(
'ref_session_write',
'ref_session_destroy',
'ref_session_gc'
-); \ No newline at end of file
+);
+
+
+ // Force cookies to be secure (https only) if this site is SSL enabled. Must be done before session_start().
+
+ if(intval($a->config['system']['ssl_cookie_protection'])) {
+ $arr = session_get_cookie_params();
+ session_set_cookie_params(
+ ((isset($arr['lifetime'])) ? $arr['lifetime'] : 0),
+ ((isset($arr['path'])) ? $arr['path'] : '/'),
+ ((isset($arr['domain'])) ? $arr['domain'] : $a->get_hostname()),
+ ((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? true : false),
+ ((isset($arr['httponly'])) ? $arr['httponly'] : true));
+ } \ No newline at end of file