explications php

Eléphanteau du PHP | 24 Messages

03 juin 2008, 16:33

Bonjour, j'ouvre donc un sujet pour ceci et je tiens a m'excuser pour la longueur du post:

j'ai sur mon disque un fichier main.php :

qui génère un code php tel que :
<?php
.........etc.........

include(dirname(__FILE__) . '/bootstrap.inc');

/*
 * If they don't have a setup password, we assume that the config.php is empty and this is an
 * initial install
 */
if (!@$gallery->getConfig('setup.password')) {
    /* May be invalid if a multisite install lost its config.php; galleryBaseUrl unknown */
    header('Location: install/');
    return;
}

if ($gallery->isEmbedded()) {
    require_once(dirname(__FILE__) . '/init.inc');
} else {
    /* If this is a request for a public data file, give it to the user immediately */
    $unsanitizedView = isset($_GET[GALLERY_FORM_VARIABLE_PREFIX . 'view']) ?
	$_GET[GALLERY_FORM_VARIABLE_PREFIX . 'view'] : null;
    $itemId = (int)(isset($_GET[GALLERY_FORM_VARIABLE_PREFIX . 'itemId']) ?
		    $_GET[GALLERY_FORM_VARIABLE_PREFIX . 'itemId'] : null);
    if ($unsanitizedView == 'core.DownloadItem' && !empty($itemId)) {
	/*
	 * Our URLs are immutable because they have the serial numbers embedded.  If the browser
	 * presents us with an If-Modified-Since then it has the latest version of the file already.
	 */
	if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])
		|| (function_exists('getallheaders')
		    && ($headers = getallheaders())
		    && (isset($headers['If-Modified-Since'])
			|| isset($headers['If-modified-since'])))) {
	    header('HTTP/1.0 304 Not Modified');
	    return;
	}

	/*
	 * Fast download depends on having data.gallery.cache set, so set it now.  If for some
	 * reason we fail, we'll reset it in init.inc (but that's OK).
	 */
	$gallery->setConfig(
	    'data.gallery.cache', $gallery->getConfig('data.gallery.base') . 'cache/');

	$path = GalleryDataCache::getCachePath(
	    array('type' => 'fast-download', 'itemId' => $itemId));
	/* We don't have a platform yet so we have to use the raw file_exists */
	/* Disable fast-download in maintenance mode, admins still get via core.DownloadItem */
	if (file_exists($path) && !$gallery->getConfig('mode.maintenance')) {
	    include($path);
	    if (GalleryFastDownload()) {
		return;
	    }
	}
    }

    /* Otherwise, proceed with our regular process */
    require_once(dirname(__FILE__) . '/init.inc');
    $ret = GalleryInitFirstPass();
    if ($ret) {
	_GalleryMain_errorHandler($ret, null, false);
	return;
    }

..............etc.............
?>
Une fois chargé en local par wamp server, il m'affiche une page qui, si j'en obtient le code source sous Internet Explorer donne du html tel que par exemple :

Code : Tout sélectionner

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="fr-FR"> <head> <title>Administration d'Éléments de Gallery</title> <link rel="stylesheet" type="text/css" href="modules/core/data/gallery.css"/> <link rel="stylesheet" type="text/css" href="modules/albumselect/dtree.css"/> <link rel="stylesheet" type="text/css" href="modules/icons/iconpacks/silk/icons.css"/> <script type="text/javascript" src="modules/albumselect/dtree.js"></script> <script type="text/javascript" src="modules/search/SearchBlock.js"></script> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <link rel="stylesheet" type="text/css" href="themes/carbon/theme.css"/> </head> <body class="gallery"> <div id="gallery" class="IE"> <div id="gsHeader"> <table width="100%" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="top" width="50%"> <a href="main.php"> <img src="images/galleryLogo_sm.gif" alt=""/> </a> </td> <td align="right" valign="top"> </td> </tr> </table> </div> <div id="gsNavBar" class="gcBorder1"> <div class="gbSystemLinks"> <span class="block-core-SystemLink"> <a href="main.php?g2_view=core.SiteAdmin&g2_return=%2Fgallery2%2Fmain.php%3Fg2_view%3Dcore.ItemAdmin%26g2_subView%3Dcore.ItemAdd%26g2_itemId%3D7%26g2_navId%3Dxbc5040ab&g2_returnName=ajouter+des+%C3%A9l%C3%A9ments&g2_navId=xbc5040ab">Administration du site</a> </span> &laquo; <span class="block-core-SystemLink"> <a href="main.php?g2_view=core.UserAdmin&g2_subView=core.UserPreferences&g2_return=%2Fgallery2%2Fmain.php%3Fg2_view%3Dcore.ItemAdmin%26g2_subView%3Dcore.ItemAdd%26g2_itemId%3D7%26g2_navId%3Dxbc5040ab&g2_returnName=ajouter+des+%C3%A9l%C3%A9ments&g2_navId=xbc5040ab">Votre compte</a> </span> &laquo; .................etc.......... </head> </html>
Je n'ai que le fichier main.php de présent sur mon HDD, et j'aimerais modifier le contenu du "fichier html" généré. Bien sur le fichier main.php et le code html généré n'ont aucun rapport.... :cry:

Est-ce possible? Est-ce clair?

[Note : ce message a été posté de manière anonyme avant d'être réattribué à son auteur]

d0m
Mammouth du PHP | 1141 Messages

04 juin 2008, 10:05

salut,

il y a 2 possibilités :
- le fichier main.php génère et affiche un fichier html : il faut donc changer le code php pour générer un autre fichier html

- le fichier main renvoie quelque part vers un fichier html existant autre part : créer un autre fichier html et changer le renvoie vers cet autre fichier.
Le renvoi peut se faire de 2 manière : avec un include (c'est pas vraiment du renvoie) c'est à dire qu'on inclus le fichier html dans le fichier php OU avec la fonction header.
Regarde si tu trouve le nom de la page html quelque part dans le code php.

Eléphanteau du PHP | 24 Messages

04 juin 2008, 10:28

Merci de ta réponse ! :D

justement j'ai cherché partout dans le main.php et aucune trace de code html, ou d'adresse de page html quelle qu'elle soit....

est t il possible qu'il y ai un rapport avec des fichiers .tpl?

Je ne sais pas ce que c'est mais j'ai pas mal de fichiers avec extension .tpl dans un répertoire "commun" au main.php.

Merci :)
Galère en php....