diff --git a/boot.php b/boot.php
index f592b4c27..5ef24f494 100644
--- a/boot.php
+++ b/boot.php
@@ -14,7 +14,7 @@ require_once('include/features.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '3.2.1753' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
-define ( 'DB_UPDATE_VERSION', 1172 );
+define ( 'DB_UPDATE_VERSION', 1173 );
define ( 'EOL', "
\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
@@ -1016,8 +1016,35 @@ if(! function_exists('update_db')) {
if(DB_UPDATE_VERSION == UPDATE_VERSION) {
// Compare the current structure with the defined structure
+
+ $t = get_config('database','dbupdate_'.DB_UPDATE_VERSION);
+ if($t !== false)
+ break;
+ set_config('database','dbupdate_'.DB_UPDATE_VERSION, time());
+
require_once("include/dbstructure.php");
- update_structure(false, true);
+ $retval = update_structure(false, true);
+ 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' => DB_UPDATE_VERSION,
+ '$error' => sprintf(t('Update %s failed. See error logs.'), DB_UPDATE_VERSION)
+ ));
+ $subject=sprintf(t('Update Error at %s'), $a->get_baseurl());
+ require_once('include/email.php');
+ $subject = email_header_encode($subject,'UTF-8');
+ mail($a->config['admin_email'], $subject, $email_msg,
+ 'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME']."\n"
+ .'Content-type: text/plain; charset=UTF-8'."\n"
+ .'Content-transfer-encoding: 8bit');
+ //try the logger
+ logger("CRITICAL: Database structure update failed: ".$retval);
+ break;
+ } else
+ set_config('database','dbupdate_'.DB_UPDATE_VERSION, 'success');
for($x = $stored; $x < $current; $x ++) {
if(function_exists('update_' . $x)) {
@@ -1058,11 +1085,13 @@ if(! function_exists('update_db')) {
//try the logger
logger('CRITICAL: Update Failed: '. $x);
break;
- }
- else {
+ } else {
set_config('database','update_' . $x, 'success');
set_config('system','build', $x + 1);
}
+ } else {
+ set_config('database','update_' . $x, 'success');
+ set_config('system','build', $x + 1);
}
}
}
diff --git a/include/dbstructure.php b/include/dbstructure.php
index 5560c84b6..77482d41b 100644
--- a/include/dbstructure.php
+++ b/include/dbstructure.php
@@ -95,6 +95,8 @@ function update_structure($verbose, $action) {
$errors = false;
+ logger('updating structure', LOGGER_DEBUG);
+
// Get the current structure
$database = array();
@@ -130,7 +132,7 @@ function update_structure($verbose, $action) {
// Compare the field structure field by field
foreach ($structure["fields"] AS $fieldname => $parameters) {
if (!isset($database[$name]["fields"][$fieldname])) {
- $sql2=db_add_table_field($name, $fieldname, $parameters);
+ $sql2=db_add_table_field($fieldname, $parameters);
if ($sql3 == "")
$sql3 = "ALTER TABLE `".$name."` ".$sql2;
else
@@ -173,7 +175,7 @@ function update_structure($verbose, $action) {
if ($action) {
$r = @$db->q($sql3);
if(false === $r)
- $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
+ $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
}
}
}
@@ -1160,6 +1162,7 @@ function db_definition() {
"visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
+ "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
"deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
diff --git a/include/enotify.php b/include/enotify.php
index e72abd331..970ece82e 100644
--- a/include/enotify.php
+++ b/include/enotify.php
@@ -63,6 +63,15 @@ function notification($params) {
$parent_id = $params['parent'];
+ $p = q("SELECT `ignored` FROM `thread` WHERE `iid` = %d AND `uid` = %d LIMIT 1",
+ intval($parent_id),
+ intval($params['uid'])
+ );
+ if ($p AND count($p) AND ($p[0]["ignored"])) {
+ logger("Thread ".$parent_id." will be ignored", LOGGER_DEBUG);
+ return;
+ }
+
// Check to see if there was already a tag notify or comment notify for this post.
// If so don't create a second notification
@@ -117,11 +126,11 @@ function notification($params) {
// Some mail softwares relies on subject field for threading.
// So, we cannot have different subjects for notifications of the same thread.
- // Before this we have the name of the replier on the subject rendering
+ // Before this we have the name of the replier on the subject rendering
// differents subjects for messages on the same thread.
$subject = sprintf( t('[Friendica:Notify] Comment to conversation #%1$d by %2$s'), $parent_id, $params['source_name']);
- $preamble = sprintf( t('%s commented on an item/conversation you have been following.'), $params['source_name']);
+ $preamble = sprintf( t('%s commented on an item/conversation you have been following.'), $params['source_name']);
$epreamble = $dest_str;
$sitelink = t('Please visit %s to view and/or reply to the conversation.');
@@ -175,9 +184,9 @@ function notification($params) {
$subject = sprintf( t('[Friendica:Notify] %1$s poked you') , $params['source_name']);
$preamble = sprintf( t('%1$s poked you at %2$s') , $params['source_name'], $sitename);
- $epreamble = sprintf( t('%1$s [url=%2$s]poked you[/url].') ,
+ $epreamble = sprintf( t('%1$s [url=%2$s]poked you[/url].') ,
'[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]',
- $params['link']);
+ $params['link']);
$subject = str_replace('poked', t($params['activity']), $subject);
$preamble = str_replace('poked', t($params['activity']), $preamble);
@@ -194,7 +203,7 @@ function notification($params) {
$preamble = sprintf( t('%1$s tagged your post at %2$s') , $params['source_name'], $sitename);
$epreamble = sprintf( t('%1$s tagged [url=%2$s]your post[/url]') ,
'[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]',
- $itemlink);
+ $itemlink);
$sitelink = t('Please visit %s to view and/or reply to the conversation.');
$tsitelink = sprintf( $sitelink, $siteurl );
@@ -204,10 +213,10 @@ function notification($params) {
if($params['type'] == NOTIFY_INTRO) {
$subject = sprintf( t('[Friendica:Notify] Introduction received'));
- $preamble = sprintf( t('You\'ve received an introduction from \'%1$s\' at %2$s'), $params['source_name'], $sitename);
+ $preamble = sprintf( t('You\'ve received an introduction from \'%1$s\' at %2$s'), $params['source_name'], $sitename);
$epreamble = sprintf( t('You\'ve received [url=%1$s]an introduction[/url] from %2$s.'),
$itemlink,
- '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]');
+ '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]');
$body = sprintf( t('You may visit their profile at %s'),$params['source_link']);
$sitelink = t('Please visit %s to approve or reject the introduction.');
@@ -218,11 +227,11 @@ function notification($params) {
if($params['type'] == NOTIFY_SUGGEST) {
$subject = sprintf( t('[Friendica:Notify] Friend suggestion received'));
- $preamble = sprintf( t('You\'ve received a friend suggestion from \'%1$s\' at %2$s'), $params['source_name'], $sitename);
+ $preamble = sprintf( t('You\'ve received a friend suggestion from \'%1$s\' at %2$s'), $params['source_name'], $sitename);
$epreamble = sprintf( t('You\'ve received [url=%1$s]a friend suggestion[/url] for %2$s from %3$s.'),
$itemlink,
'[url=' . $params['item']['url'] . ']' . $params['item']['name'] . '[/url]',
- '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]');
+ '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]');
$body = t('Name:') . ' ' . $params['item']['name'] . "\n";
$body .= t('Photo:') . ' ' . $params['item']['photo'] . "\n";
@@ -242,11 +251,11 @@ function notification($params) {
}
$h = array(
- 'params' => $params,
+ 'params' => $params,
'subject' => $subject,
- 'preamble' => $preamble,
- 'epreamble' => $epreamble,
- 'body' => $body,
+ 'preamble' => $preamble,
+ 'epreamble' => $epreamble,
+ 'body' => $body,
'sitelink' => $sitelink,
'tsitelink' => $tsitelink,
'hsitelink' => $hsitelink,
@@ -290,7 +299,7 @@ function notification($params) {
$datarray['verb'] = $params['verb'];
$datarray['otype'] = $params['otype'];
$datarray['abort'] = false;
-
+
call_hooks('enotify_store', $datarray);
if($datarray['abort']) {
@@ -391,11 +400,11 @@ function notification($params) {
values(%d,%d,%d,%d)",
intval($notify_id),
intval($params['parent']),
- intval($params['uid']),
+ intval($params['uid']),
0 );
$additional_mail_header .= "Message-ID: <${id_for_parent}>\n";
- $log_msg = "include/enotify: No previous notification found for this parent:\n" .
+ $log_msg = "include/enotify: No previous notification found for this parent:\n" .
" parent: ${params['parent']}\n" . " uid : ${params['uid']}\n";
logger($log_msg, LOGGER_DEBUG);
} else {
@@ -461,7 +470,7 @@ function notification($params) {
'$htmlversion' => $datarray['htmlversion'],
'$content_allowed' => $content_allowed,
));
-
+
// load the template for private message notifications
$tpl = get_markup_template('email_notify_text.tpl');
$email_text_body = replace_macros($tpl,array(
@@ -479,7 +488,7 @@ function notification($params) {
'$thanks' => $datarray['thanks'],
'$site_admin' => $datarray['site_admin'],
'$title' => $datarray['title'],
- '$textversion' => $datarray['textversion'],
+ '$textversion' => $datarray['textversion'],
'$content_allowed' => $content_allowed,
));
@@ -520,9 +529,9 @@ class enotify {
*/
static public function send($params) {
- $fromName = email_header_encode(html_entity_decode($params['fromName'],ENT_QUOTES,'UTF-8'),'UTF-8');
+ $fromName = email_header_encode(html_entity_decode($params['fromName'],ENT_QUOTES,'UTF-8'),'UTF-8');
$messageSubject = email_header_encode(html_entity_decode($params['messageSubject'],ENT_QUOTES,'UTF-8'),'UTF-8');
-
+
// generate a mime boundary
$mimeBoundary =rand(0,9)."-"
.rand(10000000000,9999999999)."-"
@@ -532,7 +541,7 @@ class enotify {
// generate a multipart/alternative message header
$messageHeader =
$params['additionalMailHeader'] .
- "From: $fromName <{$params['fromEmail']}>\n" .
+ "From: $fromName <{$params['fromEmail']}>\n" .
"Reply-To: $fromName <{$params['replyTo']}>\n" .
"MIME-Version: 1.0\n" .
"Content-Type: multipart/alternative; boundary=\"{$mimeBoundary}\"";
diff --git a/include/features.php b/include/features.php
index 24955ba10..091dfc6e9 100644
--- a/include/features.php
+++ b/include/features.php
@@ -60,6 +60,7 @@ function get_features() {
array('filing', t('Saved Folders'), t('Ability to file posts under folders')),
array('dislike', t('Dislike Posts'), t('Ability to dislike posts/comments')),
array('star_posts', t('Star Posts'), t('Ability to mark special posts with a star indicator')),
+ array('ignore_posts', t('Mute Post Notifications'), t('Ability to mute notifications for a thread')),
),
);
diff --git a/js/main.js b/js/main.js
index a7ffca8d8..14dbaf127 100644
--- a/js/main.js
+++ b/js/main.js
@@ -441,13 +441,33 @@
$('#star-' + ident).addClass('hidden');
$('#unstar-' + ident).removeClass('hidden');
}
- else {
+ else {
$('#starred-' + ident).addClass('unstarred');
$('#starred-' + ident).removeClass('starred');
$('#star-' + ident).removeClass('hidden');
$('#unstar-' + ident).addClass('hidden');
}
- $('#like-rotator-' + ident).hide();
+ $('#like-rotator-' + ident).hide();
+ });
+ }
+
+ function doignore(ident) {
+ ident = ident.toString();
+ $('#like-rotator-' + ident).show();
+ $.get('ignored/' + ident, function(data) {
+ if(data.match(/1/)) {
+ $('#ignored-' + ident).addClass('ignored');
+ $('#ignored-' + ident).removeClass('unignored');
+ $('#ignore-' + ident).addClass('hidden');
+ $('#unignore-' + ident).removeClass('hidden');
+ }
+ else {
+ $('#ignored-' + ident).addClass('unignored');
+ $('#ignored-' + ident).removeClass('ignored');
+ $('#ignore-' + ident).removeClass('hidden');
+ $('#unignore-' + ident).addClass('hidden');
+ }
+ $('#like-rotator-' + ident).hide();
});
}
diff --git a/mod/admin.php b/mod/admin.php
index fa4f6d7fb..24069c5d9 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -649,7 +649,7 @@ function admin_page_site(&$a) {
'$proxy_disabled' => array('proxy_disabled', t("Disable picture proxy"), get_config('system','proxy_disabled'), t("The picture proxy increases performance and privacy. It shouldn't be used on systems with very low bandwith.")),
'$relocate_url' => array('relocate_url', t("New base url"), $a->get_baseurl(), "Change base url for this server. Sends relocate message to all DFRN contacts of all users."),
-
+
'$enable_noscrape'=> array('enable_noscrape', t("Enable noscrape"), get_config('system','enable_noscrape'), t("The noscrape feature speeds up directory submissions by using JSON data instead of HTML scraping.")),
'$form_security_token' => get_form_security_token("admin_site")
@@ -671,23 +671,37 @@ function admin_page_dbsync(&$a) {
goaway($a->get_baseurl(true) . '/admin/dbsync');
}
- if($a->argc > 2 && intval($a->argv[2])) {
+ if(($a->argc > 2) AND (intval($a->argv[2]) OR ($a->argv[2] === 'check'))) {
+ require_once("include/dbstructure.php");
+ $retval = update_structure(false, true);
+ if (!$retval) {
+ $o .= sprintf(t("Database structure update %s was successfully applied."), DB_UPDATE_VERSION)."
";
+ set_config('database', 'dbupdate_'.DB_UPDATE_VERSION, 'success');
+ } else
+ $o .= sprintf(t("Executing of database structure update %s failed with error: %s"),
+ DB_UPDATE_VERSION, $retval)."
";
+ if ($a->argv[2] === 'check')
+ return $o;
+ }
+
+ if ($a->argc > 2 && intval($a->argv[2])) {
require_once('update.php');
$func = 'update_' . intval($a->argv[2]);
if(function_exists($func)) {
$retval = $func();
if($retval === UPDATE_FAILED) {
- $o .= sprintf( t('Executing %s failed. Check system logs.'), $func);
+ $o .= sprintf(t("Executing %s failed with error: %s"), $func, $retval);
}
elseif($retval === UPDATE_SUCCESS) {
- $o .= sprintf( t('Update %s was successfully applied.', $func));
+ $o .= sprintf(t('Update %s was successfully applied.', $func));
set_config('database',$func, 'success');
}
else
- $o .= sprintf( t('Update %s did not return a status. Unknown if it succeeded.'), $func);
+ $o .= sprintf(t('Update %s did not return a status. Unknown if it succeeded.'), $func);
+ } else {
+ $o .= sprintf(t('There was no additional update function %s that needed to be called.'), $func)."
";
+ set_config('database',$func, 'success');
}
- else
- $o .= sprintf( t('Update function %s could not be found.'), $func);
return $o;
}
@@ -701,17 +715,22 @@ function admin_page_dbsync(&$a) {
$failed[] = $upd;
}
}
- if(! count($failed))
- return '