<html> <head> <title>Claire: Posting Comments Example</title> <?php include_once 'config.php'; $post_xid = '6a00e5539faa3b88330120a7b004e2970b'; $page_number = 1; if (array_key_exists('page', $_GET)) { $page_number = $_GET['page']; } $entry_listing = new EntryListing(array('xid' => BLOG_XID, 'page_number' => $page_number)); $entries = $entry_listing->entries(); $user_session = new TPSession(); ?> <link rel="stylesheet" href="../tp-libraries/styles.css" type="text/css" /> </head> <body> <h2><a href="index.php">Claire Demo: Posting Comments</a></h2> <div class="login_box"> <?php if (!$user_session->is_logged_in()) { echo "<a href='login.php'>Log In</a>"; } else { echo "Welcome, <a href='" . $user_session->author->profile_url . "'>" . $user_session->author->display_name . "</a>!"; echo '<br /><a href="index.php?logout=1">Log Out</a>'; } ?>
<html> <head> <?php include_once 'config.php'; // provide a post_xid just in case. $post_xid = '6a00e5539faa3b88330120a7b004e2970b'; if (array_key_exists('xid', $_GET)) { $post_xid = $_GET['xid']; } else { if (array_key_exists('xid', $_POST)) { $post_xid = $_POST['xid']; } } $user_session = new TPSession(); $anon_comments_allowed = anon_comments_allowed(BLOG_XID); // handle comment posts... if (array_key_exists('comment_text', $_POST)) { if ($user_session->is_logged_in()) { // This will post a comment to TypePad -- while Authenticated. $comment = new Comment(array('post_xid' => $post_xid, 'session' => $user_session, 'content' => $_POST['comment_text'])); } else { if ($anon_comments_allowed) { // Post anonymously. $comment = new Comment(array('post_xid' => $post_xid, 'content' => $_POST['comment_text'], 'name' => $_POST['comment_name'], 'href' => $_POST['comment_href'], 'email' => $_POST['comment_email'], 'blog_xid' => BLOG_XID)); } } } $entry = new Entry(array('xid' => $post_xid)); $favorites = $entry->favorites(); $comments = $entry->comments(); ?>
<html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <title>Movable Type - TPConnect + FBComments Demo</title> <link rel="stylesheet" href="../tp-libraries/styles.css" type="text/css" /> <?php include_once 'config.php'; $user_session = new TPSession(); $content = '<b>Rabbits</b> are small <a href="http://en.wikipedia.org/wiki/Mammal" title="Mammal">mammals</a> in the <a href="http://en.wikipedia.org/wiki/Family_%28biology%29" title="Family (biology)">family</a> <a href="http://en.wikipedia.org/wiki/Leporidae" title="Leporidae">Leporidae</a> of the order <a href="http://en.wikipedia.org/wiki/Lagomorpha" title="Lagomorpha">Lagomorpha</a>, found in several parts of the world. There are seven different <a href="http://en.wikipedia.org/wiki/Genus" title="Genus">genera</a> in the family <a href="http://en.wikipedia.org/wiki/Taxonomy" title="Taxonomy">classified</a> as rabbits, including the <a href="http://en.wikipedia.org/wiki/European_rabbit" title="European rabbit" class="mw-redirect">European rabbit</a> (<i>Oryctolagus cuniculus</i>), <a href="http://en.wikipedia.org/wiki/Cottontail_rabbit" title="Cottontail rabbit">Cottontail rabbit</a> (genus <i>Sylvilagus</i>; 13 <a href="http://en.wikipedia.org/wiki/Species" title="Species">species</a>), and the <a href="http://en.wikipedia.org/wiki/Amami_rabbit" title="Amami rabbit" class="mw-redirect">Amami rabbit</a> (<i>Pentalagus furnessi</i>, <a href="http://en.wikipedia.org/wiki/Endangered_species" title="Endangered species">endangered species</a> on <a href="http://en.wikipedia.org/wiki/Amami_%C5%8Cshima" title="Amami Ōshima">Amami Ōshima</a>, <a href="http://en.wikipedia.org/wiki/Japan" title="Japan">Japan</a>). There are many other species of rabbit, and these, along with <a href="http://en.wikipedia.org/wiki/Pika" title="Pika">pikas</a> and <a href="http://en.wikipedia.org/wiki/Hare" title="Hare">hares</a>, make up the <a href="http://en.wikipedia.org/wiki/Order_%28biology%29" title="Order (biology)">order</a> <a href="http://en.wikipedia.org/wiki/Lagomorpha" title="Lagomorpha">Lagomorpha</a>. '; $post_url = 'http://mtcs-demo.apperceptive.com/testmt/recent_news/2010/03/performance-artist-mimics-performance-artist-at-moma.php'; $tp_entry = new TPConnectEntry(array('blog_xid' => '6a00e5539faa3b88330120a94362b9970b', 'permalink' => $post_url, 'entry_id' => '67', 'content' => $content)); // handle comment posts... if ($user_session->is_logged_in() and array_key_exists('comment_text', $_POST)) { // This will post a comment to TypePad. $comment = new Comment(array('post_xid' => $tp_entry->xid, 'session' => $user_session, 'content' => $_POST['comment_text'])); } $comments = $tp_entry->rousseaus_listing(); ?> </head> <body> <h2><a href="index.php">Movable Type Blog Post (TPConnect Comments + FaceBook Fan Page Comments)</a></h2> <a class="next" href="<?php echo $post_url; ?> " target="_blank">View Entry on Movable Type</a> <br />
<?php include_once "oauth-php-98/library/OAuthStore.php"; include_once "oauth-php-98/library/OAuthRequester.php"; include_once 'config.php'; // Create a new session object. It will flush any local cookies that you have in case // you hit this page in error, since this should be the "Login" page. $user_session = new TPSession(); // Obtain a Request token from TypePad. $user_session->request_and_verify_request_token(); // Next step in the OAuth Dance: Redirect your user to the Provider. // this redirect() method is courtesy of our OAuthPHP lib. Parameters: // 1 = the URL to redirect to // 2 = a list of parameters. In our case, it's the Request token. /* * 'oauth-authorization-page' is deprecated in favor of 'oauthAuthorizationUrl'. OAuthRequest::redirect($user_session->get_api_endpoint('oauth-authorization-page'), array('oauth_token' => $user_session->oauth_token)); */ OAuthRequest::redirect($user_session->get_api_endpoint(TP_OAUTH_AUTH_URL), array('oauth_token' => $user_session->oauth_token)); // FYI: HTML is forbidden in this file, since the redirect's headers cannot be written!! ?>