function getSweeties($id) { $file = XN_Content::load(intval($id)); $bag = XN_Query::create('Content')->filter('owner', '=', XN_Application::load('sweeties'))->filter('type', 'eic', 'SweetieBag')->filter('contributorName', 'eic', $file->contributorName); $bag = $bag->execute(); $bag = $bag[0]; $rtrn = array(); $sweeties = unserialize($bag->my->rec_trans); if ($sweeties) { foreach ($sweeties as $sweetie) { if ($sweetie['recip_obj'] == $id) { $rtrn[] = $sweetie; } } //end foreach sweeties } //end if sweeties return array_reverse($rtrn); }
</wfw:commentRSS> </item> <?php } ?> </channel> </rss> <?php exit; } //end if format == rss20 || rss echo ' <a style="float:right;" href="http://' . $_SERVER['HTTP_HOST'] . '/?xn_auth=no&format=rss20' . ($_REQUEST['user'] ? '&user='******'user'] : '') . ($_REQUEST['tag'] ? '&tag=' . $_REQUEST['tag'] : '') . ($_REQUEST['q'] ? '&q=' . urlencode($_REQUEST['q']) : '') . '" rel="alternate"><img src="http://wrinks.ning.com/feedicon12x12.png" alt="[feed]" /></a>'; echo '<p>' . nl2br($setup->my->homepageblurb) . '</p>'; echo '<h2 class="pagetitle">' . $title . ' (' . $from . ' - ' . $to . ' of ' . $total . ')</h2>'; echo '<xn:head><title>' . XN_Application::load()->name . ' - ' . $title . '</title></xn:head>'; echo '<ul>'; foreach ($items as $item) { echo '<li><a href="/xn/detail/' . $item->id . '">' . $item->h('title') . '</a>' . ($item->description ? ' - ' : '') . substr(strip_tags($item->description), 0, 100) . (strlen(strip_tags($item->description)) > 100 ? '...' : '') . '</li>'; } //end foreach echo '</ul>'; if ($to < $total) { echo '<p><a href="/?' . $_SERVER['QUERY_STRING'] . '&start=' . $to . '">More »</a></p>'; } echo '<h2 class="pagetitle">Tags</h2>'; if ($_REQUEST['user']) { echo XNC_HTML::buildMap(getTagCount(), '/user/' . $_REQUEST['user'] . '/?tag=%s', '', true, 60, 300); } else { echo XNC_HTML::buildMap(getTagCount(), '/?tag=%s', '', true, 60, 300); }
} //end if tags $file->focus(); //focus sidebar -- probably deprecated echo '<p><b>' . $setup->my->single . ' Saved</b></p>'; //Print 'saved' message } //end if isset submit if ($file) { //If there's an existing object, we're editing echo '<h2>Edit ' . $setup->my->single . '</h2>'; echo '<xn:head><title>' . XN_Application::load()->name . ' - Edit ' . $setup->my->single . '</title></xn:head>'; } else { //otherwise we're creating/adding echo '<h2>Add ' . $setup->my->single . '</h2>'; echo '<xn:head><title>' . XN_Application::load()->name . ' - Add ' . $setup->my->single . '</title></xn:head>'; } //end if-else file ?> <!-- File upload/object edit form --> <fieldset> <form enctype="multipart/form-data" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> "><dl> <dt>Title</dt><dd><input type="text" name="title" value="<?php if ($file) { echo $file->h('title'); } ?> " /></dd>
<?php $viewer = XN_Profile::current(); $name = $viewer->isLoggedIn() ? $viewer->screenName : 'Stranger'; $app = XN_Application::load(); $editFileUrl = 'http://www.ning.com/?view=apps&op=edit&sop=editFile&currentDir=%2f&fileName=index.php&appUrl=' . $app->relativeUrl; ?> <div id="skeleton"> <?php if ($viewer->isOwner()) { ?> <p><a href="<?php echo $editFileUrl; ?> "><img id="editFile" src="edit_button.gif" alt="Edit This Page" border="0" /></a></p> <?php } ?> <h3>Hello, <?php echo $name; ?> !</h3> <?php if ($viewer->isOwner()) { ?> <p>Come on in, the code's nice and warm...</p> <?php } else { ?> <p>This App is still under development. Please check back later.</p> <?php
<input type="hidden" name="xnc_comment" value="xnc_comment" /><input type="hidden" name="Comment:_parent_id" value="<?php echo $file->id; ?> " />Comment: <br /> <textarea name="Comment:description" rows="5" cols="50"></textarea><br /> <input type="submit" name="submit" value="Save Comment" class="button"/><br /> </form> <a href="http://cocomment.com/"><img src="http://cocomment.com/images/cocomment-integrated.gif" alt="coComment Integrated" /></a> <script type="text/javascript"> var blogTool = "Ning App"; var blogURL = "http://<?php echo $_SERVER['HTTP_HOST']; ?> /"; var blogTitle = "<?php echo addslashes(XN_Application::load()->name); ?> "; var postURL = "http://<?php echo $_SERVER['HTTP_HOST']; ?> /view.php?id=<?php echo $file->id; ?> "; var postTitle = "<?php echo addslashes($file->title); ?> "; var commentTextFieldName = "Comment:description"; var commentButtonName = "submit";
private function getCoCo($formid = 'commentForm', $integrate = false) { $rtrn = ''; if ($integrate) { $rtrn .= '<a href="http://cocomment.com/"><img src="http://cocomment.com/images/cocomment-integrated.gif" alt="coComment Integrated" /></a>' . "\n"; } if (!$pagetitle) { $pagetitle = XN_Application::load()->name; } $rtrn .= '<script type="text/javascript">' . "\n"; $rtrn .= ' var blogTool = "Ning App";' . "\n"; $rtrn .= ' var blogURL = "http://' . $_SERVER['HTTP_HOST'] . '/";' . "\n"; $rtrn .= ' var blogTitle = "' . addslashes(XN_Application::load()->name) . '";' . "\n"; $rtrn .= ' var postURL = "http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '";' . "\n"; $rtrn .= ' var postTitle = "' . addslashes($this->parent->title) . '";' . "\n"; $rtrn .= ' var commentTextFieldName = "Comment:description";' . "\n"; $rtrn .= ' var commentButtonName = "submit";' . "\n"; $rtrn .= ' var commentAuthorLoggedIn = true;' . "\n"; $rtrn .= ' var commentAuthor = "' . XN_Profile::current()->screenName . '";' . "\n"; $rtrn .= ' var commentFormID = "' . $formid . '";' . "\n"; $rtrn .= ' var cocomment_force = false;' . "\n"; $rtrn .= '</script>' . "\n"; if ($integrate) { $rtrn .= '<script type="text/javascript" src="http://www.cocomment.com/js/cocomment.js"></script>' . "\n"; } return $rtrn; }
?> </title> <description>On App <?php echo XN_Application::load()->name; ?> </description> <link>http://<?php echo $_SERVER['HTTP_HOST']; ?> /view.php?id=<?php echo $file->id; ?> </link> <docs>http://blogs.law.harvard.edu/tech/rss</docs> <generator><?php echo XN_Application::load()->name; ?> (PHP Script)</generator> <pubDate><?php echo date('r', strtotime($firstcomment->createdDate)); ?> </pubDate> <lastBuildDate><?php echo date('r', strtotime($firstcomment->createdDate)); ?> </lastBuildDate> <?php foreach ($comments as $comment) { $data = new XNC_Comment($comment); ?>
function extComments($file) { ?> <xn:head> <style type="text/css"> /* Comment Styles */ .comments { list-style-type: none; margin-left: 0px; margin-top: 0.5em; } .comments li { display: block; margin-left: 0px; margin-bottom: 1em; } .comments dl { display: inline; } .comments dd { margin-left: 0px; } .comments dt { display: none; } .comments dd.author { display: inline; font-size: 1em; } .comments dd.content { display: block; margin-top: 0.5em; } </style> </xn:head> <?php $newComment = new XNC_Comment($file); // Handle any form submission of adding a new comment if ($newComment->willProcessForm()) { $newComment->processForm(); $cnt = XN_Content::load($newComment->id); $cnt->my->set('parentid', $file->id); $cnt->isPrivate = false; $cnt->save(); } elseif ($newComment->lastError() != XNC_Comment::ERROR_FORM_ABSENT) { print $newComment->lastError(); } // Display a list of comments belonging to a parent object if ($file->my->content($newComment->referenceAttribute, true)) { echo '<ul class="xoxo comments">'; foreach ($file->my->content($newComment->referenceAttribute, true) as $comment) { $data = new XNC_Comment($comment); ?> <li id="<?php echo 'c' . $data->id; ?> "> Posted on <a href="<?php echo $_SERVER['SCRIPT_URI'] . ($_SERVER['QUERY_STRING'] ? '?' . $_SERVER['QUERY_STRING'] : ''); ?> #<?php echo 'c' . $data->id; ?> " title="<?php echo strtotime($data->createdDate); ?> "><?php echo date('Y-m-d H:i', strtotime($data->createdDate)); ?> </a> by <a href="http://<?php echo $_SERVER['HTTP_HOST']; ?> /?user=<?php echo $data->contributorName; ?> " class="author user"><?php echo $data->contributorName; ?> </a> <dl> <dt>body</dt> <dd class="content"><?php echo removeEvilTags(nl2br($data->description)); ?> </dd> </dl> </li> <?php } //end foreach echo '</ul>'; } //end if // Display the add a comment form if (XN_Profile::current()->isLoggedIn()) { ?> <form id="commentForm" method="post" action="<?php echo $_SERVER['SCRIPT_URI'] . ($_SERVER['QUERY_STRING'] ? '?' . $_SERVER['QUERY_STRING'] : ''); ?> "> <input type="hidden" name="xnc_comment" value="xnc_comment" /><input type="hidden" name="Comment:_parent_id" value="<?php echo $file->id; ?> " />Comment: <br /> <textarea name="Comment:description" rows="5" cols="50"></textarea><br /> <input type="submit" name="submit" value="Save Comment" class="button"/><br /> </form> <a href="http://cocomment.com/"><img src="http://cocomment.com/images/cocomment-integrated.gif" alt="coComment Integrated" /></a> <script type="text/javascript"> var blogTool = "Ning App"; var blogURL = "http://<?php echo $_SERVER['HTTP_HOST']; ?> /"; var blogTitle = "<?php echo addslashes(XN_Application::load()->name); ?> "; var postURL = "<?php echo $_SERVER['SCRIPT_URI'] . ($_SERVER['QUERY_STRING'] ? '?' . $_SERVER['QUERY_STRING'] : ''); ?> "; var postTitle = "<?php echo addslashes($file->title); ?> "; var commentTextFieldName = "Comment:description"; var commentButtonName = "submit"; var commentAuthorLoggedIn = true; var commentAuthor = "<?php echo XN_Profile::current()->screenName; ?> "; var commentFormID = "commentForm"; var cocomment_force = false; var cocoscript = document.createElement('script'); cocoscript.setAttribute('id', 'cocomment-fetchlet'); cocoscript.setAttribute('trackAllComments', 'true'); cocoscript.setAttribute('src', 'http://www.cocomment.com/js/enabler.js'); document.getElementsByTagName('head')[0].appendChild(cocoscript); </script> <?php } ?> </div> <?php }