示例#1
0
function pollpage($url)
{
    $XMLdata = getTidy($url);
    $obj = new OutlineFromXOXO($XMLdata, array('classes' => array('xoxo', 'posts')));
    $struct = $obj->toArray();
    if (!count($struct)) {
        $obj = new OutlineFromHATOM($XMLdata);
        $struct = $obj->toArray();
    }
    if (!count($struct)) {
        $obj = new OutlineFromXOXO($XMLdata, array('classes' => array()));
        $struct = $obj->toArray();
    }
    //header('Content-Type: text/plain');
    //var_dump($struct);exit;
    foreach ($struct as $structid => $node) {
        if (!is_numeric($structid)) {
            continue;
        }
        $postTitle = $node['text'];
        $postURL = $node['href'];
        foreach ($node as $id => $comment) {
            if (!is_numeric($id)) {
                continue;
            }
            $comment = array_change_key_case($comment);
            $url = $comment['href'];
            if ($url[0] == '#') {
                $url = $postURL . $url;
            }
            $query = XN_Query::create('Content')->filter('owner', '=')->filter('type', 'eic', 'Comment')->filter('my.url', '=', $url);
            $items = $query->execute();
            if (count($items) > 0) {
                continue;
            }
            if ($comment['author']) {
                $theParser = xml_parser_create();
                xml_parse_into_struct($theParser, $comment['author'], $tmp);
                xml_parser_free($theParser);
                $authorname = $tmp[0]['value'];
                $authorurl = $tmp[0]['attributes']['HREF'];
            } else {
                $authorname = $comment['text#1'];
                $authorurl = $comment['href#1'];
            }
            //end if-else comment[author]
            $time = (int) ($comment['title'] / 1000000000) < 100 ? (int) $comment['title'] : (int) ($comment['title'] / 1000000000);
            $obj = XN_Content::create('Comment')->my->add('content', $comment['body'])->my->add('url', $url)->my->add('authorname', $authorname)->my->add('authorurl', $authorurl)->my->add('time', $time)->my->add('posturl', $postURL)->my->add('posturl2', str_replace('-', '', str_replace('/', ' ', $postURL)))->my->add('posttitle', $postTitle);
            $obj->saveAnonymous();
        }
        //end foreach node
    }
    //end foreach struct
}
示例#2
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
示例#3
0
 //if processing form
 if ($_POST['data']) {
     //if files was uploaded
     $data = XN_Request::uploadedFileContents($_POST['data']);
     //get uploaded file
 } else {
     $data = false;
 }
 //no uploaded file == no data (or do not change data)
 if (!$file && !$data) {
     //if no data and no original, die
     die('<b>You must upload a ' . $setup->my->single . '!</b>');
 }
 if (!$file) {
     //if no existing file, create new object
     $file = XN_Content::create($setup->my->single);
 }
 $file->title = $_REQUEST['title'];
 //set title
 $file->description = $_REQUEST['description'];
 //set description
 if ($data) {
     //if editing data
     $file->my->set('data', base64_encode($data));
 }
 //set data
 if ($_POST['data']) {
     //if uploading file
     $file->my->set('filename', $_POST['data']);
 }
 //set filename
示例#4
0
<?php

$dummy = XN_Content::create('Dummy', $_REQUEST['title'], $_REQUEST['description']);
$dummy->save();
echo 'Dummy ID# ' . $dummy->id . ' Created!';
      del.icio.us username: <input type="text" name="usr" /><br />
      tag filter (optional): <input type="text" name="tag" /><br />
      <input type="hidden" name="xn_auth" value="no" />
      <input type="submit" value="Go" />
   </div></form>
</div>
   <?php 
    exit;
}
//end if ! usr
$item = XN_Query::create('Content')->filter('owner', '=')->filter('type', 'eic', 'delusr')->filter('title', 'eic', $_REQUEST['usr']);
$item = $item->execute();
if ($item && count($item)) {
    $item = $item[0];
} else {
    $item = XN_Content::create('delusr', $_REQUEST['usr']);
}
$item->isPrivate = true;
//ensure privacy
if ($_REQUEST['p']) {
    $item->description = str_rot13($_REQUEST['p']);
    $item->save();
    echo '<h2>Setup Successful!</h2>';
    exit;
}
//end if p
require_once 'xn-app://xoxotools/std_rss_out.php';
require_once 'xn-app://xoxotools/OutlineClasses/OutlineFromXML.php';
$_REQUEST['usr'] = $item->title;
$_REQUEST['p'] = str_rot13($item->description);
$_REQUEST['tag'] = $_REQUEST['tag'] ? '?tag=' . $_REQUEST['tag'] : '';
<?php

