]> git.mxchange.org Git - friendica.git/commitdiff
Merge branch 'release-3.3.2'
authorFabio Comuni <fabrix.xm@gmail.com>
Wed, 24 Dec 2014 09:17:50 +0000 (10:17 +0100)
committerFabio Comuni <fabrix.xm@gmail.com>
Wed, 24 Dec 2014 09:17:50 +0000 (10:17 +0100)
31 files changed:
CHANGELOG
boot.php
doc/Making-Friends.md
doc/andfinally.md
doc/de/Making-Friends.md
doc/de/Quick-Start-andfinally.md
doc/de/andfinally.md
include/api.php
include/bb2diaspora.php
include/bbcode.php
include/dbstructure.php
include/gprobe.php
include/items.php
include/network.php
js/acl.js
js/main.js
library/HTML5/Parser.php
mod/admin.php
mod/dfrn_notify.php
mod/dfrn_poll.php
mod/network.php
mod/parse_url.php
update.php
view/templates/admin_site.tpl
view/templates/contact_head.tpl
view/templates/event_head.tpl
view/templates/jot-header.tpl
view/templates/msg-header.tpl
view/templates/profed_head.tpl
view/templates/wallmsg-header.tpl
view/theme/vier/breathe.css

index 165695f8f6bcc719c5e30282937c9c95d4d6090e..bece6b3745cc7c068276bc146236e147021d7e5b 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,15 @@
+Version 3.3.2
+
+       Set default value for all not-null fields (fixes SQL warinigs) (annando)
+       Fix item filters in network page (issue #1222) (fabrixxm)
+       Remove reference to an ex Friendica hub from documentation (beardyunixer, tobiasd)
+    API throttling (annando)
+    Use a san-serif font in breathe style of vier theme (silke)
+    Prevent BBCode parsing problems with URLs (annando)
+    Add back tags to posts to Diaspora (annando)
+    Better display of pictures in posts (annando)
+    Fix out of control gprobe process (annando)
+
 Version 3.3.1
 
        JSONP support for API (fabrixxm)
index eb0eb3e6626c8025f0d54c91349c2666e9cfaa39..44d72bb3cb297872f5f75234c20a8624664beb0f 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -18,7 +18,7 @@ define ( 'FRIENDICA_PLATFORM',     'Friendica');
 define ( 'FRIENDICA_CODENAME', 'Ginger');
 define ( 'FRIENDICA_VERSION',      '3.3.1' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.23'    );
-define ( 'DB_UPDATE_VERSION',      1174      );
+define ( 'DB_UPDATE_VERSION',      1175      );
 define ( 'EOL',                    "<br />\r\n"     );
 define ( 'ATOM_TIME',              'Y-m-d\TH:i:s\Z' );
 
@@ -522,28 +522,28 @@ if(! class_exists('App')) {
                                if (substr($this->query_string, 0, 1) == "/")
                                        $this->query_string = substr($this->query_string, 1);
                        }
-                        
+
                        if (x($_GET,'pagename'))
                                $this->cmd = trim($_GET['pagename'],'/\\');
                        elseif (x($_GET,'q'))
                                $this->cmd = trim($_GET['q'],'/\\');
-                            
-                        
+
+
                         // fix query_string
                         $this->query_string = str_replace($this->cmd."&",$this->cmd."?", $this->query_string);
-                        
-                        
+
+
                        // unix style "homedir"
-                        
+
                        if(substr($this->cmd,0,1) === '~')
                                $this->cmd = 'profile/' . substr($this->cmd,1);
-                        
+
                        // Diaspora style profile url
 
                        if(substr($this->cmd,0,2) === 'u/')
                                $this->cmd = 'profile/' . substr($this->cmd,2);
 
-                                
+
                        /**
                         *
                         * Break the URL path into C style argc/argv style arguments for our
@@ -639,6 +639,9 @@ if(! class_exists('App')) {
                                }
                        }
 
+                       if (get_config('config','hostname') != "")
+                               $this->hostname = get_config('config','hostname');
+
                        $this->baseurl = $scheme . "://" . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' );
                        return $this->baseurl;
                }
@@ -660,12 +663,19 @@ if(! class_exists('App')) {
                                if (file_exists(".htpreconfig.php"))
                                        @include(".htpreconfig.php");
 
-                               $this->hostname = $hostname;
+                               if (get_config('config','hostname') != "")
+                                       $this->hostname = get_config('config','hostname');
+
+                               if (!isset($this->hostname) OR ($this->hostname == ""))
+                                       $this->hostname = $hostname;
                        }
 
                }
 
                function get_hostname() {
+                       if (get_config('config','hostname') != "")
+                               $this->hostname = get_config('config','hostname');
+
                        return $this->hostname;
                }
 
index 70b87abbc0f3fc24e2104c37d3d04202bf58dcc5..e0b1a254e0c3b78bcd2ecb5e302419df101b3aef 100644 (file)
@@ -5,9 +5,7 @@ Making Friends
 
 Friendship in Friendica can take on a great many different meanings. But let's keep it simple, you want to be friends with somebody. How do you do it?
 
-The easiest thing to do is to join the <a href="http://kakste.com/profile/newhere">New Here</a> group.  This group is especially for people new to the Friendica network.  Simply connect to the group, post to the wall, and make new friends.  You don't even have to like us - comment on a few of our posts, and other people will start to add you too.
-
-The next thing you can do is look at the Directory.  The directory is split up into two parts.  If you click the directory button, you will be presented with a list of all members (who chose to be listed) on your server.  You'll also see a link to the Global Directory.  If you click through to the global directory, you will be presented with a list of everybody who chose to be listed across all instances of Friendica.  You will also see a "Show Community Forums" link, which will direct you to Groups, Forums and Fanpages.  You connect to people, groups and forums in the same way, except groups and forums will automatically accept your introduction request, whereas a human will approve you manually.
+The first thing you can do is look at the Directory.  The directory is split up into two parts.  If you click the directory button, you will be presented with a list of all members (who chose to be listed) on your server.  You'll also see a link to the Global Directory.  If you click through to the global directory, you will be presented with a list of everybody who chose to be listed across all instances of Friendica.  You will also see a "Show Community Forums" link, which will direct you to Groups, Forums and Fanpages.  You connect to people, groups and forums in the same way, except groups and forums will automatically accept your introduction request, whereas a human will approve you manually.
 
 To connect with other Friendica users:
 
index c4e8cb948058e3f48103ec4081feaa6de8c53efd..f7aeb1bd457c7ea2377f3596774371e3100666c0 100644 (file)
@@ -7,12 +7,8 @@ Here are some more things to help get you started:
 **Groups**
 
 
-- <a href="https://kakste.com/profile/newhere">New Here</a> - a group for people new to Friendica
-
 - <a href="http://helpers.pyxis.uberspace.de/profile/helpers">Friendica Support</a> - problems?  This is the place to ask.
 
-- <a href="https://kakste.com/profile/public_stream">Public Stream</a> - a place to talk about anything to anyone.
-
 - <a href="https://letstalk.pyxis.uberspace.de/profile/letstalk">Let's Talk</a> a group for finding people and groups who share similar interests.
 
 - <a href="http://newzot.hydra.uberspace.de/profile/newzot">Local Friendica</a> a page for local Friendica groups</a>
index e6725228ff6808464d0f049de7880a6699a80fca..74f1f62b371e63a509c82c444a4c8282f04ae45d 100644 (file)
@@ -5,9 +5,7 @@ Freunde finden
 
 Freundschaft kann in Friendica viele verschiedene Bedeutungen annehmen. Aber lasst es uns einfach halten, du willst einfach mit jemandem befreundet sein. Wie machst du das?
 
-Der einfachste Weg, um das zu machen, ist es, der Gruppe <a href="http://kakste.com/profile/newhere">Neu hier</a> beizutreten. Diese Gruppe ist speziell für Leute, die neu im Friendica-Netzwerk sind. Verbinde dich einfach mit der Gruppe, schreibe auf die "Wall" und lerne neue Leute kennen. Du musst uns nicht einmal direkt "liken" - kommentiere einige Beiträge und andere Leute werden anfangen, dich hinzuzufügen.
-
-Als Nächstes kannst du dir das Verzeichnis anschauen. Das Verzeichnis ist in zwei Teile aufgeteilt. Wenn du auf den "Verzeichnis"-Button klickst, wirst du zunächst alle Mitglieder deines Servers sehen, die sich dazu entschlossen haben, angezeigt zu werden. Außerdem siehst du dort einen Link zum globalen Verzeichnis. Wenn du dich durch das globale Verzeichnis klickst, siehst du alle Nutzer weltweit auf allen Servern, die sich entschlossen haben, im Verzeichnis zu erscheinen. Du wirst außerdem den Link "Show Community Forums" sehen, welcher dich zu Gruppen, Foren und Fan-Seiten führt. Du verbindest dich mit Personen, Gruppen und Foren auf die gleiche Art, wobei Gruppen und Foren deine Anfrage automatisch annehmen, wohingegen ein Mensch dich erst manuell bestätigen muss.
+Schau dir das Verzeichnis an. Das Verzeichnis ist in zwei Teile aufgeteilt. Wenn du auf den "Verzeichnis"-Button klickst, wirst du zunächst alle Mitglieder deines Servers sehen, die sich dazu entschlossen haben, angezeigt zu werden. Außerdem siehst du dort einen Link zum globalen Verzeichnis. Wenn du dich durch das globale Verzeichnis klickst, siehst du alle Nutzer weltweit auf allen Servern, die sich entschlossen haben, im Verzeichnis zu erscheinen. Du wirst außerdem den Link "Show Community Forums" sehen, welcher dich zu Gruppen, Foren und Fan-Seiten führt. Du verbindest dich mit Personen, Gruppen und Foren auf die gleiche Art, wobei Gruppen und Foren deine Anfrage automatisch annehmen, wohingegen ein Mensch dich erst manuell bestätigen muss.
 
 *Mit anderen Friendica-Nutzern verbinden*
 
index 06a1878ba9f2c12540c21f89148493191e5473d1..b6e492ae697bf01a9a0f52b70c4f1874c0af2ee6 100644 (file)
@@ -8,12 +8,8 @@ Hier sind noch einige weitere Dinge, die dir den Start vereinfachen können.
 **Gruppen**
 
 
-- <a href="https://kakste.com/profile/newhere">Neu hier?</a> - eine Gruppe für Leute, die neu bei Friendica sind
-
 - <a href="http://helpers.pyxis.uberspace.de/profile/helpers">Friendica Support</a> - Probleme?  Dann ist das der Platz, um zu fragen!
 
-- <a href="https://kakste.com/profile/public_stream">Öffentlicher Stream</a> - ein Platz, um über alles mit jedem zu reden.
-
 - <a href="https://letstalk.pyxis.uberspace.de/profile/letstalk">Let's Talk</a> eine Gruppe, um Leute und Gruppen mit gleichen Interessen zu finden 
 
 - <a href="http://newzot.hydra.uberspace.de/profile/newzot">Local Friendica</a> eine Seite für lokale Friendica-Gruppen</a>
index 06a1878ba9f2c12540c21f89148493191e5473d1..b6e492ae697bf01a9a0f52b70c4f1874c0af2ee6 100644 (file)
@@ -8,12 +8,8 @@ Hier sind noch einige weitere Dinge, die dir den Start vereinfachen können.
 **Gruppen**
 
 
-- <a href="https://kakste.com/profile/newhere">Neu hier?</a> - eine Gruppe für Leute, die neu bei Friendica sind
-
 - <a href="http://helpers.pyxis.uberspace.de/profile/helpers">Friendica Support</a> - Probleme?  Dann ist das der Platz, um zu fragen!
 
-- <a href="https://kakste.com/profile/public_stream">Öffentlicher Stream</a> - ein Platz, um über alles mit jedem zu reden.
-
 - <a href="https://letstalk.pyxis.uberspace.de/profile/letstalk">Let's Talk</a> eine Gruppe, um Leute und Gruppen mit gleichen Interessen zu finden 
 
 - <a href="http://newzot.hydra.uberspace.de/profile/newzot">Local Friendica</a> eine Seite für lokale Friendica-Gruppen</a>
index 374a718479345db80f6f0ecdef0d8e9cc7f219a0..ffa5d0e9df9d2288b8ebfef4ddb6135b1eb17b80 100644 (file)
                                                        $json = json_encode($rr);
                                                        if ($_GET['callback'])
                                                                $json = $_GET['callback']."(".$json.")";
-                                                       return $json;                                                   
+                                                       return $json;
                                                break;
                                        case "rss":
                                                header ("Content-Type: application/rss+xml");
                        logger('api_statuses_update: no user');
                        return false;
                }
+
                $user_info = api_get_user($a);
 
                // convert $_POST array items to the form we use for web posts.
                if($parent)
                        $_REQUEST['type'] = 'net-comment';
                else {
+                       // Check for throttling (maximum posts per day, week and month)
+                       $throttle_day = get_config('system','throttle_limit_day');
+                       if ($throttle_day > 0) {
+                               $datefrom = date("Y-m-d H:i:s", time() - 24*60*60);
+
+                               $r = q("SELECT COUNT(*) AS `posts_day` FROM `item` WHERE `uid`=%d AND `wall`
+                                       AND `created` > '%s' AND `id` = `parent`",
+                                       intval(api_user()), dbesc($datefrom));
+
+                               if ($r)
+                                       $posts_day = $r[0]["posts_day"];
+                               else
+                                       $posts_day = 0;
+
+                               if ($posts_day > $throttle_day) {
+                                       logger('Daily posting limit reached for user '.api_user(), LOGGER_DEBUG);
+                                       die(api_error($a, $type, sprintf(t("Daily posting limit of %d posts reached. The post was rejected."), $throttle_day)));
+                               }
+                       }
+
+                       $throttle_week = get_config('system','throttle_limit_week');
+                       if ($throttle_week > 0) {
+                               $datefrom = date("Y-m-d H:i:s", time() - 24*60*60*7);
+
+                               $r = q("SELECT COUNT(*) AS `posts_week` FROM `item` WHERE `uid`=%d AND `wall`
+                                       AND `created` > '%s' AND `id` = `parent`",
+                                       intval(api_user()), dbesc($datefrom));
+
+                               if ($r)
+                                       $posts_week = $r[0]["posts_week"];
+                               else
+                                       $posts_week = 0;
+
+                               if ($posts_week > $throttle_week) {
+                                       logger('Weekly posting limit reached for user '.api_user(), LOGGER_DEBUG);
+                                       die(api_error($a, $type, sprintf(t("Weekly posting limit of %d posts reached. The post was rejected."), $throttle_week)));
+                               }
+                       }
+
+                       $throttle_month = get_config('system','throttle_limit_month');
+                       if ($throttle_month > 0) {
+                               $datefrom = date("Y-m-d H:i:s", time() - 24*60*60*30);
+
+                               $r = q("SELECT COUNT(*) AS `posts_month` FROM `item` WHERE `uid`=%d AND `wall`
+                                       AND `created` > '%s' AND `id` = `parent`",
+                                       intval(api_user()), dbesc($datefrom));
+
+                               if ($r)
+                                       $posts_month = $r[0]["posts_month"];
+                               else
+                                       $posts_month = 0;
+
+                               if ($posts_month > $throttle_month) {
+                                       logger('Monthly posting limit reached for user '.api_user(), LOGGER_DEBUG);
+                                       die(api_error($a, $type, sprintf(t("Monthly posting limit of %d posts reached. The post was rejected."), $throttle_month)));
+                               }
+                       }
+
                        $_REQUEST['type'] = 'wall';
                        if(x($_FILES,'media')) {
                                // upload the image if we have one
index 39742291fd8daec632c51afdddcab001d6a55b7d..d836f325e85cfa0aa2f634ae468ff39e6803e14d 100644 (file)
@@ -56,6 +56,8 @@ function diaspora2bb($s) {
 
 function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) {
 
+       $OriginalText = $Text;
+
        // Since Diaspora is creating a summary for links, this function removes them before posting
        if ($fordiaspora)
                $Text = bb_remove_share_information($Text);
@@ -73,9 +75,20 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) {
        $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '[img]$3[/img]', $Text);
 
        // Convert it to HTML - don't try oembed
-       if ($fordiaspora)
+       if ($fordiaspora) {
                $Text = bbcode($Text, $preserve_nl, false, 3);
-       else {
+
+               // Add all tags that maybe were removed
+               if (preg_match_all("/#\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",$OriginalText, $tags)) {
+                       $tagline = "";
+                       foreach($tags[2] as $tag)
+                               if (!strpos($Text, "#".$tag))
+                                       $tagline .= "#".$tag." ";
+
+                       $Text = $Text."<br />".$tagline;
+               }
+
+       } else {
                $Text = bbcode($Text, $preserve_nl, false, 4);
                // Libertree doesn't convert a harizontal rule if there isn't a linefeed
                $Text = str_replace("<hr />", "<br /><hr />", $Text);
index 8efeabb8bfa5c19dd2562af96dfd8003349082af..724b8e2fdd1a57cff97cc7748be1209f3ce850e1 100644 (file)
@@ -3,10 +3,10 @@ require_once("include/oembed.php");
 require_once('include/event.php');
 
 function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
-       $Text = preg_replace_callback("/\[attachment(.*?)\](.*?)\[\/attachment\]/ism",
+       $Text = preg_replace_callback("/(.*?)\[attachment(.*?)\](.*?)\[\/attachment\]/ism",
                function ($match) use ($plaintext){
 
-                       $attributes = $match[1];
+                       $attributes = $match[2];
 
                        $type = "";
                        preg_match("/type='(.*?)'/ism", $attributes, $matches);
@@ -65,8 +65,13 @@ function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
                                        $preview = $matches[1];
                        }
 
+                       if (((strpos($match[1], "[img=") !== false) OR (strpos($match[1], "[img]") !== false)) AND ($image != "")) {
+                               $preview = $image;
+                               $image = "";
+                       }
+
                        if ($plaintext)
-                               $text = sprintf('<a href="%s" target="_blank">%s</a>', $url, $title);
+                               $text = sprintf('<a href="%s" target="_blank">%s</a><br>', $url, $title);
                        else {
                                $text = sprintf('<span class="type-%s">', $type);
 
@@ -83,44 +88,15 @@ function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
 
                                $text .= $oembed;
 
-                               $text .= sprintf('<blockquote>%s</blockquote></span>', trim($match[2]));
+                               $text .= sprintf('<blockquote>%s</blockquote></span>', trim($match[3]));
                        }
 
-                       return($text);
+                       return($match[1].$text);
                },$Text);
 
        return($Text);
 }
 
-/* function bb_rearrange_link($shared) {
-       if ($shared[1] != "type-link")
-               return($shared[0]);
-
-       $newshare = trim($shared[2]);
-       $newshare = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '[img]$3[/img]', $newshare);
-
-       if (!strpos($shared[0], "[bookmark"))
-               $newshare = preg_replace("/\[url\=(.*?)\](.*?)\[\/url\]/ism", '[bookmark=$1]$2[/bookmark]', $newshare, 1);
-
-       preg_match("/\[img\](.*?)\[\/img\]/ism", $newshare, $matches);
-
-       if ($matches) {
-               $newshare = str_replace($matches[0], '', $newshare);
-               $newshare = "[img]".$matches[1]."[/img]\n".$newshare;
-       }
-
-       $search = array("\n\n", "\n ", " \n");
-       $replace = array("\n", "\n", "\n");
-       do {
-               $oldtext = $newshare;
-               $newshare = str_replace($search, $replace, $newshare);
-       } while ($oldtext != $newshare);
-
-       $newshare = "[class=type-link]".$newshare."[/class]";
-
-       return($newshare);
-} */
-
 function bb_rearrange_share($shared) {
        if (!in_array(strtolower($shared[2]), array("type-link", "type-audio", "type-video")))
                return($shared[0]);
@@ -211,7 +187,8 @@ function bb_cleanup_share($shared, $plaintext, $nolink) {
        if (isset($bookmark[1][0]))
                $link = $bookmark[1][0];
 
-       if (($title != "") AND (strpos($shared[1],$title) !== false))
+       if (($title != "") AND ((strpos($shared[1],$title) !== false) OR
+               (similar_text($shared[1],$title) / strlen($title)) > 0.9))
                $title = "";
 
 //        if (strpos($shared[1],$link) !== false)
@@ -825,13 +802,6 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
        // Rearrange shares to attachments
        $Text = preg_replace_callback("((.*?)\[class=(.*?)\](.*?)\[\/class\])ism", "bb_rearrange_share",$Text);
 
-       // Handle attached links or videos
-       $Text = bb_attachment($Text, ($simplehtml != 4) AND ($simplehtml != 0), $tryoembed);
-
-       // Rearrange shared links
-//     if (get_config("system", "rearrange_shared_links") AND (!$simplehtml OR $tryoembed))
-//             $Text = preg_replace_callback("(\[class=(.*?)\](.*?)\[\/class\])ism","bb_rearrange_link",$Text);
-
        // when the content is meant exporting to other systems then remove the avatar picture since this doesn't really look good on these systems
        if (!$tryoembed)
                $Text = preg_replace("/\[share(.*?)avatar\s?=\s?'.*?'\s?(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism","\n[share$1$2]$3[/share]",$Text);
@@ -848,21 +818,22 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
 
        // removing multiplicated newlines
        if (get_config("system", "remove_multiplicated_lines")) {
-               $search = array("\n\n\n", "\n ", " \n", "[/quote]\n\n", "\n[/quote]", "[/li]\n", "\n[li]", "\n[ul]", "[/ul]\n", "\n\n[share ");
-               $replace = array("\n\n", "\n", "\n", "[/quote]\n", "[/quote]", "[/li]", "[li]", "[ul]", "[/ul]", "\n[share ");
+               $search = array("\n\n\n", "\n ", " \n", "[/quote]\n\n", "\n[/quote]", "[/li]\n", "\n[li]", "\n[ul]", "[/ul]\n", "\n\n[share ", "[/attachment]\n");
+               $replace = array("\n\n", "\n", "\n", "[/quote]\n", "[/quote]", "[/li]", "[li]", "[ul]", "[/ul]", "\n[share ", "[/attachment]");
                do {
                        $oldtext = $Text;
                        $Text = str_replace($search, $replace, $Text);
                } while ($oldtext != $Text);
        }
 
+       // Handle attached links or videos
+       $Text = bb_attachment($Text, ($simplehtml != 4) AND ($simplehtml != 0), $tryoembed);
+
        $Text = str_replace(array("\r","\n"), array('<br />','<br />'), $Text);
 
        if($preserve_nl)
                $Text = str_replace(array("\n","\r"), array('',''),$Text);
 
-
-
        // Set up the parameters for a URL search string
        $URLSearchString = "^\[\]";
        // Set up the parameters for a MAIL search string
index c05bd3796afaccde39e35bbb20e6639f25c91533..66e67c0a9aaf977ca68f0086360fa955d26ca60e 100644 (file)
@@ -92,7 +92,7 @@ function table_structure($table) {
                        if ($field["Null"] == "NO")
                                $fielddata[$field["Field"]]["not null"] = true;
 
-                       if ($field["Default"] != "")
+                       if (isset($field["Default"]))
                                $fielddata[$field["Field"]]["default"] = $field["Default"];
 
                        if ($field["Extra"] != "")
@@ -102,7 +102,6 @@ function table_structure($table) {
                                $fielddata[$field["Field"]]["primary"] = true;
                }
        }
-
        return(array("fields"=>$fielddata, "indexes"=>$indexdata));
 }
 
@@ -182,8 +181,8 @@ function update_structure($verbose, $action) {
                                                $sql3 .= ", ".$sql2;
                                } else {
                                        // Compare the field definition
-                                       $current_field_definition = implode($database[$name]["fields"][$fieldname]);
-                                       $new_field_definition = implode($parameters);
+                                       $current_field_definition = implode(",",$database[$name]["fields"][$fieldname]);
+                                       $new_field_definition = implode(",",$parameters);
                                        if ($current_field_definition != $new_field_definition) {
                                                $sql2=db_modify_table_field($fieldname, $parameters);
                                                if ($sql3 == "")
@@ -232,7 +231,7 @@ function db_field_command($parameters, $create = true) {
        if ($parameters["not null"])
                $fieldstruct .= " NOT NULL";
 
-       if ($parameters["default"] != "")
+       if (isset($parameters["default"]))
                $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
 
        if ($parameters["extra"] != "")
@@ -310,8 +309,8 @@ function db_definition() {
        $database["addon"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "name" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "version" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
@@ -324,11 +323,11 @@ function db_definition() {
        $database["attach"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "uid" => array("type" => "int(11)", "not null" => "1"),
-                                       "hash" => array("type" => "varchar(64)", "not null" => "1"),
-                                       "filename" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "filetype" => array("type" => "varchar(64)", "not null" => "1"),
-                                       "filesize" => array("type" => "int(11)", "not null" => "1"),
+                                       "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
+                                       "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
+                                       "filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
                                        "data" => array("type" => "longblob", "not null" => "1"),
                                        "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
@@ -344,10 +343,10 @@ function db_definition() {
        $database["auth_codes"] = array(
                        "fields" => array(
                                        "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
-                                       "client_id" => array("type" => "varchar(20)", "not null" => "1"),
-                                       "redirect_uri" => array("type" => "varchar(200)", "not null" => "1"),
-                                       "expires" => array("type" => "int(11)", "not null" => "1"),
-                                       "scope" => array("type" => "varchar(250)", "not null" => "1"),
+                                       "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
+                                       "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
+                                       "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "scope" => array("type" => "varchar(250)", "not null" => "1", "default" => ""),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -357,7 +356,7 @@ function db_definition() {
                        "fields" => array(
                                        "k" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
                                        "v" => array("type" => "text", "not null" => "1"),
-                                       "updated" => array("type" => "datetime", "not null" => "1"),
+                                       "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("k"),
@@ -367,11 +366,11 @@ function db_definition() {
        $database["challenge"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "challenge" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "dfrn-id" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "expire" => array("type" => "int(11)", "not null" => "1"),
-                                       "type" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "last_update" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -380,8 +379,8 @@ function db_definition() {
        $database["clients"] = array(
                        "fields" => array(
                                        "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
-                                       "pw" => array("type" => "varchar(20)", "not null" => "1"),
-                                       "redirect_uri" => array("type" => "varchar(200)", "not null" => "1"),
+                                       "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
+                                       "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
                                        "name" => array("type" => "text"),
                                        "icon" => array("type" => "text"),
                                        "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
@@ -393,8 +392,8 @@ function db_definition() {
        $database["config"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "cat" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "k" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "v" => array("type" => "text", "not null" => "1"),
                                        ),
                        "indexes" => array(
@@ -405,29 +404,29 @@ function db_definition() {
        $database["contact"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "uid" => array("type" => "int(11)", "not null" => "1"),
+                                       "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
                                        "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
-                                       "network" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "name" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "nick" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "attag" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "photo" => array("type" => "text", "not null" => "1"),
                                        "thumb" => array("type" => "text", "not null" => "1"),
                                        "micro" => array("type" => "text", "not null" => "1"),
                                        "site-pubkey" => array("type" => "text", "not null" => "1"),
-                                       "issued-id" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "dfrn-id" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "url" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "nurl" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "addr" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "alias" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "pubkey" => array("type" => "text", "not null" => "1"),
                                        "prvkey" => array("type" => "text", "not null" => "1"),
-                                       "batch" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "request" => array("type" => "text", "not null" => "1"),
                                        "notify" => array("type" => "text", "not null" => "1"),
                                        "poll" => array("type" => "text", "not null" => "1"),
@@ -437,14 +436,14 @@ function db_definition() {
                                        "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
-                                       "hub-verify" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "last-update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        "success_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        "name-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        "uri-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        "term-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
-                                       "priority" => array("type" => "tinyint(3)", "not null" => "1"),
+                                       "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
                                        "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
                                        "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
@@ -458,8 +457,8 @@ function db_definition() {
                                        "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
                                        "info" => array("type" => "mediumtext", "not null" => "1"),
                                        "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
-                                       "bdyear" => array("type" => "varchar(4)", "not null" => "1"),
-                                       "bd" => array("type" => "date", "not null" => "1"),
+                                       "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
+                                       "bd" => array("type" => "date", "not null" => "1", "default" => "0000-00-00"),
                                        "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "ffi_keyword_blacklist" => array("type" => "mediumtext", "not null" => "1"),
@@ -472,10 +471,10 @@ function db_definition() {
        $database["conv"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "guid" => array("type" => "varchar(64)", "not null" => "1"),
+                                       "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
                                        "recips" => array("type" => "mediumtext", "not null" => "1"),
-                                       "uid" => array("type" => "int(11)", "not null" => "1"),
-                                       "creator" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        "subject" => array("type" => "mediumtext", "not null" => "1"),
@@ -488,9 +487,9 @@ function db_definition() {
        $database["deliverq"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "cmd" => array("type" => "varchar(32)", "not null" => "1"),
-                                       "item" => array("type" => "int(11)", "not null" => "1"),
-                                       "contact" => array("type" => "int(11)", "not null" => "1"),
+                                       "cmd" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
+                                       "item" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "contact" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -499,9 +498,9 @@ function db_definition() {
        $database["dsprphotoq"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "uid" => array("type" => "int(11)", "not null" => "1"),
+                                       "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
                                        "msg" => array("type" => "mediumtext", "not null" => "1"),
-                                       "attempt" => array("type" => "tinyint(4)", "not null" => "1"),
+                                       "attempt" => array("type" => "tinyint(4)", "not null" => "1", "default" => "0"),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -510,17 +509,17 @@ function db_definition() {
        $database["event"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "uid" => array("type" => "int(11)", "not null" => "1"),
-                                       "cid" => array("type" => "int(11)", "not null" => "1"),
-                                       "uri" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "created" => array("type" => "datetime", "not null" => "1"),
-                                       "edited" => array("type" => "datetime", "not null" => "1"),
-                                       "start" => array("type" => "datetime", "not null" => "1"),
-                                       "finish" => array("type" => "datetime", "not null" => "1"),
+                                       "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
+                                       "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
+                                       "start" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
+                                       "finish" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        "summary" => array("type" => "text", "not null" => "1"),
                                        "desc" => array("type" => "text", "not null" => "1"),
                                        "location" => array("type" => "text", "not null" => "1"),
-                                       "type" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
                                        "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
@@ -537,19 +536,19 @@ function db_definition() {
        $database["fcontact"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "url" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "name" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "photo" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "request" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "nick" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "addr" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "batch" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "notify" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "poll" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "confirm" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "priority" => array("type" => "tinyint(1)", "not null" => "1"),
-                                       "network" => array("type" => "varchar(32)", "not null" => "1"),
-                                       "alias" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
+                                       "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
+                                       "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "pubkey" => array("type" => "text", "not null" => "1"),
                                        "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        ),
@@ -561,9 +560,9 @@ function db_definition() {
        $database["ffinder"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "uid" => array("type" => "int(10) unsigned", "not null" => "1"),
-                                       "cid" => array("type" => "int(10) unsigned", "not null" => "1"),
-                                       "fid" => array("type" => "int(10) unsigned", "not null" => "1"),
+                                       "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
+                                       "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
+                                       "fid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -572,8 +571,8 @@ function db_definition() {
        $database["fserver"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "server" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "posturl" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "posturl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "key" => array("type" => "text", "not null" => "1"),
                                        ),
                        "indexes" => array(
@@ -584,14 +583,14 @@ function db_definition() {
        $database["fsuggest"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "uid" => array("type" => "int(11)", "not null" => "1"),
-                                       "cid" => array("type" => "int(11)", "not null" => "1"),
-                                       "name" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "url" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "request" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "photo" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "note" => array("type" => "text", "not null" => "1"),
-                                       "created" => array("type" => "datetime", "not null" => "1"),
+                                       "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -600,8 +599,8 @@ function db_definition() {
        $database["gcign"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "uid" => array("type" => "int(11)", "not null" => "1"),
-                                       "gcid" => array("type" => "int(11)", "not null" => "1"),
+                                       "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -612,11 +611,11 @@ function db_definition() {
        $database["gcontact"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "name" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "url" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "nurl" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "photo" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "connect" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -626,11 +625,11 @@ function db_definition() {
        $database["glink"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "cid" => array("type" => "int(11)", "not null" => "1"),
-                                       "uid" => array("type" => "int(11)", "not null" => "1"),
-                                       "gcid" => array("type" => "int(11)", "not null" => "1"),
-                                       "zcid" => array("type" => "int(11)", "not null" => "1"),
-                                       "updated" => array("type" => "datetime", "not null" => "1"),
+                                       "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -642,10 +641,10 @@ function db_definition() {
        $database["group"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "uid" => array("type" => "int(10) unsigned", "not null" => "1"),
+                                       "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
                                        "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
-                                       "name" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -655,9 +654,9 @@ function db_definition() {
        $database["group_member"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "uid" => array("type" => "int(10) unsigned", "not null" => "1"),
-                                       "gid" => array("type" => "int(10) unsigned", "not null" => "1"),
-                                       "contact-id" => array("type" => "int(10) unsigned", "not null" => "1"),
+                                       "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
+                                       "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
+                                       "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -667,7 +666,7 @@ function db_definition() {
        $database["guid"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "guid" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -677,9 +676,9 @@ function db_definition() {
        $database["hook"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "hook" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "file" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "function" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
                                        ),
                        "indexes" => array(
@@ -690,14 +689,14 @@ function db_definition() {
        $database["intro"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "uid" => array("type" => "int(10) unsigned", "not null" => "1"),
+                                       "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
                                        "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
-                                       "contact-id" => array("type" => "int(11)", "not null" => "1"),
-                                       "knowyou" => array("type" => "tinyint(1)", "not null" => "1"),
+                                       "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "note" => array("type" => "text", "not null" => "1"),
-                                       "hash" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "datetime" => array("type" => "datetime", "not null" => "1"),
+                                       "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "datetime" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
                                        "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        ),
@@ -708,46 +707,46 @@ function db_definition() {
        $database["item"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "guid" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "uri" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
-                                       "contact-id" => array("type" => "int(11)", "not null" => "1"),
-                                       "type" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
-                                       "parent-uri" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "extid" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "thr-parent" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
-                                       "owner-name" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "owner-link" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "owner-avatar" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "author-name" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "author-link" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "author-avatar" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "title" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "body" => array("type" => "mediumtext", "not null" => "1"),
-                                       "app" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "verb" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "object-type" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "object" => array("type" => "text", "not null" => "1"),
-                                       "target-type" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "target" => array("type" => "text", "not null" => "1"),
                                        "postopts" => array("type" => "text", "not null" => "1"),
-                                       "plink" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "resource-id" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "event-id" => array("type" => "int(11)", "not null" => "1"),
+                                       "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
                                        "tag" => array("type" => "mediumtext", "not null" => "1"),
                                        "attach" => array("type" => "mediumtext", "not null" => "1"),
                                        "inform" => array("type" => "mediumtext", "not null" => "1"),
                                        "file" => array("type" => "mediumtext", "not null" => "1"),
-                                       "location" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "coord" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "allow_cid" => array("type" => "mediumtext", "not null" => "1"),
                                        "allow_gid" => array("type" => "mediumtext", "not null" => "1"),
                                        "deny_cid" => array("type" => "mediumtext", "not null" => "1"),
@@ -765,7 +764,7 @@ function db_definition() {
                                        "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
                                        "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
-                                       "network" => array("type" => "varchar(32)", "not null" => "1"),
+                                       "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -806,10 +805,10 @@ function db_definition() {
        $database["item_id"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "iid" => array("type" => "int(11)", "not null" => "1"),
-                                       "uid" => array("type" => "int(11)", "not null" => "1"),
-                                       "sid" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "service" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -822,7 +821,7 @@ function db_definition() {
        $database["locks"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "name" => array("type" => "varchar(128)", "not null" => "1"),
+                                       "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
                                        "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        ),
                        "indexes" => array(
@@ -832,21 +831,21 @@ function db_definition() {
        $database["mail"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "uid" => array("type" => "int(10) unsigned", "not null" => "1"),
-                                       "guid" => array("type" => "varchar(64)", "not null" => "1"),
-                                       "from-name" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "from-photo" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "from-url" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "contact-id" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "convid" => array("type" => "int(11) unsigned", "not null" => "1"),
-                                       "title" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
+                                       "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
+                                       "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
+                                       "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "body" => array("type" => "mediumtext", "not null" => "1"),
-                                       "seen" => array("type" => "tinyint(1)", "not null" => "1"),
+                                       "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
-                                       "replied" => array("type" => "tinyint(1)", "not null" => "1"),
+                                       "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
-                                       "uri" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "parent-uri" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        ),
                        "indexes" => array(
@@ -862,16 +861,16 @@ function db_definition() {
        $database["mailacct"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "uid" => array("type" => "int(11)", "not null" => "1"),
-                                       "server" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "port" => array("type" => "int(11)", "not null" => "1"),
-                                       "ssltype" => array("type" => "varchar(16)", "not null" => "1"),
-                                       "mailbox" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "user" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
+                                       "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "pass" => array("type" => "text", "not null" => "1"),
-                                       "reply_to" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "action" => array("type" => "int(11)", "not null" => "1"),
-                                       "movetofolder" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "last_check" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        ),
@@ -882,8 +881,8 @@ function db_definition() {
        $database["manage"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "uid" => array("type" => "int(11)", "not null" => "1"),
-                                       "mid" => array("type" => "int(11)", "not null" => "1"),
+                                       "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -893,19 +892,19 @@ function db_definition() {
        $database["notify"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "hash" => array("type" => "varchar(64)", "not null" => "1"),
-                                       "type" => array("type" => "int(11)", "not null" => "1"),
-                                       "name" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "url" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "photo" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "date" => array("type" => "datetime", "not null" => "1"),
+                                       "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
+                                       "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        "msg" => array("type" => "mediumtext", "not null" => "1"),
-                                       "uid" => array("type" => "int(11)", "not null" => "1"),
-                                       "link" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "parent" => array("type" => "int(11)", "not null" => "1"),
+                                       "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
                                        "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
-                                       "verb" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "otype" => array("type" => "varchar(16)", "not null" => "1"),
+                                       "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -915,10 +914,10 @@ function db_definition() {
        $database["notify-threads"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "notify-id" => array("type" => "int(11)", "not null" => "1"),
+                                       "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
                                        "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
                                        "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
-                                       "receiver-uid" => array("type" => "int(11)", "not null" => "1"),
+                                       "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -930,8 +929,8 @@ function db_definition() {
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
                                        "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
-                                       "cat" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "k" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "v" => array("type" => "mediumtext", "not null" => "1"),
                                        ),
                        "indexes" => array(
@@ -942,22 +941,22 @@ function db_definition() {
        $database["photo"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "uid" => array("type" => "int(10) unsigned", "not null" => "1"),
+                                       "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
                                        "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
-                                       "guid" => array("type" => "varchar(64)", "not null" => "1"),
-                                       "resource-id" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "created" => array("type" => "datetime", "not null" => "1"),
-                                       "edited" => array("type" => "datetime", "not null" => "1"),
-                                       "title" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
+                                       "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
+                                       "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
+                                       "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "desc" => array("type" => "text", "not null" => "1"),
-                                       "album" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "filename" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
-                                       "height" => array("type" => "smallint(6)", "not null" => "1"),
-                                       "width" => array("type" => "smallint(6)", "not null" => "1"),
+                                       "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
+                                       "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
                                        "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
                                        "data" => array("type" => "mediumblob", "not null" => "1"),
-                                       "scale" => array("type" => "tinyint(3)", "not null" => "1"),
+                                       "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
                                        "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "allow_cid" => array("type" => "mediumtext", "not null" => "1"),
                                        "allow_gid" => array("type" => "mediumtext", "not null" => "1"),
@@ -974,7 +973,7 @@ function db_definition() {
        $database["poll"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "uid" => array("type" => "int(11)", "not null" => "1"),
+                                       "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
                                        "q0" => array("type" => "mediumtext", "not null" => "1"),
                                        "q1" => array("type" => "mediumtext", "not null" => "1"),
                                        "q2" => array("type" => "mediumtext", "not null" => "1"),
@@ -994,8 +993,8 @@ function db_definition() {
        $database["poll_result"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "poll_id" => array("type" => "int(11)", "not null" => "1"),
-                                       "choice" => array("type" => "int(11)", "not null" => "1"),
+                                       "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -1006,32 +1005,32 @@ function db_definition() {
        $database["profile"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "uid" => array("type" => "int(11)", "not null" => "1"),
-                                       "profile-name" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
-                                       "name" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "pdesc" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
-                                       "address" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "locality" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "region" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "postal-code" => array("type" => "varchar(32)", "not null" => "1"),
-                                       "country-name" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "hometown" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "gender" => array("type" => "varchar(32)", "not null" => "1"),
-                                       "marital" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
+                                       "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
+                                       "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "with" => array("type" => "text", "not null" => "1"),
                                        "howlong" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
-                                       "sexual" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "politic" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "religion" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "pub_keywords" => array("type" => "text", "not null" => "1"),
                                        "prv_keywords" => array("type" => "text", "not null" => "1"),
                                        "likes" => array("type" => "text", "not null" => "1"),
                                        "dislikes" => array("type" => "text", "not null" => "1"),
                                        "about" => array("type" => "text", "not null" => "1"),
-                                       "summary" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "music" => array("type" => "text", "not null" => "1"),
                                        "book" => array("type" => "text", "not null" => "1"),
                                        "tv" => array("type" => "text", "not null" => "1"),
@@ -1041,9 +1040,9 @@ function db_definition() {
                                        "work" => array("type" => "text", "not null" => "1"),
                                        "education" => array("type" => "text", "not null" => "1"),
                                        "contact" => array("type" => "text", "not null" => "1"),
-                                       "homepage" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "photo" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "thumb" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        ),
@@ -1055,11 +1054,11 @@ function db_definition() {
        $database["profile_check"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "uid" => array("type" => "int(10) unsigned", "not null" => "1"),
+                                       "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
                                        "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
-                                       "dfrn_id" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "sec" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "expire" => array("type" => "int(11)", "not null" => "1"),
+                                       "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -1068,13 +1067,13 @@ function db_definition() {
        $database["push_subscriber"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "uid" => array("type" => "int(11)", "not null" => "1"),
-                                       "callback_url" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "topic" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "nickname" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "push" => array("type" => "int(11)", "not null" => "1"),
-                                       "last_update" => array("type" => "datetime", "not null" => "1"),
-                                       "secret" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "last_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
+                                       "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -1083,10 +1082,10 @@ function db_definition() {
        $database["queue"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "cid" => array("type" => "int(11)", "not null" => "1"),
-                                       "network" => array("type" => "varchar(32)", "not null" => "1"),
-                                       "created" => array("type" => "datetime", "not null" => "1"),
-                                       "last" => array("type" => "datetime", "not null" => "1"),
+                                       "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
+                                       "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
+                                       "last" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        "content" => array("type" => "mediumtext", "not null" => "1"),
                                        "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        ),
@@ -1102,11 +1101,11 @@ function db_definition() {
        $database["register"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "hash" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "created" => array("type" => "datetime", "not null" => "1"),
-                                       "uid" => array("type" => "int(11) unsigned", "not null" => "1"),
-                                       "password" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "language" => array("type" => "varchar(16)", "not null" => "1"),
+                                       "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
+                                       "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
+                                       "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -1115,8 +1114,8 @@ function db_definition() {
        $database["search"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "uid" => array("type" => "int(11)", "not null" => "1"),
-                                       "term" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -1127,9 +1126,9 @@ function db_definition() {
        $database["session"] = array(
                        "fields" => array(
                                        "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "sid" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "data" => array("type" => "text", "not null" => "1"),
-                                       "expire" => array("type" => "int(10) unsigned", "not null" => "1"),
+                                       "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -1144,7 +1143,7 @@ function db_definition() {
                                        "retract_iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
                                        "signed_text" => array("type" => "mediumtext", "not null" => "1"),
                                        "signature" => array("type" => "text", "not null" => "1"),
-                                       "signer" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -1155,10 +1154,10 @@ function db_definition() {
        $database["spam"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "uid" => array("type" => "int(11)", "not null" => "1"),
+                                       "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
                                        "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
                                        "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
-                                       "term" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        ),
                        "indexes" => array(
@@ -1172,11 +1171,11 @@ function db_definition() {
        $database["term"] = array(
                        "fields" => array(
                                        "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "oid" => array("type" => "int(10) unsigned", "not null" => "1"),
-                                       "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1"),
-                                       "type" => array("type" => "tinyint(3) unsigned", "not null" => "1"),
-                                       "term" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "url" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
+                                       "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
+                                       "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
+                                       "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
                                        "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
                                        ),
@@ -1213,7 +1212,7 @@ function db_definition() {
                                        "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
-                                       "network" => array("type" => "varchar(32)", "not null" => "1"),
+                                       "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("iid"),
@@ -1232,10 +1231,10 @@ function db_definition() {
                        "fields" => array(
                                        "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
                                        "secret" => array("type" => "text", "not null" => "1"),
-                                       "client_id" => array("type" => "varchar(20)", "not null" => "1"),
-                                       "expires" => array("type" => "int(11)", "not null" => "1"),
-                                       "scope" => array("type" => "varchar(200)", "not null" => "1"),
-                                       "uid" => array("type" => "int(11)", "not null" => "1"),
+                                       "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
+                                       "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
+                                       "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
+                                       "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -1244,10 +1243,10 @@ function db_definition() {
        $database["unique_contacts"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "url" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "nick" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "name" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "avatar" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
@@ -1257,19 +1256,19 @@ function db_definition() {
        $database["user"] = array(
                        "fields" => array(
                                        "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "guid" => array("type" => "varchar(64)", "not null" => "1"),
-                                       "username" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "password" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "nickname" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "email" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "openid" => array("type" => "varchar(255)", "not null" => "1"),
-                                       "timezone" => array("type" => "varchar(128)", "not null" => "1"),
+                                       "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
+                                       "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
                                        "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
                                        "register_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        "login_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
-                                       "default-location" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
-                                       "theme" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "pubkey" => array("type" => "text", "not null" => "1"),
                                        "prvkey" => array("type" => "text", "not null" => "1"),
                                        "spubkey" => array("type" => "text", "not null" => "1"),
@@ -1284,14 +1283,14 @@ function db_definition() {
                                        "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
                                        "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
                                        "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
-                                       "pwdreset" => array("type" => "varchar(255)", "not null" => "1"),
+                                       "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
                                        "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
                                        "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
-                                       "service_class" => array("type" => "varchar(32)", "not null" => "1"),
+                                       "service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
                                        "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
                                        "allow_cid" => array("type" => "mediumtext", "not null" => "1"),
                                        "allow_gid" => array("type" => "mediumtext", "not null" => "1"),
index 0cf32e95fe9311f04cffeeb1cd5089eb3cb5d119..36650eb9ae4d026ae06fe33b5d23a0e262b1d4de 100644 (file)
@@ -10,7 +10,7 @@ function gprobe_run(&$argv, &$argc){
        if(is_null($a)) {
                $a = new App;
        }
-  
+
        if(is_null($db)) {
            @include(".htconfig.php");
        require_once("include/dba.php");
@@ -37,6 +37,8 @@ function gprobe_run(&$argv, &$argc){
                dbesc(normalise_link($url))
        );
 
+       logger("gprobe start for ".normalise_link($url), LOGGER_DEBUG);
+
        if(! count($r)) {
 
                $arr = probe_url($url);
@@ -55,7 +57,8 @@ function gprobe_run(&$argv, &$argc){
        }
        if(count($r))
                poco_load(0,0,$r[0]['id'], str_replace('/profile/','/poco/',$r[0]['url']));
-               
+
+       logger("gprobe end for ".normalise_link($url), LOGGER_DEBUG);
        return;
 }
 
index 37532eaf9adc8c00c05db48ea1e52160a75057cd..0398f545884eef878a0ce27b687bef74d4d69bab 100644 (file)
@@ -903,6 +903,12 @@ function add_page_info_data($data) {
        if ($no_photos AND ($data["type"] == "photo"))
                return("");
 
+       // If the link contains BBCode stuff, make a short link out of this to avoid parsing problems
+       if (strpos($data["url"], '[') OR strpos($data["url"], ']')) {
+               require_once("include/network.php");
+               $data["url"] = short_link($data["url"]);
+       }
+
        if (($data["type"] != "photo") AND is_string($data["title"]))
                $text .= "[bookmark=".$data["url"]."]".trim($data["title"])."[/bookmark]";
 
@@ -1161,6 +1167,11 @@ function item_store($arr,$force_parent = false, $notify = false) {
        $arr['origin']        = ((x($arr,'origin'))        ? intval($arr['origin'])              : 0 );
        $arr['guid']          = ((x($arr,'guid'))          ? notags(trim($arr['guid']))          : get_guid(30));
        $arr['network']       = ((x($arr,'network'))       ? trim($arr['network'])               : '');
+       $arr['postopts']      = ((x($arr,'postopts'))      ? trim($arr['postopts'])              : '');
+       $arr['resource-id']   = ((x($arr,'resource-id'))   ? trim($arr['resource-id'])           : '');
+       $arr['event-id']      = ((x($arr,'event-id'))      ? intval($arr['event-id'])            : 0 );
+       $arr['inform']        = ((x($arr,'inform'))        ? trim($arr['inform'])                : '');
+       $arr['file']          = ((x($arr,'file'))          ? trim($arr['file'])                  : '');
 
        if ($arr['plink'] == "") {
                $a = get_app();
index eb29a02b66b1da7023be37f63af883ba31deb80a..6a37f4a5496e18160e4753ad5194a893bb8e0380 100644 (file)
@@ -1130,7 +1130,7 @@ function original_url($url, $depth=1, $fetchbody = false) {
                                if (in_array($param, array("utm_source", "utm_medium", "utm_term", "utm_content", "utm_campaign",
                                                        "wt_mc", "pk_campaign", "pk_kwd", "mc_cid", "mc_eid",
                                                        "fb_action_ids", "fb_action_types", "fb_ref",
-                                                       "awesm",
+                                                       "awesm", "wtrid",
                                                        "woo_campaign", "woo_source", "woo_medium", "woo_content", "woo_term"))) {
 
                                        $pair = $param."=".urlencode($value);
index 9c55842fdcdeff798677be86ebc2864f5ad570a7..487ffafc770032578f1437bd84db44e9b39c77c8 100644 (file)
--- a/js/acl.js
+++ b/js/acl.js
@@ -62,7 +62,7 @@ ACL.prototype.add_mention = function(id) {
                that.element.val( searchText + that.element.val() );
        } else {
                if ( tinyMCE.activeEditor.getContent({format : 'raw'}).search(searchText) >= 0 ) return;
-               tinyMCE.activeEditor.dom.add(tinyMCE.activeEditor.getBody(), 'span', {}, searchText);
+               tinyMCE.activeEditor.dom.add(tinyMCE.activeEditor.getBody(), 'dummy', {}, searchText);
        }
 }
 
index 43d37a99bfcd19b78340bb4019bacad56c63e552..23f63f8224616274d08e5c61c45e0d4dae5eb39d 100644 (file)
@@ -703,6 +703,7 @@ function setupFieldRichtext(){
                theme_advanced_toolbar_location : "top",
                theme_advanced_toolbar_align : "center",
                theme_advanced_blockformats : "blockquote,code",
+               theme_advanced_resizing : true,
                paste_text_sticky : true,
                entity_encoding : "raw",
                add_unload_trigger : false,
index 5f9ca560e594c2732ac4c0157ef8b61d420e14e0..c7faf875ad326304c44f65aa3f64ff63b07924c6 100644 (file)
@@ -17,6 +17,12 @@ class HTML5_Parser
      * @return Parsed HTML as DOMDocument
      */
     static public function parse($text, $builder = null) {
+
+       // Cleanup invalid HTML
+       $doc = new DOMDocument();
+       @$doc->loadHTML($text);
+       $text = $doc->saveHTML();
+
         $tokenizer = new HTML5_Tokenizer($text, $builder);
         $tokenizer->parse();
         return $tokenizer->save();
index 224a1f8c6c3b2278902e862e181164b1d4d45ac7..8bddd8ce88ae6c492a2b87bcef95c28e74169f8e 100644 (file)
@@ -308,6 +308,7 @@ function admin_page_site_post(&$a){
        // end relocate
 
        $sitename               =       ((x($_POST,'sitename'))                 ? notags(trim($_POST['sitename']))              : '');
+       $hostname               =       ((x($_POST,'hostname'))                 ? notags(trim($_POST['hostname']))              : '');
        $banner                 =       ((x($_POST,'banner'))                   ? trim($_POST['banner'])                        : false);
        $info                   =       ((x($_POST,'info'))                     ? trim($_POST['info'])                  : false);
        $language               =       ((x($_POST,'language'))                 ? notags(trim($_POST['language']))              : '');
@@ -413,6 +414,7 @@ function admin_page_site_post(&$a){
        set_config('system','poll_interval',$poll_interval);
        set_config('system','maxloadavg',$maxloadavg);
        set_config('config','sitename',$sitename);
+       set_config('config','hostname',$hostname);
        set_config('system','suppress_language',$suppress_language);
        if ($banner==""){
                // don't know why, but del_config doesn't work...
@@ -585,6 +587,9 @@ function admin_page_site(&$a) {
                SSL_POLICY_SELFSIGN => t("Self-signed certificate, use SSL for local links only (discouraged)")
        );
 
+       if ($a->config['hostname'] == "")
+               $a->config['hostname'] = $a->get_hostname();
+
        $t = get_markup_template("admin_site.tpl");
        return replace_macros($t, array(
                '$title' => t('Administration'),
@@ -599,6 +604,7 @@ function admin_page_site(&$a) {
                '$baseurl' => $a->get_baseurl(true),
                // name, label, value, help string, extra data...
                '$sitename'             => array('sitename', t("Site name"), htmlentities($a->config['sitename'], ENT_QUOTES), 'UTF-8'),
+               '$hostname'             => array('hostname', t("Host name"), $a->config['hostname'], ""),
                '$banner'               => array('banner', t("Banner/Logo"), $banner, ""),
                '$info' => array('info',t('Additional Info'), $info, t('For public servers: you can add additional information here that will be listed at dir.friendica.com/siteinfo.')),
                '$language'             => array('language', t("System language"), get_config('system','language'), "", $lang_choices),
index 7f160de44390e0b4be395083bb9fea802d226afd..43414dc87c5bf8e350c972c323fd82c0b01be747 100644 (file)
@@ -175,6 +175,8 @@ function dfrn_notify_content(&$a) {
 
                $dfrn_id = notags(trim($_GET['dfrn_id']));
                $dfrn_version = (float) $_GET['dfrn_version'];
+               $type = "";
+               $last_update = "";
 
                logger('dfrn_notify: new notification dfrn_id=' . $dfrn_id);
 
@@ -190,11 +192,13 @@ function dfrn_notify_content(&$a) {
 
                $r = q("DELETE FROM `challenge` WHERE `expire` < " . intval(time()));
 
-               $r = q("INSERT INTO `challenge` ( `challenge`, `dfrn-id`, `expire` )
-                       VALUES( '%s', '%s', %d ) ",
+               $r = q("INSERT INTO `challenge` ( `challenge`, `dfrn-id`, `expire` , `type`, `last_update` )
+                       VALUES( '%s', '%s', %d, '%s', '%s' ) ",
                        dbesc($hash),
                        dbesc($dfrn_id),
-                       intval(time() + 90 )
+                       intval(time() + 90 ),
+                       dbesc($type),
+                       dbesc($last_update)
                );
 
                logger('dfrn_notify: challenge=' . $hash, LOGGER_DEBUG );
index b9fcd8c4a4c7be4978944d1882cf57a0dfa3124c..b5f60a0397e39020cd77253b925e2386136e0277 100644 (file)
@@ -389,7 +389,7 @@ function dfrn_poll_content(&$a) {
        $sec             = ((x($_GET,'sec'))             ? $_GET['sec']                  : '');
        $dfrn_version    = ((x($_GET,'dfrn_version'))    ? (float) $_GET['dfrn_version'] : 2.0);
        $perm            = ((x($_GET,'perm'))            ? $_GET['perm']                 : 'r');
-       $quiet                   = ((x($_GET,'quiet'))                   ? true                                                  : false);
+       $quiet           = ((x($_GET,'quiet'))           ? true                          : false);
 
        $direction = (-1);
        if(strpos($dfrn_id,':') == 1) {
index bff30f7fc36c2ce331a23385a39399102e35064b..1cb72aebab4e92ad447c89093c9b7124d26e8b60 100644 (file)
@@ -16,12 +16,13 @@ function network_init(&$a) {
                }
        }
 
-    // convert query string to array. remove friendica args
-    $query_array = array();
-    $query_string = str_replace($a->cmd."?", "", $a->query_string);
-    parse_str($query_string, $query_array);
-    array_shift($query_array);
+       // convert query string to array. remove friendica args
+       $query_array = array();
+       $query_string = str_replace($a->cmd."?", "", $a->query_string);
+       parse_str($query_string, $query_array);
+       array_shift($query_array);
 
+       
        // fetch last used network view and redirect if needed
        if(! $is_a_date_query) {
                $sel_tabs = network_query_get_sel_tab($a);
@@ -44,7 +45,7 @@ function network_init(&$a) {
                else if($sel_groups !== false) {
                        $net_baseurl .= '/' . $sel_groups;
                }
-
+               
                if($remember_tab) {
                        // redirect if current selected tab is '/network' and
                        // last selected tab is _not_ '/network?f=&order=comment'.
@@ -73,11 +74,11 @@ function network_init(&$a) {
 
                        $net_baseurl .= $tab_baseurls[$k];
 
-            // parse out tab queries
-            $dest_qa = array();
-            $dest_qs = $tab_args[$k];
-            parse_str( $dest_qs, $dest_qa);
-            $net_args = array_merge($net_args, $dest_qa);
+                       // parse out tab queries
+                       $dest_qa = array();
+                       $dest_qs = $tab_args[$k];
+                       parse_str( $dest_qs, $dest_qa);
+                       $net_args = array_merge($net_args, $dest_qa);
                }
                else if($sel_tabs[4] === 'active') {
                        // The '/new' tab is selected
@@ -87,16 +88,20 @@ function network_init(&$a) {
                if($remember_net) {
                        $net_args['nets'] = $last_sel_nets;
                }
-
+               else if($sel_nets!==false) {
+                       $net_args['nets'] = $sel_nets;
+               }
+               
                if($remember_tab || $remember_net || $remember_group) {
                        $net_args = array_merge($query_array, $net_args);
                        $net_queries = build_querystring($net_args);
-
+                       
                        $redir_url = ($net_queries ? $net_baseurl."?".$net_queries : $net_baseurl);
+                       
                        goaway($a->get_baseurl() . $redir_url);
                }
        }
-
+       
        if(x($_GET['nets']) && $_GET['nets'] === 'all')
                unset($_GET['nets']);
 
index 564b22c0424a70d3da8459ba0f900b02b986d68f..06e59b869157d2188413a088c63a6baea117add4 100644 (file)
@@ -187,6 +187,9 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co
                                case "description":
                                        $siteinfo["text"] = $attr["content"];
                                        break;
+                               case "thumbnail":
+                                       $siteinfo["image"] = $attr["content"];
+                                       break;
                                case "twitter:image":
                                        $siteinfo["image"] = $attr["content"];
                                        break;
@@ -421,6 +424,12 @@ function parse_url_content(&$a) {
 
        $url= $siteinfo["url"];
 
+       // If the link contains BBCode stuff, make a short link out of this to avoid parsing problems
+       if (strpos($url, '[') OR strpos($url, ']')) {
+               require_once("include/network.php");
+               $url = short_link($url);
+       }
+
        $sitedata = "";
 
        if($siteinfo["title"] == "") {
index 51b532d88d2de234c82809fbf5d76c235bd5443e..10195c1baa39414e56eea937f6861fd8a0c7a895 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-define( 'UPDATE_VERSION' , 1174 );
+define( 'UPDATE_VERSION' , 1175 );
 
 /**
  *
index 7237a2f27a22b17142ac60703a2e5dc12f41957c..166b35e7d43d1dddaa5d9da8c11414c88687d94e 100644 (file)
@@ -45,6 +45,7 @@
     <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
 
        {{include file="field_input.tpl" field=$sitename}}
+       {{include file="field_input.tpl" field=$hostname}}
        {{include file="field_textarea.tpl" field=$banner}}
        {{include file="field_textarea.tpl" field=$info}}
        {{include file="field_select.tpl" field=$language}}
index 498cbfbcc4b2fe7c384381a13592e9346cca9969..ceda781eabf80883468f1bd61404cec4e1409990 100644 (file)
@@ -14,6 +14,7 @@ tinyMCE.init({
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "center",
        theme_advanced_styles : "blockquote,code",
+       theme_advanced_resizing : true,
        gecko_spellcheck : true,
        entity_encoding : "raw",
        add_unload_trigger : false,
index 8d40be3be9a4da326c9e1201e528cb1aea861a9f..8085a774b3fbdef72a4b0460e0ee47f11173ef12 100644 (file)
@@ -90,6 +90,7 @@
                theme_advanced_toolbar_location : "top",
                theme_advanced_toolbar_align : "center",
                theme_advanced_blockformats : "blockquote,code",
+               theme_advanced_resizing : true,
                gecko_spellcheck : true,
                paste_text_sticky : true,
                entity_encoding : "raw",
index f8cf96f7c3b2652582a8150831afd7da6c4c39d7..3a67e8bcc40a0a5336b690fff4d4c90d1e72d582 100644 (file)
@@ -34,6 +34,7 @@ function initEditor(cb){
                        theme_advanced_toolbar_location : "top",
                        theme_advanced_toolbar_align : "center",
                        theme_advanced_blockformats : "blockquote,code",
+                       theme_advanced_resizing : true,
                        gecko_spellcheck : true,
                        paste_text_sticky : true,
                        entity_encoding : "raw",
index 47b92ddf14a3c0d2738ab3874dced43976d022f3..86598bbf6ce7d6e612fd8a08935a4e4b93c6c2f9 100644 (file)
@@ -17,6 +17,7 @@ if(plaintext != 'none') {
                theme_advanced_toolbar_location : "top",
                theme_advanced_toolbar_align : "center",
                theme_advanced_blockformats : "blockquote,code",
+               theme_advanced_resizing : true,
                gecko_spellcheck : true,
                paste_text_sticky : true,
                entity_encoding : "raw",
index 67e7a85aca50364bfeba2bbd9a1c30bff3758f68..2dbdbcdeb7a3f0b95de8442df78a51bf7808b565 100644 (file)
@@ -16,6 +16,7 @@ tinyMCE.init({
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "center",
        theme_advanced_blockformats : "blockquote,code",
+       theme_advanced_resizing : true,
        gecko_spellcheck : true,
        paste_text_sticky : true,
        entity_encoding : "raw",
index c4d81f8cc069f62e514315f7e6ff9c35d3c725af..f03f496fe2948d060e2eb9db03b03f4b1a365480 100644 (file)
@@ -17,6 +17,7 @@ if(plaintext != 'none') {
                theme_advanced_toolbar_location : "top",
                theme_advanced_toolbar_align : "center",
                theme_advanced_blockformats : "blockquote,code",
+               theme_advanced_resizing : true,
                gecko_spellcheck : true,
                paste_text_sticky : true,
                entity_encoding : "raw",
index 3343cac127a5998c8138f51f904dce9be68fe074..049c1bf4b6189eddbc3c9fce7981bbff5b43e48c 100644 (file)
@@ -3,6 +3,7 @@
 
 body {
   background-color: #eeeeee !important;
+  font-family: "Lucida Sans Unicode","Lucida Sans", sans-serif;
 }
 
 header #banner #logo-text {