function set_url($url, $params = array()) { if (!is_array($params)) { $params = array(); } $tmp = array(); list($url, $tmp_params) = parse_query_string($url); $params = array_merge($tmp_params, $params); $i_limit = count($params); if ($i_limit) { reset($params); while (list($key, $value) = each($params)) { if (isset($value)) { if (is_numeric($value)) { $value = (string) $value; } if (is_string($value)) { $tmp[] = rawurlencode($key) . "=" . rawurlencode(stripslashes($value)); } if (is_array($value)) { foreach ($value as $v) { $tmp[] = rawurlencode($key) . rawurlencode("[]") . "=" . rawurlencode(stripslashes($v)); } } } } if (count($tmp)) { /* verificar se $url já tem query_string */ if (strpos($url, "?") !== false) { $url .= "&" . implode("&", $tmp); } else { $url .= "?" . implode("&", $tmp); } } } return $url; }
function set_query_string_vars($uri, $array) { $parsed_uri = parse_uri($uri); if (empty($parsed_uri['query'])) { $qs = array(); } else { $qs = parse_query_string($parsed_uri['query']); } foreach ($array as $key => $value) { if (is_null($value)) { unset($qs[$key]); } else { $qs[$key] = $value; } } $parsed_uri['query'] = unparse_query_string($qs); return unparse_uri($parsed_uri); }
<?php /* * index.php * Main HTTP request handler * * Copyright Gottfried Haider, Danja Vasiliev 2010. * This source code is licensed under the GNU General Public License. * See the file COPYING for more details. */ @(require_once 'config.inc.php'); require_once 'log.inc.php'; log_msg('info', '--- request ---'); require_once 'controller.inc.php'; require_once 'modules.inc.php'; $args = parse_query_string(); log_msg('info', 'index: query arguments ' . var_dump_inl($args)); log_msg('debug', 'index: base url is ' . quot(base_url())); invoke_controller($args);
function url($link) { global $config; $tweak = ""; if ($config["is_rewrite"]) { $url = explode("?", $link); $param = parse_query_string($url[1]); if (count($param) == 1) { switch ($param['node']) { case 0: $tweak = "home" . ".html"; break; case 1: $tweak = "ourservices" . ".html"; break; case 2: $tweak = "portfolio" . ".html"; break; case 3: $tweak = "clients" . ".html"; break; case 4: $tweak = "contactus" . ".html"; break; case 5: $tweak = "about" . ".html"; break; case 6: $tweak = "privacy-policy" . ".html"; break; case 7: $tweak = "careers" . ".html"; break; case 8: $tweak = "news" . ".html"; break; case 9: $tweak = "thank-you" . ".html"; break; case 10: $tweak = "useful-links" . ".html"; break; default: $tweak = "home" . ".html"; break; } } else { if ($param['node'] == 8 && isset($param['news'])) { $tweak = "news/news-" . $param['news'] . ".html"; } elseif ($param['node'] == 8 && isset($param['page'])) { $tweak = "news/page-" . $param['page'] . ".html"; } elseif ($param['node'] == 2 && isset($param['taxonomy']) && isset($param['profile'])) { $tweak = "portfolio/taxonomy-" . $param['taxonomy'] . "-" . $param['profile'] . ".html"; } elseif ($param['node'] == 2 && isset($param['taxonomy'])) { $tweak = "portfolio/taxonomy-" . $param['taxonomy'] . ".html"; } else { } //print isset($param['news']); //print_r($param); } } else { $tweak = str_replace("&", "&", $link); } return $config["path"] . $tweak; }