public function processForm()
 {
     $comment = $this->comment;
     if ($_REQUEST['Comment:_parent_id'] && $_REQUEST['Comment:_parent_id'] != $this->parent->id) {
         $comment = new XNC_Comment(XN_Content::load(intval($_REQUEST['Comment:_parent_id'])));
     }
     if ($comment->willProcessForm()) {
         $comment->processForm();
         $cnt = XN_Content::load($comment->id);
         if ($this->storeparent) {
             $cnt->my->set('parentid', $this->parent->id);
         }
         $cnt->isPrivate = $this->private;
         $cnt->save();
     } elseif ($comment->lastError() != XNC_Comment::ERROR_FORM_ABSENT) {
         print $comment->lastError();
     }
 }
示例#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
//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]);
        }
    }
    //end foreach
    $site->my->wrinks = implode(' ', $wrinks);
}
示例#4
0
<?php

if (!XN_Profile::current()->isLoggedIn()) {
    //Check if user is logged in and fail if they are not
    die('<b>Please log in</b>');
}
if (!$_REQUEST['id']) {
    die('<b>No ID Specified</b>');
}
$file = XN_Content::load(intval($_REQUEST['id']));
//load file by id from Content Store
if (XN_Profile::current()->screenName != $file->contributorName) {
    //if this user is not the object owner, die
    die('You do not have permission to edit this item');
}
if ($_REQUEST['_content']) {
    //save
    $file->my->set('data', base64_encode($_REQUEST['_content']));
    $file->save();
    echo '<h2>Saved</h2>';
}
//end if _content
?>
<h2>Edit File</h2>
<fieldset>
<form method="post" action="?id=<?php 
echo $_REQUEST['id'];
?>
" style="width:auto;"><dl>
   <dt style="float:none;clear:both;text-align:left;width:auto;">File Contents</dt>
   <dd style="clear:both;padding:0px;float:none;margin:0px;"><textarea name="_content" cols="100" rows="25"><?php 
示例#5
0
<?php

if (!$_REQUEST['id']) {
    die('<b>No ID Specified</b>');
}
$content = XN_Content::load($_REQUEST['id']);
if (XN_Profile::current()->screenName != $content->contributorName) {
    die('You do not have permission to delete this item');
}
XN_Content::delete($content);
$setup = XN_Query::create('Content')->filter('owner', '=')->filter('type', 'eic', 'Setup');
$setup = $setup->execute();
$setup = $setup[0];
echo '<p>' . $setup->my->single . ' #' . $_REQUEST['id'] . ' Deleted</p>';
示例#6
0
<?php

