diff --git a/boot.php b/boot.php
index bbcc9d9a66..e98bfea9de 100644
--- a/boot.php
+++ b/boot.php
@@ -9,9 +9,9 @@ require_once('include/nav.php');
require_once('include/cache.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica');
-define ( 'FRIENDICA_VERSION', '2.3.1318' );
+define ( 'FRIENDICA_VERSION', '2.3.1336' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
-define ( 'DB_UPDATE_VERSION', 1138 );
+define ( 'DB_UPDATE_VERSION', 1143 );
define ( 'EOL', "
\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
@@ -29,6 +29,12 @@ define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
define ( 'JPEG_QUALITY', 100 );
+/**
+ * Not yet used
+ */
+
+define ( 'DEFAULT_DB_ENGINE', 'MyISAM' );
+
/**
* SSL redirection policies
*/
@@ -73,6 +79,14 @@ define ( 'HOOK_HOOK', 0);
define ( 'HOOK_FILE', 1);
define ( 'HOOK_FUNCTION', 2);
+/**
+ * DB update return values
+ */
+
+define ( 'UPDATE_SUCCESS', 0);
+define ( 'UPDATE_FAILED', 1);
+
+
/**
*
* page/profile types
@@ -193,6 +207,8 @@ define ( 'ACTIVITY_REQ_FRIEND', NAMESPACE_ACTIVITY_SCHEMA . 'request-friend' );
define ( 'ACTIVITY_UNFRIEND', NAMESPACE_ACTIVITY_SCHEMA . 'remove-friend' );
define ( 'ACTIVITY_FOLLOW', NAMESPACE_ACTIVITY_SCHEMA . 'follow' );
define ( 'ACTIVITY_UNFOLLOW', NAMESPACE_ACTIVITY_SCHEMA . 'stop-following' );
+define ( 'ACTIVITY_JOIN', NAMESPACE_ACTIVITY_SCHEMA . 'join' );
+
define ( 'ACTIVITY_POST', NAMESPACE_ACTIVITY_SCHEMA . 'post' );
define ( 'ACTIVITY_UPDATE', NAMESPACE_ACTIVITY_SCHEMA . 'update' );
define ( 'ACTIVITY_TAG', NAMESPACE_ACTIVITY_SCHEMA . 'tag' );
@@ -205,6 +221,7 @@ define ( 'ACTIVITY_OBJ_PHOTO', NAMESPACE_ACTIVITY_SCHEMA . 'photo' );
define ( 'ACTIVITY_OBJ_P_PHOTO', NAMESPACE_ACTIVITY_SCHEMA . 'profile-photo' );
define ( 'ACTIVITY_OBJ_ALBUM', NAMESPACE_ACTIVITY_SCHEMA . 'photo-album' );
define ( 'ACTIVITY_OBJ_EVENT', NAMESPACE_ACTIVITY_SCHEMA . 'event' );
+define ( 'ACTIVITY_OBJ_GROUP', NAMESPACE_ACTIVITY_SCHEMA . 'group' );
define ( 'ACTIVITY_OBJ_TAGTERM', NAMESPACE_DFRN . '/tagterm' );
define ( 'ACTIVITY_OBJ_PROFILE', NAMESPACE_DFRN . '/profile' );
@@ -658,32 +675,29 @@ if(! function_exists('check_config')) {
// call the specific update
-// global $db;
-// $db->excep(TRUE);
-// try {
-// $db->beginTransaction();
- $func = 'update_' . $x;
- $func($a);
-// $db->commit();
-// } catch(Exception $ex) {
-// $db->rollback();
-// //send the administrator an e-mail
-// $email_tpl = get_intltext_template("update_fail_eml.tpl");
-// $email_tpl = replace_macros($email_tpl, array(
-// '$sitename' => $a->config['sitename'],
-// '$siteurl' => $a->get_baseurl(),
-// '$update' => $x,
-// '$error' => $ex->getMessage()));
-// $subject=sprintf(t('Update Error at %s'), $a->get_baseurl());
+ $func = 'update_' . $x;
+ $retval = $func();
+ if($retval) {
+ //send the administrator an e-mail
+ $email_tpl = get_intltext_template("update_fail_eml.tpl");
+ $email_msg = replace_macros($email_tpl, array(
+ '$sitename' => $a->config['sitename'],
+ '$siteurl' => $a->get_baseurl(),
+ '$update' => $x,
+ '$error' => sprintf( t('Update %s failed. See error logs.'), $x)
+ ));
+ $subject=sprintf(t('Update Error at %s'), $a->get_baseurl());
-// mail($a->config['admin_email'], $subject, $text,
-// 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
-// . 'Content-type: text/plain; charset=UTF-8' . "\n"
-// . 'Content-transfer-encoding: 8bit' );
-// //try the logger
-// logger('update failed: '.$ex->getMessage().EOL);
-// }
-// $db->excep(FALSE);
+ mail($a->config['admin_email'], $subject, $email_msg,
+ 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
+ . 'Content-type: text/plain; charset=UTF-8' . "\n"
+ . 'Content-transfer-encoding: 8bit' );
+ //try the logger
+ logger('CRITICAL: Update Failed: '. $x);
+ }
+ else
+ set_config('database','update_' . $x, 'success');
+
}
}
set_config('system','build', DB_UPDATE_VERSION);
@@ -725,9 +739,10 @@ if(! function_exists('check_config')) {
foreach($installed as $i) {
if(! in_array($i['name'],$plugins_arr)) {
uninstall_plugin($i['name']);
- }
- else
+ }
+ else {
$installed_arr[] = $i['name'];
+ }
}
}
@@ -1174,11 +1189,7 @@ if(! function_exists('get_birthdays')) {
}
$classtoday = $istoday ? ' birthday-today ' : '';
if($total) {
- $o .= '
' . t('Birthday Reminders') . ' ' . '(' . $total . ')' . '
';
- $o .= '' . t('Birthdays this week:') . '
';
- $o .= '
';
-
- foreach($r as $rr) {
+ foreach($r as &$rr) {
if(! strlen($rr['name']))
continue;
@@ -1196,15 +1207,24 @@ if(! function_exists('get_birthdays')) {
$url = $a->get_baseurl() . '/redir/' . $rr['cid'];
}
- $o .= '
' . $rr['name'] . ' '
- . day_translate(datetime_convert('UTC', $a->timezone, $rr['start'], $rr['adjust'] ? $bd_format : $bd_short)) . (($today) ? ' ' . t('[today]') : '')
- . '
' ;
+ $rr['link'] = $url;
+ $rr['title'] = $rr['name'];
+ $rr['date'] = day_translate(datetime_convert('UTC', $a->timezone, $rr['start'], $rr['adjust'] ? $bd_format : $bd_short)) . (($today) ? ' ' . t('[today]') : '');
+ $rr['startime'] = Null;
+ $rr['today'] = $today;
+
}
- $o .= '
';
}
}
- return $o;
+ $tpl = get_markup_template("birthdays_reminder.tpl");
+ return replace_macros($tpl, array(
+ '$baseurl' => $a->get_baseurl(),
+ '$classtoday' => $classtoday,
+ '$count' => $total,
+ '$event_reminders' => t('Birthday Reminders'),
+ '$event_title' => t('Birthdays this week:'),
+ '$events' => $r,
+ ));
}
}
@@ -1215,7 +1235,6 @@ if(! function_exists('get_events')) {
require_once('include/bbcode.php');
$a = get_app();
- $o = '';
if(! local_user())
return $o;
@@ -1242,18 +1261,15 @@ if(! function_exists('get_events')) {
if($strt === datetime_convert('UTC',$a->timezone,'now','Y-m-d'))
$istoday = true;
}
- $classtoday = (($istoday) ? ' event-today ' : '');
+ $classtoday = (($istoday) ? 'event-today' : '');
- $o .= '' . t('Event Reminders') . ' ' . '(' . count($r) . ')' . '
';
- $o .= '' . t('Events this week:') . '
';
- $o .= '
';
-
- foreach($r as $rr) {
+ foreach($r as &$rr) {
if($rr['adjust'])
- $md = datetime_convert('UTC',$a->timezone,$rr['start'],'Y/m\#\l\i\n\k\-j');
+ $md = datetime_convert('UTC',$a->timezone,$rr['start'],'Y/m');
else
- $md = datetime_convert('UTC','UTC',$rr['start'],'Y/m\#\l\i\n\k\-j');
+ $md = datetime_convert('UTC','UTC',$rr['start'],'Y/m');
+ $md .= "/#link-".$rr['id'];
$title = substr(strip_tags(bbcode($rr['desc'])),0,32) . '... ';
if(! $title)
@@ -1261,15 +1277,24 @@ if(! function_exists('get_events')) {
$strt = datetime_convert('UTC',$rr['convert'] ? $a->timezone : 'UTC',$rr['start']);
$today = ((substr($strt,0,10) === datetime_convert('UTC',$a->timezone,'now','Y-m-d')) ? true : false);
-
- $o .= '
' . $title . ''
- . day_translate(datetime_convert('UTC', $rr['adjust'] ? $a->timezone : 'UTC', $rr['start'], $bd_format)) . (($today) ? ' ' . t('[today]') : '')
- . '
' ;
+
+ $rr['link'] = $md;
+ $rr['title'] = $title;
+ $rr['date'] = day_translate(datetime_convert('UTC', $rr['adjust'] ? $a->timezone : 'UTC', $rr['start'], $bd_format)) . (($today) ? ' ' . t('[today]') : '');
+ $rr['startime'] = $strt;
+ $rr['today'] = $today;
}
- $o .= '
';
}
- return $o;
+ $tpl = get_markup_template("events_reminder.tpl");
+ return replace_macros($tpl, array(
+ '$baseurl' => $a->get_baseurl(),
+ '$classtoday' => $classtoday,
+ '$count' => count($r),
+ '$event_reminders' => t('Event Reminders'),
+ '$event_title' => t('Events this week:'),
+ '$events' => $r,
+ ));
}
}
@@ -1453,16 +1478,19 @@ if(! function_exists('profile_tabs')){
'label'=>t('Status'),
'url' => $url,
'sel' => ((!isset($tab)&&$a->argv[0]=='profile')?'active':''),
+ 'title' => t('Status Messages and Posts'),
),
array(
'label' => t('Profile'),
'url' => $url.'/?tab=profile',
'sel' => ((isset($tab) && $tab=='profile')?'active':''),
+ 'title' => t('Profile Details'),
),
array(
'label' => t('Photos'),
'url' => $a->get_baseurl() . '/photos/' . $nickname,
'sel' => ((!isset($tab)&&$a->argv[0]=='photos')?'active':''),
+ 'title' => t('Photo Albums'),
),
);
@@ -1471,11 +1499,13 @@ if(! function_exists('profile_tabs')){
'label' => t('Events'),
'url' => $a->get_baseurl() . '/events',
'sel' =>((!isset($tab)&&$a->argv[0]=='events')?'active':''),
+ 'title' => t('Events and Calendar'),
);
$tabs[] = array(
'label' => t('Personal Notes'),
'url' => $a->get_baseurl() . '/notes',
'sel' =>((!isset($tab)&&$a->argv[0]=='notes')?'active':''),
+ 'title' => t('Only You Can See This'),
);
}
@@ -1495,6 +1525,15 @@ function get_my_url() {
return false;
}
+function zrl_init(&$a) {
+ $tmp_str = get_my_url();
+ if(validate_url($tmp_str)) {
+ proc_run('php','include/gprobe.php',bin2hex($tmp_str));
+ $arr = array('zrl' => $tmp_str, 'url' => $a->cmd);
+ call_hooks('zrl_init',$arr);
+ }
+}
+
function zrl($s,$force = false) {
if(! strlen($s))
return $s;
diff --git a/database.sql b/database.sql
index eadb53cc64..cf086796a6 100644
--- a/database.sql
+++ b/database.sql
@@ -16,9 +16,11 @@ CREATE TABLE IF NOT EXISTS `addon` (
`name` char(255) NOT NULL,
`version` char(255) NOT NULL,
`installed` tinyint(1) NOT NULL DEFAULT '0',
+ `hidden` tinyint(1) NOT NULL DEFAULT '0',
`timestamp` bigint(20) NOT NULL DEFAULT '0',
`plugin_admin` tinyint(1) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ KEY `hidden` (`hidden`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -172,6 +174,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
`writable` tinyint(1) NOT NULL DEFAULT '0',
`forum` tinyint(1) NOT NULL DEFAULT '0',
`hidden` tinyint(1) NOT NULL DEFAULT '0',
+ `archive` tinyint(1) NOT NULL DEFAULT '0',
`pending` tinyint(1) NOT NULL DEFAULT '1',
`rating` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0-5 reputation, 0 unknown, 1 call police, 5 inscrutable',
`reason` text NOT NULL COMMENT 'why a rating was given - will help friends decide to make friends or not',
@@ -197,6 +200,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
KEY `nurl` (`nurl`),
KEY `pending` (`pending`),
KEY `hidden` (`hidden`),
+ KEY `archive` (`archive`),
KEY `forum` (`forum`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
@@ -380,11 +384,13 @@ CREATE TABLE IF NOT EXISTS `glink` (
`cid` int(11) NOT NULL,
`uid` int(11) NOT NULL,
`gcid` int(11) NOT NULL,
+ `zcid` int(11) NOT NULL,
`updated` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `cid` (`cid`),
KEY `uid` (`uid`),
KEY `gcid` (`gcid`),
+ KEY `zcid` (`zcid`),
KEY `updated` (`updated`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
@@ -1017,9 +1023,11 @@ CREATE TABLE IF NOT EXISTS `user` (
`pwdreset` char(255) NOT NULL,
`maxreq` int(11) NOT NULL DEFAULT '10',
`expire` int(10) unsigned NOT NULL DEFAULT '0',
+ `account_removed` tinyint(1) NOT NULL DEFAULT '0',
`account_expired` tinyint(1) NOT NULL DEFAULT '0',
`account_expires_on` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`expire_notification_sent` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `service_class` char(32) NOT NULL,
`allow_cid` mediumtext NOT NULL,
`allow_gid` mediumtext NOT NULL,
`deny_cid` mediumtext NOT NULL,
@@ -1034,7 +1042,9 @@ CREATE TABLE IF NOT EXISTS `user` (
KEY `blocked` (`blocked`),
KEY `verified` (`verified`),
KEY `unkmail` (`unkmail`),
- KEY `cntunkmail` (`cntunkmail`)
+ KEY `cntunkmail` (`cntunkmail`),
+ KEY `account_removed` (`account_removed`),
+ KEY `service_class` (`service_class`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
diff --git a/htconfig.php b/htconfig.php
index 63a40c8090..872572654a 100644
--- a/htconfig.php
+++ b/htconfig.php
@@ -69,7 +69,7 @@ $a->config['system']['rino_encrypt'] = true;
// allowed themes (change this from admin panel after installation)
-$a->config['system']['allowed_themes'] = 'dispy,quattro,testbubble,vier,darkbubble,darkzero,duepuntozero,greenzero,purplezero,quattro-green,slackr,diabook,diabook-blue';
+$a->config['system']['allowed_themes'] = 'dispy,quattro,vier,darkzero,duepuntozero,greenzero,purplezero,slackr,diabook';
// default system theme
diff --git a/images/smiley-thumbsup.gif b/images/smiley-thumbsup.gif
index a9533a64d2..1bc6b124ea 100644
Binary files a/images/smiley-thumbsup.gif and b/images/smiley-thumbsup.gif differ
diff --git a/include/Contact.php b/include/Contact.php
index 9ba1e8ae5c..2523fc0231 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -51,6 +51,21 @@ function user_remove($uid) {
function contact_remove($id) {
+
+ $r = q("select uid from contact where id = %d limit 1",
+ intval($id)
+ );
+ if((! count($r)) || (! intval($r[0]['uid'])))
+ return;
+
+ $archive = get_pconfig($r[0]['uid'], 'system','archive_removed_contacts');
+ if($archive) {
+ q("update contact set `archive` = 1, `network` = 'none', `writable` = 0 where id = %d limit 1",
+ intval($id)
+ );
+ return;
+ }
+
q("DELETE FROM `contact` WHERE `id` = %d LIMIT 1",
intval($id)
);
@@ -73,6 +88,49 @@ function contact_remove($id) {
}
+// sends an unfriend message. Does not remove the contact
+
+function terminate_friendship($user,$self,$contact) {
+
+
+ $a = get_app();
+
+ require_once('include/datetime.php');
+
+ if($contact['network'] === NETWORK_OSTATUS) {
+
+ $slap = replace_macros(get_markup_template('follow_slap.tpl'), array(
+ '$name' => $user['username'],
+ '$profile_page' => $a->get_baseurl() . '/profile/' . $user['nickname'],
+ '$photo' => $self['photo'],
+ '$thumb' => $self['thumb'],
+ '$published' => datetime_convert('UTC','UTC', 'now', ATOM_TIME),
+ '$item_id' => 'urn:X-dfrn:' . $a->get_hostname() . ':unfollow:' . random_string(),
+ '$title' => '',
+ '$type' => 'text',
+ '$content' => t('stopped following'),
+ '$nick' => $user['nickname'],
+ '$verb' => 'http://ostatus.org/schema/1.0/unfollow', // ACTIVITY_UNFOLLOW,
+ '$ostat_follow' => '' // 'http://ostatus.org/schema/1.0/unfollow' . "\r\n"
+ ));
+
+ if((x($contact,'notify')) && (strlen($contact['notify']))) {
+ require_once('include/salmon.php');
+ slapper($user,$contact['notify'],$slap);
+ }
+ }
+ elseif($contact['network'] === NETWORK_DIASPORA) {
+ require_once('include/diaspora.php');
+ diaspora_unshare($user,$contact);
+ }
+ elseif($contact['network'] === NETWORK_DFRN) {
+ require_once('include/items.php');
+ dfrn_deliver($user,$contact,'placeholder', 1);
+ }
+
+}
+
+
// Contact has refused to recognise us as a friend. We will start a countdown.
// If they still don't recognise us in 32 days, the relationship is over,
// and we won't waste any more time trying to communicate with them.
diff --git a/include/Scrape.php b/include/Scrape.php
index b20d7d6046..2272526009 100644
--- a/include/Scrape.php
+++ b/include/Scrape.php
@@ -282,7 +282,7 @@ function scrape_feed($url) {
}
}
if(! $basename)
- $basename = substr($url,0,strrpos($url,'/')) . '/';
+ $basename = implode('/', array_slice(explode('/',$url),0,3)) . '/';
$items = $dom->getElementsByTagName('link');
diff --git a/include/acl_selectors.php b/include/acl_selectors.php
index a5f5aff532..461ad0c364 100644
--- a/include/acl_selectors.php
+++ b/include/acl_selectors.php
@@ -122,7 +122,7 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
$o .= "