summaryrefslogtreecommitdiff
path: root/modules/mod_status.php
blob: ceb2785081cb517bbfdb9d02c305968b297eb87d (plain)
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
<?php
/**
 * @version $Header$
 *
 * FeedStatus class
 *
 * @version  $Revision$
 * @package  feed
 * @subpackage functions
 */

/**
 * global defs
 */
global $gQueryUser,$gBitSmarty;

require_once( FEED_PKG_INCLUDE_PATH.'feed_lib.php' );

if( !empty( $_REQUEST['feed_status'] ) ){
	
	$pParamHash['status_message'] = $_REQUEST['feed_status'];
	feed_set_status($pParamHash);		
}

if( !empty( $moduleParams['module_params']['no_link_user'] ) ) {
	$listHash['no_link_user'] = TRUE;
}
if( !empty( $moduleParams['module_rows'] ) ) {
	$listHash['max_records'] = $moduleParams['module_rows'];
}elseif (!empty($moduleParams['module_params']['max_records'])){
	$listHash['max_records'] = $moduleParams['module_params']['max_records'];
}

if( !empty( $moduleParams['module_params']['user_id'] ) ){
	$listHash['user_id'] = $moduleParams['module_params']['user_id'];
}else{
	$listHash['user_id'] = $gQueryUser->mUserId;
}

$statuses = feed_get_status( $listHash );
$_template->tpl_vars['statuses'] = new Smarty_variable( $statuses);

foreach ($statuses as $status){

	$commentContentId = 'comment_'.$status['content_id'];
	if(!empty($_REQUEST[$commentContentId])){
		//then there is a reply to this comment and break, we only handle one at a time
		$reply = new LibertyComment();

		$pParamHash['root_id'] =   $status['content_id'];
		$pParamHash['parent_id'] = $status['content_id'];

		$pParamHash['comment_data'] = $_REQUEST[$commentContentId];
		$pParamHash['title'] = substr($_REQUEST[$commentContentId],0,20);

		$reply->storeComment($pParamHash);
		
		$statuses = feed_get_status( $listHash );

		$_template->tpl_vars['statuses'] = new Smarty_variable( $statuses);
		break;
	}
}

?>