Merge remote-tracking branch 'upstream/develop' into 1704-conversation

This commit is contained in:
Michael 2017-04-23 14:25:35 +00:00
commit 05dcedb54c
13 changed files with 180 additions and 147 deletions

View file

@ -590,7 +590,7 @@ function update_contact_birthdays() {
// This only handles foreign or alien networks where a birthday has been provided.
// In-network birthdays are handled within local_delivery
$r = q("SELECT * FROM contact WHERE `bd` != '' AND `bd` > '0001-01-01' AND SUBSTRING(`bd`,1,4) != `bdyear` ");
$r = q("SELECT * FROM `contact` WHERE `bd` != '' AND `bd` > '0001-01-01' AND SUBSTRING(`bd`, 1, 4) != `bdyear` ");
if (dbm::is_result($r)) {
foreach ($r as $rr) {
@ -598,14 +598,12 @@ function update_contact_birthdays() {
$nextbd = datetime_convert('UTC','UTC','now','Y') . substr($rr['bd'], 4);
/**
*
/*
* Add new birthday event for this person
*
* $bdtext is just a readable placeholder in case the event is shared
* with others. We will replace it during presentation to our $importer
* to contain a sparkle link and perhaps a photo.
*
*/
// Check for duplicates
@ -638,7 +636,6 @@ function update_contact_birthdays() {
// update bdyear
q("UPDATE `contact` SET `bdyear` = '%s', `bd` = '%s' WHERE `uid` = %d AND `id` = %d",
dbesc(substr($nextbd,0,4)),
dbesc($nextbd),

View file

@ -7,6 +7,31 @@ require_once("include/text.php");
define('NEW_UPDATE_ROUTINE_VERSION', 1170);
/*
* Converts all tables from MyISAM to InnoDB
*/
function convert_to_innodb() {
global $db;
$r = q("SELECT `TABLE_NAME` FROM `information_schema`.`tables` WHERE `engine` = 'MyISAM' AND `table_schema` = '%s'",
dbesc($db->database_name()));
if (!dbm::is_result($r)) {
echo t('There are no tables on MyISAM.')."\n";
return;
}
foreach ($r AS $table) {
$sql = sprintf("ALTER TABLE `%s` engine=InnoDB;", dbesc($table['TABLE_NAME']));
echo $sql."\n";
$result = @$db->q($sql);
if (!dbm::is_result($result)) {
print_update_error($db, $sql);
}
}
}
/*
* send the email and do what is needed to do on update fails
*
@ -95,10 +120,6 @@ function table_structure($table) {
if (dbm::is_result($indexes))
foreach ($indexes AS $index) {
if ($index["Index_type"] == "FULLTEXT") {
continue;
}
if ($index['Key_name'] != 'PRIMARY' && $index['Non_unique'] == '0' && !isset($indexdata[$index["Key_name"]])) {
$indexdata[$index["Key_name"]] = array('UNIQUE');
}
@ -1743,6 +1764,9 @@ function dbstructure_run(&$argv, &$argc) {
case "dumpsql":
print_structure(db_definition());
return;
case "toinnodb":
convert_to_innodb();
return;
}
}
@ -1754,6 +1778,7 @@ function dbstructure_run(&$argv, &$argc) {
echo "dryrun show database update schema queries without running them\n";
echo "update update database schema\n";
echo "dumpsql dump database schema\n";
echo "toinnodb convert all tables from MyISAM to InnoDB\n";
return;
}

View file

@ -82,6 +82,7 @@ function format_event_html($ev, $simple = false) {
}
/*
@TODO old-lost code found?
function parse_event($h) {
require_once('include/Scrape.php');

View file

@ -271,6 +271,7 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) {
if ($creator != "") {
$item["author-name"] = $creator;
}
/// @TODO ?
// <category>Ausland</category>
// <media:thumbnail width="152" height="76" url="http://www.taz.de/picture/667875/192/14388767.jpg"/>
@ -293,8 +294,9 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) {
$type = $attributes->textContent;
}
}
if(strlen($item["attach"]))
if (strlen($item["attach"])) {
$item["attach"] .= ',';
}
$attachments[] = array("link" => $href, "type" => $type, "length" => $length);

View file

@ -33,11 +33,13 @@ function gprobe_run(&$argv, &$argc){
$arr = probe_url($url);
if (is_null($result))
if (is_null($result)) {
Cache::set("gprobe:".$urlparts["host"], $arr);
}
if (!in_array($arr["network"], array(NETWORK_FEED, NETWORK_PHANTOM)))
if (!in_array($arr["network"], array(NETWORK_FEED, NETWORK_PHANTOM))) {
update_gcontact($arr);
}
$r = q("SELECT `id`, `url`, `network` FROM `gcontact` WHERE `nurl` = '%s' ORDER BY `id` LIMIT 1",
dbesc(normalise_link($url))

View file

@ -347,9 +347,10 @@ function groups_containing($uid,$c) {
$ret = array();
if (dbm::is_result($r)) {
foreach($r as $rr)
foreach ($r as $rr) {
$ret[] = $rr['gid'];
}
}
return $ret;
}

View file

@ -205,15 +205,17 @@ function profile_sidebar($profile, $block = 0) {
// This function can also use contact information in $profile
$is_contact = x($profile, 'cid');
if((! is_array($profile)) && (! count($profile)))
if ((! is_array($profile)) && (! count($profile))) {
return $o;
}
$profile['picdate'] = urlencode($profile['picdate']);
if (($profile['network'] != "") AND ($profile['network'] != NETWORK_DFRN)) {
$profile['network_name'] = format_network_name($profile['network'], $profile['url']);
} else
} else {
$profile['network_name'] = "";
}
call_hooks('profile_sidebar_enter', $profile);
@ -630,9 +632,7 @@ function advanced_profile(App $a) {
if ($a->profile['gender']) $profile['gender'] = array( t('Gender:'), $a->profile['gender'] );
if (($a->profile['dob']) && ($a->profile['dob'] > '0001-01-01')) {
$year_bd_format = t('j F, Y');
$short_bd_format = t('j F');
@ -881,16 +881,20 @@ function zrl_init(App $a) {
}
function zrl($s,$force = false) {
if(! strlen($s))
if (! strlen($s)) {
return $s;
if((! strpos($s,'/profile/')) && (! $force))
}
if ((! strpos($s,'/profile/')) && (! $force)) {
return $s;
if($force && substr($s,-1,1) !== '/')
}
if ($force && substr($s,-1,1) !== '/') {
$s = $s . '/';
}
$achar = strpos($s,'?') ? '&' : '?';
$mine = get_my_url();
if($mine and ! link_compare($mine,$s))
if ($mine and ! link_compare($mine,$s)) {
return $s . $achar . 'zrl=' . urlencode($mine);
}
return $s;
}
@ -911,9 +915,10 @@ function zrl($s,$force = false) {
function get_theme_uid() {
$uid = (($_REQUEST['puid']) ? intval($_REQUEST['puid']) : 0);
if (local_user()) {
if((get_pconfig(local_user(),'system','always_my_theme')) || (! $uid))
if ((get_pconfig(local_user(),'system','always_my_theme')) || (! $uid)) {
return local_user();
}
}
return $uid;
}

View file

@ -447,7 +447,7 @@ function admin_page_summary(App $a) {
$warningtext = array();
if (dbm::is_result($r)) {
$showwarning = true;
$warningtext[] = sprintf(t('Your DB still runs with MyISAM tables. You should change the engine type to InnoDB. As Friendica will use InnoDB only features in the future, you should change this! See <a href="%s">here</a> for a guide that may be helpful converting the table engines. You may also use the <tt>convert_innodb.sql</tt> in the <tt>/util</tt> directory of your Friendica installation.<br />'), 'https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html');
$warningtext[] = sprintf(t('Your DB still runs with MyISAM tables. You should change the engine type to InnoDB. As Friendica will use InnoDB only features in the future, you should change this! See <a href="%s">here</a> for a guide that may be helpful converting the table engines. You may also use the command <tt>php include/dbstructure.php toinnodb</tt> of your Friendica installation for an automatic conversion.<br />'), 'https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html');
}
// MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
if ((version_compare($db->server_info(), '5.7.4') >= 0) AND

View file

@ -73,10 +73,10 @@ function openid_content(App $a) {
$first = notags(trim($v));
}
if($k === 'namePerson') {
$args .= '&username=' . notags(trim($v));
$args .= '&username=' . urlencode(notags(trim($v)));
}
if ($k === 'contact/email') {
$args .= '&email=' . notags(trim($v));
$args .= '&email=' . urlencode(notags(trim($v)));
}
if ($k === 'media/image/aspect11') {
$photosq = bin2hex(trim($v));
@ -87,22 +87,22 @@ function openid_content(App $a) {
}
}
if ($nick) {
$args .= '&nickname=' . $nick;
$args .= '&nickname=' . urlencode($nick);
}
elseif ($first) {
$args .= '&nickname=' . $first;
$args .= '&nickname=' . urlencode($first);
}
if ($photosq) {
$args .= '&photo=' . $photosq;
$args .= '&photo=' . urlencode($photosq);
}
elseif ($photo) {
$args .= '&photo=' . $photo;
$args .= '&photo=' . urlencode($photo);
}
$args .= '&openid_url=' . notags(trim($authid));
$args .= '&openid_url=' . urlencode(notags(trim($authid)));
goaway(App::get_baseurl() . '/register' . $args);
goaway(App::get_baseurl() . '/register?' . $args);
// NOTREACHED
}