예제 #1
0
function getListOfUsers()
{
    $conn = mysql_connect("localhost", "cc");
    if (!$conn) {
        die('Could not connect: ' . mysql_error());
    }
    mysql_select_db("paypertweet", $conn);
    $queryString = "";
    // Get list of all current users
    $queryString = "SELECT * FROM paypertweet.authed_users";
    $result = mysql_query($queryString) or die(mysql_error());
    while ($array = mysql_fetch_assoc($result)) {
        $nextUserID = $array['id'];
        $nextUserScreenName = $array['screen_name'];
        $nextUserOauthToken = $array['oauth_token'];
        $nextUserOauthTokenSecret = $array['oauth_token_secret'];
        $nextUserOauthTokens = getOauthToken($nextUser);
        $nextUsersFollowRequests = getFollowers($nextUserOauthTokens['oauth_token'], $nextUserOauthTokens['oauth_token_secret']);
        print "<nextuser>";
        print "<id>";
        print $nextUserID;
        print "</id>";
        print "<screen_name>";
        print $nextUserScreenName;
        print "</screen_name>";
        print "<oauth_token>";
        print $nextUserOauthToken;
        print "</oauth_token>";
        print "<oauth_token_secret>";
        print $nextUserOauthTokenSecret;
        print "</oauth_token_secret>";
        print "</nextuser>";
        // TODO - print this array out properly to show all the follow requests
        //print($nextUsersFollowRequests."\n");
    }
    if (isset($conn) && is_resource($conn)) {
        mysql_close($conn);
    }
}
예제 #2
0
function getMultiBadgeHTML($act)
{
    $imports = $act["locations"];
    $type = $act["type"];
    $start = tryGET('start');
    $end = tryGET('end');
    $followers = 0;
    $hasFollowers = false;
    $change = 0;
    $hasChange = false;
    $acts = array();
    foreach ($imports as $key => $imp) {
        $act = getImportAct($imp, $type);
        if (!isset($act)) {
            continue;
        }
        $acts[] = $act;
        //Followers
        $tFollow = getFollowers($act["id"], $end);
        if (isset($tFollow)) {
            $followers += $tFollow;
            $hasFollowers = true;
        }
        // Change in followers (delta)
        $tChange = getFollowerChange($act["id"], $start, $end);
        if (isset($tChange)) {
            $change += $tChange;
            $hasChange = true;
        }
    }
    if (!$hasFollowers) {
        $followers = '?';
    } else {
        $followers = number_format($followers);
    }
    if (!$hasChange) {
        $change = '?';
        $dirclass = '';
    } else {
        if ($change > 0) {
            $dirclass = 'fa-chevron-up';
            $change = number_format($change);
        } else {
            if ($change < 0) {
                $dirclass = 'fa-chevron-down';
                $change *= -1;
                $change = number_format($change);
            } else {
                $dirclass = 'fa-minus';
                $change = 'No Change';
            }
        }
    }
    $toppages = getTopRefferalPagesByType($type);
    $topposts = getMultiTopPosts($acts, $type);
    $typeclass = str_replace(" ", "-", $type);
    switch ($type) {
        case 'twitter':
            $postname = "Tweet";
            $faicon = "fa-twitter";
            break;
        case 'facebook':
            $postname = "Post";
            $faicon = "fa-facebook";
            break;
        case 'instagram':
            $postname = "Image";
            $faicon = "fa-instagram";
            break;
        default:
            $postname = "Post";
            $faicon = "";
    }
    $html = "\n\n<!-- Start Social Badge -->\n\n";
    $html .= "<div class=' col-md-4 col-xs-12'>\n";
    $html .= "\t<div class='" . $typeclass . " social-pane panel'>\n";
    $html .= "\t\t<div class='panel-heading'>\n";
    $html .= "\t\t\t<h3 class='panel-title social-title'><i class='fa {$faicon}'></i> " . ucfirst($type) . "</h3>\n";
    $html .= "\t\t</div>\n";
    $html .= "\t\t<div class='social-body panel-body'>\n";
    $html .= "\t\t\t<h4>Total Followers: <b>{$followers}</b></h4>\n";
    $html .= "\t\t\t<h4>Change in Followers: <i class='fa {$dirclass}'></i> <b>{$change}</b></h4>\n";
    if (count($toppages) > 0) {
        $html .= "\t\t\t<h4>Top Pages Visited From " . ucfirst($type) . "</h4>\n";
        $html .= "\t\t\t<div class='social-urls'>\n";
        $html .= "\t\t\t\t<ol>\n";
        foreach ($toppages as $key => $u) {
            $url = $u['url'];
            $title = $u['title'];
            $html .= "\t\t\t\t\t<li><a target='_blank' href='//{$url}'>{$title}</a></li>\n";
        }
        $html .= "\t\t\t\t</ol>\n";
        $html .= "\t\t\t</div>\n";
        /*	$html .= "\t\t\t<h5>None :(</h5>\n"; */
    }
    if (count($topposts) > 0) {
        $html .= "\t\t\t<h4>Top " . $postname . "s</h4>\n";
        $html .= "\t\t\t<div class='social-urls'>\n";
        $html .= "\t\t\t\t<ol>\n";
        foreach ($topposts as $key => $p) {
            $url = $p["url"];
            $user = $p['username'];
            $html .= "\t\t\t\t\t<li><a target='_blank' href='{$url}'>{$user}'s {$postname}</a></li>\n";
        }
        $html .= "\t\t\t\t</ol>\n";
        $html .= "\t\t\t</div>\n";
    }
    $html .= "\t\t</div>\n";
    $html .= "\t</div>\n";
    $html .= "</div>\n";
    $html .= "\n\n<!-- End Social Badge -->\n\n";
    return $html;
}
예제 #3
0
  $insertion_length=strlen($long_string)-strlen($short_string);
  for($i=0;$i<strlen($short_string);++$i){
    if($long_string[$i]!=$short_string[$i])break;
  }
  $inserted_string=substr($long_string,$i,$insertion_length);
  if($is_html && $inserted_string[$insertion_length-1]=='<'){
    $inserted_string='<'.substr($inserted_string,0,$insertion_length-1);
  }
  return $inserted_string;
}

