summaryrefslogtreecommitdiff
path: root/received_pages.php
blob: 6b0657cdd7236cce7b40b4d4bac53333633625a3 (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
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
<?php
/**
 * $Header: /cvsroot/bitweaver/_bit_wiki/Attic/received_pages.php,v 1.5 2006/02/02 08:20:47 squareing Exp $
 *
 * Copyright (c) 2004 bitweaver.org
 * Copyright (c) 2003 tikwiki.org
 * Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
 * All Rights Reserved. See copyright.txt for details and a complete list of authors.
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
 *
 * $Id: received_pages.php,v 1.5 2006/02/02 08:20:47 squareing Exp $
 * @package wiki
 * @subpackage functions
 */

/**
 * required setup
 */
require_once( '../bit_setup_inc.php' );

$gBitSystem->verifyPackage( 'xmlrpc' );

include_once( XMLRPC_PKG_PATH.'comm_lib.php' );
include_once( WIKI_PKG_PATH.'BitPage.php');

$gBitSystem->verifyFeature( 'feature_comm' );
$gBitSystem->verifyPermission( 'bit_p_admin_received_pages' );

if (!isset($_REQUEST["received_page_id"])) {
	$_REQUEST["received_page_id"] = 0;
}
$gBitSmarty->assign('received_page_id', $_REQUEST["received_page_id"]);
if (isset($_REQUEST["accept"])) {
	
	// CODE TO ACCEPT A PAGE HERE
	$commlib->accept_page($_REQUEST["accept"]);
}
if ($_REQUEST["received_page_id"]) {
	$info = $commlib->get_received_page($_REQUEST["received_page_id"]);
} else {
	$info = array();
	$info["title"] = '';
	$info["data"] = '';
	$info["comment"] = '';
}
$gBitSmarty->assign('view', 'n');
if (isset($_REQUEST["view"])) {
	$info = $commlib->get_received_page($_REQUEST["view"]);
	$gBitSmarty->assign('view', 'y');
}
if (isset($_REQUEST["preview"])) {
	$info["title"] = $_REQUEST["title"];
	$info["data"] = $_REQUEST["data"];
	$info["comment"] = $_REQUEST["comment"];
}
$gBitSmarty->assign('title', $info["title"]);
$gBitSmarty->assign('data', $info["data"]);
$gBitSmarty->assign('comment', $info["comment"]);
// Assign parsed
$gBitSmarty->assign('parsed', $wikilib->parseData($info["data"]));
if (isset($_REQUEST["remove"])) {
	
	$commlib->remove_received_page($_REQUEST["remove"]);
}
if (isset($_REQUEST["save"])) {
	
	$commlib->update_received_page($_REQUEST["received_page_id"], $_REQUEST["title"], $_REQUEST["data"], $_REQUEST["comment"]);
	$gBitSmarty->assign('title', $_REQUEST["title"]);
	$gBitSmarty->assign('data', $_REQUEST["data"]);
	$gBitSmarty->assign('comment', $_REQUEST["comment"]);
	$gBitSmarty->assign('received_page_id', $_REQUEST["received_page_id"]);
	$gBitSmarty->assign('parsed', $gBitSystem->parseData($_REQUEST["data"]));
}
if (empty( $_REQUEST["sort_mode"] )) {
	$sort_mode = 'received_date_desc';
} else {
	$sort_mode = $_REQUEST["sort_mode"];
}
$gBitSmarty->assign_by_ref('sort_mode', $sort_mode);
if (!isset($_REQUEST["offset"])) {
	$offset = 0;
} else {
	$offset = $_REQUEST["offset"];
}
if (isset($_REQUEST['page'])) {
	$page = &$_REQUEST['page'];
	$offset = ($page - 1) * $maxRecords;
}
$gBitSmarty->assign_by_ref('offset', $offset);
if (isset($_REQUEST["find"])) {
	$find = $_REQUEST["find"];
} else {
	$find = '';
}
$gBitSmarty->assign_by_ref('find', $find);

$channels = $wikilib->list_received_pages($offset, $maxRecords, $sort_mode, $find);
$cant_pages = ceil($channels["cant"] / $maxRecords);
$gBitSmarty->assign_by_ref('cant_pages', $cant_pages);
$gBitSmarty->assign('actual_page', 1 + ($offset / $maxRecords));
if ($channels["cant"] > ($offset + $maxRecords)) {
	$gBitSmarty->assign('next_offset', $offset + $maxRecords);
} else {
	$gBitSmarty->assign('next_offset', -1);
}
// If offset is > 0 then prev_offset
if ($offset > 0) {
	$gBitSmarty->assign('prev_offset', $offset - $maxRecords);
} else {
	$gBitSmarty->assign('prev_offset', -1);
}
$gBitSmarty->assign_by_ref('channels', $channels["data"]);

// Display the template
$gBitSystem->display( 'bitpackage:wiki/received_pages.tpl');
?>