Ejemplo n.º 1
0
<?php

if (!XN_Profile::current()->isLoggedIn()) {
    die('<b>Please log in</b>');
}
if (!isset($_REQUEST['submit'])) {
    ?>
   <h2 class="pagetitle">Add Wrink</h2>
   <form method="get" action="addWrink.php"><div>
      <label for="title">Wrink title:</label> <input type="text" name="title" value="" /><br />
      <label for="description">Wrink description:</label> <input type="text" name="description" value="" /><br />
      <label for="tags">Wrink tags:</label> <input type="text" name="tags" value="" /><br />
      <input type="submit" name="submit" value="Add" />
   </div></form>
   <?php 
} else {
    header('Content-Type: text/plain;');
    $item = XN_Content::create('Wrink', $_REQUEST['title'], $_REQUEST['description'])->my->add('traffic', 0);
    $item->save();
    XN_Tag::checkTags($_REQUEST['tags']);
    XN_Tag::addTags($item, $_REQUEST['tags']);
    header('Location: http://' . $_SERVER['HTTP_HOST'] . '/wrink.php?id=' . $item->id, TRUE, 303);
}
//end if-else ! isset submit
Ejemplo n.º 2
0
<?php

if (!$_REQUEST['wrinkid'] || !$_REQUEST['siteid']) {
    die("<b>ERROR : no wrink/site ids given</b>");
}
//update wrink
$wrink = XN_Content::load(intval($_REQUEST['wrinkid']));
if (XN_Profile::current()->screenName != $wrink->contributorName) {
    die("<b>Only Wrink owner can reject sites!</b>");
}
$requestedsites = explode(' ', $wrink->my->requestedsites);
foreach ($requestedsites as $id => $site) {
    if ($site == $_REQUEST['siteid'] || !$site) {
        unset($requestedsites[$id]);
    }
}
//end foreach
$wrink->my->requestedsites = implode(' ', $requestedsites);
$wrink->save();
//update site
$site = XN_Content::load(intval($_REQUEST['siteid']));
if ($site->my->rejectedwrinks) {
    $site->my->rejectedwrinks .= ' ' . $_REQUEST['wrinkid'];
} else {
    $site->my->add('rejectedwrinks', $_REQUEST['wrinkid']);
}
if ($site->my->wrinks) {
    $wrinks = array_unique(explode(' ', $site->my->wrinks));
    foreach ($wrinks as $id => $wrink) {
        if ($wrink == $_REQUEST['wrinkid'] || !$wrink) {
            unset($wrinks[$id]);
Ejemplo n.º 3
0
<?php

require_once 'XNC/ContentManager.php';
if (XN_Profile::current()->isOwner()) {
    $mgr = new XNC_ContentManager();
    $mgr->go();
} else {
    echo '<h1>Whoops!</h1>';
    echo '<p>We\'re sorry, only the owner of this application can access the Content Manager.  If that\'s
        you, please sign in.</p>';
}
Ejemplo n.º 4
0
    echo '<input type="submit" name="submit" value="Update" />' . "\n";
    echo '</div></form>' . "\n";
}
//end if owner
if ($item->my->wrinks) {
    echo '<h3>In Wrinks</h3>' . "\n";
    echo '<ul>' . "\n";
    $wrinks = array_unique(explode(' ', $item->my->wrinks));
    foreach ($wrinks as $wrink) {
        $wrinkdata = XN_Content::load(intval($wrink));
        echo '<li>';
        echo '<a href="/wrink.php?id=' . $wrink . '" title="' . $wrinkdata->description . '">' . $wrinkdata->title . '</a>';
        echo '</li>' . "\n";
    }
    //end foreach sites
    echo '</ul>' . "\n";
}
//end if isset wrinks
if ($item->my->rejectedwrinks && XN_Profile::current()->screenName == $item->contributorName) {
    echo '<h3>Rejected From Wrinks</h3>' . "\n";
    echo '<ul>' . "\n";
    $reject = array_unique(explode(' ', $item->my->rejectedwrinks));
    foreach ($reject as $wrink) {
        $wrinkdata = XN_Content::load(intval($wrink));
        echo '<li><a href="/wrink.php?id=' . $wrink . '" title="' . $wrinkdata->description . '">' . $wrinkdata->title . '</a>';
        echo '</li>' . "\n";
    }
    //end foreach sites
    echo '</ul>' . "\n";
}
//end if rejectedwrinks
Ejemplo n.º 5
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 
Ejemplo n.º 6
0
/";
  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";
  var commentAuthorLoggedIn = true;
  var commentAuthor         = "<?php 
    echo XN_Profile::current()->screenName;
    ?>
";
  var commentFormID         = "commentForm";
  var cocomment_force       = false;
</script>
<script type="text/javascript" src="http://www.cocomment.com/js/cocomment.js"></script>
<?php 
}
?>
</div>
Ejemplo n.º 7
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;
 }
Ejemplo n.º 8
0
echo '   <input type="hidden" name="roll" value="" />' . "\n";
echo '   <input type="submit" name="submit" value="Get Code" />' . "\n";
echo '</div></form>' . "\n";
echo '<div id="rollcoderesp"></div>';
echo '</div>' . "\n";
echo '<div id="freshrollcode" style="display:none;">' . "\n";
echo '<form action="getcode.php" onsubmit="respid = &quot;freshrollcoderesp&quot;;getCode(this,&quot;freshroll&quot;);return false;"><div>' . "\n";
echo '   <label for="combo">Used with ring?</label> <input type="checkbox" name="combo" /><br />';
echo '   <label for="site">Site to exclude:</label> <select name="site">' . "\n";
echo '      <option value="">None</option>' . "\n";
foreach ($sitesdata as $site) {
    echo '<option value="' . $site->id . '">' . $site->title . '</option>';
}
//end foreach
echo '   </select><br />' . "\n";
echo '   <input type="hidden" name="wrinkid" value="' . $item->id . '" />' . "\n";
echo '   <input type="hidden" name="freshroll" value="" />' . "\n";
echo '   <input type="submit" name="submit" value="Get Code" />' . "\n";
echo '</div></form>' . "\n";
echo '<div id="freshrollcoderesp"></div>';
echo '</div>' . "\n";
echo '<p style="float:right;"><a href="?xn_auth=no&amp;format=json&amp;' . $_SERVER['QUERY_STRING'] . '">JSON</a></p>';
if (XN_Profile::current()->screenName == $item->contributorName) {
    echo '<p><a href="javascript:toggleitem(&quot;addsite&quot;);">Add site to wrink</a></p>' . "\n";
} else {
    echo '<p><a href="javascript:toggleitem(&quot;addsite&quot;);">Request to add site to wrink</a></p>' . "\n";
}
$_REQUEST['towrink'] = $item->id;
echo '<div id="addsite" style="display:none;">';
require 'addSite.php';
echo '</div>';
Ejemplo n.º 9
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 
}