/
search.php
75 lines (65 loc) · 2.28 KB
/
search.php
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
<?php if (!defined('VB_ENTRY')) die('Access denied.');
/*========================================================================*\
|| ###################################################################### ||
|| # vBulletin 5.1.9 - Licence Number LD18132D6F
|| # ------------------------------------------------------------------ # ||
|| # Copyright 2000-2015 vBulletin Solutions Inc. All Rights Reserved. # ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ----------------- VBULLETIN IS NOT FREE SOFTWARE ----------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| ###################################################################### ||
\*========================================================================*/
class vB5_Route_Search extends vB5_Route
{
public function getUrl()
{
// the regex contains the url
$url = '/' . $this->regex;
if (strtolower(vB_String::getCharset()) != 'utf-8')
{
$url = vB_String::encodeUtf8Url($url);
}
return $url;
}
public function getCanonicalRoute()
{
if (!isset($this->canonicalRoute))
{
if (!empty($this->arguments['pageid']))
{
$page = vB::getDbAssertor()->getRow('page', array('pageid'=>$this->arguments['pageid']));
}
if (!empty($page['routeid']))
{
$this->canonicalRoute = self::getRoute($page['routeid'], array(), $this->queryParameters);
}
else
{
return $this;
}
}
return $this->canonicalRoute;
}
protected static function validInput(array &$data)
{
if (
!isset($data['contentid']) OR !is_numeric($data['contentid']) OR
!isset($data['prefix']) OR
!isset($data['action'])
)
{
return FALSE;
}
$data['regex'] = $data['prefix'];
$data['class'] = __CLASS__;
$data['controller'] = 'search';
$data['arguments'] = '';//serialize(array('pageid' => $data['contentid']));
return parent::validInput($data);
}
}
/*=========================================================================*\
|| #######################################################################
|| # Downloaded: 15:45, Tue Sep 8th 2015
|| # CVS: $RCSfile$ - $Revision: 83435 $
|| #######################################################################
\*=========================================================================*/