Пример #1
0
function feed2hatom($url)
{
    XN_Application::includeFile('alphacomponents', '/Alpha/Format/RSS.php');
    $feed = XNC_Alpha_Format_RSS::load($url);
    $outlinearray = array();
    $outlinearray[0]['rel'] = 'home';
    $outlinearray[0]['text'] = $feed->title;
    $outlinearray[0]['href'] = $feed->link;
    $outlinearray[0]['title'] = $feed->description;
    $outlinearray[0]['text#1'] = '[feed]';
    $outlinearray[0]['href#1'] = $_GET['url'];
    $count = 1;
    if (!$feed->items) {
        return $outlinearray;
    }
    foreach ($feed->items as $item) {
        $outlinearray[$count]['text'] = $item->title;
        $outlinearray[$count]['href'] = $item->link;
        if ($item->description) {
            $outlinearray[$count]['body'] = str_replace('</br>', '', str_replace('<br>', '<br />', $item->description));
            $outlinearray[$count]['body>>class'] = 'entry-content';
        }
        //end if description
        if ($item->pubDate) {
            $outlinearray[$count]['title'] = $item->pubDate * 1000000000;
            $outlinearray[$count]['published'] = date('c', $item->pubDate);
            $outlinearray[$count]['published>>class'] = 'published';
        }
        //end if pubDate
        if ($item->comments) {
            $outlinearray[$count]['href#1'] = $item->comments;
            $outlinearray[$count]['text#1'] = 'comments';
            $outlinearray[$count]['rel#1'] = 'comments';
        }
        //end if comments
        if ($item->author || $item->dc->creator) {
            $outlinearray[$count]['text#2'] = $item->author ? $item->author : $item->dc->creator;
            $outlinearray[$count]['rel#2'] = 'author';
            $outlinearray[$count]['class#2'] = 'author vcard fn';
        }
        //end if comments
        $outlinearray[$count]['rel'] = 'bookmark';
        $outlinearray[$count]['class'] = 'entry-title';
        $count++;
    }
    //end foreach feed->items
    return $outlinearray;
}
Пример #2
0
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);
}
Пример #3
0
</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&amp;format=rss20' . ($_REQUEST['user'] ? '&amp;user='******'user'] : '') . ($_REQUEST['tag'] ? '&amp;tag=' . $_REQUEST['tag'] : '') . ($_REQUEST['q'] ? '&amp;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'] . '&amp;start=' . $to . '">More &raquo;</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);
}
Пример #4
0
<?php

XN_Application::includeFile('xoxotools', '/OutlineClasses/Outline.php');
XN_Application::includeFile('xoxotools', '/OutlineClasses/OutlineFromXOXO.php');
XN_Application::includeFile('xoxotools', '/OutlineClasses/OutlineFromOPML.php');
XN_Application::includeFile('xoxotools', '/OutlineClasses/JSON.php');
$json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
//Reading List
function process_reading_list($obj)
{
    foreach ($obj->getNodes() as $node) {
        if ($node->getField('href')) {
            echo '   <li><a href="' . $node->getField('href') . '" title="' . $node->getField('title') . '">' . $node->getField('text') . '</a>' . ($node->getField('href#1') ? ' <a href="' . $node->getField('href#1') . '" rel="alternate">[feed]</a>' : '') . '</li>' . "\n";
        }
        if ($node->getNumNodes()) {
            process_reading_list($node);
        }
    }
    //end foreach nodes
}
//end function
$readinglistdata = file_get_contents('http://www.awriterz.org/etcetc/boxtheweb/exportboxes.php?user=hash%3Afc6e6f4412f270b70b869cf7757122d4&format=xoxo&feedsonly=on');
if (stristr('<opml', $readinglistdata)) {
    $obj = new OutlineFromOPML($readinglistdata);
} else {
    $obj = new OutlineFromXOXO($readinglistdata);
}
$obj->toOPMLfields();
$obj->toXOXOfields();
echo '<h2>Reading List</h2>' . "\n";
echo '<ul>' . "\n";
Пример #5
0
<?php

/* License (BSD)
Copyright (c) 2004, Ryan Lee
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
    * Neither the name of the ryanlee.org nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* Modifications (c) 2006 Stephen Paul Weber */
XN_Application::includeFile('xoxotools', '/OutlineClasses/OutlineFromXML.php');
$xanga_username = "";
$xanga_password = "";
$xanga_comments = 0;
// 1 = allow comments on Xanga post, 0 = no comments
$xanga_premium = 0;
// 1 = accounts is Premium Xanga, 0 = normal (free)
$xanga_authors = 0;
// 1 = show wp author's name as profile data pref
$xanga_title = 1;
// 1 = use Xanga's title parameter; title will show
//     above all other parts of post
$xanga_protected = 0;
// 1 = post your WP password protected posts to Xanga
//     as a Xanga protected post
function xanga_fetch_login_key()
Пример #6
0
    }
    //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>
Пример #7
0
<?php

$viewer = XN_Profile::current();
$name = $viewer->isLoggedIn() ? $viewer->screenName : 'Stranger';
$app = XN_Application::load();
$editFileUrl = 'http://www.ning.com/?view=apps&amp;op=edit&amp;sop=editFile&amp;currentDir=%2f&amp;fileName=index.php&amp;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 
Пример #8
0
<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";
Пример #9
0
 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;
 }
Пример #10
0
?>
</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);
    ?>
Пример #11
0
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 
}