This repository has been archived by the owner on Jul 25, 2018. It is now read-only.
/
view.php
executable file
·144 lines (128 loc) · 7.22 KB
/
view.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<div style="margin:0px;padding:0px;" class="hfeed hentry">
<?php
if(!$_REQUEST['id'])
die('<b>No ID specified!</b>');
require_once 'tagFunctions.php';
require_once 'getSweeties.php';
$setup = XN_Query::create('Content')
->filter('owner','=')
->filter('type','eic','Setup');
$setup = $setup->execute();
$setup = $setup[0];
$file = XN_Content::load(intval($_REQUEST['id']));
$file->focus();
$sweeties = getSweeties($file->id);
echo '<div id="sidebar" style="float:right;width:200px;">'."\n";
echo '<ul>'."\n";
echo ' <li>Tags ';
foreach(fetchTags($file) as $tag)
echo '<a href="http://'.$_SERVER['HTTP_HOST'].'/?tag='.$tag.'" rel="tag">'.$tag.'</a> ';
echo '</li>'."\n";
echo ' <li><address style="font-style:normal;" class="author vcard">User - <a href="http://'.$_SERVER['HTTP_HOST'].'/?user='.$file->contributorName.'" class="url fn user">'.$file->contributorName.'</a></address></li>'."\n";
echo ' <li style="margin-bottom:20px;">Updated - <span class="updated"><abbr title="'.date('c',strtotime($file->updatedDate)).'">'.date('Y-m-d',strtotime($file->updatedDate)).'</abbr></span></li>'."\n";
foreach(unserialize($setup->my->fields) as $field) {
if(!$file->my->$field) continue;
if(substr($file->my->$field,0,4) == 'http')
echo ' <li><a href="'.$file->my->$field.'">'.$field.'</a></li>'."\n";
else
echo ' <li>'.$field.' - '.$file->my->$field.'</li>'."\n";
}//end foreach fields
echo '</ul>'."\n";
if(!count($sweeties))
echo '<br /><a href="http://sweeties.ning.com/give.php?recip_id='.$file->id.'&giver_app='.XN_Application::load()->relativeUrl.'&url='.urlencode('http://'.$_SERVER['HTTP_HOST'].'/view.php?id='.$file->id).'"><img src="http://sweeties.ning.com/img/toffee.gif" alt="Add Sweetie" title="Add Sweetie" /></a>';
if(XN_Profile::current()->screenName == $file->contributorName)
echo '<br /><a href="/addORedit.php?id='.$file->id.'">Edit »</a><br /><a href="/delete.php?id='.$file->id.'">Delete »</a>';
echo '<br /><a href="http://'.$_SERVER['HTTP_HOST'].'/view.php?id='.$file->id.'" rel="bookmark">permalink</a>';
echo '</div>'."\n";
echo '<h2 class="entry-title">'.$file->title.'</h2>'."\n";
echo '<xn:head><title>'.XN_Application::load()->name.' - '.$file->title.'</title></xn:head>';
echo '<p class="entry-content">'.nl2br($file->description).'</p>'."\n";
echo '<p><a href="http://'.$_SERVER['HTTP_HOST'].'/id/'.$file->id.'" rel="external">Get '.$setup->my->single.'</a>';
$size = strlen(base64_decode($file->my->data));
$sizeunit = ' bytes';
if($size > 1000) {
$size /= 1000;
$sizeunit = ' K';
}//end if size > 1000
if($size > 1000) {
$size /= 1000;
$sizeunit = ' M';
}//end if size > 1000
echo ' <span style="font-style:italic;font-size:10pt;">('.round($size,1).$sizeunit.')</span> ';
echo '</p>'."\n";
echo '<br />'."\n";
if(count($sweeties)) {
echo '<h3 id="sweeties" style="display:inline;margin:0px;padding:0px;">Sweeties</h3>';
echo '<a href="http://sweeties.ning.com/give.php?recip_id='.$file->id.'&giver_app='.XN_Application::load()->relativeUrl.'&url='.urlencode('http://'.$_SERVER['HTTP_HOST'].'/view.php?id='.$file->id).'"><img src="http://sweeties.ning.com/img/toffee.gif" alt="Add Sweetie" title="Add Sweetie" /></a><br />';
echo '<ul>'."\n";
foreach($sweeties as $sweetie) {
echo ' <li id="sweetie-'.$sweetie['sweetie'].'">';
echo '<a href="http://sweeties.ning.com/sweetieTrail.php?sweetie='.$sweetie['sweetie'].'">';
echo '<img src="http://sweeties.ning.com/img/'.str_replace(' ','_',$sweetie['flavour']).'.gif" alt="" /></a> ';
echo $sweetie['flavour'];
echo ' given at '.date('Y-m-d H:i',$sweetie['timestamp']);
echo ' by <a href="http://browse.ning.com/any/'.$sweetie['giver'].'/any/any" class="user">'.$sweetie['giver'].'</a>';
if($sweetie['message'])
echo '<br />'.$sweetie['message'];
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">»</a> '."\n";
echo '<a href="http://'.$_SERVER['HTTP_HOST'].'/commentRSS.php?xn_auth=no&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; ?>">
Posted on <a href="http://<?php echo $_SERVER['HTTP_HOST']; ?>/view.php?id=<?php echo $file->id; ?>#<?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="?id=<?php echo $file->id; ?>">
<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";
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>