示例#1
0
/**
 * Generer l'url geodiv
 *
 * http://doc.spip.org/@_generer_url_arbo
 *
 * @param string $type
 * @param int $id
 * @param string $args
 * @param string $ancre
 * @return string
 */
function _generer_url_geodiv($type, $id, $args = '', $ancre = '')
{
    if ($type == 'forum') {
        if ($generer_url_externe = charger_fonction("generer_url_forum", 'urls', true)) {
            return $generer_url_externe($id, $args, $ancre);
        }
        return '';
    }
    if ($type == 'document') {
        include_spip('inc/documents');
        return generer_url_document_dist($id, $args, $ancre);
    }
    if ($type == 'article') {
        return _DIR_RACINE . 'media' . $id . ($args ? "?{$args}" : '') . ($ancre ? "#{$ancre}" : '');
    }
    if ($type == 'rubrique') {
        return _DIR_RACINE . 'cat' . $id . ($args ? "?{$args}" : '') . ($ancre ? "#{$ancre}" : '');
    }
    if ($type == 'mot') {
        return _DIR_RACINE . 'tag' . $id . ($args ? "?{$args}" : '') . ($ancre ? "#{$ancre}" : '');
    }
    if ($type == 'auteur') {
        return _DIR_RACINE . $type . $id . ($args ? "?{$args}" : '') . ($ancre ? "#{$ancre}" : '');
    }
    if ($type == 'collection') {
        return _DIR_RACINE . 'album' . $id . ($args ? "?{$args}" : '') . ($ancre ? "#{$ancre}" : '');
    }
    return _DIR_RACINE . $type . $id . ($args ? "?{$args}" : '') . ($ancre ? "#{$ancre}" : '');
}
示例#2
0
文件: html.php 项目: rhertzog/lcs
function _generer_url_html($type, $id, $args='', $ancre='') {
	if ($generer_url_externe = charger_fonction("generer_url_$type",'urls',true)) {
		$url = $generer_url_externe($id, $args, $ancre);
		if (NULL != $url) return $url;
	}

	if ($type == 'document') {
		include_spip('inc/documents');
		return generer_url_document_dist($id, $args, $ancre);
	}

	return _DIR_RACINE . $type . $id . '.html' . ($args ? "?$args" : '') .($ancre ? "#$ancre" : '');
}
示例#3
0
文件: page.php 项目: rhertzog/lcs
function _generer_url_page($type,$id, $args='', $ancre='') {

	if ($generer_url_externe = charger_fonction("generer_url_$type",'urls',true)) {
		$url = $generer_url_externe($id, $args, $ancre);
		if (NULL != $url) return $url;
	}

	if ($type == 'document') {
		include_spip('inc/documents');
		return generer_url_document_dist($id, $args, $ancre);
	}

	$url = _debut_urls_page . $type . _separateur_urls_page
	  . $id . _terminaison_urls_page;

	if ($args) $args = strpos($url,'?') ? "&$args" : "?$args";
	return _DIR_RACINE . $url . $args . ($ancre ? "#$ancre" : '');
}
/**
 * Generer l'url d'un document dans l'espace prive,
 * fonction du statut du document
 *
 * @param int $id
 * @param string $args
 * @param string $ancre
 * @param string $public
 * @param string $connect
 * @return string
 *
 * http://doc.spip.org/@generer_url_ecrire_document
 */
