From e6444adafdd3c50913ca44d8701996e058e064b9 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Mon, 25 Jul 2011 16:52:30 +0200 Subject: change nav selected css class --- mod/community.php | 2 +- mod/contacts.php | 2 +- mod/directory.php | 2 +- mod/message.php | 2 +- mod/network.php | 2 +- mod/notifications.php | 2 +- mod/profile.php | 2 +- mod/profiles.php | 2 +- mod/settings.php | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) (limited to 'mod') diff --git a/mod/community.php b/mod/community.php index cf43598b5..f8bd88d86 100644 --- a/mod/community.php +++ b/mod/community.php @@ -25,7 +25,7 @@ function community_content(&$a, $update = 0) { $o .= '

' . t('Community') . '

'; if(! $update) { - $o .= ''; + $o .= set_nav_selected('nav-community-link'); $o .= '
' . "\r\n"; $o .= "\r\n"; } diff --git a/mod/contacts.php b/mod/contacts.php index 2fc01a0d8..1fa07688c 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -112,7 +112,7 @@ function contacts_content(&$a) { $sort_type = 0; $o = ''; - $o .= ''; + $o .= set_nav_selected('nav-contacts-link'); $_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd; diff --git a/mod/directory.php b/mod/directory.php index 0c60f04bf..03b6ab4d1 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -22,7 +22,7 @@ function directory_content(&$a) { } $o = ''; - $o .= ''; + $o .= set_nav_selected('nav-directory-link'); if(x($_SESSION,'theme')) unset($_SESSION['theme']); diff --git a/mod/message.php b/mod/message.php index ad598eb7d..ff3db06e2 100644 --- a/mod/message.php +++ b/mod/message.php @@ -110,7 +110,7 @@ function message_post(&$a) { function message_content(&$a) { $o = ''; - $o .= ''; + $o .= set_nav_selected('nav-messages-link'); if(! local_user()) { notice( t('Permission denied.') . EOL); diff --git a/mod/network.php b/mod/network.php index 7bdd3f3f1..8d377fa0e 100644 --- a/mod/network.php +++ b/mod/network.php @@ -98,7 +98,7 @@ function network_content(&$a, $update = 0) { } } - $o .= ''; + $o .= set_nav_selected('nav-network-link'); $_SESSION['return_url'] = $a->cmd; diff --git a/mod/notifications.php b/mod/notifications.php index c6f073058..6f9ece184 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -64,7 +64,7 @@ function notifications_content(&$a) { } $o = ''; - $o .= ''; + $o .= set_nav_selected("nav-notifications-link"); if(($a->argc > 1) && ($a->argv[1] == 'all')) $sql_extra = ''; diff --git a/mod/profile.php b/mod/profile.php index f4b6bfaf1..7e47c91bb 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -70,7 +70,7 @@ function profile_content(&$a, $update = 0) { } else { if($a->profile['profile_uid'] == local_user()) - $o .= ''; + $o .= set_nav_selected('nav-home-link'); } $contact = null; diff --git a/mod/profiles.php b/mod/profiles.php index 160ca13bc..7041249e2 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -220,7 +220,7 @@ function profiles_post(&$a) { function profiles_content(&$a) { $o = ''; - $o .= ''; + $o .= set_nav_selected('nav-profiles-link'); if(! local_user()) { notice( t('Permission denied.') . EOL); diff --git a/mod/settings.php b/mod/settings.php index 1b4098de8..0223b1b9c 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -299,7 +299,7 @@ if(! function_exists('settings_content')) { function settings_content(&$a) { $o = ''; - $o .= ''; + $o .= set_nav_selected('nav-settings-link'); if(! local_user()) { notice( t('Permission denied.') . EOL ); -- cgit v1.2.3 From 99ab06bad3eb8b4c20e70c255d9d4b168c137dde Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Mon, 25 Jul 2011 16:54:39 +0200 Subject: js to open close popup nav menu and to populate notification menu via ping. Update mod/ping to return details about messages and intros --- mod/ping.php | 45 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-) (limited to 'mod') diff --git a/mod/ping.php b/mod/ping.php index 7c31f00c9..e7f366095 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -1,5 +1,5 @@ get_baseurl() . '/profile/' . $a->user['nickname'] ; - $r = q("SELECT COUNT(*) AS `total` FROM `mail` + $mails = q("SELECT *, COUNT(*) AS `total` FROM `mail` WHERE `uid` = %d AND `seen` = 0 AND `from-url` != '%s' ", intval(local_user()), dbesc($myurl) ); - - $mail = $r[0]['total']; + $mail = $mails[0]['total']; + + header("Content-type: text/xml"); - echo "\r\n$intro$mail$network$home\r\n"; + echo " + + $intro + $mail + $network + $home + "; + if ($intro>0){ + foreach ($intros as $i) { + echo sprintf ('%s', + $a->get_baseurl().'/notification/'.$i['id'], $i['name'], $i['url'], $i['photo'], relative_date($i['datetime']), t("{0} wants to be your friend") + ); + }; + } + if ($mail>0){ + foreach ($mails as $i) { + var_dump($i); + echo sprintf ('%s', + $a->get_baseurl().'/message/'.$i['id'], $i['from-name'], $i['from-url'], $i['from-photo'], relative_date($i['created']), t("{0} sent you a message") + ); + }; + } + + echo " + + "; killme(); } -- cgit v1.2.3 From d88ed393f8fc04eb111d8061889e446f340a1c40 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Fri, 29 Jul 2011 16:24:09 +0200 Subject: notify pending registrations --- mod/ping.php | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'mod') diff --git a/mod/ping.php b/mod/ping.php index e7f366095..973ecb03f 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -36,6 +36,16 @@ function ping_init(&$a) { ); $mail = $mails[0]['total']; + if ($a->config['register_policy'] == REGISTER_APPROVE && is_site_admin()){ + $regs = q("SELECT `contact`.`name`, `contact`.`url`, `contact`.`micro`, `register`.`created`, COUNT(*) as `total` FROM `contact` RIGHT JOIN `register` ON `register`.`uid`=`contact`.`uid` WHERE `contact`.`self`=1"); + $register = $regs[0]['total']; + } else { + $register = "0"; + } + + + $notsxml = '%s'; + header("Content-type: text/xml"); @@ -44,23 +54,32 @@ function ping_init(&$a) { $intro $mail $network - $home - "; + $home"; + if ($register!=0) echo "$register"; + + echo ' '; if ($intro>0){ foreach ($intros as $i) { - echo sprintf ('%s', + echo sprintf ( $notsxml, $a->get_baseurl().'/notification/'.$i['id'], $i['name'], $i['url'], $i['photo'], relative_date($i['datetime']), t("{0} wants to be your friend") ); }; } if ($mail>0){ foreach ($mails as $i) { - var_dump($i); - echo sprintf ('%s', + echo sprintf ( $notsxml, $a->get_baseurl().'/message/'.$i['id'], $i['from-name'], $i['from-url'], $i['from-photo'], relative_date($i['created']), t("{0} sent you a message") ); }; } + if ($register>0){ + foreach ($regs as $i) { + echo sprintf ( $notsxml, + $a->get_baseurl().'/admin/users/', $i['name'], $i['url'], $i['micro'], relative_date($i['created']), t("{0} requested registration") + ); + }; + } + echo " -- cgit v1.2.3 From 07b6c868b3a66efc2737dfc6459b4114fea59ba0 Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Wed, 17 Aug 2011 18:36:24 +0200 Subject: remove javascript to set selectect nav item. enanche img template prefetch ignoring --- mod/community.php | 2 +- mod/contacts.php | 2 +- mod/directory.php | 2 +- mod/help.php | 3 ++- mod/message.php | 2 +- mod/network.php | 2 +- mod/notifications.php | 2 +- mod/profile.php | 5 +++-- mod/profiles.php | 2 +- mod/search.php | 2 ++ mod/settings.php | 2 +- 11 files changed, 15 insertions(+), 11 deletions(-) (limited to 'mod') diff --git a/mod/community.php b/mod/community.php index f8bd88d86..cb255029f 100644 --- a/mod/community.php +++ b/mod/community.php @@ -25,7 +25,7 @@ function community_content(&$a, $update = 0) { $o .= '

' . t('Community') . '

'; if(! $update) { - $o .= set_nav_selected('nav-community-link'); + nav_set_selected('community'); $o .= '
' . "\r\n"; $o .= "\r\n"; } diff --git a/mod/contacts.php b/mod/contacts.php index f8b9a743f..eb1de25ad 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -124,7 +124,7 @@ function contacts_content(&$a) { $sort_type = 0; $o = ''; - $o .= set_nav_selected('nav-contacts-link'); + nav_set_selected('contacts'); $_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd; diff --git a/mod/directory.php b/mod/directory.php index 03b6ab4d1..93abcd5de 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -22,7 +22,7 @@ function directory_content(&$a) { } $o = ''; - $o .= set_nav_selected('nav-directory-link'); + nav_set_selected('directory'); if(x($_SESSION,'theme')) unset($_SESSION['theme']); diff --git a/mod/help.php b/mod/help.php index 495b4ccc2..59e062f6d 100644 --- a/mod/help.php +++ b/mod/help.php @@ -17,6 +17,7 @@ function load_doc_file($s) { function help_content(&$a) { + nav_set_selected('help'); global $lang; @@ -41,4 +42,4 @@ function help_content(&$a) { return Markdown($text); -} \ No newline at end of file +} diff --git a/mod/message.php b/mod/message.php index ff3db06e2..9e8999592 100644 --- a/mod/message.php +++ b/mod/message.php @@ -110,7 +110,7 @@ function message_post(&$a) { function message_content(&$a) { $o = ''; - $o .= set_nav_selected('nav-messages-link'); + nav_set_selected('messages'); if(! local_user()) { notice( t('Permission denied.') . EOL); diff --git a/mod/network.php b/mod/network.php index 7cac7b858..cf4c994f0 100644 --- a/mod/network.php +++ b/mod/network.php @@ -98,7 +98,7 @@ function network_content(&$a, $update = 0) { } } - $o .= set_nav_selected('nav-network-link'); + nav_set_selected('network'); $_SESSION['return_url'] = $a->cmd; diff --git a/mod/notifications.php b/mod/notifications.php index 920d0d82d..0c35d4cd1 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -64,7 +64,7 @@ function notifications_content(&$a) { } $o = ''; - $o .= set_nav_selected("nav-notifications-link"); + nav_set_selected("notifications"); if(($a->argc > 1) && ($a->argv[1] == 'all')) $sql_extra = ''; diff --git a/mod/profile.php b/mod/profile.php index b309ea647..5a66892da 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -69,8 +69,9 @@ function profile_content(&$a, $update = 0) { $a->profile['profile_uid'] = $update; } else { - if($a->profile['profile_uid'] == local_user()) - $o .= set_nav_selected('nav-home-link'); + if($a->profile['profile_uid'] == local_user()) { + nav_set_selected('home'); + } } $contact = null; diff --git a/mod/profiles.php b/mod/profiles.php index 9b0a2970b..5cc9fa38c 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -220,7 +220,7 @@ function profiles_post(&$a) { function profiles_content(&$a) { $o = ''; - $o .= set_nav_selected('nav-profiles-link'); + nav_set_selected('profiles'); if(! local_user()) { notice( t('Permission denied.') . EOL); diff --git a/mod/search.php b/mod/search.php index 88ff9bbb7..f7ce75905 100644 --- a/mod/search.php +++ b/mod/search.php @@ -13,6 +13,8 @@ function search_content(&$a) { notice( t('Public access denied.') . EOL); return; } + + nav_set_selected('search'); require_once("include/bbcode.php"); require_once('include/security.php'); diff --git a/mod/settings.php b/mod/settings.php index 0223b1b9c..44ebdd77b 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -299,7 +299,7 @@ if(! function_exists('settings_content')) { function settings_content(&$a) { $o = ''; - $o .= set_nav_selected('nav-settings-link'); + nav_set_selected('settings'); if(! local_user()) { notice( t('Permission denied.') . EOL ); -- cgit v1.2.3 From afdc639f17f0f5e12f291b512ccc12b3df6b2acf Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Wed, 17 Aug 2011 21:59:06 +0200 Subject: fix friend request query in ping --- mod/ping.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'mod') diff --git a/mod/ping.php b/mod/ping.php index 973ecb03f..40ce5be0b 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -20,13 +20,25 @@ function ping_init(&$a) { ); $home = $r[0]['total']; - $intros = q("SELECT COUNT(`intro`.`id`) AS `total`, `intro`.`id`, `intro`.`datetime`, + $intros1 = q("SELECT COUNT(`intro`.`id`) AS `total`, `intro`.`id`, `intro`.`datetime`, `fcontact`.`name`, `fcontact`.`url`, `fcontact`.`photo` FROM `intro` LEFT JOIN `fcontact` ON `intro`.`fid` = `fcontact`.`id` - WHERE `intro`.`uid` = %d AND `intro`.`blocked` = 0 AND `intro`.`ignore` = 0 ", + WHERE `intro`.`uid` = %d AND `intro`.`blocked` = 0 AND `intro`.`ignore` = 0 AND `intro`.`fid`!=0", intval(local_user()) ); - $intro = $intros[0]['total']; + $intros2 = q("SELECT COUNT(`intro`.`id`) AS `total`, `intro`.`id`, `intro`.`datetime`, + `contact`.`name`, `contact`.`url`, `contact`.`photo` + FROM `intro` LEFT JOIN `contact` ON `intro`.`contact-id` = `contact`.`id` + WHERE `intro`.`uid` = %d AND `intro`.`blocked` = 0 AND `intro`.`ignore` = 0 AND `intro`.`contact-id`!=0", + intval(local_user()) + ); + + $intro = $intros1[0]['total'] + $intros2[0]['total']; + if ($intros1[0]['total']==0) $intros1=Array(); + if ($intros2[0]['total']==0) $intros2=Array(); + $intros = $intros1+$intros2; + + $myurl = $a->get_baseurl() . '/profile/' . $a->user['nickname'] ; $mails = q("SELECT *, COUNT(*) AS `total` FROM `mail` @@ -61,7 +73,7 @@ function ping_init(&$a) { if ($intro>0){ foreach ($intros as $i) { echo sprintf ( $notsxml, - $a->get_baseurl().'/notification/'.$i['id'], $i['name'], $i['url'], $i['photo'], relative_date($i['datetime']), t("{0} wants to be your friend") + $a->get_baseurl().'/notifications/'.$i['id'], $i['name'], $i['url'], $i['photo'], relative_date($i['datetime']), t("{0} wants to be your friend") ); }; } -- cgit v1.2.3 From 89c5733ca566f6f6e5568b4a4f22e20d60d7442d Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Tue, 23 Aug 2011 13:52:20 +0200 Subject: add more notification messages --- mod/ping.php | 106 ++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 86 insertions(+), 20 deletions(-) (limited to 'mod') diff --git a/mod/ping.php b/mod/ping.php index 40ce5be0b..f9d7cd8a7 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -8,17 +8,63 @@ function ping_init(&$a) { xml_status(0); - $r = q("SELECT COUNT(*) AS `total` FROM `item` - WHERE `unseen` = 1 AND `visible` = 1 AND `deleted` = 0 AND `uid` = %d AND `wall` = 0 ", + $comments = array(); + $likes = array(); + $dislikes = array(); + $friends = array(); + + $r = q("SELECT `item`.`parent`, `item`.`verb`, `item`.`author-name`, + `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, + `pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink` + FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent` + WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND + `item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 0", intval(local_user()) ); - $network = $r[0]['total']; + + $network = count($r); + foreach ($r as $it) { + switch($it['verb']){ + case 'http://activitystrea.ms/schema/1.0/like': + $likes[] = $it; + break; + case 'http://activitystrea.ms/schema/1.0/dislike': + $dislikes[] = $it; + break; + case 'http://activitystrea.ms/schema/1.0/make-friend': + $friends[] = $it; + break; + default: + $comments[] = $it; + } + } - $r = q("SELECT COUNT(*) AS `total` FROM `item` - WHERE `unseen` = 1 AND `visible` = 1 AND `deleted` = 0 AND `uid` = %d AND `wall` = 1 ", + + $r = q("SELECT `item`.`parent`, `item`.`verb`, `item`.`author-name`, + `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, + `pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink` + FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent` + WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND + `item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 1", intval(local_user()) - ); - $home = $r[0]['total']; + ); + $home = count($r); + foreach ($r as $it) { + switch($it['verb']){ + case 'http://activitystrea.ms/schema/1.0/like': + $likes[] = $it; + break; + case 'http://activitystrea.ms/schema/1.0/dislike': + $dislikes[] = $it; + break; + case 'http://activitystrea.ms/schema/1.0/make-friend': + $friends[] = $it; + break; + default: + $comments[] = $it; + } + } + $intros1 = q("SELECT COUNT(`intro`.`id`) AS `total`, `intro`.`id`, `intro`.`datetime`, `fcontact`.`name`, `fcontact`.`url`, `fcontact`.`photo` @@ -56,9 +102,12 @@ function ping_init(&$a) { } - $notsxml = '%s'; - - + function xmlize($href, $name, $url, $photo, $date, $message){ + $notsxml = '%s'; + return sprintf ( $notsxml, + $href, $name, $url, $photo, $date, $message + ); + } header("Content-type: text/xml"); echo " @@ -69,26 +118,43 @@ function ping_init(&$a) { $home"; if ($register!=0) echo "$register"; - echo ' '; + $tot = $mail+$intro+$register+count($comments)+count($likes)+count($dislikes)+count($friends); + + echo ' '; if ($intro>0){ foreach ($intros as $i) { - echo sprintf ( $notsxml, - $a->get_baseurl().'/notifications/'.$i['id'], $i['name'], $i['url'], $i['photo'], relative_date($i['datetime']), t("{0} wants to be your friend") - ); + echo xmlize( $a->get_baseurl().'/notifications/'.$i['id'], $i['name'], $i['url'], $i['photo'], relative_date($i['datetime']), t("{0} wants to be your friend") ); }; } if ($mail>0){ foreach ($mails as $i) { - echo sprintf ( $notsxml, - $a->get_baseurl().'/message/'.$i['id'], $i['from-name'], $i['from-url'], $i['from-photo'], relative_date($i['created']), t("{0} sent you a message") - ); + echo xmlize( $a->get_baseurl().'/message/'.$i['id'], $i['from-name'], $i['from-url'], $i['from-photo'], relative_date($i['created']), t("{0} sent you a message") ); }; } if ($register>0){ foreach ($regs as $i) { - echo sprintf ( $notsxml, - $a->get_baseurl().'/admin/users/', $i['name'], $i['url'], $i['micro'], relative_date($i['created']), t("{0} requested registration") - ); + echo xmlize( $a->get_baseurl().'/admin/users/', $i['name'], $i['url'], $i['micro'], relative_date($i['created']), t("{0} requested registration") ); + }; + } + + if (count($comments)){ + foreach ($comments as $i) { + echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} commented %s's post"), $i['pname'] ) ); + }; + } + if (count($likes)){ + foreach ($likes as $i) { + echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} like %s's post"), $i['pname'] ) ); + }; + } + if (count($dislikes)){ + foreach ($dislikes as $i) { + echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} dislike %s's post"), $i['pname'] ) ); + }; + } + if (count($friends)){ + foreach ($friends as $i) { + echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} is now friend with %s"), $i['pname'] ) ); }; } -- cgit v1.2.3 From 97806544bcd7ee3831ffc515062afe0812828b76 Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Tue, 23 Aug 2011 14:02:04 +0200 Subject: don't add notification details on new posts --- mod/ping.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'mod') diff --git a/mod/ping.php b/mod/ping.php index f9d7cd8a7..8a3d284af 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -13,7 +13,7 @@ function ping_init(&$a) { $dislikes = array(); $friends = array(); - $r = q("SELECT `item`.`parent`, `item`.`verb`, `item`.`author-name`, + $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`, `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink` FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent` @@ -35,12 +35,12 @@ function ping_init(&$a) { $friends[] = $it; break; default: - $comments[] = $it; + if ($it['parent']!=$it['id']) $comments[] = $it; } } - $r = q("SELECT `item`.`parent`, `item`.`verb`, `item`.`author-name`, + $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`, `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink` FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent` @@ -61,7 +61,7 @@ function ping_init(&$a) { $friends[] = $it; break; default: - $comments[] = $it; + if ($it['parent']!=$it['id']) $comments[] = $it; } } -- cgit v1.2.3 From 71d44d78ec5b16a53b82f4e631b86cd8247a9b0f Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Wed, 31 Aug 2011 16:17:32 +0200 Subject: Installed apps as array instead of string --- mod/apps.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'mod') diff --git a/mod/apps.php b/mod/apps.php index 7a0a3f59e..8049b45fb 100644 --- a/mod/apps.php +++ b/mod/apps.php @@ -1,15 +1,18 @@ ' . t('Applications') . ''; - - if($a->apps) - $o .= $a->apps; - else + if(count($a->apps)==0) notice( t('No installed applications.') . EOL); - return $o; -} \ No newline at end of file + $tpl = get_markup_template("apps.tpl"); + return replace_macros($tpl, array( + '$title' => $title, + '$apps' => $a->apps, + )); + + + +} -- cgit v1.2.3 From b38d6d97c3746203241c5ef50a8dd9f0bb0a0de0 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Wed, 31 Aug 2011 16:18:37 +0200 Subject: Avoid a small error in admin --- mod/admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/admin.php b/mod/admin.php index 7799e64ab..bbf786acb 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -540,7 +540,7 @@ function admin_page_plugins(&$a){ } $admin_form=""; - if (in_array($plugin, $a->plugins_admin)){ + if (is_array($a->plugins_admin) && in_array($plugin, $a->plugins_admin)){ @require_once("addon/$plugin/$plugin.php"); $func = $plugin.'_plugin_admin'; $func($a, $admin_form); -- cgit v1.2.3 From abd65e00aba5a2581665a689e01fe9330046f001 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Mon, 5 Sep 2011 14:01:21 +0200 Subject: Load infos and notices via ping and show them with js popup --- mod/ping.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/ping.php b/mod/ping.php index 8a3d284af..38a32744d 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -159,8 +159,26 @@ function ping_init(&$a) { } - echo " - + echo " "; + + echo " "; + if(x($_SESSION,'sysmsg')){ + foreach ($_SESSION['sysmsg'] as $m){ + echo "".($m).""; + } + $_SESSION['sysmsg']=array(); + unset($_SESSION['sysmsg']); + } + if(x($_SESSION,'sysmsg_info')){ + foreach ($_SESSION['sysmsg_info'] as $m){ + echo "".($m).""; + } + $_SESSION['sysmsg_info']=array(); + unset($_SESSION['sysmsg_info']); + } + + echo " "; + echo" "; killme(); -- cgit v1.2.3 From 991656a3ef396d9a6bd43ddb752627c2880b17ba Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Mon, 19 Sep 2011 11:52:32 +0200 Subject: Show "404.tpl" instead of using 'notice()' in case of 404 --- mod/help.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/help.php b/mod/help.php index 59e062f6d..af05bd47c 100644 --- a/mod/help.php +++ b/mod/help.php @@ -36,8 +36,10 @@ function help_content(&$a) { if(! strlen($text)) { header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . t('Not Found')); - notice( t('Page not found.' ) . EOL); - return; + $tpl = get_markup_template("404.tpl"); + return replace_macros($tpl, array( + '$message' => t('Page not found.' ) + )); } return Markdown($text); -- cgit v1.2.3 From ae024edbf9d9210126902b241bf9b7d2dbece1ec Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Mon, 26 Sep 2011 12:14:48 +0200 Subject: fix "friend of" message in ping.php --- mod/ping.php | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'mod') diff --git a/mod/ping.php b/mod/ping.php index 38a32744d..d11af2e0e 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -14,7 +14,7 @@ function ping_init(&$a) { $friends = array(); $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`, - `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, + `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object`, `pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink` FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent` WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND @@ -25,13 +25,16 @@ function ping_init(&$a) { $network = count($r); foreach ($r as $it) { switch($it['verb']){ - case 'http://activitystrea.ms/schema/1.0/like': + case ACTIVITY_LIKE: $likes[] = $it; break; - case 'http://activitystrea.ms/schema/1.0/dislike': + case ACTIVITY_DISLIKE: $dislikes[] = $it; break; - case 'http://activitystrea.ms/schema/1.0/make-friend': + case ACTIVITY_FRIEND: + $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">"; + $obj = parse_xml_string($xmlhead.$it['object']); + $it['fname'] = $obj->title; $friends[] = $it; break; default: @@ -41,7 +44,7 @@ function ping_init(&$a) { $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`, - `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, + `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object`, `pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink` FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent` WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND @@ -51,13 +54,16 @@ function ping_init(&$a) { $home = count($r); foreach ($r as $it) { switch($it['verb']){ - case 'http://activitystrea.ms/schema/1.0/like': + case ACTIVITY_LIKE: $likes[] = $it; break; - case 'http://activitystrea.ms/schema/1.0/dislike': + case ACTIVITY_DISLIKE: $dislikes[] = $it; break; - case 'http://activitystrea.ms/schema/1.0/make-friend': + case ACTIVITY_FRIEND: + $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">"; + $obj = parse_xml_string($xmlhead.$it['object']); + $it['fname'] = $obj->title; $friends[] = $it; break; default: @@ -154,7 +160,7 @@ function ping_init(&$a) { } if (count($friends)){ foreach ($friends as $i) { - echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} is now friend with %s"), $i['pname'] ) ); + echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} is now friend with %s"), $i['fname'] ) ); }; } -- cgit v1.2.3