Passed
Pull Request — master (#117)
by Spuds
07:11
created

UBB_7_5::getDbName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
1
<?php
2
/**
3
 * @name      OpenImporter
4
 * @copyright OpenImporter contributors
5
 * @license   BSD https://opensource.org/licenses/BSD-3-Clause
6
 *
7
 * @version 1.0
8
 */
9
10
/**
11
 * Class UBB_7_5
12
 */
13
class UBB_7_5 extends Importers\AbstractSourceImporter
14
{
15
	protected $setting_file = '/includes/config.inc.php';
16
17
	public function getName()
18
	{
19
		return 'UBB Threads 7.5.x';
20
	}
21
22
	public function getVersion()
23
	{
24
		return 'ElkArte 1.0';
25
	}
26
27
	public function getPrefix()
28
	{
29
		global $db_prefix;
30
31
		return '`' . $this->getDbName() . '`.' . $db_prefix;
32
	}
33
34
	public function getDbName()
35
	{
36
		global $db_name;
37
38
		return $db_name;
39
	}
40
41
	public function getTableTest()
42
	{
43
		return 'USERS';
44
	}
45
}
46
47
// Utility functions specific to UBB
48
49
/**
50
 * @param string $string
51
 * @param bool $new_lines
52
 *
53
 * @return string
54
 */
55
function fix_quotes($string, $new_lines = true)
56
{
57
	if ($new_lines)
58
	{
59
		return strtr(htmlspecialchars($string, ENT_QUOTES), array("\n" => '<br />'));
60
	}
61
62
	return htmlspecialchars($string);
63
}
64
65
/**
66
 * @param int $date
67
 *
68
 * @return string
69
 */
70
function convert_birthdate($date)
71
{
72
	$tmp_birthdate = explode('/', $date);
73
	if (count($tmp_birthdate) == 3)
74
	{
75
		if (strlen($tmp_birthdate[2]) != 4)
76
		{
77
			$tmp_birthdate[2] = '0004';
78
		}
79
80
		return $tmp_birthdate[2] . '-' . str_pad($tmp_birthdate[0], 2, "0", STR_PAD_LEFT) . '-' . str_pad($tmp_birthdate[1], 2, "0", STR_PAD_LEFT);
81
	}
82
83
	return '0001-01-01';
84
}
85