function urls_generer_url_ecrire_document_dist($id, $args = '', $ancre = '', $public = null, $connect = '')
{
    include_spip('inc/documents');
    return generer_url_document_dist($id);
}
示例#5
0
文件: arbo.php 项目: rhertzog/lcs
function _generer_url_arbo($type, $id, $args='', $ancre='') {

	if ($generer_url_externe = charger_fonction("generer_url_$type",'urls',true)) {
		$url = $generer_url_externe($id, $args, $ancre);
		if (NULL != $url) return $url;
	}

	if ($type == 'document') {
		include_spip('inc/documents');
		return generer_url_document_dist($id, $args, $ancre);
	}

	// Mode propre
	$propre = declarer_url_arbo($type, $id);

	if ($propre === false) return ''; // objet inconnu. raccourci ? 

	if ($propre) {
		$url = _debut_urls_arbo
			. rtrim($propre,'/')
			. url_arbo_terminaison($type);
	} else {

		// objet connu mais sans possibilite d'URL lisible, revenir au defaut
		include_spip('base/connect_sql');
		$id_type = id_table_objet($type);
		$url = get_spip_script('./')."?"._SPIP_PAGE."=$type&$id_type=$id";
	}

	// Ajouter les args
	if ($args)
		$url .= ((strpos($url, '?')===false) ? '?' : '&') . $args;

	// Ajouter l'ancre
	if ($ancre)
		$url .= "#$ancre";

	return _DIR_RACINE . $url;
}
示例#6
0
文件: urls.php 项目: rhertzog/lcs
function generer_url_ecrire_document($id, $args='', $ancre='', $statut='', $connect='') {
	include_spip('inc/documents');
	return generer_url_document_dist($id);
}
示例#7
0
文件: standard.php 项目: rhertzog/lcs
function generer_url_document($id_document) {
	include_spip('inc/documents');
	return generer_url_document_dist($id_document);
}
示例#8
0
function document_et_vignette($document, $url, $portfolio=false) {
	$image = $document['id_vignette'];

	if ($image)
		$image = sql_fetsel("*", "spip_documents", "id_document = ".$image);
	if ($image) {
		if (!$portfolio OR !($GLOBALS['meta']['creer_preview'] == 'oui')) {
			$x = $image['largeur'];
			$y = $image['hauteur'];
		} else {
			$x = 120;
			$y = 110;
		}
		$image = get_spip_doc($image['fichier']);
	} else {
		if ($portfolio) {
			$x = 110;
			$y = 120;
		} else 	$x = $y =-1;
	}
	if (!$url) $url = generer_url_document_dist($document['id_document'], 'document');
	return vignette_automatique($image, $document, $url, $x, $y, '', "miniature_document");
}
示例#9
0
文件: propres.php 项目: rhertzog/lcs
function _generer_url_propre($type, $id, $args='', $ancre='') {
	if ($generer_url_externe = charger_fonction("generer_url_$type",'urls',true)) {
		$url = $generer_url_externe($id, $args, $ancre);
		if (NULL != $url) return $url;
	}

	if ($type == 'document') {
		include_spip('inc/documents');
		return generer_url_document_dist($id, $args, $ancre);
	}

	// Mode compatibilite pour conserver la distinction -Rubrique-
	if (_MARQUEUR_URL) {
		$marqueur = unserialize(_MARQUEUR_URL);
		$marqueur1 = $marqueur[$type.'1']; // debut '+-'
		$marqueur2 = $marqueur[$type.'2']; // fin '-+'
	} else
		$marqueur1 = $marqueur2 = '';
	// fin

	// Mode propre
	$propre = declarer_url_propre($type, $id);

	if ($propre === false) return ''; // objet inconnu. raccourci ? 

	if ($propre) {
		$url = _debut_urls_propres
			. $marqueur1
			. $propre
			. $marqueur2
			. _terminaison_urls_propres;

		// Repositionne l'URL par rapport a la racine du site (#GLOBALS)
		$url = str_repeat('../', $GLOBALS['profondeur_url']).$url;
	} else {

		// objet connu mais sans possibilite d'URL lisible, revenir au defaut
		include_spip('base/connect_sql');
		$id_type = id_table_objet($type);
		$url = _DIR_RACINE . get_spip_script('./')."?"._SPIP_PAGE."=$type&$id_type=$id";
	}

	// Ajouter les args
	if ($args)
		$url .= ((strpos($url, '?')===false) ? '?' : '&') . $args;

	// Ajouter l'ancre
	if ($ancre)
		$url .= "#$ancre";

	return $url;
}