<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3.1"/>
<title>The Red Matrix: mod/item.php File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="rm-64.png"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname">The Red Matrix
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>File Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('item_8php.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Pages</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">item.php File Reference</div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a693cd09805755ab85bbb5ecae69a48c3"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="item_8php.html#a693cd09805755ab85bbb5ecae69a48c3">item_post</a> (&$a)</td></tr>
<tr class="separator:a693cd09805755ab85bbb5ecae69a48c3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a764bbb2e9a885a86fb23d0b5e4a09221"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="item_8php.html#a764bbb2e9a885a86fb23d0b5e4a09221">item_content</a> (&$a)</td></tr>
<tr class="separator:a764bbb2e9a885a86fb23d0b5e4a09221"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aa22feef4de326e1d7078dedd892e615c"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="item_8php.html#aa22feef4de326e1d7078dedd892e615c">handle_tag</a> ($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag)</td></tr>
<tr class="separator:aa22feef4de326e1d7078dedd892e615c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a7b63a9d0cd02096e17dcf11f4afa7c10"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="item_8php.html#a7b63a9d0cd02096e17dcf11f4afa7c10">fix_attached_photo_permissions</a> ($uid, $xchan_hash, $body, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny)</td></tr>
<tr class="separator:a7b63a9d0cd02096e17dcf11f4afa7c10"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a3daae7944f737bd30412a0d042207c0f"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="item_8php.html#a3daae7944f737bd30412a0d042207c0f">fix_attached_file_permissions</a> ($channel, $observer_hash, $body, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny)</td></tr>
<tr class="separator:a3daae7944f737bd30412a0d042207c0f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a5b1b36cb301a94b38150074f0d424e74"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="item_8php.html#a5b1b36cb301a94b38150074f0d424e74">item_check_service_class</a> ($channel_id, $iswebpage)</td></tr>
<tr class="separator:a5b1b36cb301a94b38150074f0d424e74"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="a3daae7944f737bd30412a0d042207c0f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">fix_attached_file_permissions </td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>$channel</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname"><em>$observer_hash</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname"><em>$body</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname"><em>$str_contact_allow</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname"><em>$str_group_allow</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname"><em>$str_contact_deny</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname"><em>$str_group_deny</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Referenced by <a class="el" href="item_8php.html#a693cd09805755ab85bbb5ecae69a48c3">item_post()</a>.</p>
</div>
</div>
<a class="anchor" id="a7b63a9d0cd02096e17dcf11f4afa7c10"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">fix_attached_photo_permissions </td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>$uid</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname"><em>$xchan_hash</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname"><em>$body</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname"><em>$str_contact_allow</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname"><em>$str_group_allow</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname"><em>$str_contact_deny</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname"><em>$str_group_deny</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Referenced by <a class="el" href="item_8php.html#a693cd09805755ab85bbb5ecae69a48c3">item_post()</a>.</p>
</div>
</div>
<a class="anchor" id="aa22feef4de326e1d7078dedd892e615c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">handle_tag </td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>$a</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">& </td>
<td class="paramname"><em>$body</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">& </td>
<td class="paramname"><em>$access_tag</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">& </td>
<td class="paramname"><em>$str_tags</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname"><em>$profile_uid</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname"><em>$tag</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function removes the tag $tag from the text $body and replaces it with the appropiate link.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramtype">unknown_type</td><td class="paramname">$body</td><td>the text to replace the tag in </td></tr>
<tr><td class="paramtype">unknown_type</td><td class="paramname">$access_tag</td><td>- used to return tag ACL exclusions e.g. @!foo </td></tr>
<tr><td class="paramtype">unknown_type</td><td class="paramname">$str_tags</td><td>string to add the tag to </td></tr>
<tr><td class="paramtype">unknown_type</td><td class="paramname">$profile_uid</td><td></td></tr>
<tr><td class="paramtype">unknown_type</td><td class="paramname">$tag</td><td>the tag to replace</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>boolean true if replaced, false if not replaced </dd></dl>
<p>Referenced by <a class="el" href="item_8php.html#a693cd09805755ab85bbb5ecae69a48c3">item_post()</a>, and <a class="el" href="mod_2photos_8php.html#a062bed4d04d14fee8a53f4c9be673080">photos_post()</a>.</p>
</div>
</div>
<a class="anchor" id="a5b1b36cb301a94b38150074f0d424e74"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">item_check_service_class </td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>$channel_id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname"><em>$iswebpage</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Referenced by <a class="el" href="item_8php.html#a693cd09805755ab85bbb5ecae69a48c3">item_post()</a>.</p>
</div>
</div>
<a class="anchor" id="a764bbb2e9a885a86fb23d0b5e4a09221"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">item_content </td>
<td>(</td>
<td class="paramtype">& </td>
<td class="paramname"><em>$a</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="a693cd09805755ab85bbb5ecae69a48c3"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">item_post </td>
<td>(</td>
<td class="paramtype">& </td>
<td class="paramname"><em>$a</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This is the POST destination for most all locally posted text stuff. This function handles status, wall-to-wall status, local comments, and remote coments that are posted on this site (as opposed to being delivered in a feed). Also processed here are posts and comments coming through the statusnet/twitter API. All of these become an "item" which is our basic unit of information. Posts that originate externally or do not fall into the above posting categories go through <a class="el" href="items_8php.html#a2541e6861a56d145c9281877cc501615">item_store()</a> instead of this function. </p>
<p>Is this a reply to something?</p>
<p>fix naked links by passing through a callback to see if this is a red site (already known to us) which will get a zrl, otherwise link with url, add bookmark tag to both. First protect any url inside certain bbcode tags so we don't double link it.</p>
<p>When a photo was uploaded into the message using the (profile wall) ajax uploader, The permissions are initially set to disallow anybody but the owner from seeing it. This is because the permissions may not yet have been set for the post. If it's private, the photo permissions should be set appropriately. But we didn't know the final permissions on the post until now. So now we'll look for links of uploaded photos and attachments that are in the post and set them to the same permissions as the post itself.</p>
<p>If the post was end-to-end encrypted we can't find images and attachments in the body, use our media_str input instead which only contains these elements - but only do this when encrypted content exists because the photo/attachment may have been removed from the post and we should keep it private. If it's encrypted we have no way of knowing so we'll set the permissions regardless and realise that the media may not be referenced in the post.</p>
<p>What is preventing us from being able to upload photos into comments is dealing with the photo and attachment permissions, since we don't always know who was in the distribution for the top level post.</p>
<p>We might be able to provide this functionality with a lot of fiddling:</p>
<ul>
<li>if the top level post is public (make the photo public)</li>
<li>if the top level post was written by us or a wall post that belongs to us (match the top level post)</li>
<li>if the top level post has privacy mentions, add those to the permissions.</li>
<li>otherwise disallow the photo <em>or</em> make the photo public. This is the part that gets messy.</li>
</ul>
<p>Fold multi-line [code] sequences</p>
<p>Look for any tags and linkify them</p>
<p>Referenced by <a class="el" href="include_2api_8php.html#a450d8732b7b608f7ac929aee61572b95">api_statuses_mediap()</a>, <a class="el" href="include_2api_8php.html#ae0fa388479cace9c5a7a45b571ab42f8">api_statuses_repeat()</a>, <a class="el" href="include_2api_8php.html#ad4d1634df6b35126552324683caaffa2">api_statuses_update()</a>, and <a class="el" href="oexchange_8php.html#a2d8b785cd7d041a4e6274f5af370cf26">oexchange_content()</a>.</p>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->