joomla /administrator/components/com_redirect/tables/link.php

Language PHP Lines 95
MD5 Hash a07a2460c5c9201badf2baeed0eae3f1
Repository https://github.com/joebushi/joomla.git View Raw File View Project SPDX
 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
<?php
/**
 * @version		$Id$
 * @package		Joomla.Administrator
 * @subpackage	com_redirect
 * @copyright	Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die('Invalid Request.');

/**
 * Link Table for Redirect.
 *
 * @package		Joomla.Administrator
 * @subpackage	com_redirect
 * @version		1.6
 */
class RedirectTableLink extends JTable
{
	/**
	 * @var int
	 */
	public $id = null;
	/**
	 * @var varchar
	 */
	public $old_url = null;
	/**
	 * @var varchar
	 */
	public $new_url = null;
	/**
	 * @var varchar
	 */
	public $comment = null;
	/**
	 * @var int unsigned
	 */
	public $published = null;
	/**
	 * @var int unsigned
	 */
	public $created_date = null;
	/**
	 * @var int unsigned
	 */
	public $updated_date = null;

	/**
	 * Constructor
	 *
	 * @param	object	Database object
	 * @return	void
	 * @since	1.0
	 */
	public function __construct(&$db)
	{
		parent::__construct('#__redirect_links', 'id', $db);
	}

	/**
	 * Overloaded check function
	 *
	 * @return boolean
	 */
	public function check()
	{
		$this->old_url = trim($this->old_url);
		$this->new_url = trim($this->new_url);

		// Check for valid name.
		if (empty($this->old_url))
		{
			$this->setError(JText::_('Redir_Error_Source_URL_Required'));
			return false;
		}

		// Check for valid name.
		if (empty($this->new_url))
		{
			$this->setError(JText::_('Redir_Error_Destination_URL_Required'));
			return false;
		}

		// Check for duplicates
		if ($this->old_url == $this->new_url)
		{
			$this->setError(JText::_('Redir_Error_Duplicate_URLs'));
			return false;
		}
		return true;
	}
}
Back to Top