Exemple #1
0
        header("Location: login.php?emsg=Invalid+email+or+password");
    } elseif (!$session->pwdCheck($_POST['pwd'], $result['pwd'])) {
        header("Location: login.php?emsg=Incorrect+email+or+password");
    } else {
        // this sets variables in the session
        $session->completeLogin($result);
        $od->updateLastLogin($user_email);
        if (isset($_GET['ret']) && !empty($_GET['ret'])) {
            header("Location: {$_GET['ret']}");
        } else {
            header("Location: " . $THINKTANK_CFG['site_root_path']);
        }
        exit;
    }
}
if (isset($_GET["emsg"])) {
    $emsg = $_GET["emsg"];
}
if (isset($_GET["smsg"])) {
    $smsg = $_GET["smsg"];
}
if (isset($emsg)) {
    $s->assign('errormsg', $emsg);
} elseif (isset($smsg)) {
    $s->assign('successmsg', $smsg);
}
$db->closeConnection($conn);
$cfg = new Config();
$s->assign('cfg', $cfg);
$s->display('session.login.tpl');
Exemple #2
0
        if (isset($i)) {
            $s->assign('likely_orphans', $td->getLikelyOrphansForParent($tweet->pub_date, $i->twitter_user_id, $tweet->author_username, 15));
            $s->assign('all_tweets', $td->getAllTweets($i->twitter_user_id, 15));
        }
        $cfg = new Config($i->twitter_username, $i->twitter_user_id);
        // instantiate data access objects
        $ud = new UserDAO($db);
        $all_replies = $td->getRepliesToTweet($status_id);
        $all_replies_count = count($all_replies);
        $all_retweets = $td->getRetweetsOfTweet($status_id);
        $retweet_reach = $td->getTweetReachViaRetweets($status_id);
        $public_replies = $td->getPublicRepliesToTweet($status_id);
        $public_replies_count = count($public_replies);
        $private_replies_count = $all_replies_count - $public_replies_count;
        $tweet = $td->getTweet($status_id);
        $s->assign('tweet', $tweet);
        $s->assign('replies', $all_replies);
        $s->assign('retweets', $all_retweets);
        $s->assign('retweet_reach', $retweet_reach);
        $s->assign('public_reply_count', $public_replies_count);
        $s->assign('private_reply_count', $private_replies_count);
        $s->assign('reply_count', $all_replies_count);
        $s->assign('cfg', $cfg);
        $s->assign('instance', $i);
    }
    # clean up
    $db->closeConnection($conn);
    $s->display('status.index.tpl', $status_id);
} else {
    echo 'This update is not in the system.<br /><a href="' . $cfg->site_root_path . '">back home</a>';
}
Exemple #3
0
session_start();
if (!isset($_SESSION['user'])) {
    header("Location: /session/login.php");
}
// set up
chdir("..");
require_once "common/init.php";
$od = new OwnerDAO($db);
$owner = $od->getByEmail($_SESSION['user']);
$pd = new PostDAO($db);
$id = new InstanceDAO($db);
if (isset($_REQUEST['u']) && $id->isUserConfigured($_REQUEST['u'])) {
    $username = $_REQUEST['u'];
    $oid = new OwnerInstanceDAO($db);
    if (!$oid->doesOwnerHaveAccess($owner, $username)) {
        echo 'Insufficient privileges. <a href="/">Back</a>.';
        die;
    } else {
        $tweets = $pd->getAllPostsByUsername($username);
    }
} else {
    echo 'No access';
    $db->closeConnection($conn);
    die;
}
$db->closeConnection($conn);
$s = new SmartyThinkTank();
$s->assign('tweets', $tweets);
$s->display('post.export.tpl', $username);
Exemple #4
0
<?php

