Completed
Push — master ( df7035...349ca4 )
by Daniel
08:26
created

admin::remove()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 5
crap 1
1
<?php
2
/**
3
 *
4
 * @package sitemaker
5
 * @copyright (c) 2013 Daniel A. (blitze)
6
 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
7
 *
8
 */
9
10
namespace blitze\sitemaker\services\forum;
11
12
class admin
13
{
14
	/**
15
	 * @param array $forum_data
16
	 * @return array
17
	 */
18 1
	public static function save(array &$forum_data)
19
	{
20
		$forum_data += array(
21 1
			'parent_id'				=> 0,
22 1
			'forum_type'			=> FORUM_POST,
23 1
			'type_action'			=> '',
24 1
			'forum_status'			=> ITEM_UNLOCKED,
25 1
			'forum_parents'			=> '',
26 1
			'forum_name'			=> '',
27 1
			'forum_link'			=> '',
28 1
			'forum_link_track'		=> false,
29 1
			'forum_desc'			=> '',
30 1
			'forum_desc_uid'		=> '',
31 1
			'forum_desc_options'	=> 7,
32 1
			'forum_desc_bitfield'	=> '',
33 1
			'forum_rules'			=> '',
34 1
			'forum_rules_uid'		=> '',
35 1
			'forum_rules_options'	=> 7,
36 1
			'forum_rules_bitfield'	=> '',
37 1
			'forum_rules_link'		=> '',
38 1
			'forum_image'			=> '',
39 1
			'forum_style'			=> 0,
40 1
			'display_subforum_list'	=> false,
41 1
			'display_on_index'		=> false,
42 1
			'forum_topics_per_page'	=> 0,
43 1
			'enable_indexing'		=> true,
44 1
			'enable_icons'			=> false,
45 1
			'enable_prune'			=> false,
46 1
			'enable_post_review'	=> true,
47 1
			'enable_quick_reply'	=> false,
48 1
			'prune_days'			=> 7,
49 1
			'prune_viewed'			=> 7,
50 1
			'prune_freq'			=> 1,
51 1
			'prune_old_polls'		=> false,
52 1
			'prune_announce'		=> false,
53 1
			'prune_sticky'			=> false,
54 1
			'show_active'			=> false,
55 1
			'forum_password'		=> '',
56 1
			'forum_password_confirm'=> '',
57 1
			'forum_password_unset'	=> false,
58 1
			'hidden_forum'			=> 1,
59
		);
60
61 1
		$forum = new \acp_forums();
62 1
		$errors = $forum->update_forum_data($forum_data);
63
64 1
		return $errors;
65
	}
66
67
	/**
68
	 * @param int $forum_id
69
	 * @param string $action_posts
70
	 * @param string $action_subforums
71
	 * @param int $posts_to_id
72
	 * @param int $subforums_to_id
73
	 */
74 1
	public static function remove($forum_id, $action_posts = 'delete', $action_subforums = 'delete', $posts_to_id = 0, $subforums_to_id = 0)
75
	{
76 1
		$forum = new \acp_forums();
77 1
		$forum->delete_forum($forum_id, $action_posts, $action_subforums, $posts_to_id, $subforums_to_id);
78 1
	}
79
}
80