function DOMElement_getOuterHTML($document,$element){
  $html=$document->saveHTML();
  $element->parentNode->removeChild($element);
  $html2=$document->saveHTML();
  return string_getInsertedString($html,$html2,true);
}

function getFollowers($username){
  $x = file_get_contents("http://twitter.com/".$username);
  $doc = new DomDocument;
  @$doc->loadHTML($x);
  $ele = $doc->getElementById('follower_count');
  $innerHTML=preg_replace('/^<[^>]*>(.*)<[^>]*>$/',"\\1",DOMElement_getOuterHTML($doc,$ele));
  return $innerHTML;
}

?>

<? echo getFollowers('Geeklyplanet')." followers";?>
예제 #4
0
            send503($nick);
            exit;
        }
    }
    insertUser($user, $nick, $conn);
}
// followers
try {
    $users = getFollowers($nick, null, $client);
    insertFollowers($users, $user['id'], $conn);
} catch (Exception $e) {
    $throttled = true;
    error_log("<br>" . $e->getMessage());
}
if (!$users) {
    $users = getFollowers($nick, $connfb);
}
// keys
try {
    $keys = getKeys($nick, null, $client);
} catch (Exception $e) {
    $throttled = true;
    error_log($e->getMessage());
    $keys = getKeys($nick, $conn);
}
// turtle
$rank = getRank($users);
$ledger = getLedger($webid, $conn);
$project = getProject($ledger);
$main = 'http://gitpay.org/' . $user['login'] . '#this';
$githubaccount = 'http://github.com/' . $user['login'];
예제 #5
0
function copy_followers($instagram, $instagramUserID, $debug, $targetUser, $date, $email, $debugEmails, $name)
{
    $debug = false;
    /*
    	$numberOfFollowers = number_of_followers($connection, $myScreenName);
    
    	$numberOfRequests_USER = (int) $numberOfFollowers/5000;
    	$numberOfRequests_target = (int) 15 - ceil($numberOfRequests_USER); // Request as many followers from the user as possible
    	// $numberOfRequests_target = (int) ceil($numberOfRequests_USER); // Request only the amount of followers that you follow
    
    
    	//$numberOfRequests_target = 2;
    
    	if($debug){echo "Number of target user requests to Twitter's API to make: $numberOfRequests_target<br>";}
    */
    $followerArray = getFollowers($instagram, $instagramUserID, $debug);
    if ($debug) {
        echo "got my followers";
    }
    $followingArray = iAmFollowing($instagram, $instagramUserID, $debug);
    if ($debug) {
        echo "<br>got who I'm following";
    }
    $targetFollowerArray = getFollowers($instagram, $targetUser, $debug);
    if ($debug) {
        echo "<br>got target user's followers";
    }
    echo "<br><br><hr><br><br>";
    $debug = true;
    $targetFollowersNarrowed = array_diff($targetFollowerArray, $followerArray, $followingArray);
    if ($debug) {
        echo '<br>NARROWED TARGET FOLLOWERS:<BR>';
        print_r($targetFollowersNarrowed);
    }
    $message = '';
    $i = 1;
    foreach ($targetFollowersNarrowed as $targetFollower) {
        $isFollowing = in_array($targetFollowerArray, $followerArray);
        $imFollowing = in_array($targetFollowerArray, $followingArray);
        //echo "$targetFollower: ".( $isFollowing ? 'OK' : '!!!' )."<br/>";
        if (!$isFollowing && !$imfollowing) {
            $parameters = array('user_id' => $targetFollower);
            $userID = $parameters['user_id'];
            //if($debug){echo "Possible follower detected: ".$userID."<br>";}
            //Investigate User Before Following
            $userData = $instagram->getUserRelationship($userID);
            if ($debug) {
                echo "<br>";
                print_r($userData);
            }
            $privateUser = $userData->data->target_user_is_private;
            $outgoingStatus = $userData->data->outgoing_status;
            if ($outgoingStatus != 'requested' && $privateUser != 1) {
                $follow = $instagram->modifyRelationship('follow', $userID);
                if ($debug) {
                    echo '<br><small>';
                    print_r($follow);
                    echo '</small><br>';
                }
                $i++;
            }
        }
    }
}
예제 #6
0
파일: profile.php 프로젝트: nickavv/iSENSE
    
}
*/
$data['activity_responses'] = getResponsesFromUser($id);
// Compile the user's media
foreach ($data as $key => $value) {
    if (is_array($value)) {
        foreach ($value as $v) {
            $v['type'] = $key;
            $output[] = $v;
        }
    }
}
usort($output, 'timeobj_cmp');
// Grab the user's graph
$followers = getFollowers($id);
$following = getFollowing($id);
$is_following = "No";
if ($id == $session->userid) {
    $is_following = "You";
} else {
    $is_following = doesFollow($session->userid, $id) ? "Yes" : "No";
}
$smarty->assign('is_following', $is_following);
$smarty->assign('followers', $followers);
$smarty->assign('following', $following);
$smarty->assign('is_owner', $is_owner);
$smarty->assign('results', $output);
$smarty->assign('errors', $errors);
$counts = array('sessions' => count($data['session']), 'experiments' => count($data['experiment']), 'vises' => count($data['vis']), 'images' => count($data['image']), 'videos' => count($data['video']));
$smarty->assign('counts', $counts);
예제 #7
0
						</div>
					</div>
				</div>	
			</div>';
}
?>
		<div class="col nine">
			<h2>Previous Sessions</h2>
		</div>
		<?php 
