aboutsummaryrefslogtreecommitdiffstats
path: root/boot.php
diff options
context:
space:
mode:
Diffstat (limited to 'boot.php')
-rwxr-xr-xboot.php129
1 files changed, 90 insertions, 39 deletions
diff --git a/boot.php b/boot.php
index d4add9cc9..397513312 100755
--- a/boot.php
+++ b/boot.php
@@ -37,11 +37,13 @@ require_once('include/permissions.php');
require_once('library/Mobile_Detect/Mobile_Detect.php');
require_once('include/BaseObject.php');
require_once('include/features.php');
+require_once('include/taxonomy.php');
+
define ( 'RED_PLATFORM', 'Red Matrix' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
-define ( 'DB_UPDATE_VERSION', 1043 );
+define ( 'DB_UPDATE_VERSION', 1050 );
define ( 'EOL', '<br />' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
@@ -117,7 +119,7 @@ define ( 'DEFAULT_DB_ENGINE', 'MyISAM' );
define ( 'SSL_POLICY_NONE', 0 );
define ( 'SSL_POLICY_FULL', 1 );
-define ( 'SSL_POLICY_SELFSIGN', 2 );
+define ( 'SSL_POLICY_SELFSIGN', 2 ); // NOT supported in Red
/**
@@ -313,18 +315,21 @@ define ( 'XCHAN_FLAGS_HIDDEN', 0x0001);
* Tag/term types
*/
-define ( 'TERM_UNKNOWN', 0 );
-define ( 'TERM_HASHTAG', 1 );
-define ( 'TERM_MENTION', 2 );
-define ( 'TERM_CATEGORY', 3 );
-define ( 'TERM_PCATEGORY', 4 );
-define ( 'TERM_FILE', 5 );
-define ( 'TERM_SAVEDSEARCH', 6 );
-
-
-define ( 'TERM_OBJ_POST', 1 );
-define ( 'TERM_OBJ_PHOTO', 2 );
+define ( 'TERM_UNKNOWN', 0 );
+define ( 'TERM_HASHTAG', 1 );
+define ( 'TERM_MENTION', 2 );
+define ( 'TERM_CATEGORY', 3 );
+define ( 'TERM_PCATEGORY', 4 );
+define ( 'TERM_FILE', 5 );
+define ( 'TERM_SAVEDSEARCH', 6 );
+define ( 'TERM_THING', 7 );
+define ( 'TERM_OBJ_POST', 1 );
+define ( 'TERM_OBJ_PHOTO', 2 );
+define ( 'TERM_OBJ_PROFILE', 3 );
+define ( 'TERM_OBJ_CHANNEL', 4 );
+define ( 'TERM_OBJ_OBJECT', 5 );
+define ( 'TERM_OBJ_THING', 6 );
/**
@@ -379,6 +384,7 @@ define ( 'ACTIVITY_OBJ_EVENT', NAMESPACE_ACTIVITY_SCHEMA . 'event' );
define ( 'ACTIVITY_OBJ_GROUP', NAMESPACE_ACTIVITY_SCHEMA . 'group' );
define ( 'ACTIVITY_OBJ_TAGTERM', NAMESPACE_ZOT . '/activity/tagterm' );
define ( 'ACTIVITY_OBJ_PROFILE', NAMESPACE_ZOT . '/activity/profile' );
+define ( 'ACTIVITY_OBJ_THING', NAMESPACE_ZOT . '/activity/thing' );
/**
* item weight for query ordering
@@ -436,6 +442,7 @@ define ( 'ITEM_NOTSHOWN', 0x0080); // technically visible but not normal
define ( 'ITEM_NSFW', 0x0100);
define ( 'ITEM_RELAY', 0x0200); // used only in the communication layers, not stored
define ( 'ITEM_MENTIONSME', 0x0400);
+define ( 'ITEM_NOCOMMENT', 0x0800); // commenting/followups are disabled
/**
@@ -692,6 +699,8 @@ class App {
$this->is_mobile = $mobile_detect->isMobile();
$this->is_tablet = $mobile_detect->isTablet();
+ $this->head_set_icon('/images/rhash-32.png');
+
BaseObject::set_app($this);
/**
@@ -892,6 +901,7 @@ class App {
'$local_user' => local_user(),
'$generator' => RED_PLATFORM . ' ' . RED_VERSION,
'$update_interval' => $interval,
+ '$icon' => head_get_icon(),
'$head_css' => head_get_css(),
'$head_js' => head_get_js(),
'$js_strings' => js_strings()
@@ -990,6 +1000,17 @@ class App {
return $this->rdelim[$engine];
}
+ function head_set_icon($icon) {
+ $this->data['pageicon'] = $icon;
+
+ }
+
+ function head_get_icon() {
+ $icon = $this->data['pageicon'];
+ if(! strpos($icon,'://'))
+ $icon = z_root() . $icon;
+ return $icon;
+ }
}
@@ -1412,7 +1433,7 @@ function get_max_import_size() {
* Function : profile_load
* @parameter App $a
* @parameter string $nickname
- * @parameter int $profile
+ * @parameter string $profile
*
* Summary: Loads a profile into the page sidebar.
* The function requires a writeable copy of the main App structure, and the nickname
@@ -1429,7 +1450,9 @@ function get_max_import_size() {
*/
-function profile_load(&$a, $nickname, $profile = 0) {
+function profile_load(&$a, $nickname, $profile = '') {
+
+ logger('profile_load: ' . $profile);
$user = q("select channel_id from channel where channel_address = '%s' limit 1",
dbesc($nickname)
@@ -1453,30 +1476,29 @@ function profile_load(&$a, $nickname, $profile = 0) {
return;
}
- $r = q("SELECT abook_profile FROM abook WHERE abook_xchan = '%s' limit 1",
- dbesc($observer['xchan_hash'])
- );
- if($r)
- $profile = $r[0]['abook_profile'];
-
+ if(! $profile) {
+ $r = q("SELECT abook_profile FROM abook WHERE abook_xchan = '%s' and abook_channel = '%d' limit 1",
+ dbesc($observer['xchan_hash']),
+ intval($user[0]['channel_id'])
+ );
+ if($r)
+ $profile = $r[0]['abook_profile'];
+ }
$r = null;
-
-
if($profile) {
- $profile_int = intval($profile);
- $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , channel.* FROM `profile`
- LEFT JOIN channel ON `profile`.`uid` = channel.channel_id
- WHERE channel.channel_address = '%s' AND `profile`.`id` = %d LIMIT 1",
+ $r = q("SELECT profile.uid AS profile_uid, profile.*, channel.* FROM profile
+ LEFT JOIN channel ON profile.uid = channel.channel_id
+ WHERE channel.channel_address = '%s' AND profile.profile_guid = '%s' LIMIT 1",
dbesc($nickname),
- intval($profile_int)
+ dbesc($profile)
);
}
- if(! ($r && count($r))) {
- $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `channel`.* FROM `profile`
- LEFT JOIN `channel` ON `profile`.`uid` = channel.channel_id
- WHERE channel.channel_address = '%s' AND `profile`.`is_default` = 1 LIMIT 1",
+ if(! $r) {
+ $r = q("SELECT profile.uid AS profile_uid, profile.*, channel.* FROM profile
+ LEFT JOIN channel ON profile.uid = channel.channel_id
+ WHERE channel.channel_address = '%s' AND profile.is_default = 1 LIMIT 1",
dbesc($nickname)
);
}
@@ -1561,6 +1583,8 @@ function profile_sidebar($profile, $block = 0) {
return $o;
+ head_set_icon($profile['thumb']);
+
$is_owner = (($profile['uid'] == local_user()) ? true : false);
$profile['picdate'] = urlencode($profile['picdate']);
@@ -1922,7 +1946,7 @@ function current_theme(){
function current_theme_url($installing = false) {
global $a;
$t = current_theme();
- if((file_exists('view/theme/' . $t . '/php/style.php')) && (! $installing))
+ if(file_exists('view/theme/' . $t . '/php/style.php'))
return('view/theme/' . $t . '/php/style.pcss');
return('view/theme/' . $t . '/css/style.css');
}
@@ -2034,6 +2058,14 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
'title' => t('Events and Calendar'),
'id' => 'events-tab',
);
+ if(feature_enabled(local_user(),'webpages')){
+ $tabs[] = array(
+ 'label' => t('Webpages'),
+ 'url' => $a->get_baseurl() . '/webpages/' . $nickname,
+ 'sel' => ((argv(0) == 'webpages') ? 'active' : ''),
+ 'title' => t('Manage Webpages'),
+ 'id' => 'webpages-tab',
+ );}
}
else {
// FIXME
@@ -2054,12 +2086,16 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
function get_my_url() {
+ if(x($_SESSION,'zrl_override'))
+ return $_SESSION['zrl_override'];
if(x($_SESSION,'my_url'))
return $_SESSION['my_url'];
return false;
}
function get_my_address() {
+ if(x($_SESSION,'zid_override'))
+ return $_SESSION['zid_override'];
if(x($_SESSION,'my_address'))
return $_SESSION['my_address'];
return false;
@@ -2097,12 +2133,12 @@ function zid_init(&$a) {
}
/**
- * @function zid($s,$force = false)
+ * @function zid($s,$address = '')
* Adds a zid parameter to a url
* @param string $s
* The url to accept the zid
- * @param boolean $force
- * Currently unused
+ * @param boolean $address
+ * $address to use instead of session environment
* @return string
*
* @hooks 'zid'
@@ -2112,7 +2148,7 @@ function zid_init(&$a) {
*/
-function zid($s,$force = false) {
+function zid($s,$address = '') {
if(! strlen($s) || strpos($s,'zid='))
return $s;
$has_params = ((strpos($s,'?')) ? true : false);
@@ -2122,9 +2158,9 @@ function zid($s,$force = false) {
$achar = strpos($s,'?') ? '&' : '?';
$mine = get_my_url();
- $myaddr = get_my_address();
+ $myaddr = (($address) ? $address : get_my_address());
- if($mine and ! link_compare($mine,$s))
+ if($mine && $myaddr && (! link_compare($mine,$s)))
$zurl = $s . (($num_slashes >= 3) ? '' : '/') . $achar . 'zid=' . urlencode($myaddr);
else
$zurl = $s;
@@ -2276,3 +2312,18 @@ function construct_page(&$a) {
function appdirpath() {
return dirname(__FILE__);
}
+
+
+function head_set_icon($icon) {
+ global $a;
+ $a->data['pageicon'] = $icon;
+ logger('head_set_icon: ' . $icon);
+}
+
+function head_get_icon() {
+ global $a;
+ $icon = $a->data['pageicon'];
+ if(! strpos($icon,'://'))
+ $icon = z_root() . $icon;
+ return $icon;
+}