From d53c1bb48a9fb9105387ea9e77395a66f471a4f6 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sat, 4 Jun 2011 22:43:55 -0700 Subject: [PATCH 01/20] facebook queue: not enough parameters --- addon/facebook/facebook.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon/facebook/facebook.php b/addon/facebook/facebook.php index ac522aab63..cbd0fe490e 100644 --- a/addon/facebook/facebook.php +++ b/addon/facebook/facebook.php @@ -640,7 +640,7 @@ function facebook_post_hook(&$a,&$b) { if(! $likes) { $s = serialize(array('url' => $url, 'item' => $b['id'], 'post' => $postvars)); q("INSERT INTO `queue` ( `network`, `cid`, `created`, `last`, `content`) - VALUES ( '%s', '%s', '%s', '%s') ", + VALUES ( '%s', %d, '%s', '%s', '%s') ", dbesc(NETWORK_FACEBOOK), intval($a->contact), dbesc(datetime_convert()), From 6f34f89ddbbbac5747140991ebf750ddee4d31bf Mon Sep 17 00:00:00 2001 From: Friendika Date: Sat, 4 Jun 2011 22:48:43 -0700 Subject: [PATCH 02/20] mb_string is now required. --- mod/install.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mod/install.php b/mod/install.php index 35c2b3daee..b9deb6114f 100644 --- a/mod/install.php +++ b/mod/install.php @@ -194,7 +194,10 @@ function check_funcs() { if(! function_exists('openssl_public_encrypt')) notice( t('Error: openssl PHP module required but not installed.') . EOL); if(! function_exists('mysqli_connect')) - notice( t('Error: mysqli PHP module required but not installed.') . EOL); + notice( t('Error: mysqli PHP module required but not installed.') . EOL); + if(! function_exists('mb_strlen')) + notice( t('Error: mb_string PHP module required but not installed.') . EOL); + if((x($_SESSION,'sysmsg')) && strlen($_SESSION['sysmsg'])) notice( t('Please see the file "INSTALL.txt".') . EOL); } From dbaf3eca070537f16298015a870b209c3581e388 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 5 Jun 2011 00:19:22 -0700 Subject: [PATCH 03/20] fb queue - wrong var --- addon/facebook/facebook.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon/facebook/facebook.php b/addon/facebook/facebook.php index cbd0fe490e..ae69805fa7 100644 --- a/addon/facebook/facebook.php +++ b/addon/facebook/facebook.php @@ -666,7 +666,7 @@ function fb_queue_hook(&$a,&$b) { if((! is_array($b)) || (! count($b))) return; foreach($b as $x) { - if($b['network'] !== NETWORK_FACEBOOK) + if($x['network'] !== NETWORK_FACEBOOK) continue; $r = q("SELECT `user`.* FROM `user` LEFT JOIN `contact` on `contact`.`uid` = `user`.`uid` WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1", From 182582eed8672b0c75aae747413be2cc6ce0709f Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 5 Jun 2011 02:09:31 -0700 Subject: [PATCH 04/20] load hooks inside queue --- addon/facebook/facebook.php | 16 ++++++++++++---- include/queue.php | 2 ++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/addon/facebook/facebook.php b/addon/facebook/facebook.php index ae69805fa7..657ba7dc23 100644 --- a/addon/facebook/facebook.php +++ b/addon/facebook/facebook.php @@ -662,12 +662,20 @@ function facebook_post_hook(&$a,&$b) { function fb_queue_hook(&$a,&$b) { - require_once('include/queue_fn.php'); - if((! is_array($b)) || (! count($b))) + $qi = q("SELECT * FROM `queue` WHERE `network` = '%s'", + dbesc(NETWORK_FACEBOOK) + ); + if(! count($qi)) return; - foreach($b as $x) { + + require_once('include/queue_fn.php'); + + foreach($qi as $x) { if($x['network'] !== NETWORK_FACEBOOK) continue; + + logger('facebook_queue: run'); + $r = q("SELECT `user`.* FROM `user` LEFT JOIN `contact` on `contact`.`uid` = `user`.`uid` WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1", intval($x['cid']) @@ -698,7 +706,7 @@ function fb_queue_hook(&$a,&$b) { dbesc('fb::' . $retj->id), intval($item) ); - logger('facebook queue: success: ' . $j); + logger('facebook_queue: success: ' . $j); remove_queue_item($x['id']); } else { diff --git a/include/queue.php b/include/queue.php index cc36b2f625..79f656017c 100644 --- a/include/queue.php +++ b/include/queue.php @@ -24,6 +24,8 @@ function queue_run($argv, $argc){ $a->set_baseurl(get_config('system','url')); + load_hooks(); + $deadguys = array(); logger('queue: start'); From 7b02e178a4dd56e7658af5f01a50a778d3212573 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 5 Jun 2011 02:18:18 -0700 Subject: [PATCH 05/20] more work on facebook re-queue --- include/queue.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/queue.php b/include/queue.php index 79f656017c..cbda196dac 100644 --- a/include/queue.php +++ b/include/queue.php @@ -55,7 +55,11 @@ function queue_run($argv, $argc){ require_once('include/salmon.php'); foreach($r as $q_item) { - $qi = q("SELECT * FROM `queue` WHERE `id` = %d LIMIT 1", + + // queue_predeliver hooks may have changed the queue db details, + // so check again if this entry still needs processing + + $qi = q("SELECT * FROM `queue` WHERE `id` = %d AND `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE ", intval($q_item['id']) ); if(! count($qi)) From 4284c6f9ee471d253354b8ba9508281b98976f52 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 5 Jun 2011 17:32:56 -0700 Subject: [PATCH 06/20] use icon for language selector instead of hotkey --- boot.php | 3 ++- images/icons.png | Bin 8875 -> 9382 bytes include/main.js | 24 ++++++++++++------------ view/theme/duepuntozero/style.css | 12 ++++++++++-- view/theme/loozah/style.css | 10 +++++++++- 5 files changed, 33 insertions(+), 16 deletions(-) diff --git a/boot.php b/boot.php index 3ca0839011..a67b96a085 100644 --- a/boot.php +++ b/boot.php @@ -4,7 +4,7 @@ set_time_limit(0); ini_set('pcre.backtrack_limit', 250000); -define ( 'FRIENDIKA_VERSION', '2.2.1001' ); +define ( 'FRIENDIKA_VERSION', '2.2.1002' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); define ( 'DB_UPDATE_VERSION', 1060 ); @@ -2766,6 +2766,7 @@ function unamp($s) { if(! function_exists('lang_selector')) { function lang_selector() { global $lang; + $o .= '
'; $o .= '