HTTPQuery =& $this->Application->recallObject('HTTPQuery'); } function processRewriteURL() { $passed = Array (); $url = $this->HTTPQuery->Get('_mod_rw_url_'); if (substr($url, -5) == '.html') { $url = substr($url, 0, strlen($url) - 5); } $restored = false; $sql = 'SELECT Data, Cached FROM ' . TABLE_PREFIX . 'Cache WHERE VarName = "mod_rw_' . md5($url) . '"'; $cache = $this->Conn->GetRow($sql); if (false && $cache && $cache['Cached'] > 0) { // not used for now $cache = unserialize($cache['Data']); $vars = $cache['vars']; $passed = $cache['passed']; $restored = true; } else { $vars = $this->parseRewriteURL($url); $passed = $vars['pass']; // also used in bottom of this method unset($vars['pass']); $cache = Array ('vars' => $vars, 'passed' => $passed); $fields_hash = Array ( 'VarName' => 'mod_rw_' . md5($url), 'Data' => serialize($cache), 'Cached' => adodb_mktime(), ); $this->Conn->doInsert($fields_hash, TABLE_PREFIX . 'Cache', 'REPLACE'); if (array_key_exists('t', $this->HTTPQuery->Post) && $this->HTTPQuery->Post['t']) { // template from POST overrides template from URL. $vars['t'] = $this->HTTPQuery->Post['t']; if (isset($vars['is_virtual']) && $vars['is_virtual']) { $vars['m_cat_id'] = 0; // this is virtual template category (for Proj-CMS) } } unset($vars['is_virtual']); } foreach ($vars as $name => $value) { $this->HTTPQuery->Set($name,$value); } // if ($restored) { $this->InitAll(); // } $this->HTTPQuery->finalizeParsing($passed); } function parseRewriteURL($url) { $sql = 'SELECT Data, Cached FROM ' . TABLE_PREFIX . 'Cache WHERE VarName = "mod_rw_' . md5($url) . '"'; $vars = $this->Conn->GetRow($sql); if (false && $vars && $vars['Cached'] > 0) { // not used for now $vars = unserialize($menu['Data']); return $vars; } $vars = Array ('pass' => Array ('m')); $url_parts = $url ? explode('/', trim(mb_strtolower($url), '/')) : Array (); if (($this->HTTPQuery->Get('rewrite') == 'on') || !$url_parts) { $this->_setDefaultValues($vars); } if (!$url_parts) { $this->InitAll(); $vars['t'] = $this->HTTPQuery->getDefaultTemplate(''); return $vars; } else { $vars['t'] = ''; } $this->_parseLanguage($url_parts, $vars); $this->_parseTheme($url_parts, $vars); // http://site-url///[_]/