{$post->post_text}
diff --git a/webapp/plugins/insightsgenerator/view/ageanalysis.tpl b/webapp/plugins/insightsgenerator/view/ageanalysis.tpl
new file mode 100644
index 0000000000..d6bf55ae32
--- /dev/null
+++ b/webapp/plugins/insightsgenerator/view/ageanalysis.tpl
@@ -0,0 +1,69 @@
+{include file=$tpl_path|cat:'_header.tpl'}
+
+{if !$expand}
+
+{/if}
+
+
{$i->headline}
+
+
+{$i->text|link_usernames_to_twitter}
+
+
+ {include file=$tpl_path|cat:"_post.tpl" post=$i->related_data[0] hide_insight_header=true}
+
+
+{if !$expand}
+
+{/if}
+
+
+
+
+{if !$expand}
+
+{/if}
+
+{include file=$tpl_path|cat:'_footer.tpl'}
\ No newline at end of file
diff --git a/webapp/plugins/insightsgenerator/view/genderanalysis.tpl b/webapp/plugins/insightsgenerator/view/genderanalysis.tpl
new file mode 100644
index 0000000000..ef2429c8e0
--- /dev/null
+++ b/webapp/plugins/insightsgenerator/view/genderanalysis.tpl
@@ -0,0 +1,57 @@
+{include file=$tpl_path|cat:'_header.tpl'}
+
+{if !$expand}
+
+{/if}
+
+
{$i->headline}
+
+
+{$i->text|link_usernames_to_twitter}
+
+
+ {include file=$tpl_path|cat:"_post.tpl" post=$i->related_data[0] hide_insight_header=true}
+
+
+{if !$expand}
+
+{/if}
+
+
+
+
+{if !$expand}
+
+{/if}
+
+{include file=$tpl_path|cat:'_footer.tpl'}
diff --git a/webapp/plugins/insightsgenerator/view/geoanalysisfacebook.tpl b/webapp/plugins/insightsgenerator/view/geoanalysisfacebook.tpl
new file mode 100644
index 0000000000..e09b8a0190
--- /dev/null
+++ b/webapp/plugins/insightsgenerator/view/geoanalysisfacebook.tpl
@@ -0,0 +1,55 @@
+{include file=$tpl_path|cat:'_header.tpl'}
+
+{if !$expand}
+
+{/if}
+
+
{$i->headline}
+
+
+{$i->text|link_usernames_to_twitter}
+
+{if !$expand}
+
+{/if}
+
+
+
+
+
+{if !$expand}
+
+{/if}
+
+{include file=$tpl_path|cat:'_footer.tpl'}
\ No newline at end of file
diff --git a/webapp/plugins/insightsgenerator/view/geoanalysistwitter.tpl b/webapp/plugins/insightsgenerator/view/geoanalysistwitter.tpl
new file mode 100644
index 0000000000..649e2ac1c7
--- /dev/null
+++ b/webapp/plugins/insightsgenerator/view/geoanalysistwitter.tpl
@@ -0,0 +1,56 @@
+{include file=$tpl_path|cat:'_header.tpl'}
+
+{if !$expand}
+
+{/if}
+
+
{$i->headline}
+
+
+{$i->text|link_usernames_to_twitter}
+
+{if !$expand}
+
+{/if}
+
+
+
+
+
+{if !$expand}
+
+{/if}
+
+{include file=$tpl_path|cat:'_footer.tpl'}
\ No newline at end of file
diff --git a/webapp/plugins/insightsgenerator/view/topofpostsfacebook.tpl b/webapp/plugins/insightsgenerator/view/topofpostsfacebook.tpl
new file mode 100644
index 0000000000..c4d300b4ae
--- /dev/null
+++ b/webapp/plugins/insightsgenerator/view/topofpostsfacebook.tpl
@@ -0,0 +1,7 @@
+{include file=$tpl_path|cat:'_header.tpl'}
+
+
+ {include file=$tpl_path|cat:"_posts.tpl" icon="trophy"}
+
+
+{include file=$tpl_path|cat:'_footer.tpl'}
diff --git a/webapp/plugins/insightsgenerator/view/unfollowersanalysis.tpl b/webapp/plugins/insightsgenerator/view/unfollowersanalysis.tpl
new file mode 100644
index 0000000000..7554fd6bf5
--- /dev/null
+++ b/webapp/plugins/insightsgenerator/view/unfollowersanalysis.tpl
@@ -0,0 +1,7 @@
+{include file=$tpl_path|cat:'_header.tpl'}
+
+
+ {include file=$tpl_path|cat:"_users.tpl" icon="bolt"}
+
+
+{include file=$tpl_path|cat:'_footer.tpl'}
\ No newline at end of file
diff --git a/webapp/plugins/twitter/model/class.TwitterCrawler.php b/webapp/plugins/twitter/model/class.TwitterCrawler.php
index 94048a88f9..f17aa01bb6 100644
--- a/webapp/plugins/twitter/model/class.TwitterCrawler.php
+++ b/webapp/plugins/twitter/model/class.TwitterCrawler.php
@@ -529,6 +529,7 @@ private function fetchInstanceUserFollowersByIDs() {
if ($follow_dao->insert($this->instance->network_user_id, $id['id'], 'twitter'))
$inserted_follow_count = $inserted_follow_count + 1;
}
+
}
$this->logger->logSuccess("Cursor at ".strval($next_cursor), __METHOD__.','.__LINE__);
}
@@ -576,7 +577,7 @@ public function fetchInstanceUserFollowers() {
$updated_follow_count = 0;
$inserted_follow_count = 0;
- $follow_dao = DAOFactory::getDAO('FollowDAO');;
+ $follow_dao = DAOFactory::getDAO('FollowDAO');
while ($continue_fetching && !$this->instance->is_archive_loaded_follows) {
$endpoint = $this->api->endpoints['followers'];
@@ -640,6 +641,68 @@ public function fetchInstanceUserFollowers() {
}
}
+ /**
+ * Fetch instance users's unfollowers
+ */
+ public function fetchInstanceUserUnfollowers() {
+ $continue_fetching = true;
+ $follow_dao = DAOFactory::getDAO('FollowDAO');
+
+ if (isset($this->user) ) {
+ $followers=$follow_dao->getFollowersIds($this->instance->network_user_id,$this->instance->network);
+ $followers_count=count($followers);
+ if($followers_count>$this->user->follower_count){
+ while ( $continue_fetching) {
+ $args = array();
+ $endpoint = $this->api->endpoints['followers'];
+ if (!isset($next_cursor)) {
+ $next_cursor = -1;
+ }
+ $args['cursor'] = strval($next_cursor);
+ $args['stringify_ids'] = 'true';
+
+ try {
+ list($http_status, $payload) = $this->api->apiRequest($endpoint, $args);
+ if ($http_status > 200) {
+ $continue_fetching = false;
+ } else {
+ $users = $this->api->parseJSONUsers($payload);
+ $next_cursor = $this->api->getNextCursor();
+
+ if (count($users) == 0) {
+ $continue_fetching = false;
+ } else {
+ foreach ($followers as $f) {
+ if(!$this->isFollowerInList($users, $f['id'])){
+ $follow_dao->setUnfollowed($this->instance->network_user_id, $f['id'],
+ $this->instance->network);
+ }
+ }
+ }
+ }
+
+ } catch (APICallLimitExceededException $e) {
+ $this->logger->logUserInfo($e->getMessage(), __METHOD__.','.__LINE__);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Checking whether or not follower is in list of users
+ * @param array $users
+ * @param int $id
+ */
+ private function isFollowerInList($users, $id) {
+ foreach ($users as $u) {
+ $user = new User($u);
+ if($user->user_id==$id) return true;
+ }
+ return false;
+ }
+
/** Find group memberships that are probably no longer active, verify, and
* deactivate or update
*/
diff --git a/webapp/plugins/twitter/model/class.TwitterPlugin.php b/webapp/plugins/twitter/model/class.TwitterPlugin.php
index b9b2756f98..eb0970f13e 100644
--- a/webapp/plugins/twitter/model/class.TwitterPlugin.php
+++ b/webapp/plugins/twitter/model/class.TwitterPlugin.php
@@ -97,6 +97,7 @@ public function crawl() {
$twitter_crawler->fetchInstanceUserMentions();
$twitter_crawler->fetchInstanceUserFriends();
$twitter_crawler->fetchInstanceUserFollowers();
+ $twitter_crawler->fetchInstanceUserUnfollowers();
$twitter_crawler->fetchInstanceUserGroups();
$twitter_crawler->fetchRetweetsOfInstanceUser();
$twitter_crawler->fetchInstanceUserFavorites();
diff --git a/webapp/session/forgot.php b/webapp/session/forgot.php
index 2cd5e4e88f..538a4b08d3 100644
--- a/webapp/session/forgot.php
+++ b/webapp/session/forgot.php
@@ -31,3 +31,4 @@
$controller = new ForgotPasswordController();
echo $controller->go();
+