3
* $RCSfile: parser.inc,v $
5
* Gallery - a web based photo album viewer and editor
6
* Copyright (C) 2000-2006 Bharat Mediratta
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or (at
11
* your option) any later version.
13
* This program is distributed in the hope that it will be useful, but
14
* WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
24
* @version $Revision: 1.2 $ $Date: 2006/01/10 04:42:18 $
25
* @author Douglas Cau <douglas@cau.se>
29
GalleryCoreApi::requireOnce('modules/rewrite/classes/RewriteParser.class');
31
/* Status code used by the PHP Path Info parser */
32
define('REWRITE_STATUS_NO_PATH_INFO', 21);
35
* This URL Rewrite parser provides PHP Path Info support for short URLs.
40
class PathInfoParser extends RewriteParser {
42
function PathInfoParser() {
43
$this->_setParserId('pathinfo');
44
$this->_setParserType('inGallery');
45
$this->_setUrlGeneratorId('PathInfoUrlGenerator');
49
* @see RewriteParser::saveActiveRules
51
function saveActiveRules($activeRules=null, $rewriteModule=null) {
52
GalleryCoreApi::requireOnce(
53
'modules/rewrite/classes/parsers/pathinfo/PathInfoHelper.class');
54
return PathInfoHelper::saveActiveRules($this, $activeRules, $rewriteModule);
58
* @see RewriteParser::needsConfiguration
60
function needsConfiguration() {
61
GalleryCoreApi::requireOnce(
62
'modules/rewrite/classes/parsers/pathinfo/PathInfoHelper.class');
64
list ($ret, $code) = PathInfoHelper::checkPathInfo();
66
return array($ret->wrap(__FILE__, __LINE__), null);
69
return array(null, $code != REWRITE_STATUS_OK);
73
* @see RewriteParser::loadTestResultsTemplate
75
function loadTestResultsTemplate(&$template, &$form) {
76
GalleryCoreApi::requireOnce(
77
'modules/rewrite/classes/parsers/pathinfo/PathInfoHelper.class');
78
return PathInfoHelper::loadTestResultsTemplate($template, $form);
82
* @see RewriteParser::handleTestResultsRequest
84
function handleTestResultsRequest($form) {
85
$error = $status = array();
87
$ret = GalleryCoreApi::assertUserIsSiteAdministrator();
89
return array($ret->wrap(__FILE__, __LINE__), null, null);
92
if (isset($form['force']['test'])) {
93
$ret = GalleryCoreApi::setPluginParameter('module', 'rewrite', 'pathinfo.forced', '1');
95
return array($ret->wrap(__FILE__, __LINE__), null, null);
100
return array(null, $error, $status);