PageRenderTime 34ms CodeModel.GetById 31ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/package_J16/router.php

http://jumi.googlecode.com/
PHP | 30 lines | 18 code | 6 blank | 6 comment | 1 complexity | 28d61a75d3de51d441f5b224056eb9d4 MD5 | raw file
 1<?php
 2/**
 3* @version   $Id$
 4* @package   Jumi
 5* @copyright (C) 2008 - 2011 Edvard Ananyan
 6* @license   GNU/GPL v3 http://www.gnu.org/licenses/gpl.html
 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}