session_start();
if (!isset($_SESSION['user'])) {
    header("Location: login.php");
}
include 'dbc.php';
if ($_POST['Submit'] == 'Change') {
    $rsPwd = mysql_query("select user_pwd from owners where user_email='{$_SESSION['user']}'") or die(mysql_error());
    list($oldpwd) = mysql_fetch_row($rsPwd);
    if ($oldpwd == md5($_POST['oldpwd'])) {
        $newpasswd = md5($_POST['newpwd']);
        mysql_query("Update " . $THINKTANK_CFG['table_prefix'] . "owners\r\n      SET user_pwd = '{$newpasswd}'       WHERE user_email = '{$_SESSION['user']}'") or die(mysql_error());
        $msg = "Location: settings.php?msg=Password updated...";
    } else {
        $msg = "Location: settings.php?msg=ERROR: Password does not match...";
    }
}
$s = new SmartyThinkTank();
if (isset($msg)) {
    $s->assign('msg', $msg);
    $s->display('session.settings.tpl', sha1($msg));
} else {
    $s->display('session.settings.tpl');
}
?>
 
Exemple #5
0
if (isset($_REQUEST['t']) && $td->isTweetByPublicInstance($_REQUEST['t'])) {
    if (!$s->is_cached('public.tpl', $_REQUEST['t'])) {
        $tweet = $td->getTweet($_REQUEST['t']);
        $public_tweet_replies = $td->getPublicRepliesToTweet($tweet->status_id);
        $public_retweets = $td->getRetweetsOfTweet($tweet->status_id, true);
        $s->assign('tweet', $tweet);
        $s->assign('replies', $public_tweet_replies);
        $s->assign('retweets', $public_retweets);
        $rtreach = 0;
        foreach ($public_retweets as $t) {
            $rtreach += $t->author->follower_count;
        }
        $s->assign('rtreach', $rtreach);
        $s->assign('site_root', $THINKTANK_CFG['site_root_path']);
    }
    $s->display('public.tpl', $_REQUEST['t']);
} elseif (isset($_REQUEST['v'])) {
    $view = $_REQUEST['v'];
    switch ($view) {
        case 'timeline':
            if (!$s->is_cached('public.tpl')) {
                $s->assign('tweets', $td->getTweetsByPublicInstances());
                $s->assign('site_root', $THINKTANK_CFG['site_root_path']);
            }
            $s->display('public.tpl', 'timeline');
            break;
        case 'mostretweets':
            if (!$s->is_cached('public.tpl', 'mostretweets')) {
                $s->assign('tweets', $td->getMostRetweetedTweetsByPublicInstances());
                $s->assign('site_root', $THINKTANK_CFG['site_root_path']);
            }
Exemple #6
0
    } elseif (strlen($_POST['pass1']) < 5) {
        die("ERROR: New password must be at least 5 characters.");
    } else {
        $newmd5pwd = md5($_POST['pass1']);
        mysql_query("UPDATE " . $THINKTANK_CFG['table_prefix'] . "owners set user_pwd='{$newmd5pwd}' where user_email='{$_SESSION['user']}'");
    }
}
$db = new Database($THINKTANK_CFG);
$conn = $db->getConnection();
$id = new InstanceDAO($db);
$od = new OwnerDAO($db);
$cfg = new Config($db);
$s = new SmartyThinkTank();
$s->caching = 0;
$owner = $od->getByEmail($_SESSION['user']);
$owner_instances = $id->getByOwner($owner);
$to = new TwitterOAuth($cfg->oauth_consumer_key, $cfg->oauth_consumer_secret);
/* Request tokens from twitter */
$tok = $to->getRequestToken();
$token = $tok['oauth_token'];
$_SESSION['oauth_request_token_secret'] = $tok['oauth_token_secret'];
/* Build the authorization URL */
$oauthorize_link = $to->getAuthorizeURL($token);
$s->assign('owner_instances', $owner_instances);
$s->assign('owner', $owner);
$s->assign('cfg', $cfg);
$s->assign('oauthorize_link', $oauthorize_link);
# clean up
$db->closeConnection($conn);
$s->display('account.index.tpl');
Exemple #7
0
}
// set up
chdir("..");
require_once 'config.webapp.inc.php';
ini_set("include_path", ini_get("include_path") . PATH_SEPARATOR . $INCLUDE_PATH);
require_once "init.php";
$db = new Database($THINKTANK_CFG);
$conn = $db->getConnection();
$od = new OwnerDAO($db);
$owner = $od->getByEmail($_SESSION['user']);
$td = new TweetDAO($db);
$id = new InstanceDAO($db);
if (isset($_REQUEST['u']) && $id->isUserConfigured($_REQUEST['u'])) {
    $username = $_REQUEST['u'];
    $oid = new OwnerInstanceDAO($db);
    if (!$oid->doesOwnerHaveAccess($owner, $username)) {
        echo 'Insufficient privileges. <a href="/">Back</a>.';
        $db->closeConnection($conn);
        die;
    } else {
        $tweets = $td->getAllTweetsByUsername($username);
    }
} else {
    echo 'No access';
    $db->closeConnection($conn);
    die;
}
$s = new SmartyThinkTank();
$s->assign('tweets', $tweets);
$s->display('status.export.tpl', $username);
Exemple #8
0
            $s->assign('likely_orphans', $pd->getLikelyOrphansForParent($post->pub_date, $i->network_user_id, $post->author_username, 15));
            $s->assign('all_tweets', $pd->getAllPosts($i->network_user_id, 15));
        }
        $cfg = new Config($i->network_username, $i->network_user_id);
        // instantiate data access objects
        $ud = new UserDAO($db);
        $all_replies = $pd->getRepliesToPost($post_id);
        $all_replies_count = count($all_replies);
        $all_retweets = $pd->getRetweetsOfPost($post_id);
        $retweet_reach = $pd->getPostReachViaRetweets($post_id);
        $public_replies = $pd->getPublicRepliesToPost($post_id);
        $public_replies_count = count($public_replies);
        $private_replies_count = $all_replies_count - $public_replies_count;
        $post = $pd->getPost($post_id);
        $s->assign('post', $post);
        $s->assign('replies', $all_replies);
        $s->assign('retweets', $all_retweets);
        $s->assign('retweet_reach', $retweet_reach);
        $s->assign('public_reply_count', $public_replies_count);
        $s->assign('private_reply_count', $private_replies_count);
        $s->assign('reply_count', $all_replies_count);
        $s->assign('cfg', $cfg);
        $s->assign('instance', $i);
        $s->assign('i', $i);
    }
    # clean up
    $db->closeConnection($conn);
    $s->display('post.index.tpl', $post_id);
} else {
    echo 'This update is not in the system.<br /><a href="' . $cfg->site_root_path . '">back home</a>';
}
Exemple #9
0
     $percent_followers_loaded = $percent_followers_loaded > 100 ? 100 : $percent_followers_loaded;
     $percent_tweets_loaded = $u->getPercentage($owner_stats['tweet_count'], $i->total_tweets_in_system);
     $percent_tweets_loaded = $percent_tweets_loaded > 100 ? 100 : $percent_tweets_loaded;
     $percent_friends_loaded = $u->getPercentage($owner_stats['friend_count'], $total_friends_loaded);
     $percent_friends_loaded = $percent_friends_loaded > 100 ? 100 : $percent_friends_loaded;
     $percent_followers_suspended = round($u->getPercentage($total_follows_with_full_details, $total_follows_with_errors), 2);
     $percent_followers_protected = round($u->getPercentage($total_follows_with_full_details, $total_follows_protected), 2);
     $s->assign('percent_followers_loaded', $percent_followers_loaded);
     $s->assign('percent_tweets_loaded', $percent_tweets_loaded);
     $s->assign('percent_friends_loaded', $percent_friends_loaded);
     $s->assign('percent_followers_suspended', $percent_followers_suspended);
     $s->assign('percent_followers_protected', $percent_followers_protected);
 }
 # clean up
 $db->closeConnection($conn);
 $s->display('index.tpl', $i->twitter_username . "-" . $_SESSION['user']);
 /*  People you've gotten the most replies from in the last XXX months (use date of oldest reply)
 
 	select 
 		author_username, count(author_user_id) as total_replies 
 	from
 		reply
 	group by
 		author_user_id
 	order by 
 		total_replies desc
 	limit 5;
 	
 	
 	People you reply to the most since (date of oldest tweet)
 	
Exemple #10
0
            $s->assign('likely_orphans', $pd->getLikelyOrphansForParent($post->pub_date, $i->network_user_id, $post->author_username, 15));
            $s->assign('all_tweets', $pd->getAllPosts($i->network_user_id, 15));
        }
        $cfg = new Config($i->network_username, $i->network_user_id);
        // instantiate data access objects
        $ud = new UserDAO($db);
        $all_replies = $pd->getRepliesToPost($status_id);
        $all_replies_count = count($all_replies);
        $all_retweets = $pd->getRetweetsOfPost($status_id);
        $retweet_reach = $pd->getPostReachViaRetweets($status_id);
        $public_replies = $pd->getPublicRepliesToPost($status_id);
        $public_replies_count = count($public_replies);
        $private_replies_count = $all_replies_count - $public_replies_count;
        $post = $pd->getPost($status_id);
        $s->assign('post', $post);
        $s->assign('replies', $all_replies);
        $s->assign('retweets', $all_retweets);
        $s->assign('retweet_reach', $retweet_reach);
        $s->assign('public_reply_count', $public_replies_count);
        $s->assign('private_reply_count', $private_replies_count);
        $s->assign('reply_count', $all_replies_count);
        $s->assign('cfg', $cfg);
        $s->assign('instance', $i);
        $s->assign('i', $i);
    }
    # clean up
    $db->closeConnection($conn);
    $s->display('post.index.tpl', $status_id);
} else {
    echo 'This update is not in the system.<br /><a href="' . $cfg->site_root_path . '">back home</a>';
}
Exemple #11
0
$db = new Database($THINKTANK_CFG);
$conn = $db->getConnection();
$ud = new UserDAO($db);
$fd = new FollowDAO($db);
$id = new InstanceDAO($db);
$td = new TweetDAO($db);
if (isset($_REQUEST['u']) && $ud->isUserInDBByName($_REQUEST['u']) && isset($_REQUEST['i'])) {
    $user = $ud->getUserByName($_REQUEST['u']);
    $i = $id->getByUsername($_REQUEST['i']);
    if (isset($i)) {
        $cfg = new Config($i->twitter_username, $i->twitter_user_id);
        $s = new SmartyThinkTank();
        if (!$s->is_cached('user.index.tpl', $i->twitter_username . "-" . $user['user_name'])) {
            $s->assign('profile', $user);
            $s->assign('user_statuses', $td->getAllTweets($user['user_id'], 20));
            $s->assign('sources', $td->getStatusSources($user['user_id']));
            $s->assign('cfg', $cfg);
            $s->assign('instance', $i);
            $exchanges = $td->getExchangesBetweenUsers($cfg->twitter_user_id, $user['user_id']);
            $s->assign('exchanges', $exchanges);
            $s->assign('total_exchanges', count($exchanges));
            $mutual_friends = $fd->getMutualFriends($user['user_id'], $i->twitter_user_id);
            $s->assign('mutual_friends', $mutual_friends);
            $s->assign('total_mutual_friends', count($mutual_friends));
        }
        $db->closeConnection($conn);
        $s->display('user.index.tpl', $i->twitter_username . "-" . $user['user_name']);
    }
} else {
    echo 'This user is not in the system.<br /><a href="' . $THINKTANK_CFG['site_root_path'] . '">back home</a>';
}
Exemple #12
0
<?php

// set up
require_once 'config.webapp.inc.php';
ini_set("include_path", ini_get("include_path") . PATH_SEPARATOR . $INCLUDE_PATH);
require_once "init.php";
$db = new Database($THINKTANK_CFG);
$conn = $db->getConnection();
$td = new TweetDAO($db);
$s = new SmartyThinkTank();
// show tweet with public replies
if (isset($_REQUEST['t']) && $td->isTweetByPublicInstance($_REQUEST['t'])) {
    if (!$s->is_cached('public.tpl', $_REQUEST['t'])) {
        $tweet = $td->getTweet($_REQUEST['t']);
        $public_tweet_replies = $td->getPublicRepliesToTweet($tweet->status_id);
        $s->assign('tweet', $tweet);
        $s->assign('replies', $public_tweet_replies);
        $s->assign('site_root', $THINKTANK_CFG['site_root_path']);
    }
    $s->display('public.tpl', $_REQUEST['t']);
} else {
    if (!$s->is_cached('public.tpl')) {
        $s->assign('tweets', $td->getTweetsByPublicInstances());
        $s->assign('site_root', $THINKTANK_CFG['site_root_path']);
    }
    $s->display('public.tpl');
}
Exemple #13
0
        die;
    } else {
        $i = $id->getByUsernameOnNetwork($username, $_REQUEST['n']);
    }
} else {
    $db->closeConnection($conn);
    die;
}
if (!isset($_REQUEST['d'])) {
    $_REQUEST['d'] = "all-tweets";
}
$webapp->setActivePlugin($i->network);
$s = new SmartyThinkTank();
// instantiate data access objects
$ud = DAOFactory::getDAO('UserDAO');
$pd = DAOFactory::getDAO('PostDAO');
$fd = DAOFactory::getDAO('FollowDAO');
$ld = DAOFactory::getDAO('LinkDAO');
// pass data to smarty
$view_template = $webapp->loadRequestedTabData($_GET["d"], $i);
if (!$s->is_cached($view_template, $i->network_username . "-" . $_SESSION['user'] . "-" . $_REQUEST['d'])) {
    $s->assign('site_root_path', $config->getValue('site_root_path'));
    $s->assign('i', $i);
    $u = new Utils();
    $s->assign('display', $_REQUEST['d']);
}
# clean up
$db->closeConnection($conn);
//echo "TEMPLATE: ".$view_template;
$s->display($view_template, $i->network_username . "-" . $_SESSION['user'] . "-" . $_REQUEST['d']);
Exemple #14
0
                } else {
                    $msg .= "OAuth Tokens NOT updated.";
                }
            } else {
                if ($oid->insert($owner->id, $i->id, $tok['oauth_token'], $tok['oauth_token_secret'])) {
                    $msg .= "Added owner instance.<br />";
                } else {
                    $msg .= "PROBLEM Did not add owner instance.<br />";
                }
            }
        } else {
            $msg .= "Instance does not exist.<br />";
            $id->insert($twitter_id, $tu);
            $msg .= "Created instance.<br />";
            $i = $id->getByUsername($tu);
            if ($oid->insert($owner->id, $i->id, $tok['oauth_token'], $tok['oauth_token_secret'])) {
                $msg .= "Created an owner instance.<br />";
            } else {
                $msg .= "Did NOT create an owner instance.<br />";
            }
        }
        $cfg = new Config($i->network_username, $i->network_user_id);
        $s->assign('cfg', $cfg);
    }
    # clean up
    $db->closeConnection($conn);
}
$msg .= '<a href="' . $THINKTANK_CFG['site_root_path'] . 'account/" class="tt-button ui-state-default tt-button-icon-left ui-corner-all"><span class="ui-icon ui-icon-circle-arrow-e"></span>Back to your account</a>';
$s->assign('msg', $msg);
$s->display('message.tpl');
Exemple #15
0
$od = DAOFactory::getDAO('OwnerDAO');
$ud = DAOFactory::getDAO('UserDAO');
$fd = DAOFactory::getDAO('FollowDAO');
$id = DAOFactory::getDAO('InstanceDAO');
$pd = DAOFactory::getDAO('PostDAO');
$s = new SmartyThinkTank();
if (isset($_REQUEST['u']) && $ud->isUserInDBByName($_REQUEST['u']) && isset($_REQUEST['i'])) {
    $user = $ud->getUserByName($_REQUEST['u']);
    $owner = $od->getByEmail($_SESSION['user']);
    $i = $id->getByUsername($_REQUEST['i']);
    if (isset($i)) {
        if (!$s->is_cached('user.index.tpl', $i->network_username . "-" . $user->username)) {
            $s->assign('instances', $id->getByOwner($owner));
            $s->assign('profile', $user);
            $s->assign('user_statuses', $pd->getAllPosts($user->user_id, 20));
            $s->assign('sources', $pd->getStatusSources($user->user_id));
            $s->assign('site_root_path', $config->getValue('site_root_path'));
            $s->assign('instance', $i);
            $exchanges = $pd->getExchangesBetweenUsers($i->network_user_id, $user->user_id);
            $s->assign('exchanges', $exchanges);
            $s->assign('total_exchanges', count($exchanges));
            $mutual_friends = $fd->getMutualFriends($user->user_id, $i->network_user_id);
            $s->assign('mutual_friends', $mutual_friends);
            $s->assign('total_mutual_friends', count($mutual_friends));
        }
        $db->closeConnection($conn);
        $s->display('user.index.tpl', $i->network_username . "-" . $user->username);
    }
} else {
    echo 'This user is not in the system.<br /><a href="' . $config->getValue('site_root_path') . '">back home</a>';
}
Exemple #16
0
            $s->assign('people', $fd->getMostFollowedFollowees($i->network_user_id, 15));
            break;
        case "friends-former":
            $s->assign('header', 'Former Friends');
            $s->assign('people', $fd->getFormerFollowees($i->network_user_id, 15));
            break;
        case "friends-notmutual":
            $s->assign('header', 'Not Mutual Friends');
            $s->assign('people', $fd->getFriendsNotFollowingBack($i->network_user_id));
            break;
        case "links-friends":
            $s->assign('header', 'Links From Friends');
            $s->assign('description', 'Links your friends posted');
            $s->assign('links', $ld->getLinksByFriends($i->network_user_id));
            break;
        case "links-favorites":
            $s->assign('header', 'Links From Favorites');
            $s->assign('description', 'Links in posts you favorited');
            //$s->assign('links', $ld->getLinksByFriends($cfg->twitter_user_id));
            break;
        case "links-photos":
            $s->assign('header', 'Photos');
            $s->assign('description', 'Photos your friends have posted');
            $s->assign('links', $ld->getPhotosByFriends($i->network_user_id));
            break;
    }
}
# clean up
$db->closeConnection($conn);
$s->display('inline.view.tpl', $i->network_username . "-" . $_SESSION['user'] . "-" . $_REQUEST['d']);
Exemple #17
0
if (isset($_REQUEST['t']) && $pd->isPostByPublicInstance($_REQUEST['t'])) {
    if (!$s->is_cached('public.tpl', $_REQUEST['t'])) {
        $post = $pd->getPost($_REQUEST['t']);
        $public_tweet_replies = $pd->getPublicRepliesToPost($post->post_id);
        $public_retweets = $pd->getRetweetsOfPost($post->post_id, true);
        $s->assign('post', $post);
        $s->assign('replies', $public_tweet_replies);
        $s->assign('retweets', $public_retweets);
        $rtreach = 0;
        foreach ($public_retweets as $t) {
            $rtreach += $t->author->follower_count;
        }
        $s->assign('rtreach', $rtreach);
        $s->assign('site_root', $THINKTANK_CFG['site_root_path']);
    }
    $s->display('public.tpl', $_REQUEST['t']);
} elseif (isset($_REQUEST['v'])) {
    $view = $_REQUEST['v'];
    switch ($view) {
        case 'timeline':
            if (!$s->is_cached('public.tpl', $page)) {
                $totals = $pd->getTotalPagesAndPostsByPublicInstances($count);
                if ($totals['total_pages'] > $page) {
                    $s->assign('next_page', $page + 1);
                }
                $s->assign('current_page', $page);
                $s->assign('total_pages', $totals['total_pages']);
                $s->assign('posts', $pd->getPostsByPublicInstances($page, $count));
                $s->assign('site_root', $THINKTANK_CFG['site_root_path']);
            }
            $s->assign('header', 'Latest');
Exemple #18
0
                    $msg .= "OAuth Tokens updated.";
                } else {
                    $msg .= "OAuth Tokens NOT updated.";
                }
            } else {
                if ($oid->insert($owner->id, $i->id, $tok['oauth_token'], $tok['oauth_token_secret'])) {
                    $msg .= "Added owner instance.<br />";
                } else {
                    $msg .= "PROBLEM Did not add owner instance.<br />";
                }
            }
        } else {
            $msg .= "Instance does not exist.<br />";
            $id->insert($twitter_id, $tu);
            $msg .= "Created instance.<br />";
            $i = $id->getByUsername($tu);
            if ($oid->insert($owner->id, $i->id, $tok['oauth_token'], $tok['oauth_token_secret'])) {
                $msg .= "Created an owner instance.<br />";
            } else {
                $msg .= "Did NOT create an owner instance.<br />";
            }
        }
        $s->assign('site_root_path', $config->getValue('site_root_path'));
    }
    # clean up
    $db->closeConnection($conn);
}
$msg .= '<a href="' . $config->getValue('site_root_path') . 'account/index.php?p=twitter" class="tt-button ui-state-default tt-button-icon-left ui-corner-all"><span class="ui-icon ui-icon-circle-arrow-e"></span>Back to your account</a>';
$s->assign('msg', $msg);
$s->display($config->getValue('source_root_path') . 'webapp/plugins/twitter/view/auth.tpl');
Exemple #19
0
$s = new SmartyThinkTank();
$s->caching = false;
if (isset($_POST['Submit']) && $_POST['Submit'] == 'Send') {
    if ($od->doesOwnerExist($_POST['email'])) {
        $newpwd = rand(10000, 99999);
        $server = $_SERVER['HTTP_HOST'];
        $cryptpass = $session->pwdcrypt($newpwd);
        $od->updatePassword($_POST['email'], $cryptpass);
        $es = new SmartyThinkTank();
        $es->caching = false;
        $es->assign('apptitle', $config->getValue('app_title'));
        $es->assign('email', $_POST['email']);
        $es->assign('newpwd', $newpwd);
        $es->assign('server', $server);
        $es->assign('site_root_path', $config->getValue('site_root_path'));
        $message = $es->fetch('_email.forgotpassword.tpl');
        Mailer::mail($_POST['email'], "The " . $config->getValue('app_title') . " Account Details You Requested", $message);
        $successmsg = "Password recovery information has been sent to your email address. <a href=\"login.php\">Sign in.</a>";
    } else {
        $errormsg = "Account does not exist";
    }
}
if (isset($errormsg)) {
    $s->assign('errormsg', $errormsg);
} elseif (isset($successmsg)) {
    $s->assign('successmsg', $successmsg);
}
$db->closeConnection($conn);
$s->assign('site_root_path', $config->getValue('site_root_path'));
$s->display('session.forgot.tpl');
Exemple #20
0
 $s = new SmartyThinkTank();
 if (isset($_REQUEST['u']) && $id->isUserConfigured($_REQUEST['u'])) {
     $username = $_REQUEST['u'];
     $oid = new OwnerInstanceDAO($db);
     if (!$oid->doesOwnerHaveAccess($owner, $username)) {
         echo 'Insufficient privileges. <a href="/">Back</a>.';
         $db->closeConnection($conn);
         die;
     } else {
         $i = $id->getByUsername($username);
     }
 } else {
     $i = $id->getFreshestByOwnerId($owner->id);
     if (!isset($i) && $i == null) {
         $s->assign('msg', 'You have no Twitter accounts configured. <a href="' . $THINKTANK_CFG['site_root_path'] . 'account/?p=twitter">Set up a Twitter account here</a>');
         $s->display('message.tpl');
         $db->closeConnection($conn);
         die;
     }
 }
 // save the session instance network username to the current instance
 $_SESSION['network_username'] = $i->network_username;
 $_SESSION['instance'] = serialize($i);
 if (!$s->is_cached('index.tpl', $i->network_username . "-" . $_SESSION['user'])) {
     $cfg = new Config($i->network_username, $i->network_user_id);
     $u = new Utils();
     // instantiate data access objects
     $ud = new UserDAO($db);
     $pd = new PostDAO($db);
     $fd = new FollowDAO($db);
     // pass data to smarty
Exemple #21
0
                $cryptpass = $session->pwdcrypt($_POST['pass2']);
                $server = $_SERVER['HTTP_HOST'];
                $od->create($_POST['email'], $cryptpass, $_POST['country'], $activ_code, $_POST['full_name']);
                $es->assign('apptitle', $THINKTANK_CFG['app_title']);
                $es->assign('server', $server);
                $es->assign('site_root_path', $THINKTANK_CFG['site_root_path']);
                $es->assign('email', urlencode($_POST[email]));
                $es->assign('activ_code', $activ_code);
                $message = $es->fetch('_email.registration.tpl');
                Mailer::mail($_POST['email'], "Activate Your " . $THINKTANK_CFG['app_title'] . " Account", $message);
                echo $message;
                unset($_SESSION['ckey']);
                $successmsg = "Success! Check your email for an activation link.";
            }
        }
        $s->assign('name', $_POST["full_name"]);
        $s->assign('mail', $_POST["email"]);
    }
    $challenge = $captcha->generate($msg);
    $s->assign('captcha', $challenge);
}
if (isset($errormsg)) {
    $s->assign('errormsg', $errormsg);
} elseif (isset($successmsg)) {
    $s->assign('successmsg', $successmsg);
}
$db->closeConnection($conn);
$cfg = new Config();
$s->assign('cfg', $cfg);
$s->display('session.register.tpl');
Exemple #22
0
                $host = ereg_replace('www.', '', $server);
                $sql = "INSERT INTO " . $THINKTANK_CFG['table_prefix'];
                $sql .= "owners (`user_email`,`user_pwd`,`country`,`joined`,`activation_code`,`full_name`)";
                $sql .= "VALUES ('{$_POST['email']}','{$md5pass}','{$_POST['country']}',now(),'{$activ_code}','{$_POST['full_name']}')";
                mysql_query($sql) or die(mysql_error());
                $message = "Thank you for registering an account with " . $THINKTANK_CFG['app_title'];
                $message .= ". Click on the link below to activate your account...\n\n";
                $message .= "http://{$server}/" . $THINKTANK_CFG['site_root_path'];
                $message .= "session/activate.php?usr="******"&code={$activ_code} \n\n";
                $message .= "_____________________________________________";
                $message .= "Thank you. This is an automated response. PLEASE DO NOT REPLY.";
                $mailheader = "From: \"Auto-Response\" <notifications@{$host}>\r\n";
                $mailheader .= "X-Mailer: PHP/" . phpversion();
                mail($_POST['email'], "Login Activation", $message, $mailheader);
                unset($_SESSION['ckey']);
                echo "Registration Successful! An activation code has been sent to your email address with an activation link.";
                exit;
            }
        }
        $s->assign('name', $_POST["full_name"]);
        $s->assign('mail', $_POST["email"]);
    }
    $challenge = $captcha->generate($msg);
    $s->assign('captcha', $challenge);
    if (isset($_GET['msg'])) {
        $s->assign('msg', $_GET[msg]);
        $s->display('session.register.tpl', sha1($_GET['msg']));
    } else {
        $s->display('session.register.tpl');
    }
}