summaryrefslogtreecommitdiff
path: root/modules/mod_status.php
blob: fd6271e9426db8921a25e5f9918f0ecc05d57b4d (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
<?php

global $gQueryUser,$gBitSmarty;

require_once( FEED_PKG_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 );
$gBitSmarty->assign( 'statuses', $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 );

		$gBitSmarty->assign( 'statuses', $statuses);
		break;
	}
}

?>