From b8757fb45624d038e1f072fa40fb439608532164 Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 3 Mar 2011 15:41:08 -0800 Subject: make sure db queries never get called if the database isn't open --- boot.php | 2 +- include/dba.php | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/boot.php b/boot.php index 3cf01b4a0..a97f85814 100644 --- a/boot.php +++ b/boot.php @@ -3,7 +3,7 @@ set_time_limit(0); define ( 'BUILD_ID', 1039 ); -define ( 'FRIENDIKA_VERSION', '2.10.0908' ); +define ( 'FRIENDIKA_VERSION', '2.10.0909' ); define ( 'DFRN_PROTOCOL_VERSION', '2.1' ); define ( 'EOL', "
\r\n" ); diff --git a/include/dba.php b/include/dba.php index b05a1cabf..b89648bca 100644 --- a/include/dba.php +++ b/include/dba.php @@ -20,12 +20,14 @@ class dba { function __construct($server,$user,$pass,$db,$install = false) { $this->db = @new mysqli($server,$user,$pass,$db); - if((mysqli_connect_errno()) && (! $install)) { + if(! mysql_connect_errno()) { + $this->connected = true; + } + else { $this->db = null; - system_unavailable(); + if(! $install) + system_unavailable(); } - else - $this->connected = true; } public function getdb() { @@ -34,7 +36,7 @@ class dba { public function q($sql) { - if(! $this->db ) + if((! $this->db) || (! $this->connected)) return false; $result = @$this->db->query($sql); @@ -92,7 +94,8 @@ class dba { } public function escape($str) { - return @$this->db->real_escape_string($str); + if($this->db && $this->connected) + return @$this->db->real_escape_string($str); } function __destruct() { -- cgit v1.2.3 From 69e2252fd6fc8acd8bf5b0fcecd8c329d71c9673 Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 3 Mar 2011 15:47:13 -0800 Subject: that would be mysql !i! connect_errno... --- include/dba.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/dba.php b/include/dba.php index b89648bca..d75ed560a 100644 --- a/include/dba.php +++ b/include/dba.php @@ -20,7 +20,7 @@ class dba { function __construct($server,$user,$pass,$db,$install = false) { $this->db = @new mysqli($server,$user,$pass,$db); - if(! mysql_connect_errno()) { + if(! mysqli_connect_errno()) { $this->connected = true; } else { -- cgit v1.2.3 From 71d481069792a099a3cbc714d92b1cc528d60c6d Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 3 Mar 2011 20:58:39 -0800 Subject: photo in mail message getting bogus response --- mod/message.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mod/message.php b/mod/message.php index 466b0befa..4821a45d2 100644 --- a/mod/message.php +++ b/mod/message.php @@ -165,9 +165,12 @@ function message_content(&$a) { if(($a->argc > 1) && ($a->argv[1] === 'new')) { $tpl = load_view_file('view/msg-header.tpl'); - - $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl())); + $a->page['htmlhead'] .= replace_macros($tpl, array( + '$baseurl' => $a->get_baseurl(), + '$nickname' => $a->user['nickname'] + )); + $select = contact_select('messageto','message-to-select', false, 4, true); $tpl = load_view_file('view/prv_message.tpl'); $o .= replace_macros($tpl,array( -- cgit v1.2.3 From 15d3be18a96606cdb099050e964a848fb0b252e6 Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 3 Mar 2011 22:53:20 -0800 Subject: use prepare_body for text preparation --- view/de/profile_advanced.php | 20 ++++++++++---------- view/en/profile_advanced.php | 20 ++++++++++---------- view/fr/profile_advanced.php | 20 ++++++++++---------- view/it/profile_advanced.php | 20 ++++++++++---------- 4 files changed, 40 insertions(+), 40 deletions(-) diff --git a/view/de/profile_advanced.php b/view/de/profile_advanced.php index d2b9d0612..aec1b0108 100644 --- a/view/de/profile_advanced.php +++ b/view/de/profile_advanced.php @@ -113,7 +113,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['about'])) { +if($txt = prepare_body($a->profile['about'])) { $o .= <<< EOT
About:
@@ -124,7 +124,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['interest'])) { +if($txt = prepare_body($a->profile['interest'])) { $o .= <<< EOT
Hobbies/Interests:
@@ -135,7 +135,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['contact'])) { +if($txt = prepare_body($a->profile['contact'])) { $o .= <<< EOT
Contact information and Social Networks:
@@ -146,7 +146,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['music'])) { +if($txt = prepare_body($a->profile['music'])) { $o .= <<< EOT
Musical interests:
@@ -157,7 +157,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['book'])) { +if($txt = prepare_body($a->profile['book'])) { $o .= <<< EOT
Books, literature:
@@ -168,7 +168,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['tv'])) { +if($txt = prepare_body($a->profile['tv'])) { $o .= <<< EOT
Television:
@@ -179,7 +179,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['film'])) { +if($txt = prepare_body($a->profile['film'])) { $o .= <<< EOT
Film/dance/culture/entertainment:
@@ -190,7 +190,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['romance'])) { +if($txt = prepare_body($a->profile['romance'])) { $o .= <<< EOT
Love/romance:
@@ -201,7 +201,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['work'])) { +if($txt = prepare_body($a->profile['work'])) { $o .= <<< EOT
Work/employment:
@@ -212,7 +212,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['education'])) { +if($txt = prepare_body($a->profile['education'])) { $o .= <<< EOT
School/education:
diff --git a/view/en/profile_advanced.php b/view/en/profile_advanced.php index d2b9d0612..aec1b0108 100644 --- a/view/en/profile_advanced.php +++ b/view/en/profile_advanced.php @@ -113,7 +113,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['about'])) { +if($txt = prepare_body($a->profile['about'])) { $o .= <<< EOT
About:
@@ -124,7 +124,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['interest'])) { +if($txt = prepare_body($a->profile['interest'])) { $o .= <<< EOT
Hobbies/Interests:
@@ -135,7 +135,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['contact'])) { +if($txt = prepare_body($a->profile['contact'])) { $o .= <<< EOT
Contact information and Social Networks:
@@ -146,7 +146,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['music'])) { +if($txt = prepare_body($a->profile['music'])) { $o .= <<< EOT
Musical interests:
@@ -157,7 +157,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['book'])) { +if($txt = prepare_body($a->profile['book'])) { $o .= <<< EOT
Books, literature:
@@ -168,7 +168,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['tv'])) { +if($txt = prepare_body($a->profile['tv'])) { $o .= <<< EOT
Television:
@@ -179,7 +179,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['film'])) { +if($txt = prepare_body($a->profile['film'])) { $o .= <<< EOT
Film/dance/culture/entertainment:
@@ -190,7 +190,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['romance'])) { +if($txt = prepare_body($a->profile['romance'])) { $o .= <<< EOT
Love/romance:
@@ -201,7 +201,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['work'])) { +if($txt = prepare_body($a->profile['work'])) { $o .= <<< EOT
Work/employment:
@@ -212,7 +212,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['education'])) { +if($txt = prepare_body($a->profile['education'])) { $o .= <<< EOT
School/education:
diff --git a/view/fr/profile_advanced.php b/view/fr/profile_advanced.php index f2c891383..c7f8834da 100644 --- a/view/fr/profile_advanced.php +++ b/view/fr/profile_advanced.php @@ -113,7 +113,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['about'])) { +if($txt = prepare_body($a->profile['about'])) { $o .= <<< EOT
About:
@@ -124,7 +124,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['interest'])) { +if($txt = prepare_body($a->profile['interest'])) { $o .= <<< EOT
Hobbies/Interests:
@@ -135,7 +135,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['contact'])) { +if($txt = prepare_body($a->profile['contact'])) { $o .= <<< EOT
Contact information and Social Networks:
@@ -146,7 +146,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['music'])) { +if($txt = prepare_body($a->profile['music'])) { $o .= <<< EOT
Musical interests:
@@ -157,7 +157,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['book'])) { +if($txt = prepare_body($a->profile['book'])) { $o .= <<< EOT
Books, literature:
@@ -168,7 +168,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['tv'])) { +if($txt = prepare_body($a->profile['tv'])) { $o .= <<< EOT
Television:
@@ -179,7 +179,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['film'])) { +if($txt = prepare_body($a->profile['film'])) { $o .= <<< EOT
Film/dance/culture/entertainment:
@@ -190,7 +190,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['romance'])) { +if($txt = prepare_body($a->profile['romance'])) { $o .= <<< EOT
Love/romance:
@@ -201,7 +201,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['work'])) { +if($txt = prepare_body($a->profile['work'])) { $o .= <<< EOT
Work/employment:
@@ -212,7 +212,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['education'])) { +if($txt = prepare_body($a->profile['education'])) { $o .= <<< EOT
School/education:
diff --git a/view/it/profile_advanced.php b/view/it/profile_advanced.php index 44327f6a6..ee6d8b50d 100644 --- a/view/it/profile_advanced.php +++ b/view/it/profile_advanced.php @@ -113,7 +113,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['about'])) { +if($txt = prepare_body($a->profile['about'])) { $o .= <<< EOT
Informazioni varie:
@@ -124,7 +124,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['interest'])) { +if($txt = prepare_body($a->profile['interest'])) { $o .= <<< EOT
Hobbie/Interessi:
@@ -135,7 +135,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['contact'])) { +if($txt = prepare_body($a->profile['contact'])) { $o .= <<< EOT
Informazioni su contatti e Social Networks:
@@ -146,7 +146,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['music'])) { +if($txt = prepare_body($a->profile['music'])) { $o .= <<< EOT
Interessi musicali:
@@ -157,7 +157,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['book'])) { +if($txt = prepare_body($a->profile['book'])) { $o .= <<< EOT
Libri, letteratura:
@@ -168,7 +168,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['tv'])) { +if($txt = prepare_body($a->profile['tv'])) { $o .= <<< EOT
Televisione:
@@ -179,7 +179,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['film'])) { +if($txt = prepare_body($a->profile['film'])) { $o .= <<< EOT
Film/danza/cultura/intrattenimento:
@@ -190,7 +190,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['romance'])) { +if($txt = prepare_body($a->profile['romance'])) { $o .= <<< EOT
Amore/romanticismo:
@@ -201,7 +201,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['work'])) { +if($txt = prepare_body($a->profile['work'])) { $o .= <<< EOT
Lavoro/impiego:
@@ -212,7 +212,7 @@ $o .= <<< EOT EOT; } -if($txt = bbcode($a->profile['education'])) { +if($txt = prepare_body($a->profile['education'])) { $o .= <<< EOT
Scuola/educazione:
-- cgit v1.2.3 From 3c076b53fe0fb3d5e625b773a5e4723dece0a057 Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 3 Mar 2011 23:13:16 -0800 Subject: use prepare_text instead of prepare_body --- boot.php | 9 ++++++++- view/de/profile_advanced.php | 20 ++++++++++---------- view/en/profile_advanced.php | 21 ++++++++++----------- view/fr/profile_advanced.php | 20 ++++++++++---------- view/it/profile_advanced.php | 20 ++++++++++---------- 5 files changed, 48 insertions(+), 42 deletions(-) diff --git a/boot.php b/boot.php index a97f85814..ed7c9956c 100644 --- a/boot.php +++ b/boot.php @@ -40,6 +40,8 @@ define ( 'REGISTER_OPEN', 2 ); /** * relationship types + * When used in contact records, this indicates that 'uid' has + * this relationship with contact['name'] */ define ( 'REL_VIP', 1); @@ -2417,10 +2419,15 @@ function link_compare($a,$b) { if(! function_exists('prepare_body')) { function prepare_body($item) { + return prepare_text($item['body']); +}} + +if(! function_exists('prepare_text')) { +function prepare_text($text) { require_once('include/bbcode.php'); - $s = smilies(bbcode($item['body'])); + $s = smilies(bbcode($text)); return $s; }} diff --git a/view/de/profile_advanced.php b/view/de/profile_advanced.php index aec1b0108..ec6eb6e3a 100644 --- a/view/de/profile_advanced.php +++ b/view/de/profile_advanced.php @@ -113,7 +113,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['about'])) { +if($txt = prepare_text($a->profile['about'])) { $o .= <<< EOT
About:
@@ -124,7 +124,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['interest'])) { +if($txt = prepare_text($a->profile['interest'])) { $o .= <<< EOT
Hobbies/Interests:
@@ -135,7 +135,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['contact'])) { +if($txt = prepare_text($a->profile['contact'])) { $o .= <<< EOT
Contact information and Social Networks:
@@ -146,7 +146,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['music'])) { +if($txt = prepare_text($a->profile['music'])) { $o .= <<< EOT
Musical interests:
@@ -157,7 +157,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['book'])) { +if($txt = prepare_text($a->profile['book'])) { $o .= <<< EOT
Books, literature:
@@ -168,7 +168,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['tv'])) { +if($txt = prepare_text($a->profile['tv'])) { $o .= <<< EOT
Television:
@@ -179,7 +179,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['film'])) { +if($txt = prepare_text($a->profile['film'])) { $o .= <<< EOT
Film/dance/culture/entertainment:
@@ -190,7 +190,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['romance'])) { +if($txt = prepare_text($a->profile['romance'])) { $o .= <<< EOT
Love/romance:
@@ -201,7 +201,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['work'])) { +if($txt = prepare_text($a->profile['work'])) { $o .= <<< EOT
Work/employment:
@@ -212,7 +212,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['education'])) { +if($txt = prepare_text($a->profile['education'])) { $o .= <<< EOT
School/education:
diff --git a/view/en/profile_advanced.php b/view/en/profile_advanced.php index aec1b0108..6d2ecba4d 100644 --- a/view/en/profile_advanced.php +++ b/view/en/profile_advanced.php @@ -112,8 +112,7 @@ $o .= <<< EOT
EOT; } - -if($txt = prepare_body($a->profile['about'])) { +if($txt = prepare_text($a->profile['about'])) { $o .= <<< EOT
About:
@@ -124,7 +123,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['interest'])) { +if($txt = prepare_text($a->profile['interest'])) { $o .= <<< EOT
Hobbies/Interests:
@@ -135,7 +134,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['contact'])) { +if($txt = prepare_text($a->profile['contact'])) { $o .= <<< EOT
Contact information and Social Networks:
@@ -146,7 +145,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['music'])) { +if($txt = prepare_text($a->profile['music'])) { $o .= <<< EOT
Musical interests:
@@ -157,7 +156,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['book'])) { +if($txt = prepare_text($a->profile['book'])) { $o .= <<< EOT
Books, literature:
@@ -168,7 +167,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['tv'])) { +if($txt = prepare_text($a->profile['tv'])) { $o .= <<< EOT
Television:
@@ -179,7 +178,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['film'])) { +if($txt = prepare_text($a->profile['film'])) { $o .= <<< EOT
Film/dance/culture/entertainment:
@@ -190,7 +189,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['romance'])) { +if($txt = prepare_text($a->profile['romance'])) { $o .= <<< EOT
Love/romance:
@@ -201,7 +200,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['work'])) { +if($txt = prepare_text($a->profile['work'])) { $o .= <<< EOT
Work/employment:
@@ -212,7 +211,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['education'])) { +if($txt = prepare_text($a->profile['education'])) { $o .= <<< EOT
School/education:
diff --git a/view/fr/profile_advanced.php b/view/fr/profile_advanced.php index c7f8834da..73f7f135e 100644 --- a/view/fr/profile_advanced.php +++ b/view/fr/profile_advanced.php @@ -113,7 +113,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['about'])) { +if($txt = prepare_text($a->profile['about'])) { $o .= <<< EOT
About:
@@ -124,7 +124,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['interest'])) { +if($txt = prepare_text($a->profile['interest'])) { $o .= <<< EOT
Hobbies/Interests:
@@ -135,7 +135,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['contact'])) { +if($txt = prepare_text($a->profile['contact'])) { $o .= <<< EOT
Contact information and Social Networks:
@@ -146,7 +146,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['music'])) { +if($txt = prepare_text($a->profile['music'])) { $o .= <<< EOT
Musical interests:
@@ -157,7 +157,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['book'])) { +if($txt = prepare_text($a->profile['book'])) { $o .= <<< EOT
Books, literature:
@@ -168,7 +168,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['tv'])) { +if($txt = prepare_text($a->profile['tv'])) { $o .= <<< EOT
Television:
@@ -179,7 +179,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['film'])) { +if($txt = prepare_text($a->profile['film'])) { $o .= <<< EOT
Film/dance/culture/entertainment:
@@ -190,7 +190,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['romance'])) { +if($txt = prepare_text($a->profile['romance'])) { $o .= <<< EOT
Love/romance:
@@ -201,7 +201,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['work'])) { +if($txt = prepare_text($a->profile['work'])) { $o .= <<< EOT
Work/employment:
@@ -212,7 +212,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['education'])) { +if($txt = prepare_text($a->profile['education'])) { $o .= <<< EOT
School/education:
diff --git a/view/it/profile_advanced.php b/view/it/profile_advanced.php index ee6d8b50d..fe065d46f 100644 --- a/view/it/profile_advanced.php +++ b/view/it/profile_advanced.php @@ -113,7 +113,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['about'])) { +if($txt = prepare_text($a->profile['about'])) { $o .= <<< EOT
Informazioni varie:
@@ -124,7 +124,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['interest'])) { +if($txt = prepare_text($a->profile['interest'])) { $o .= <<< EOT
Hobbie/Interessi:
@@ -135,7 +135,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['contact'])) { +if($txt = prepare_text($a->profile['contact'])) { $o .= <<< EOT
Informazioni su contatti e Social Networks:
@@ -146,7 +146,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['music'])) { +if($txt = prepare_text($a->profile['music'])) { $o .= <<< EOT
Interessi musicali:
@@ -157,7 +157,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['book'])) { +if($txt = prepare_text($a->profile['book'])) { $o .= <<< EOT
Libri, letteratura:
@@ -168,7 +168,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['tv'])) { +if($txt = prepare_text($a->profile['tv'])) { $o .= <<< EOT
Televisione:
@@ -179,7 +179,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['film'])) { +if($txt = prepare_text($a->profile['film'])) { $o .= <<< EOT
Film/danza/cultura/intrattenimento:
@@ -190,7 +190,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['romance'])) { +if($txt = prepare_text($a->profile['romance'])) { $o .= <<< EOT
Amore/romanticismo:
@@ -201,7 +201,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['work'])) { +if($txt = prepare_text($a->profile['work'])) { $o .= <<< EOT
Lavoro/impiego:
@@ -212,7 +212,7 @@ $o .= <<< EOT EOT; } -if($txt = prepare_body($a->profile['education'])) { +if($txt = prepare_text($a->profile['education'])) { $o .= <<< EOT
Scuola/educazione:
-- cgit v1.2.3 From 216f038456cae1016e030b33cac79f8ed690e366 Mon Sep 17 00:00:00 2001 From: Friendika Date: Fri, 4 Mar 2011 20:55:32 -0800 Subject: icon changes, feed security improvements --- images/friendika-128.jpg | Bin 0 -> 8368 bytes images/friendika-128.png | Bin 0 -> 7086 bytes images/friendika-16.jpg | Bin 0 -> 659 bytes images/friendika-16.png | Bin 0 -> 699 bytes images/friendika-256.jpg | Bin 0 -> 17130 bytes images/friendika-256.png | Bin 0 -> 11869 bytes images/friendika-32.jpg | Bin 0 -> 1541 bytes images/friendika-32.png | Bin 0 -> 1411 bytes images/friendika-64.jpg | Bin 0 -> 3450 bytes images/friendika-64.png | Bin 0 -> 3174 bytes images/friendika.svg | 240 +++++++++++++++++++ include/nav.php | 2 +- include/poller.php | 381 ++++++++++++++++--------------- mod/pubsub.php | 11 +- mod/wall_upload.php | 4 +- view/de/head.tpl | 2 +- view/de/mail_received_html_body_eml.tpl | 2 +- view/en/head.tpl | 2 +- view/en/mail_received_html_body_eml.tpl | 2 +- view/fr/head.tpl | 2 +- view/fr/mail_received_html_body_eml.tpl | 2 +- view/it/head.tpl | 2 +- view/it/mail_received_html_body_eml.tpl | 2 +- view/theme/duepuntozero/friendika-16.png | Bin 0 -> 699 bytes view/theme/duepuntozero/style.css | 7 +- view/theme/loozah/friendika-16.png | Bin 0 -> 699 bytes view/theme/loozah/style.css | 2 +- 27 files changed, 459 insertions(+), 204 deletions(-) create mode 100644 images/friendika-128.jpg create mode 100644 images/friendika-128.png create mode 100644 images/friendika-16.jpg create mode 100644 images/friendika-16.png create mode 100644 images/friendika-256.jpg create mode 100644 images/friendika-256.png create mode 100644 images/friendika-32.jpg create mode 100644 images/friendika-32.png create mode 100644 images/friendika-64.jpg create mode 100644 images/friendika-64.png create mode 100644 images/friendika.svg create mode 100644 view/theme/duepuntozero/friendika-16.png create mode 100644 view/theme/loozah/friendika-16.png diff --git a/images/friendika-128.jpg b/images/friendika-128.jpg new file mode 100644 index 000000000..f7d86ae50 Binary files /dev/null and b/images/friendika-128.jpg differ diff --git a/images/friendika-128.png b/images/friendika-128.png new file mode 100644 index 000000000..1d1c8e320 Binary files /dev/null and b/images/friendika-128.png differ diff --git a/images/friendika-16.jpg b/images/friendika-16.jpg new file mode 100644 index 000000000..ce59a70a0 Binary files /dev/null and b/images/friendika-16.jpg differ diff --git a/images/friendika-16.png b/images/friendika-16.png new file mode 100644 index 000000000..1a742ecdc Binary files /dev/null and b/images/friendika-16.png differ diff --git a/images/friendika-256.jpg b/images/friendika-256.jpg new file mode 100644 index 000000000..182810d62 Binary files /dev/null and b/images/friendika-256.jpg differ diff --git a/images/friendika-256.png b/images/friendika-256.png new file mode 100644 index 000000000..ea931c85f Binary files /dev/null and b/images/friendika-256.png differ diff --git a/images/friendika-32.jpg b/images/friendika-32.jpg new file mode 100644 index 000000000..4e697411d Binary files /dev/null and b/images/friendika-32.jpg differ diff --git a/images/friendika-32.png b/images/friendika-32.png new file mode 100644 index 000000000..a300b7bea Binary files /dev/null and b/images/friendika-32.png differ diff --git a/images/friendika-64.jpg b/images/friendika-64.jpg new file mode 100644 index 000000000..050830fff Binary files /dev/null and b/images/friendika-64.jpg differ diff --git a/images/friendika-64.png b/images/friendika-64.png new file mode 100644 index 000000000..a1c042293 Binary files /dev/null and b/images/friendika-64.png differ diff --git a/images/friendika.svg b/images/friendika.svg new file mode 100644 index 000000000..2155d0b00 --- /dev/null +++ b/images/friendika.svg @@ -0,0 +1,240 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + diff --git a/include/nav.php b/include/nav.php index 5e29cc3c4..4104cf3cf 100644 --- a/include/nav.php +++ b/include/nav.php @@ -124,7 +124,7 @@ function nav(&$a) { $banner = get_config('system','banner'); if($banner === false) - $banner .= 'logoFriendika'; + $banner .= 'logoFriendika'; $a->page['nav'] .= ''; diff --git a/include/poller.php b/include/poller.php index d54c88e05..fd02e0198 100644 --- a/include/poller.php +++ b/include/poller.php @@ -2,18 +2,18 @@ require_once("boot.php"); function poller_run($argv, $argc){ - global $a, $db; + global $a, $db; - if(is_null($a)){ - $a = new App; - } + if(is_null($a)) { + $a = new App; + } - if(is_null($db)){ - @include(".htconfig.php"); - require_once("dba.php"); - $db = new dba($db_host, $db_user, $db_pass, $db_data); - unset($db_host, $db_user, $db_pass, $db_data); - }; + if(is_null($db)) { + @include(".htconfig.php"); + require_once("dba.php"); + $db = new dba($db_host, $db_user, $db_pass, $db_data); + unset($db_host, $db_user, $db_pass, $db_data); + }; require_once('session.php'); require_once('datetime.php'); @@ -30,7 +30,7 @@ function poller_run($argv, $argc){ proc_run('php',"include/queue.php"); // clear old cache - q("DELETE FROM `cache` WHERE `updated`<'%s'", + q("DELETE FROM `cache` WHERE `updated` < '%s'", dbesc(datetime_convert('UTC','UTC',"now - 30 days"))); $manual_id = 0; @@ -47,245 +47,254 @@ function poller_run($argv, $argc){ $sql_extra = (($manual_id) ? " AND `id` = $manual_id " : ""); - // 'stat' clause is a temporary measure until we have federation subscriptions working both directions - $contacts = q("SELECT * FROM `contact` - WHERE ( ( `network` = 'dfrn' AND ( `dfrn-id` != '' OR (`issued-id` != '' AND `duplex` = 1))) - OR ( `network` IN ( 'stat', 'feed' ) AND `poll` != '' )) + $contacts = q("SELECT `id` FROM `contact` + WHERE ( `rel` = %d OR `rel` = %d ) AND `poll` != '' $sql_extra - AND `self` = 0 AND `blocked` = 0 AND `readonly` = 0 ORDER BY RAND()"); + AND `self` = 0 AND `blocked` = 0 AND `readonly` = 0 ORDER BY RAND()", + intval(REL_FAN), + intval(REL_BUD) + ); - if(! count($contacts)){ + if(! count($contacts)) { return; } - foreach($contacts as $contact) { + foreach($contacts as $c) { - if($manual_id) - $contact['last-update'] = '0000-00-00 00:00:00'; + $res = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1", + intval($c['id']) + ); - if($contact['priority'] || $contact['subhub']) { + if(! count($res)) + continue; - $hub_update = true; - $update = false; + foreach($res as $contact) { + if($manual_id) + $contact['last-update'] = '0000-00-00 00:00:00'; - $t = $contact['last-update']; + if($contact['priority'] || $contact['subhub']) { - // We should be getting everything via a hub. But just to be sure, let's check once a day. - // (You can make this more or less frequent if desired by setting 'pushpoll_frequency' appropriately) - // This also lets us update our subscription to the hub, and add or replace hubs in case it - // changed. We will only update hubs once a day, regardless of 'pushpoll_frequency'. + $hub_update = true; + $update = false; + $t = $contact['last-update']; - if($contact['subhub']) { - $interval = get_config('system','pushpoll_frequency'); - $contact['priority'] = (($interval !== false) ? intval($interval) : 3); - $hub_update = false; + // We should be getting everything via a hub. But just to be sure, let's check once a day. + // (You can make this more or less frequent if desired by setting 'pushpoll_frequency' appropriately) + // This also lets us update our subscription to the hub, and add or replace hubs in case it + // changed. We will only update hubs once a day, regardless of 'pushpoll_frequency'. - if((datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")) || $force) - $hub_update = true; - } + if($contact['subhub']) { + $interval = get_config('system','pushpoll_frequency'); + $contact['priority'] = (($interval !== false) ? intval($interval) : 3); + $hub_update = false; + + if((datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")) || $force) + $hub_update = true; + } - /** - * Based on $contact['priority'], should we poll this site now? Or later? - */ - - switch ($contact['priority']) { - case 5: - if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 month")) - $update = true; - break; - case 4: - if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 week")) - $update = true; - break; - case 3: - if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")) - $update = true; - break; - case 2: - if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 12 hour")) - $update = true; - break; - case 1: - default: - if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 hour")) - $update = true; - break; + /** + * Based on $contact['priority'], should we poll this site now? Or later? + */ + + switch ($contact['priority']) { + case 5: + if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 month")) + $update = true; + break; + case 4: + if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 week")) + $update = true; + break; + case 3: + if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")) + $update = true; + break; + case 2: + if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 12 hour")) + $update = true; + break; + case 1: + default: + if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 hour")) + $update = true; + break; + } + if((! $update) && (! $force)) + continue; } - if((! $update) && (! $force)) + + $importer_uid = $contact['uid']; + + $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1", + intval($importer_uid) + ); + if(! count($r)) continue; - } - $importer_uid = $contact['uid']; + $importer = $r[0]; - $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1", - intval($importer_uid) - ); - if(! count($r)) - continue; + logger("poller: poll: IMPORTER: {$importer['name']}, CONTACT: {$contact['name']}"); - $importer = $r[0]; + $last_update = (($contact['last-update'] === '0000-00-00 00:00:00') + ? datetime_convert('UTC','UTC','now - 30 days', ATOM_TIME) + : datetime_convert('UTC','UTC',$contact['last-update'], ATOM_TIME) + ); - logger("poller: poll: IMPORTER: {$importer['name']}, CONTACT: {$contact['name']}"); + if($contact['network'] === 'dfrn') { - $last_update = (($contact['last-update'] === '0000-00-00 00:00:00') - ? datetime_convert('UTC','UTC','now - 30 days', ATOM_TIME) - : datetime_convert('UTC','UTC',$contact['last-update'], ATOM_TIME) - ); + $idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']); - if($contact['network'] === 'dfrn') { + if(intval($contact['duplex']) && $contact['dfrn-id']) + $idtosend = '0:' . $orig_id; + if(intval($contact['duplex']) && $contact['issued-id']) + $idtosend = '1:' . $orig_id; - $idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']); + $url = $contact['poll'] . '?dfrn_id=' . $idtosend + . '&dfrn_version=' . DFRN_PROTOCOL_VERSION + . '&type=data&last_update=' . $last_update ; + + $xml = fetch_url($url); - if(intval($contact['duplex']) && $contact['dfrn-id']) - $idtosend = '0:' . $orig_id; - if(intval($contact['duplex']) && $contact['issued-id']) - $idtosend = '1:' . $orig_id; + logger('poller: handshake with url ' . $url . ' returns xml: ' . $xml, LOGGER_DATA); - $url = $contact['poll'] . '?dfrn_id=' . $idtosend - . '&dfrn_version=' . DFRN_PROTOCOL_VERSION - . '&type=data&last_update=' . $last_update ; - - $xml = fetch_url($url); - logger('poller: handshake with url ' . $url . ' returns xml: ' . $xml, LOGGER_DATA); + if(! $xml) { + logger("poller: $url appears to be dead - marking for death "); + // dead connection - might be a transient event, or this might + // mean the software was uninstalled or the domain expired. + // Will keep trying for one month. + mark_for_death($contact); + // set the last-update so we don't keep polling - if(! $xml) { - logger("poller: $url appears to be dead - marking for death "); - // dead connection - might be a transient event, or this might - // mean the software was uninstalled or the domain expired. - // Will keep trying for one month. - mark_for_death($contact); + $r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1", + dbesc(datetime_convert()), + intval($contact['id']) + ); - // set the last-update so we don't keep polling + continue; + } - $r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1", - dbesc(datetime_convert()), - intval($contact['id']) - ); + if(! strstr($xml,'status) == 1) { + logger("poller: $url replied status 1 - marking for death "); + // we may not be friends anymore. Will keep trying for one month. + // set the last-update so we don't keep polling - $res = simplexml_load_string($xml); + $r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1", + dbesc(datetime_convert()), + intval($contact['id']) + ); - if(intval($res->status) == 1) { - logger("poller: $url replied status 1 - marking for death "); + mark_for_death($contact); + } + else { + if($contact['term-date'] != '0000-00-00 00:00:00') { + logger("poller: $url back from the dead - removing mark for death"); + unmark_for_death($contact); + } + } - // we may not be friends anymore. Will keep trying for one month. - // set the last-update so we don't keep polling + if((intval($res->status) != 0) || (! strlen($res->challenge)) || (! strlen($res->dfrn_id))) + continue; - $r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1", - dbesc(datetime_convert()), - intval($contact['id']) - ); + $postvars = array(); - mark_for_death($contact); - } - else { - if($contact['term-date'] != '0000-00-00 00:00:00') { - logger("poller: $url back from the dead - removing mark for death"); - unmark_for_death($contact); + $sent_dfrn_id = hex2bin((string) $res->dfrn_id); + $challenge = hex2bin((string) $res->challenge); + + $final_dfrn_id = ''; + + if(($contact['duplex']) && strlen($contact['prvkey'])) { + openssl_private_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['prvkey']); + openssl_private_decrypt($challenge,$postvars['challenge'],$contact['prvkey']); + } + else { + openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']); + openssl_public_decrypt($challenge,$postvars['challenge'],$contact['pubkey']); } - } - if((intval($res->status) != 0) || (! strlen($res->challenge)) || (! strlen($res->dfrn_id))) - continue; + $final_dfrn_id = substr($final_dfrn_id, 0, strpos($final_dfrn_id, '.')); - $postvars = array(); + if(strpos($final_dfrn_id,':') == 1) + $final_dfrn_id = substr($final_dfrn_id,2); - $sent_dfrn_id = hex2bin((string) $res->dfrn_id); - $challenge = hex2bin((string) $res->challenge); + if($final_dfrn_id != $orig_id) { + + // did not decode properly - cannot trust this site + continue; + } - $final_dfrn_id = ''; + $postvars['dfrn_id'] = $idtosend; + $postvars['dfrn_version'] = DFRN_PROTOCOL_VERSION; - if(($contact['duplex']) && strlen($contact['prvkey'])) { - openssl_private_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['prvkey']); - openssl_private_decrypt($challenge,$postvars['challenge'],$contact['prvkey']); + $xml = post_url($contact['poll'],$postvars); } else { - openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']); - openssl_public_decrypt($challenge,$postvars['challenge'],$contact['pubkey']); - } - $final_dfrn_id = substr($final_dfrn_id, 0, strpos($final_dfrn_id, '.')); + // $contact['network'] !== 'dfrn' - if(strpos($final_dfrn_id,':') == 1) - $final_dfrn_id = substr($final_dfrn_id,2); + $xml = fetch_url($contact['poll']); + } - if($final_dfrn_id != $orig_id) { + logger('poller: received xml : ' . $xml, LOGGER_DATA); - // did not decode properly - cannot trust this site + if(! strstr($xml,'
\"$basename\"

"; killme(); - return; // NOTREACHED -} \ No newline at end of file + // NOTREACHED +} diff --git a/view/de/head.tpl b/view/de/head.tpl index c3ec3d2c9..17b7706f8 100644 --- a/view/de/head.tpl +++ b/view/de/head.tpl @@ -1,7 +1,7 @@ - +