require 'connect_database.php';
for ($i = $current - 1; $i >= 0; $i--) {
    $result = mysqli_query($link, "SELECT * FROM sessions WHERE id='{$id[$i]}'");
    $arr = mysqli_fetch_array($result, MYSQLI_ASSOC);
    $rating = getRating(intval($arr['id']));
    $followers = getFollowers(intval($arr['id']));
    echo '
				<div class="col nine">
					<div class="session clearfix">
						<div class="col two"><img src="' . $arr["poster"] . '" alt="Session Poster"></div>
						<div class="col ten">
							<h2 class="title">' . $arr["Title"] . '</h2>
							<p class="speaker">
								<i class="fa fa-user"></i>
								<span>Speaker:</span>
								' . $arr["speaker"] . '
							</p>
							<p class="where">
								<i class="fa fa-location-arrow"></i>
								<span>Where:</span>
								' . $arr["venue"] . '
예제 #8
0
파일: profile.php 프로젝트: nilvisa/litter
    } else {
        print '<div id="online_container">';
        foreach ($following as $following) {
            print '<div class="whos_online">';
            print '<a href="profile.php?profile=' . $following['username'] . '" title="' . $following['username'] . '">' . getProfilePic($following['following'], '50px') . '</a>';
            print '</div>';
        }
        print '</div>';
    }
    print '</div>';
    print '</div>';
}
print '<p id="followers">Followers: ' . count($followers) . '</p>';
print '<div class="followers">';
print '<div id="online_img">';
$following = getFollowers($get['user_id']);
if (count($following) == 0) {
    print "None, follow " . $get['username'] . "!";
} else {
    print '<div id="online_container">';
    foreach ($following as $following) {
        print '<div class="whos_online">';
        print '<a href="profile.php?profile=' . $following['username'] . '" title="' . $following['username'] . '">' . getProfilePic($following['user_id'], '50px') . '</a>';
        print '</div>';
    }
    print '</div>';
}
print '</div>';
print '</div>';
if ($sess['user_id'] == $get['user_id']) {
    print '<br><a href="profile.php?profile=at' . $sess['username'] . '">See where you have been mentioned</a><br>';
예제 #9
0
/** 
 * @author Amedeo Leo
 */
function getIdeasFollowed($idUser)
{
    return getFollowers($idUser);
}