require_once 'XNC/Ajax.php';
XNC_Ajax::startAjaxPage();
if (!$_REQUEST['id']) {
    die;
}
$group = XN_Content::load(intval($_REQUEST['id']));
$grouptags = explode(' ', $group->my->grouptags);
$_REQUEST['grouptag'] = str_replace(' ', '+', $_REQUEST['grouptag']);
if (isset($_REQUEST['edit-title'])) {
    $group->set('title', $_REQUEST['title']);
    $group->save();
    header('Content-Type: text/plain');
    if (isset($_REQUEST['form'])) {
        exit($_REQUEST['title']);
    }
    header('Location: ' . $_REQUEST['return_to'], TRUE, 303);
    exit;
}
//end if edit-title
if (isset($_REQUEST['edit-desc'])) {
    $group->set('description', $_REQUEST['desc']);
    $group->save();
    header('Content-Type: text/plain');
    if (isset($_REQUEST['form'])) {
        exit(nl2br($_REQUEST['desc']));
    }
    header('Location: ' . $_REQUEST['return_to'], TRUE, 303);
    exit;
}
示例#7
0
if ($wrink->my->traffictime < time() - 604800) {
    $wrink->my->traffic = 0;
    $wrink->my->traffictime = time();
}
//end if traffictime over
$wrink->save();
$sites = explode(' ', $wrink->my->sites);
if (!$_REQUEST['siteid']) {
    $_REQUEST['siteid'] = XN_Query::create('Content')->filter('owner', '=')->filter('type', 'eic', 'Website')->filter('my.url', '=', $_SERVER['HTTP_REFERER']);
    $_REQUEST['siteid'] = $_REQUEST['siteid']->execute();
    $_REQUEST['siteid'] = $_REQUEST['siteid'][0]->id;
}
//end if ! siteid
$key = array_search($_REQUEST['siteid'], $sites);
$_REQUEST['move'] = $_REQUEST['move'] ? $_REQUEST['move'] : 1;
if ($_REQUEST['move'] == 'random') {
    $key = 0;
    shuffle($sites);
} else {
    $key += $_REQUEST['move'];
    if ($key > count($sites)) {
        $key -= count($sites);
    }
    if ($key < 0) {
        $key += count($sites);
    }
}
//end if-else random
$site = XN_Content::load(intval($sites[$key]));
header('Content-Type: text/plain;');
header('Location: ' . $site->my->url, TRUE, 303);
示例#8
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
示例#9
0
     }
 } else {
     echo '{"wrinks":[';
 }
 foreach ($items as $id => $item) {
     if ($id > 0) {
         echo ',';
     }
     echo '{';
     echo '"title":"' . $item->title . '",';
     echo '"description":"' . $item->description . '",';
     echo '"user":"******",';
     echo '"traffic":"' . $item->my->traffic . '",';
     echo '"sites":[';
     foreach (explode(' ', $item->my->sites) as $id => $site) {
         $sitedata = XN_Content::load(intval($site));
         if ($id > 0) {
             echo ',';
         }
         echo '{';
         echo '"title":"' . $sitedata->title . '",';
         echo '"description":"' . $sitedata->description . '",';
         echo '"url":"' . $sitedata->my->url . '",';
         echo '"feedurl":"' . $sitedata->my->feedurl . '",';
         $tags = fetchTags($sitedata);
         if (count($tags)) {
             echo '"tags":["' . implode('","', $tags) . '"]';
         } else {
             echo '"tags":[]';
         }
         echo '}';
示例#10
0
<?php

if (!$_REQUEST['wrinkid']) {
    die('<b>ERROR : No Wrink specified</b>');
}
$wrink = XN_Content::load(intval($_REQUEST['wrinkid']));
$wrink->my->traffic += 1;
if ($wrink->my->traffictime < time() - 604800) {
    $wrink->my->traffic = 0;
    $wrink->my->traffictime = time();
}
//end if traffictime over
$wrink->save();
header('Content-Type: text/plain;');
header('Location: ' . $_REQUEST['url'], TRUE, 303);
示例#11
0
        echo '</li>' . "\n";
    }
    //end foreach sweeties
    echo '</ul>' . "\n";
}
//end if count sweeties
echo '<h3 id="comments" style="display:inline;margin:0px;padding:0px;">Comments</h3>' . "\n";
echo ' <a href="http://' . $_SERVER['HTTP_HOST'] . '/view.php?id=' . $file->id . '#comments" rel="comments">&raquo;</a> ' . "\n";
echo '<a href="http://' . $_SERVER['HTTP_HOST'] . '/commentRSS.php?xn_auth=no&amp;id=' . $file->id . '" rel="comments alternate"><img src="http://wrinks.ning.com/feedicon12x12.png" alt="[feed]" /></a><br />' . "\n";
require_once 'XNC/Comment.php';
require_once 'removeEvils.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;
        ?>
示例#12
0
   <?php 
} else {
    header('Content-Type: text/plain;');
    $item = XN_Query::create('Content')->filter('owner', '=')->filter('type', 'eic', 'Website')->filter('my.url', '=', $_REQUEST['url']);
    $item = $item->execute();
    if (count($item)) {
        $item = $item[0];
    } else {
        $item = XN_Content::create('Website', $_REQUEST['title'], $_REQUEST['description'])->my->add('url', $_REQUEST['url'])->my->add('feedurl', $_REQUEST['feedurl']);
        $item->save();
        XN_Tag::checkTags($_REQUEST['tags']);
        XN_Tag::addTags($item, $_REQUEST['tags']);
    }
    //end if-else count item
    if ($_REQUEST['towrink']) {
        $wrink = XN_Content::load(intval($_REQUEST['towrink']));
        if (XN_Profile::current()->screenName == $wrink->contributorName) {
            if ($wrink->my->sites) {
                $wrink->my->sites .= ' ' . $item->id;
            } else {
                $wrink->my->add('sites', $item->id);
            }
            if ($item->my->wrinks) {
                $item->my->wrinks .= ' ' . $_REQUEST['towrink'];
            } else {
                $item->my->add('wrinks', $_REQUEST['towrink']);
            }
            $item->save();
        } else {
            if ($wrink->my->requestedsites) {
                $wrink->my->requestedsites .= ' ' . $item->id;
示例#13
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 
}