Server IP : 180.180.241.3 / Your IP : 216.73.216.252 Web Server : Microsoft-IIS/7.5 System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586 User : IUSR ( 0) PHP Version : 5.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /AppServ/www/news/components/com_simple_review/ |
Upload File : |
<?php /** * $Id$ * * Copyright (C) 2005-2011 Rowan Youngson * * This file is part of Simple Review. * * Simple Review is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * Simple Review is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with Simple Review. If not, see <http://www.gnu.org/licenses/>. */ function simple_reviewBuildRoute( &$query ) { $segments = array(); $coreViewSet = false; if(isset( $query['cat'] )) { $segments[] = $query['cat']; unset( $query['cat'] ); $coreViewSet = true; }; if( isset($query['rev']) ) { $segments[] = $query['rev']; unset( $query['rev'] ); $coreViewSet = true; }; if(!$coreViewSet && isset( $query['view']) && isset( $query['id'])) { $segments[] = $query['view']; $segments[] = $query['id']; unset( $query['id'] ); }; unset( $query['view'] ); return $segments; } function simple_reviewParseRoute( $segments ) { $parser = new SRRouteParser(); return $parser->ParseRoute($segments); } class SRRouteParser { var $includeCategory = true; function ParseRoute( $segments ) { $menu = &JSite::getMenu(); $item = &$menu->getActive(); $count = count( $segments ); if($count < 2) { return $this->ParseDefaultRoute($segments); } $vars = array(); //review e.g. /reviews/categoryName/1-review.html if($count == 2) { $view = explode( ':', $segments[0] ); $viewId = (int) $view[0]; //For other task eg. tags if($viewId == 0) { $id = explode( ':', $segments[1] ); $id = (int) $id[0]; if($id > 0) { $vars['view'] = $view[0]; $vars['id'] = $id; } } //For review else { $id = explode( ':', $segments[1] ); $id = (int) $id[0]; if($id > 0) { $vars['view'] = 'Review'; $vars['id'] = $id; } } } return $vars; } function ParseDefaultRoute( $segments ) { $count = count( $segments ); $vars = array(); //default e.g. /reviews.html if($count == 0) { $vars['view'] = 'Category'; } if($count == 1) { $id = explode( ':', $segments[0] ); $id = (int) $id[0]; if($id > 0) { $vars['view'] = $this->includeCategory ? 'Category' : 'Review'; $vars['id'] = $id; } } return $vars; } } ?>