PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/package_J15/router.php

http://jumi.googlecode.com/
PHP | 30 lines | 18 code | 6 blank | 6 comment | 1 complexity | 74441075edbb7b101f5335c8c6958d95 MD5 | raw file
 1<?php
 2/**
 3* @version   $Id: router.php 53 2008-12-06 10:16:52Z edo888 $
 4* @package   Jumi
 5* @copyright Copyright (C) 2008 Edvard Ananyan. All rights reserved.
 6* @license   GNU/GPL, see LICENSE.php
 7*/
 8
 9function JumiBuildRoute(&$query) {
10    $db =& JFactory::getDBO();
11    $segments = array();
12
13    if(isset($query['fileid'])) {
14        $db->setQuery('select alias from #__jumi where id = '.$query['fileid']);
15        $segments[] = $db->loadResult();
16        unset($query['fileid']);
17    }
18
19    return $segments;
20}
21
22function JumiParseRoute($segments) {
23    $db =& JFactory::getDBO();
24    $vars = array();
25
26    $db->setQuery('select id from #__jumi where alias = "'.$segments[0].'"');
27    $vars['fileid'] = $db->loadResult();
28
29    return $vars;
30}