Example #1
0
 public static function redirectInternal($intId)
 {
     if ($intId > 0) {
         $arrNeedle = array('iid' => $intId);
         $strQuery = implode_with_keys(array_diff($_GET, $arrNeedle), "&") . "#label_{$intId}";
         header("Location: " . self::getURI() . "/?" . $strQuery);
     }
 }
Example #2
0
 /**
  * Dibuja el paginado de una lista 
  *
  */
 function Display()
 {
     $contenidoTpl = $this->_loadTemplate();
     $salida = "";
     $init = $this->por_pagina * $this->pagina_actual;
     $fin = $init + $this->por_pagina;
     $this->query_arr[$this->param_pagina] = isset($this->query_arr[$this->param_pagina]) ? $this->query_arr[$this->param_pagina] : 0;
     //$total_paginas = round((($this->total +1)/ $this->por_pagina));
     //echo '<!-- total: '. $this->total . " / por pagina: " . $this->por_pagina." -->";
     $total_paginas = (int) ceil($this->total / $this->por_pagina);
     if ($total_paginas <= 1) {
         return "";
     }
     $ant = $this->query_arr[$this->param_pagina] - 1;
     $sig = $this->query_arr[$this->param_pagina] + 1;
     if ($this->pagina_actual > 0) {
         $this->query_arr[$this->param_pagina] = $ant;
         $query_str = implode_with_keys("&amp;", "=", $this->query_arr);
         $contenidoTpl = str_replace("#ANTERIOR#", $this->url_pagina . '?' . $query_str, $contenidoTpl);
         $contenidoTpl = str_replace("#TEXTOANTERIOR#", 'Anterior', $contenidoTpl);
     } else {
         $contenidoTpl = str_replace("#ANTERIOR#", '', $contenidoTpl);
         $contenidoTpl = str_replace("#TEXTOANTERIOR#", '', $contenidoTpl);
     }
     if (ceil($total_paginas) > 1) {
         $progress = " " . ($this->pagina_actual + 1) . "/" . ceil($total_paginas) . " ";
         $contenidoTpl = str_replace("#PROGRESS#", $progress, $contenidoTpl);
     } else {
         $contenidoTpl = str_replace("#PROGRESS#", "", $contenidoTpl);
     }
     if (ceil($this->pagina_actual) < $total_paginas - 1) {
         $this->query_arr[$this->param_pagina] = $sig;
         $query_str = implode_with_keys("&amp;", "=", $this->query_arr);
         $contenidoTpl = str_replace("#SIGUIENTE#", $this->url_pagina . '?' . $query_str, $contenidoTpl);
         $contenidoTpl = str_replace("#TEXTOSIGUIENTE#", 'Siguiente', $contenidoTpl);
     } else {
         $contenidoTpl = str_replace("#SIGUIENTE#", '', $contenidoTpl);
         $contenidoTpl = str_replace("#TEXTOSIGUIENTE#", '', $contenidoTpl);
     }
     return $contenidoTpl;
 }
Example #3
0
        }
        return implode($glue, $output);
    }
    if (isset($_GET["pid"])) {
        $pid = $_GET["pid"];
        if (strpos($pid, "?") !== false) {
            $pid = substr($pid, 0, strpos($pid, "?"));
        }
        unset($_GET["pid"]);
    } else {
        $pid = "";
    }
    if (isset($_SERVER['QUERY_STRING'])) {
        $query_string = substr($_SERVER['QUERY_STRING'], strpos($_SERVER['QUERY_STRING'], "?") + 1);
    } else {
        $query_string = implode_with_keys("&", $_GET);
    }
    if ($pid != "") {
        header("Location: {$XBTT_URL}/{$pid}/announce?" . $query_string);
    } else {
        header("Location: {$XBTT_URL}/announce?" . $query_string);
    }
    exit;
}
// not using xbtt, let us go ;)
// Schedules an update to the table. It gets so much traffic
// that we do all our changes at once.
// When called, the column $column for the current info_hash is incremented
// by $value, or set to exactly $value if $abs is true.
function summaryAdd($column, $value, $abs = false)
{
	function show_news_item(&$news_item)
	{
		$title = $news_item->get_value('release_title');
		$parameters = $news_item->get_value('parameters');
		$link = (strpos($news_item->get_value('page_url'), 'http') === false) // if it is not absoulte build the host for backwards compatibility
				? '//' . REASON_HOST . $news_item->get_value('page_url')
				: $news_item->get_value('page_url'); // else it is what it is - an absolute multidomain safe URL
		
		if (!on_secure_page()) $link = alter_protocol($link, 'https', 'http'); // attempt to link over http if the home page is requested that way
		if (!empty($parameters))
		{
			if ($this->textonly) $parameters['textonly'] = 1;
			foreach ($parameters as $k=>$v)
			{
				$param[$k] = $v;
			}
			$link .= '?' . implode_with_keys('&amp;',$param);
		}
		echo '<a href="'. $link . '">'.$title.'</a>';
	}
Example #5
0
	/**
	 * Make a query-string-based link within the events module
	 *
	 * @param array $vars The query string variables for the link
	 * @param boolean $pass_passables should the items in $this->pass_vars
	 *                be passed if they are present in the current query?
	 * @return string
	 *
	 * @todo replace this with carl_ functions
	 */
	function construct_link( $vars = array(), $pass_passables = true ) // {{{
	{
		if($pass_passables)
			$link_vars = $this->pass_vars;
		else
		{
			$link_vars = array();
			if(!empty($this->pass_vars['textonly']))
				$link_vars['textonly'] = 1; // always pass the textonly value
		}
		foreach( array_keys($vars) as $key )
		{
			$link_vars[$key] = $vars[$key];
		}
		foreach(array_keys($link_vars) as $key)
		{
			$link_vars[$key] = urlencode($link_vars[$key]);
		}
		return '?'.implode_with_keys('&amp;',$link_vars);
	} // }}}