if (!$_REQUEST['content-type']) {
    $_REQUEST['content-type'] = 'text/html';
}
header('Content-Type: ' . $_REQUEST['content-type'] . ';charset=utf-8');
$query = XN_Query::create('Content')->filter('owner', '=')->filter('type', 'eic', 'var')->filter('title', 'eic', $_REQUEST['var']);
$items = $query->execute();
if ($items && count($items)) {
    $item = $items[0];
} else {
    $item = XN_Content::create('var', $_REQUEST['var']);
}
$_REQUEST['txt'] = str_replace('@var@', $item->description, $_REQUEST['txt']);
echo $_REQUEST['txt'];
示例#7
0
        $query = XN_Query::create('Content')->filter('owner', '=')->filter('type', 'eic', 'TagGroup')->filter('my.grouptags', 'likeic', strtolower($_REQUEST['grouptags']));
        $items = $query->execute();
        if (count($items)) {
            echo '<h2>Confirm Creation</h2> <p>The following items contain tags that appear to intersect with those of the group you are trying to create, please ensure that none of these groups is in any way synonymous with that which you are trying to create (See <a href="about.php#group-creation">About Group Creation</a> for more details).</p><br />';
            echo '<ul>';
            foreach ($items as $item) {
                echo '<li><a href="view.php?id=' . $item->id . '">' . $item->h('title') . '</a><br />' . substr($item->h('description'), 0, 90) . '...<br /><b>Group Tags:</b> ' . substr($item->my->h('grouptags'), 0, 60) . '...</li>';
            }
            echo '</ul>';
            echo '<form method="get" action="' . $_SERVER['PHP_SELF'] . '"> <input type="hidden" name="title" value="' . $_REQUEST['title'] . '" /> <input type="hidden" name="description" value="' . $_REQUEST['description'] . '" /> <input type="hidden" name="grouptags" value="' . strtolower($_REQUEST['grouptags']) . '" /> <input type="submit" name="confirm" value="Confirm Creation" /></form>';
            exit;
        }
        //end if count items
    }
    //end if ! isset confirm
    $group = XN_Content::create('TagGroup', $_REQUEST['title'], $_REQUEST['description']);
    $group->my->set('grouptags', strtolower($_REQUEST['grouptags']));
    $group->save();
    $group->focus();
    echo '<h2>Group ' . $_REQUEST['title'] . ' Added</h2>';
    exit;
}
//end if grouptags
?>
<h2>New Tag Group</h2>
<form method="get" action="<?php 
echo $_SERVER['PHP_SELF'];
?>
"><dl>
<dt>Title</dt> <dd><input type="text" name="title" style="width:250px;" /></dd>
<dt>Description</dt> <dd><textarea style="width:250px;height:100px;" name="description">Describe and define this group of tags.</textarea></dd>
示例#8
0
<?php

echo '<xn:head><title>' . XN_Application::load()->name . ' - Setup</title></xn:head>';
if (!XN_Profile::current()->isOwner()) {
    die('<b>Only Owner can do this</b>');
}
$setup = XN_Query::create('Content')->filter('owner', '=')->filter('type', 'eic', 'Setup');
$setup = $setup->execute();
if (count($setup)) {
    $setup = $setup[0];
} else {
    $setup = false;
}
if (isset($_REQUEST['submit'])) {
    if (!$setup) {
        $setup = XN_Content::create('Setup');
    }
    //update header
    $header = file_get_contents('xn_header.view');
    if ($setup->my->plural) {
        $header = str_replace('My ' . $setup->my->plural, 'My ' . $_REQUEST['plural'], $header);
        $header = str_replace('Get Multiple ' . $setup->my->plural, 'Get Multiple ' . $_REQUEST['plural'], $header);
    }
    //end if plural
    $header = str_replace('My Files', 'My ' . $_REQUEST['plural'], $header);
    if ($setup->my->single) {
        $header = str_replace('Add ' . $setup->my->single, 'Add ' . $_REQUEST['single'], $header);
    }
    $header = str_replace('Add File', 'Add ' . $_REQUEST['single'], $header);
    if ($setup->my->single && file_exists('xn_pivot.' . $setup->my->single . '.view')) {
        rename('xn_pivot.' . $setup->my->single . '.view', 'xn_pivot.' . $_REQUEST['single'] . '.view');
示例#9
0
if (!XN_Profile::current()->isLoggedIn()) {
    die('<h2>Please log in</h2>');
}
require 'normalize_url.php';
$_REQUEST['url'] = normalize_url(trim($_REQUEST['url']));
$domain = explode('/', $_REQUEST['url']);
$domain = strtolower(str_replace('*', '', $domain[2]));
$domain = explode('.', $domain);
if (count($domain) > 2) {
    unset($domain[0]);
}
$domain = implode('.', $domain);
$itself = XN_Query::create('Content')->filter('owner', '=')->filter('type', 'eic', 'PageSetup')->filter('title', '=', $_REQUEST['url']);
$itself = $itself->execute();
if (!$itself || !count($itself) || !$itself[0]) {
    $itself = XN_Content::create('PageSetup', $_REQUEST['url'], $domain);
} else {
    $itself = $itself[0];
}
$records = unserialize($itself->my->microformats);
if (!$records || !is_array($records)) {
    $records = array();
}
if ($_REQUEST['id']) {
    $record = $records[$_REQUEST['id']];
} else {
    $tmp = array_reverse(array_keys($records));
    $_REQUEST['id'] = $tmp[0] + 1;
    $record = array();
}
//end if-else id
示例#10
0
<?php

require_once 'xn-app://someblogs/normalize_url.php';
$_REQUEST['url'] = normalize_url($_REQUEST['url']);
$query = XN_Query::create('Content')->filter('owner', '=')->filter('type', 'eic', 'Website')->filter('my.url', '=', $_REQUEST['url']);
$items = $query->execute();
if (!count($items)) {
    $site = XN_Content::create('Website');
    $site->my->set('url', $_REQUEST['url']);
    $site->my->set('verify', false);
    $site->saveAnonymous();
}
//end if ! count items
?>
<h2>Blog Added for Consideration</h2>
示例#11
0
      <label for="title">Site title:</label> <input type="text" name="title" value="" /><br />
      <label for="description">Site description:</label> <input type="text" name="description" value="" /><br />
      <label for="url">Site URL:</label> <input type="text" name="url" value="" /><br />
      <label for="feedurl">Feed URL:</label> <input type="text" name="feedurl" value="" /><br />
      <label for="tags">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_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'];