aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/BaseObject.php1
-rw-r--r--include/ConversationObject.php23
-rw-r--r--include/ItemObject.php4
-rw-r--r--include/bbcode.php5
-rw-r--r--include/conversation.php5
-rw-r--r--include/datetime.php2
-rwxr-xr-xinclude/dba/dba_driver.php8
-rwxr-xr-xinclude/dba/dba_mysqli.php8
-rw-r--r--include/hubloc.php15
-rwxr-xr-xinclude/items.php6
-rw-r--r--include/permissions.php18
-rw-r--r--include/profile_selectors.php12
-rw-r--r--include/widgets.php3
-rw-r--r--include/zot.php54
14 files changed, 118 insertions, 46 deletions
diff --git a/include/BaseObject.php b/include/BaseObject.php
index 4bfac5fa0..a88978a83 100644
--- a/include/BaseObject.php
+++ b/include/BaseObject.php
@@ -1,4 +1,5 @@
<?php /** @file */
+
if(class_exists('BaseObject'))
return;
diff --git a/include/ConversationObject.php b/include/ConversationObject.php
index 7e0d67c10..66f6cca0e 100644
--- a/include/ConversationObject.php
+++ b/include/ConversationObject.php
@@ -15,6 +15,7 @@ require_once('include/items.php');
*/
class Conversation extends BaseObject {
+
private $threads = array();
private $mode = null;
private $observer = null;
@@ -52,14 +53,8 @@ class Conversation extends BaseObject {
switch($mode) {
case 'network':
-// if(array_key_exists('firehose',$a->data) && intval($a->data['firehose'])) {
-// $this->profile_owner = intval($a->data['firehose']);
-// $this->writable = false;
-// }
-// else {
- $this->profile_owner = local_channel();
- $this->writable = true;
-// }
+ $this->profile_owner = local_channel();
+ $this->writable = true;
break;
case 'channel':
$this->profile_owner = $a->profile['profile_uid'];
@@ -69,7 +64,6 @@ class Conversation extends BaseObject {
// in this mode we set profile_owner after initialisation (from conversation()) and then
// pull some trickery which allows us to re-invoke this function afterward
// it's an ugly hack so FIXME
-// $this->profile_owner = $a->profile['uid'];
$this->writable = perm_is_allowed($this->profile_owner,$ob_hash,'post_comments');
break;
case 'page':
@@ -142,11 +136,11 @@ class Conversation extends BaseObject {
public function add_thread($item) {
$item_id = $item->get_id();
if(!$item_id) {
- logger('[ERROR] Conversation::add_thread : Item has no ID!!', LOGGER_DEBUG);
+ logger('Item has no ID!!', LOGGER_DEBUG, LOG_ERR);
return false;
}
if($this->get_thread($item->get_id())) {
- logger('[WARN] Conversation::add_thread : Thread already exists ('. $item->get_id() .').', LOGGER_DEBUG);
+ logger('Thread already exists ('. $item->get_id() .').', LOGGER_DEBUG, LOG_WARNING);
return false;
}
@@ -177,11 +171,6 @@ class Conversation extends BaseObject {
}
}
require_once('include/identity.php');
-// $sys = get_sys_channel();
-
-// if($sys && $item->get_data_value('uid') == $sys['channel_id']) {
-// $item->set_commentable(false);
-// }
$item->set_conversation($this);
$this->threads[] = $item;
@@ -209,7 +198,7 @@ class Conversation extends BaseObject {
$item_data = $item->get_template_data($conv_responses);
}
if(!$item_data) {
- logger('[ERROR] Conversation::get_template_data : Failed to get item template data ('. $item->get_id() .').', LOGGER_DEBUG);
+ logger('Failed to get item template data ('. $item->get_id() .').', LOGGER_DEBUG, LOG_ERR);
return false;
}
$result[] = $item_data;
diff --git a/include/ItemObject.php b/include/ItemObject.php
index 2be7e3ac9..d42e993e6 100644
--- a/include/ItemObject.php
+++ b/include/ItemObject.php
@@ -241,7 +241,7 @@ class Item extends BaseObject {
$has_bookmarks = false;
if(is_array($item['term'])) {
foreach($item['term'] as $t) {
- if($t['type'] == TERM_BOOKMARK)
+ if(!UNO && $t['type'] == TERM_BOOKMARK)
$has_bookmarks = true;
}
}
@@ -689,7 +689,7 @@ class Item extends BaseObject {
$comment_box = replace_macros($template,array(
'$return_path' => '',
'$threaded' => $this->is_threaded(),
- '$jsreload' => (($conv->get_mode() === 'display') ? $_SESSION['return_url'] : ''),
+ '$jsreload' => '', //(($conv->get_mode() === 'display') ? $_SESSION['return_url'] : ''),
'$type' => (($conv->get_mode() === 'channel') ? 'wall-comment' : 'net-comment'),
'$id' => $this->get_id(),
'$parent' => $this->get_id(),
diff --git a/include/bbcode.php b/include/bbcode.php
index 477436475..eefe7fe98 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -593,6 +593,11 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
$Text = preg_replace("/\[zrl\]([$URLSearchString]*)\[\/zrl\]/ism", '<a class="zrl" href="$1" target="_blank" >$1</a>', $Text);
$Text = preg_replace("/\[zrl\=([$URLSearchString]*)\](.*?)\[\/zrl\]/ism", '<a class="zrl" href="$1" target="_blank" >$2</a>', $Text);
}
+
+ // Remove bookmarks from UNO
+ if (UNO)
+ $Text = str_replace('<span class="bookmark-identifier">#^</span>', '', $Text);
+
// Perform MAIL Search
if (strpos($Text,'[/mail]') !== false) {
$Text = preg_replace("/\[mail\]([$MAILSearchString]*)\[\/mail\]/", '<a href="mailto:$1" target="_blank" >$1</a>', $Text);
diff --git a/include/conversation.php b/include/conversation.php
index 39119b2bb..676067f86 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1110,6 +1110,11 @@ function status_editor($a, $x, $popup = false) {
$o = '';
+ require_once('include/Contact.php');
+ $c = channelx_by_n($x['profile_uid']);
+ if($c && $c['channel_moved'])
+ return $o;
+
$geotag = (($x['allow_location']) ? replace_macros(get_markup_template('jot_geotag.tpl'), array()) : '');
$plaintext = true;
diff --git a/include/datetime.php b/include/datetime.php
index ace1ad14f..57b2b6d37 100644
--- a/include/datetime.php
+++ b/include/datetime.php
@@ -129,7 +129,7 @@ function dob($dob) {
else
$value = (($year) ? datetime_convert('UTC','UTC',$dob,'Y-m-d') : datetime_convert('UTC','UTC',$dob,'m-d'));
- $o = '<input type="text" name="dob" value="' . $value . '" placeholder="' . t('YYYY-MM-DD or MM-DD') . '" />';
+ $o = '<input class="form-control" type="text" name="dob" value="' . $value . '" placeholder="' . t('YYYY-MM-DD or MM-DD') . '" />';
// if ($dob && $dob != '0000-00-00')
// $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),mktime(0,0,0,$month,$day,$year),'dob');
diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php
index 2219b43cb..3c5b0b67e 100755
--- a/include/dba/dba_driver.php
+++ b/include/dba/dba_driver.php
@@ -303,9 +303,9 @@ function q($sql) {
if($stmt === false) {
if(version_compare(PHP_VERSION, '5.4.0') >= 0)
logger('dba: vsprintf error: ' .
- print_r(debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 1), true));
+ print_r(debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 1), true),LOGGER_NORMAL,LOG_CRIT);
else
- logger('dba: vsprintf error: ' . print_r(debug_backtrace(), true));
+ logger('dba: vsprintf error: ' . print_r(debug_backtrace(), true),LOGGER_NORMAL,LOG_CRIT);
}
return $db->q($stmt);
}
@@ -314,7 +314,7 @@ function q($sql) {
* This will happen occasionally trying to store the
* session data after abnormal program termination
*/
- logger('dba: no database: ' . print_r($args,true));
+ logger('dba: no database: ' . print_r($args,true),LOGGER_NORMAL,LOG_CRIT);
return false;
}
@@ -385,7 +385,7 @@ function db_getfunc($f) {
if(isset($lookup[$f]) && isset($lookup[$f][ACTIVE_DBTYPE]))
return $lookup[$f][ACTIVE_DBTYPE];
- logger('Unable to abstract DB function "'. $f . '" for dbtype ' . ACTIVE_DBTYPE, LOGGER_DEBUG);
+ logger('Unable to abstract DB function "'. $f . '" for dbtype ' . ACTIVE_DBTYPE, LOGGER_DEBUG, LOG_ERR);
return $f;
}
diff --git a/include/dba/dba_mysqli.php b/include/dba/dba_mysqli.php
index 74a999974..6986d4586 100755
--- a/include/dba/dba_mysqli.php
+++ b/include/dba/dba_mysqli.php
@@ -32,7 +32,7 @@ class dba_mysqli extends dba_driver {
if($this->error) {
- logger('dba_mysqli: ERROR: ' . printable($sql) . "\n" . $this->error);
+ logger('dba_mysqli: ERROR: ' . printable($sql) . "\n" . $this->error, LOGGER_NORMAL, LOG_ERR);
if(file_exists('dbfail.out')) {
file_put_contents('dbfail.out', datetime_convert() . "\n" . printable($sql) . "\n" . $this->error . "\n", FILE_APPEND);
}
@@ -40,13 +40,13 @@ class dba_mysqli extends dba_driver {
if(($result === true) || ($result === false)) {
if($this->debug) {
- logger('dba_mysqli: DEBUG: ' . printable($sql) . ' returns ' . (($result) ? 'true' : 'false'));
+ logger('dba_mysqli: DEBUG: ' . printable($sql) . ' returns ' . (($result) ? 'true' : 'false'), LOGGER_NORMAL,(($result) ? LOG_INFO : LOG_ERR));
}
return $result;
}
if($this->debug) {
- logger('dba_mysqli: DEBUG: ' . printable($sql) . ' returned ' . $result->num_rows . ' results.');
+ logger('dba_mysqli: DEBUG: ' . printable($sql) . ' returned ' . $result->num_rows . ' results.', LOGGER_NORMAL, LOG_INFO);
}
$r = array();
@@ -55,7 +55,7 @@ class dba_mysqli extends dba_driver {
$r[] = $x;
$result->free_result();
if($this->debug) {
- logger('dba_mysqli: ' . printable(print_r($r,true)));
+ logger('dba_mysqli: ' . printable(print_r($r,true)), LOGGER_NORMAL, LOG_INFO);
}
}
return $r;
diff --git a/include/hubloc.php b/include/hubloc.php
index a1171b0e2..695cada3c 100644
--- a/include/hubloc.php
+++ b/include/hubloc.php
@@ -134,10 +134,17 @@ function hubloc_change_primary($hubloc) {
$r = q("select channel_id, channel_primary from channel where channel_hash = '%s' limit 1",
dbesc($hubloc['hubloc_hash'])
);
- if(($r) && (! $r[0]['channel_primary'])) {
- q("update channel set channel_primary = 1 where channel_id = %d",
- intval($r[0]['channel_id'])
- );
+ if($r) {
+ if(! $r[0]['channel_primary']) {
+ q("update channel set channel_primary = 1 where channel_id = %d",
+ intval($r[0]['channel_id'])
+ );
+ }
+ else {
+ q("update channel set channel_primary = 0 where channel_id = %d",
+ intval($r[0]['channel_id'])
+ );
+ }
}
// do we even have an xchan for this hubloc and if so is it already set as primary?
diff --git a/include/items.php b/include/items.php
index bb4d1108e..9163016e1 100755
--- a/include/items.php
+++ b/include/items.php
@@ -1144,9 +1144,8 @@ function import_author_rss($x) {
$photos = import_xchan_photo($x['photo']['src'],$x['url']);
if($photos) {
- /** @bug $arr is undefined in this SQL query */
$r = q("update xchan set xchan_photo_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' where xchan_url = '%s' and xchan_network = 'rss'",
- dbesc(datetime_convert('UTC', 'UTC', $arr['photo_updated'])),
+ dbesc(datetime_convert()),
dbesc($photos[0]),
dbesc($photos[1]),
dbesc($photos[2]),
@@ -1189,9 +1188,8 @@ function import_author_unknown($x) {
$photos = import_xchan_photo($x['photo']['src'],$x['url']);
if($photos) {
- /** @bug $arr is undefined in this SQL query */
$r = q("update xchan set xchan_photo_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' where xchan_url = '%s' and xchan_network = 'unknown'",
- dbesc(datetime_convert('UTC','UTC',$arr['photo_updated'])),
+ dbesc(datetime_convert()),
dbesc($photos[0]),
dbesc($photos[1]),
dbesc($photos[2]),
diff --git a/include/permissions.php b/include/permissions.php
index e4cd9ddda..8f593640c 100644
--- a/include/permissions.php
+++ b/include/permissions.php
@@ -151,9 +151,13 @@ function get_all_perms($uid, $observer_xchan, $internal_use = true) {
// Check if this $uid is actually the $observer_xchan - if it's your content
// you always have permission to do anything
+ // if you've moved elsewhere, you will only have read only access
if(($observer_xchan) && ($r[0]['channel_hash'] === $observer_xchan)) {
- $ret[$perm_name] = true;
+ if($r[0]['channel_moved'] && (! $permission[2]))
+ $ret[$perm_name] = false;
+ else
+ $ret[$perm_name] = true;
continue;
}
@@ -286,7 +290,7 @@ function perm_is_allowed($uid, $observer_xchan, $permission) {
$channel_perm = $global_perms[$permission][0];
- $r = q("select %s, channel_pageflags, channel_hash from channel where channel_id = %d limit 1",
+ $r = q("select %s, channel_pageflags, channel_moved, channel_hash from channel where channel_id = %d limit 1",
dbesc($channel_perm),
intval($uid)
);
@@ -325,9 +329,15 @@ function perm_is_allowed($uid, $observer_xchan, $permission) {
return false;
// Check if this $uid is actually the $observer_xchan
+ // you will have full access unless the channel was moved -
+ // in which case you will have read_only access
- if($r[0]['channel_hash'] === $observer_xchan)
- return true;
+ if($r[0]['channel_hash'] === $observer_xchan) {
+ if($r[0]['channel_moved'] && (! $global_perms[$permission][2]))
+ return false;
+ else
+ return true;
+ }
if($r[0][$channel_perm] & PERMS_PUBLIC)
return true;
diff --git a/include/profile_selectors.php b/include/profile_selectors.php
index a80677cb3..9f993f803 100644
--- a/include/profile_selectors.php
+++ b/include/profile_selectors.php
@@ -7,7 +7,7 @@ function gender_selector($current="",$suffix="") {
call_hooks('gender_selector', $select);
- $o .= "<select name=\"gender$suffix\" id=\"gender-select$suffix\" size=\"1\" >";
+ $o .= "<select class=\"form-control\" name=\"gender$suffix\" id=\"gender-select$suffix\" size=\"1\" >";
foreach($select as $selection) {
if($selection !== 'NOTRANSLATION') {
$selected = (($selection == $current) ? ' selected="selected" ' : '');
@@ -24,7 +24,7 @@ function gender_selector_min($current="",$suffix="") {
call_hooks('gender_selector_min', $select);
- $o .= "<select name=\"gender$suffix\" id=\"gender-select$suffix\" size=\"1\" >";
+ $o .= "<select class=\"form-control\" name=\"gender$suffix\" id=\"gender-select$suffix\" size=\"1\" >";
foreach($select as $selection) {
if($selection !== 'NOTRANSLATION') {
$selected = (($selection == $current) ? ' selected="selected" ' : '');
@@ -44,7 +44,7 @@ function sexpref_selector($current="",$suffix="") {
call_hooks('sexpref_selector', $select);
- $o .= "<select name=\"sexual$suffix\" id=\"sexual-select$suffix\" size=\"1\" >";
+ $o .= "<select class=\"form-control\" name=\"sexual$suffix\" id=\"sexual-select$suffix\" size=\"1\" >";
foreach($select as $selection) {
if($selection !== 'NOTRANSLATION') {
$selected = (($selection == $current) ? ' selected="selected" ' : '');
@@ -62,7 +62,7 @@ function sexpref_selector_min($current="",$suffix="") {
call_hooks('sexpref_selector_min', $select);
- $o .= "<select name=\"sexual$suffix\" id=\"sexual-select$suffix\" size=\"1\" >";
+ $o .= "<select class=\"form-control\" name=\"sexual$suffix\" id=\"sexual-select$suffix\" size=\"1\" >";
foreach($select as $selection) {
if($selection !== 'NOTRANSLATION') {
$selected = (($selection == $current) ? ' selected="selected" ' : '');
@@ -81,7 +81,7 @@ function marital_selector($current="",$suffix="") {
call_hooks('marital_selector', $select);
- $o .= "<select name=\"marital\" id=\"marital-select\" size=\"1\" >";
+ $o .= "<select class=\"form-control\" name=\"marital\" id=\"marital-select\" size=\"1\" >";
foreach($select as $selection) {
if($selection !== 'NOTRANSLATION') {
$selected = (($selection == $current) ? ' selected="selected" ' : '');
@@ -98,7 +98,7 @@ function marital_selector_min($current="",$suffix="") {
call_hooks('marital_selector_min', $select);
- $o .= "<select name=\"marital\" id=\"marital-select\" size=\"1\" >";
+ $o .= "<select class=\"form-control\" name=\"marital\" id=\"marital-select\" size=\"1\" >";
foreach($select as $selection) {
if($selection !== 'NOTRANSLATION') {
$selected = (($selection == $current) ? ' selected="selected" ' : '');
diff --git a/include/widgets.php b/include/widgets.php
index 0d31133e7..65c745a05 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -983,6 +983,9 @@ function widget_cover_photo($arr) {
$o = '';
$a = get_app();
+
+ if($a->module == 'channel' && $_REQUEST['mid'])
+ return '';
$channel_id = 0;
if(array_key_exists('channel_id', $arr) && intval($arr['channel_id']))
diff --git a/include/zot.php b/include/zot.php
index a60a50d8f..cff9e1810 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -2234,6 +2234,56 @@ function process_location_delivery($sender,$arr,$deliveries) {
}
/**
+ * @brief checks for a moved UNO channel and sets the channel_moved flag
+ *
+ * Currently the effect of this flag is to turn the channel into 'read-only' mode.
+ * New content will not be processed (there was still an issue with blocking the
+ * ability to post comments as of 10-Mar-2016).
+ * We do not physically remove the channel at this time. The hub admin may choose
+ * to do so, but is encouraged to allow a grace period of several days in case there
+ * are any issues migrating content. This packet will generally be received by the
+ * original site when the basic channel import has been processed.
+ *
+ * This will only be executed on the UNO system which is the old location
+ * if a new location is reported and there is only one location record.
+ * The rest of the hubloc syncronisation will be handled within
+ * sync_locations
+ */
+
+
+
+function check_location_move($sender_hash,$locations) {
+
+ if(! $locations)
+ return;
+
+ if(! UNO)
+ return;
+
+ if(count($locations) != 1)
+ return;
+
+ $loc = $locations[0];
+
+ $r = q("select * from channel where channel_hash = '%s' limit 1",
+ dbesc($sender_hash)
+ );
+
+ if(! $r)
+ return;
+
+ if($loc['url'] !== z_root()) {
+ $x = q("update channel set channel_moved = '%s' where channel_hash = '%s' limit 1",
+ dbesc($loc['url']),
+ dbesc($sender_hash)
+ );
+
+ }
+
+}
+
+
+/**
* @brief Synchronises locations.
*
* @param array $sender
@@ -2247,6 +2297,10 @@ function sync_locations($sender, $arr, $absolute = false) {
if($arr['locations']) {
+ if($absolute)
+ check_location_move($sender['hash'],$arr['locations']);
+
+
$xisting = q("select hubloc_id, hubloc_url, hubloc_sitekey from hubloc where hubloc_hash = '%s'",
dbesc($sender['hash'])
);