<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Naeh.net &#187; Programmation</title>
	<atom:link href="http://naeh.net/categorie/programmation/feed/" rel="self" type="application/rss+xml" />
	<link>http://naeh.net</link>
	<description>Le mémo du développeur</description>
	<lastBuildDate>Wed, 30 Jun 2010 18:56:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>convertir un array en utf8</title>
		<link>http://naeh.net/convertir-un-array-en-utf8/</link>
		<comments>http://naeh.net/convertir-un-array-en-utf8/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 20:03:22 +0000</pubDate>
		<dc:creator>Naeh</dc:creator>
				<category><![CDATA[PHP / MySQL]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[utf-8]]></category>

		<guid isPermaLink="false">http://naeh.net/?p=100</guid>
		<description><![CDATA[dans un précédent article nous avons vu comment convertir un texte en utf8.
aujourd'hui on va voir comment faire la même chose mais avec un tableau, sans passer par un foreach, ni aucune autre boucle.
pour cela nous allons utiliser une seule fonction qui convertira ce qu'on lui donne en entrée en utf8.
pour l'instant elle va savoir [...]]]></description>
			<content:encoded><![CDATA[<p>dans un <a href="http://naeh.net/comment-convertir-un-texte-en-utf-8/">précédent article</a> nous avons vu comment convertir un texte en utf8.</p>
<p>aujourd'hui on va voir comment faire la même chose mais avec un tableau, sans passer par un foreach, ni aucune autre boucle.</p>
<p>pour cela nous allons utiliser une seule fonction qui convertira ce qu'on lui donne en entrée en utf8.<br />
pour l'instant elle va savoir gérer, les chaînes de caractères et les tableaux.</p>

<div class="wp_codebox"><table><tr id="p1003"><td class="code" id="p100code3"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> toUTF8<span style="color: #009900;">&#40;</span><span style="color: #000088;">$param</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/is_array"><span style="color: #990000;">is_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$param</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <a href="http://www.php.net/array_walk_recursive"><span style="color: #990000;">array_walk_recursive</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$param</span><span style="color: #339933;">,</span> <a href="http://www.php.net/create_function"><span style="color: #990000;">create_function</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&amp;$item, $index'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'$item = toUTF8($item);'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$param</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <a href="http://www.php.net/mb_detect_order"><span style="color: #990000;">mb_detect_order</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UTF-8, ISO-8859-15, ISO-8859-1, Windows-1252'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">//parfois si le dernier caractère de la chaine est accentué, la conversion peut foirer, </span>
    <span style="color: #666666; font-style: italic;">//donc on force avec un caractère qui ne l'est pas.</span>
    <span style="color: #666666; font-style: italic;">//(astuce trouvée sur les commentaires de la doc sur php.net)</span>
    <span style="color: #000088;">$param</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'_'</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$currentCharset</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mb_detect_encoding"><span style="color: #990000;">mb_detect_encoding</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$param</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$currentCharset</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'UTF-8'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$param</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mb_convert_encoding"><span style="color: #990000;">mb_convert_encoding</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$param</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'UTF-8'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$currentCharset</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">return</span> <a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$param</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <a href="http://www.php.net/strlen"><span style="color: #990000;">strlen</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$param</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	  
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>et voilà, cette fonction convertira array ou string en utf8 sans brancher...</p>
<p>en bonus voici une fonction somme que j'ai trouvé dans les commentaire de la doc sur php.net (une sorte de coup de coeur pour moi :-D)</p>

<div class="wp_codebox"><table><tr id="p1004"><td class="code" id="p100code4"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> sum<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$s</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/func_get_args"><span style="color: #990000;">func_get_args</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$a</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$s</span><span style="color: #339933;">+=</span> <a href="http://www.php.net/is_numeric"><span style="color: #990000;">is_numeric</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span><span style="color: #009900;">&#41;</span>?<span style="color: #000088;">$a</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$s</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">print</span> sum<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">4</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">5</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">6</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// will return 21</span>
<span style="color: #b1b100;">print</span> sum<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// will return 6</span>
<span style="color: #b1b100;">print</span> sum<span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">5</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// will return 10</span></pre></td></tr></table></div>

<p>trop fort non ?</p>
]]></content:encoded>
			<wfw:commentRss>http://naeh.net/convertir-un-array-en-utf8/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>protéger un ou plusieurs fichiers par htaccess</title>
		<link>http://naeh.net/proteger-un-ou-plusieurs-fichiers-par-htaccess/</link>
		<comments>http://naeh.net/proteger-un-ou-plusieurs-fichiers-par-htaccess/#comments</comments>
		<pubDate>Fri, 08 May 2009 16:46:23 +0000</pubDate>
		<dc:creator>Naeh</dc:creator>
				<category><![CDATA[Divers]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[htaccess]]></category>

		<guid isPermaLink="false">http://naeh.net/?p=95</guid>
		<description><![CDATA[Nous avons vu dans précédent article comment protéger un répertoire avec htaccess, c'est l'utilisation la plus courante de cette technique, mais ici nous allons nous intéresser a comment faire la même chose mais pour protéger uniquement un ou quelques fichiers d'un répertoire, c'est à dire, dans le même répertoire, certains fichiers seront protégés mais pas [...]]]></description>
			<content:encoded><![CDATA[<p>Nous avons vu dans <a href="http://naeh.net/proteger-un-repertoire-par-un-htaccess/">précédent article</a> comment protéger un répertoire avec htaccess, c'est l'utilisation la plus courante de cette technique, mais ici nous allons nous intéresser a comment faire la même chose mais pour protéger uniquement un ou quelques fichiers d'un répertoire, c'est à dire, dans le même répertoire, certains fichiers seront protégés mais pas d'autres.</p>
<p>pour protéger un seul fichier voici ce qu'il faut mettre dans le .htaccess :</p>

<div class="wp_codebox"><table><tr id="p957"><td class="code" id="p95code7"><pre class="html" style="font-family:monospace;">&lt;Files fichier.ext&gt;
require valid-user
&lt;/Files&gt;</pre></td></tr></table></div>

<p>pour en protéger plusieurs :</p>

<div class="wp_codebox"><table><tr id="p958"><td class="code" id="p95code8"><pre class="html" style="font-family:monospace;">&lt;Files fichier1.ext fichier2.ext fichier3.ext&gt;
require valid-user
&lt;/Files&gt;</pre></td></tr></table></div>

<p>cette syntaxe est a utiliser en complément de celle expliquée dans <a href="http://naeh.net/proteger-un-repertoire-par-un-htaccess">l'autre article</a> bien sûr.</p>
<p>bonne protection de fichiers...</p>
]]></content:encoded>
			<wfw:commentRss>http://naeh.net/proteger-un-ou-plusieurs-fichiers-par-htaccess/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installer libssh2, ssh2 pour php</title>
		<link>http://naeh.net/installer-libssh2-ssh2-pour-php/</link>
		<comments>http://naeh.net/installer-libssh2-ssh2-pour-php/#comments</comments>
		<pubDate>Wed, 08 Oct 2008 20:51:00 +0000</pubDate>
		<dc:creator>Naeh</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux - Logiciels]]></category>
		<category><![CDATA[PHP / MySQL]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[libssh2]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[Serveur]]></category>
		<category><![CDATA[ssh2]]></category>

		<guid isPermaLink="false">http://naeh.net/?p=56</guid>
		<description><![CDATA[Dans cet article nous allons voir comment installer l'extension ssh2 pour php5, cette extension permet l'utilisation de fonctionnalités SSH2 avec php (très utiles quand on veut faire du SFTP par exemple) pour plus d'informations cf. la documentation officielle sur php.net
Pour l'installation, ce n'est pas très compliqué, il suffit de suivre ces quelques étapes à la [...]]]></description>
			<content:encoded><![CDATA[<p>Dans cet article nous allons voir comment installer l'extension ssh2 pour php5, cette extension permet l'utilisation de fonctionnalités SSH2 avec php (très utiles quand on veut faire du SFTP par exemple) pour plus d'informations cf. <a href="http://fr.php.net/manual/fr/book.ssh2.php" target="_blank">la documentation officielle sur php.net</a></p>
<p>Pour l'installation, ce n'est pas très compliqué, il suffit de suivre ces quelques étapes à la lettre et tout ira très bien ;-)</p>
<p>tout d'abord il faut s'assurer d'avoir les bons paquets d'installés, en voici une liste :</p>
<ul>
<li>php5-dev</li>
<li>openssl</li>
<li>libssl-dev</li>
<li>gcc</li>
<li>make</li>
<li>etc. je suppose que si vous installez cette extension, c'est que vous avez déjà php, apache etc.</li>
</ul>
<p><em>Toute la suite s'effectue en root</em></p>
<p>mais avant toute chose, n'oublions pas de faire un petit :</p>

<div class="wp_codebox"><table><tr id="p5619"><td class="code" id="p56code19"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> update
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> upgrade</pre></td></tr></table></div>

<p>en suite il faut créer un répertoire de travail :</p>

<div class="wp_codebox"><table><tr id="p5620"><td class="code" id="p56code20"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ~
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> libssh2
<span style="color: #7a0874; font-weight: bold;">cd</span> libssh2</pre></td></tr></table></div>

<p>ensuite télécharger libssh2 :</p>

<div class="wp_codebox"><table><tr id="p5621"><td class="code" id="p56code21"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>ovh.dl.sourceforge.net<span style="color: #000000; font-weight: bold;">/</span>sourceforge<span style="color: #000000; font-weight: bold;">/</span>libssh2<span style="color: #000000; font-weight: bold;">/</span>libssh2-<span style="color: #000000;">0.14</span>.tar.gz</pre></td></tr></table></div>

<p>puis l'extraire :</p>

<div class="wp_codebox"><table><tr id="p5622"><td class="code" id="p56code22"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xzvf</span> libssh2-<span style="color: #000000;">0.14</span>.tar.gz</pre></td></tr></table></div>

<p>aller dans le répertoire créé et installer libssh2 :</p>

<div class="wp_codebox"><table><tr id="p5623"><td class="code" id="p56code23"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> libssh2-<span style="color: #000000;">0.14</span>
.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> all <span style="color: #c20cb9; font-weight: bold;">install</span></pre></td></tr></table></div>

<p>maintenant que libssh2 est installée, passons a ssh2 :</p>
<p>on sort du repertoire de libssh2 et on télécharge ssh2 :</p>

<div class="wp_codebox"><table><tr id="p5624"><td class="code" id="p56code24"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ..
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>pecl.php.net<span style="color: #000000; font-weight: bold;">/</span>get<span style="color: #000000; font-weight: bold;">/</span>ssh2-<span style="color: #000000;">0.10</span>.tgz</pre></td></tr></table></div>

<p>extraire l'archive téléchargée :</p>

<div class="wp_codebox"><table><tr id="p5625"><td class="code" id="p56code25"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xzvf</span> ssh2-<span style="color: #000000;">0.10</span>.tgz</pre></td></tr></table></div>

<p>aller dans le répertoire créé et installer ssh2 :</p>

<div class="wp_codebox"><table><tr id="p5626"><td class="code" id="p56code26"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ssh2-<span style="color: #000000;">0.10</span>
phpize <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--with-ssh2</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span></pre></td></tr></table></div>

<p>maintenant que l'installation est terminée, on active l'extension, ici on va copier le fichier ssh2.so dans le répertoire des extension de php5 (il peut être différent du mien selon la distrib et l'installation) :</p>

<div class="wp_codebox"><table><tr id="p5627"><td class="code" id="p56code27"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cp</span> modules<span style="color: #000000; font-weight: bold;">/</span>ssh2.so <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>php5<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">20060613</span>+lfs</pre></td></tr></table></div>

<p>puis on ajoute l'extension en créant un fichier ssh2.ini dans le répertoire conf.d (comme pour toutes les autres extensions de php) on n'oublie pas de le faire pour apache mais aussi pour le mode CLI.</p>

<div class="wp_codebox"><table><tr id="p5628"><td class="code" id="p56code28"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;extension=ssh2.so&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php5<span style="color: #000000; font-weight: bold;">/</span>cli<span style="color: #000000; font-weight: bold;">/</span>conf.d<span style="color: #000000; font-weight: bold;">/</span>ssh2.ini
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;extension=ssh2.so&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php5<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>conf.d<span style="color: #000000; font-weight: bold;">/</span>ssh2.ini
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 restart</pre></td></tr></table></div>

<p>Et voilà, notre extension est installée, a vous ssh2 et sftp avec php :)</p>
]]></content:encoded>
			<wfw:commentRss>http://naeh.net/installer-libssh2-ssh2-pour-php/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Comment installer fileinfo sous debian</title>
		<link>http://naeh.net/installation-fileinfo/</link>
		<comments>http://naeh.net/installation-fileinfo/#comments</comments>
		<pubDate>Wed, 14 May 2008 15:43:14 +0000</pubDate>
		<dc:creator>Naeh</dc:creator>
				<category><![CDATA[Linux - Logiciels]]></category>
		<category><![CDATA[PHP / MySQL]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[apt-get]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[fileinfo]]></category>
		<category><![CDATA[libmagic]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[phpize]]></category>

		<guid isPermaLink="false">http://naeh.net/installation-fileinfo/</guid>
		<description><![CDATA[Les fonctions de l'extension FileInfo essaient de savoir le type de contenu et l’encodage d’un fichier en regardant certaines séquences d’octet "magique" à des positions spécifiques à l’intérieur du fichier. Bien qu'il ne s'agit pas d'une approche infaillible, la méthode heuristique effectue un très bon travail.
le problème avec cette extension c'est qu'elle est un peu [...]]]></description>
			<content:encoded><![CDATA[<p>Les fonctions de l'extension <a href="http://fr3.php.net/manual/fr/book.fileinfo.php" target="_blank">FileInfo</a> essaient de savoir le type de contenu et l’encodage d’un fichier en regardant certaines séquences d’octet "magique" à des positions spécifiques à l’intérieur du fichier. Bien qu'il ne s'agit pas d'une approche infaillible, la méthode heuristique effectue un très bon travail.</p>
<p>le problème avec cette extension c'est qu'elle est un peu dur à installer, en réalité pas si dur que ça, il suffit de prendre le temps de le faire. Il faut juste savoir qu'un simple <strong>apt-get install php5-fileinfo</strong> ne suffira pas, tout simplement parce qu'il n'existe pas de paquet debian pour cette extension (pas encore...).</p>
<p>Donc pour l'installer, voici la procédure :<br />
Il faut d'abord installer <a href="http://pear.php.net/manual/fr/introduction.php" target="_blank">PEAR</a> :</p>

<div class="wp_codebox"><table><tr id="p5135"><td class="code" id="p51code35"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> php-pear</pre></td></tr></table></div>

<p>ensuite il faut installer php5-dev si ce n'est pas déjà fait, ceci installera phpize ce qui nous évitera l'erreur :</p>

<div class="wp_codebox"><table><tr id="p5136"><td class="code" id="p51code36"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sh</span>: phpize: <span style="color: #7a0874; font-weight: bold;">command</span> not found
ERROR: <span style="color: #000000; font-weight: bold;">`</span>phpize<span style="color: #ff0000;">' failed</span></pre></td></tr></table></div>

<p>installation de php5-dev :</p>

<div class="wp_codebox"><table><tr id="p5137"><td class="code" id="p51code37"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> php5-dev</pre></td></tr></table></div>

<p>c'est presque bon mais pas encore :<br />
maintenant il faut installer libmagic pour nous éviter une erreur lors de l'installation de fileinfo :</p>

<div class="wp_codebox"><table><tr id="p5138"><td class="code" id="p51code38"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libmagic-dev</pre></td></tr></table></div>

<p>maintenant tout est bon, nous allons enfin pouvoir lancer l'installation de notre extension :</p>

<div class="wp_codebox"><table><tr id="p5139"><td class="code" id="p51code39"><pre class="bash" style="font-family:monospace;">pecl <span style="color: #c20cb9; font-weight: bold;">install</span> fileinfo</pre></td></tr></table></div>

<p>Voilà, maintenant fileinfo est installée, nous allons pouvoir vérifier les types mime des fichiers avec des méthodes plus fiables ;-)</p>
<p>Normalement tout devrait fonctionner maintenant, mais il ce peut que l'extension ne soit pas activée comme il faut, dans ce cas il faudra créer un fichier <strong>fileinfo.ini</strong> dans <strong>/etc/php5/apache2/conf.d</strong> avec le contenu suivant :</p>

<div class="wp_codebox"><table><tr id="p5140"><td class="code" id="p51code40"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">extension</span>=fileinfo.so</pre></td></tr></table></div>

<p>reloader apache avec /etc/init.d/apache2 reload et le tour est joué :)</p>
]]></content:encoded>
			<wfw:commentRss>http://naeh.net/installation-fileinfo/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Forcer le téléchargement d&#8217;un fichier avec PHP</title>
		<link>http://naeh.net/forcer-le-telechargement-dun-fichier-avec-php/</link>
		<comments>http://naeh.net/forcer-le-telechargement-dun-fichier-avec-php/#comments</comments>
		<pubDate>Tue, 18 Mar 2008 22:16:33 +0000</pubDate>
		<dc:creator>Naeh</dc:creator>
				<category><![CDATA[PHP / MySQL]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[header]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Serveur]]></category>
		<category><![CDATA[telecharger]]></category>

		<guid isPermaLink="false">http://naeh.net/forcer-le-telechargement-dun-fichier-avec-php/</guid>
		<description><![CDATA[Dance cet article nous allons voir comment forcer le navigateur à télécharger un fichier (n'importe lequel) au lieux de l'ouvrir. Pour cela nous allons utiliser les Headers qu'envoie le serveur au navigateur (fonction header de php).
Voici le code a utiliser :

 //date actuelle
$date = gmdate&#40;'D, d M Y H:i:s'&#41;;
&#160;
header&#40;&#34;Content-Type: text/xml&#34;&#41;; //Ici par exemple c'est pour [...]]]></description>
			<content:encoded><![CDATA[<p>Dance cet article nous allons voir comment forcer le navigateur à télécharger un fichier (n'importe lequel) au lieux de l'ouvrir. Pour cela nous allons utiliser les <strong>Headers</strong> qu'envoie le serveur au navigateur (<a href="http://fr3.php.net/manual/fr/function.header.php" target="_blank">fonction header de php</a>).</p>
<p>Voici le code a utiliser :</p>

<div class="wp_codebox"><table><tr id="p5043"><td class="code" id="p50code43"><pre class="php" style="font-family:monospace;"> <span style="color: #666666; font-style: italic;">//date actuelle</span>
<span style="color: #000088;">$date</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/gmdate"><span style="color: #990000;">gmdate</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'D, d M Y H:i:s'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Type: text/xml&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Ici par exemple c'est pour un fichier XML, a changer en fonction du type mime du fichier voulu.</span>
<a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Content-Disposition: attachment; filename=NOM_FICHIER.xml'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Last-Modified: '</span><span style="color: #339933;">.</span> <span style="color: #000088;">$date</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' GMT'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Expires: '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$date</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//header specifique IE :s parce que sinon il aime pas</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/preg_match"><span style="color: #990000;">preg_match</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/msie|(microsoft internet explorer)/i'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_USER_AGENT'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Cache-Control: must-revalidate, post-check=0, pre-check=0'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Pragma: public'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
  <a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Pragma: no-cache'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$CONTENU_DE_NOTRE_FICHIER</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// ou readfile('CHEMIN_FICHIER'); En fonction du type de fichier.</span></pre></td></tr></table></div>

<p>Le type Mime doit être celui du fichier qu'on veut pouvoir télécharger (<a href="http://www.c-p-f.org/divers-Liste_des_types_MIME-a15.html" target="_blank">liste des types mime disponibles</a>). En voici quelques exemples :</p>

<div class="wp_codebox"><table><tr id="p5044"><td class="code" id="p50code44"><pre class="bash" style="font-family:monospace;">image GIF : image<span style="color: #000000; font-weight: bold;">/</span>gif
fichier XML : text<span style="color: #000000; font-weight: bold;">/</span>xml
fichier rtf : application<span style="color: #000000; font-weight: bold;">/</span>rtf
fichier avi : video<span style="color: #000000; font-weight: bold;">/</span>msvideo</pre></td></tr></table></div>

<p>Maintenant à vos fichiers dl.php ;-)</p>
]]></content:encoded>
			<wfw:commentRss>http://naeh.net/forcer-le-telechargement-dun-fichier-avec-php/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Extraire le contenu d&#8217;un zip directement sur son FTP chez free</title>
		<link>http://naeh.net/extraire-le-contenu-dun-zip-directement-sur-son-ftp-chez-free/</link>
		<comments>http://naeh.net/extraire-le-contenu-dun-zip-directement-sur-son-ftp-chez-free/#comments</comments>
		<pubDate>Sun, 16 Mar 2008 17:13:21 +0000</pubDate>
		<dc:creator>Naeh</dc:creator>
				<category><![CDATA[PHP / MySQL]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[extraire]]></category>
		<category><![CDATA[hébergement]]></category>
		<category><![CDATA[librairie]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Serveur]]></category>
		<category><![CDATA[zip]]></category>

		<guid isPermaLink="false">http://naeh.net/extraire-le-contenu-dun-zip-directement-sur-son-ftp-chez-free/</guid>
		<description><![CDATA[Dans cette article nous allons voir comment procéder pour dézippé le contenu d'une archive directement sur son FTP free. Ceci peut être très intéressant si on a plusieurs (beaucoup) fichiers à envoyer sur le ftp, parfois ce genre d'upload peut s'avérer très difficile en fonction de la connexion, du logicile client FTP, mais aussi de [...]]]></description>
			<content:encoded><![CDATA[<p>Dans cette article nous allons voir comment procéder pour dézippé le contenu d'une archive directement sur son FTP free. Ceci peut être très intéressant si on a plusieurs (beaucoup) fichiers à envoyer sur le ftp, parfois ce genre d'upload peut s'avérer très difficile en fonction de la connexion, du logicile client FTP, mais aussi de l'humeur du serveur FTP de chez free. On peut se retrouver avec un certain nombre de fichiers qui ne seront pas envoyé (perdus en route ?!).</p>
<p>L'astuce consiste à mettre tous ses fichiers dans ZIP, uploader le zip sur le FTP et l'extraire sur place avec script PHP. Parce que envoyer UN SEUL fichier quelque soit sa taille, est toujours plus simple que d'en envoyer 36 000.</p>
<p>Pour commencer il faut savoir que Free ne propose aucune librairie PHP pour gérer les archives, donc nous utiliserons une classe de substitution, pour l'exemple, on va utiliser <a href="http://www.phpconcept.net/pclzip/index.php" target="_blank"><font color="#206033" face="Comic Sans MS">pclzip</font></a>.</p>
<p>Maintenant, il faut créer un fichier ZIP (test.zip pour l'exemple) dans lequel on mettra tous nos fichiers à uploader sur le FTP.</p>
<p>Ensuite, il faut créer un fichier php (extract.php pour l'exemple) dans lequel on mettra le code suivant (à adapter selon votre cas) :</p>

<div class="wp_codebox"><table><tr id="p4946"><td class="code" id="p49code46"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//Extrait de la documentation de la class.</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'pclzip.lib.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$archive</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> PclZip<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'test.zip'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//METTRE LE VRAI NOM DU ZIP ;)</span>
<span style="color: #666666; font-style: italic;">//Extrait dans le repertoire courant.</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$archive</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">extract</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Error : &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$archive</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">errorInfo</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>maintenant on se retrouve avec 3 fichiers :</p>
<ol>
<li>extract.php</li>
<li> pclzip.lib.php</li>
<li>test.zip</li>
</ol>
<p>On peut maintenant envoyer nos 3 fichiers dans le répertoire sensé accueillir les fichiers finaux (contenus dans le zip) sur le FTP.</p>
<p>maintenant prendre son navigateur et aller à l'url http://adresse_du_site.free.fr/repertoire/extract.php</p>
<p>et le tour est joué :-)</p>
<p>N.B. Cette procédure et valable pour tout hébergement mutualisé (ou pas) ne proposant pas les extensions PHP Zlib ou équivalent.</p>
]]></content:encoded>
			<wfw:commentRss>http://naeh.net/extraire-le-contenu-dun-zip-directement-sur-son-ftp-chez-free/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>Protéger un répertoire par htaccess</title>
		<link>http://naeh.net/proteger-un-repertoire-par-un-htaccess/</link>
		<comments>http://naeh.net/proteger-un-repertoire-par-un-htaccess/#comments</comments>
		<pubDate>Mon, 10 Mar 2008 23:18:34 +0000</pubDate>
		<dc:creator>Naeh</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Serveur]]></category>
		<category><![CDATA[vhost]]></category>

		<guid isPermaLink="false">http://naeh.net/proteger-un-repertoire-par-un-htaccess/</guid>
		<description><![CDATA[Le but de cet article est montrer comment protéger un répertoire par un htaccess.
pour cela il faut d'abord créer un fichier .htaccess à la racine du répertoire, ce fichier doit contenir  les lignes suivantes (a adapter selon la configuration/ besoins) :

AuthName &#34;Page protégée&#34;
AuthType Basic
AuthUserFile &#34;/CHEMIN/VERS/LE/FICHIER/.htpasswd&#34;
Require valid-user

en suite il faut créer un fichier .htpasswd qui [...]]]></description>
			<content:encoded><![CDATA[<p>Le but de cet article est montrer comment protéger un répertoire par un <strong>htaccess</strong>.</p>
<p>pour cela il faut d'abord créer un fichier <em>.htaccess</em> à la racine du répertoire, ce fichier doit contenir  les lignes suivantes (a adapter selon la configuration/ besoins) :</p>

<div class="wp_codebox"><table><tr id="p4850"><td class="code" id="p48code50"><pre class="bash" style="font-family:monospace;">AuthName <span style="color: #ff0000;">&quot;Page protégée&quot;</span>
AuthType Basic
AuthUserFile <span style="color: #ff0000;">&quot;/CHEMIN/VERS/LE/FICHIER/.htpasswd&quot;</span>
Require valid-user</pre></td></tr></table></div>

<p>en suite il faut créer un fichier <em>.htpasswd</em> qui lui contiendra les couples login/mot de passe qui auront accès au répertoire protégé.<br />
pour cela exécutez la commande suivante :</p>

<div class="wp_codebox"><table><tr id="p4851"><td class="code" id="p48code51"><pre class="bash" style="font-family:monospace;">htpasswd <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">/</span>CHEMIN<span style="color: #000000; font-weight: bold;">/</span>VERS<span style="color: #000000; font-weight: bold;">/</span>LE<span style="color: #000000; font-weight: bold;">/</span>FICHIER<span style="color: #000000; font-weight: bold;">/</span>.htpasswd LOGIN</pre></td></tr></table></div>

<p>-c pour créer un nouveau fichier <em>.htpasswd</em> (a ne pas utiliser si vous ajouter un utilisateur à un fichier existant).<br />
il vous sera ensuite demandé d'entrer le mot de passe 2 fois, faites le, et le tour est joué.</p>
<p>pour plus de renseignement sur la commande <strong>htpasswd</strong>, voici l'écran d'aide de ladite commande :</p>

<div class="wp_codebox"><table><tr id="p4852"><td class="code" id="p48code52"><pre class="bash" style="font-family:monospace;">$ htpasswd
Usage:
        htpasswd <span style="color: #7a0874; font-weight: bold;">&#91;</span>-cmdpsD<span style="color: #7a0874; font-weight: bold;">&#93;</span> passwordfile username
        htpasswd -b<span style="color: #7a0874; font-weight: bold;">&#91;</span>cmdpsD<span style="color: #7a0874; font-weight: bold;">&#93;</span> passwordfile username password
        htpasswd -n<span style="color: #7a0874; font-weight: bold;">&#91;</span>mdps<span style="color: #7a0874; font-weight: bold;">&#93;</span> username
        htpasswd -nb<span style="color: #7a0874; font-weight: bold;">&#91;</span>mdps<span style="color: #7a0874; font-weight: bold;">&#93;</span> username password
&nbsp;
 <span style="color: #660033;">-c</span>  Create a new file.
 <span style="color: #660033;">-n</span>  Don<span style="color: #ff0000;">'t update file; display results on stdout.
 -m  Force MD5 encryption of the password.
 -d  Force CRYPT encryption of the password (default).
 -p  Do not encrypt the password (plaintext).
 -s  Force SHA encryption of the password.
 -b  Use the password from the command line rather than prompting for it.
 -D  Delete the specified user.
On Windows, NetWare and TPF systems the '</span><span style="color: #660033;">-m</span><span style="color: #ff0000;">' flag is used by default.
On all other systems, the '</span><span style="color: #660033;">-p</span><span style="color: #ff0000;">' flag will probably not work.</span></pre></td></tr></table></div>

<p>notez aussi que pour que cette protection fonctionne, il est obligatoire de ne pas avoir la directive apache <strong>AllowOverride</strong> a none, sinon le fichier <em>.htaccess</em> ne sera pas pris en compte, donc n'oubliez pas de la commenter ou l'enlever tout simplement si vous l'avez dans votre <strong>vhost</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://naeh.net/proteger-un-repertoire-par-un-htaccess/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installer PHPDoc et générer une documentation</title>
		<link>http://naeh.net/installation-phpdoc/</link>
		<comments>http://naeh.net/installation-phpdoc/#comments</comments>
		<pubDate>Tue, 04 Mar 2008 14:33:16 +0000</pubDate>
		<dc:creator>Naeh</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux - Logiciels]]></category>
		<category><![CDATA[PHP / MySQL]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[phpdoc]]></category>
		<category><![CDATA[Serveur]]></category>

		<guid isPermaLink="false">http://naeh.net/installation-phpdoc/</guid>
		<description><![CDATA[Dans cet article nous allons voir comment à partir d'un code source bien commenté, générer une documentation comme on aimerait avoir pour tout projet ou application digne de son nom.
Pour cela nous allons utiliser PHPDocumentor. qui va nous permetre de générer une documentation à paritr des sources de notre projet.
Il faut d'abord l'installer avec la [...]]]></description>
			<content:encoded><![CDATA[<p>Dans cet article nous allons voir comment à partir d'un code source bien commenté, générer une documentation comme on aimerait avoir pour tout projet ou application digne de son nom.</p>
<p>Pour cela nous allons utiliser <a href="http://www.phpdoc.org/" target="_blank">PHPDocumentor</a>. qui va nous permetre de générer une documentation à paritr des sources de notre projet.</p>
<h2>Il faut d'abord l'installer avec la commande suivante :</h2>

<div class="wp_codebox"><table><tr id="p4756"><td class="code" id="p47code56"><pre class="bash" style="font-family:monospace;">pear <span style="color: #c20cb9; font-weight: bold;">install</span> phpdocumentor</pre></td></tr></table></div>

<p>(si pear n'est pas installé faites un <strong>apt-get install php-pear</strong><em>)</em></p>
<p><em>Si vous rencontrez un problème de dépassement  de mémoire alouée avec PHP, allez dans /etc/php5/cli/php.ini et augmenter cette limite (il s'agit du paramètre memory_limit).</em></p>
<h2>création d'un fichier de configuration pour le projet :</h2>
<p>pour générer la documentation d'un projet nous avons besoin d'un fichier de configuration par projet, en voici un exemple :<br />
fichier nom_du_projet.conf :</p>

<div class="wp_codebox"><table><tr id="p4757"><td class="code" id="p47code57"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>Parse Data<span style="color: #7a0874; font-weight: bold;">&#93;</span>
title = Titre de la documentation
hidden = <span style="color: #c20cb9; font-weight: bold;">false</span>
parseprivate = off
javadocdesc = off
defaultcategoryname = Documentation
defaultpackagename = Projet
target = <span style="color: #000000; font-weight: bold;">/</span>PATH<span style="color: #000000; font-weight: bold;">/</span>OU<span style="color: #000000; font-weight: bold;">/</span>SERA<span style="color: #000000; font-weight: bold;">/</span>ENREGISTRE<span style="color: #000000; font-weight: bold;">/</span>LA<span style="color: #000000; font-weight: bold;">/</span>DOCUMENTATION
readmeinstallchangelog = README, INSTALL, FAQ, LICENSE
directory =   <span style="color: #000000; font-weight: bold;">/</span>PATH<span style="color: #000000; font-weight: bold;">/</span>VERS<span style="color: #000000; font-weight: bold;">/</span>LE<span style="color: #000000; font-weight: bold;">/</span>PROJET
ignore = templates<span style="color: #000000; font-weight: bold;">/</span>,<span style="color: #7a0874; font-weight: bold;">test</span><span style="color: #000000; font-weight: bold;">*</span>.php
sourcecode = on
<span style="color: #007800;">output</span>=HTML:frames:earthli</pre></td></tr></table></div>

<p>et pour tester exécutez la commande suivante (après avoir créé le répertoire cible de la documentation)</p>

<div class="wp_codebox"><table><tr id="p4758"><td class="code" id="p47code58"><pre class="bash" style="font-family:monospace;">phpdoc <span style="color: #660033;">-c</span> nom_du_projet.conf</pre></td></tr></table></div>

<p>et voilà, la génération prend un peu de temps, en fonction de la machine et de la taille du projet.</p>
]]></content:encoded>
			<wfw:commentRss>http://naeh.net/installation-phpdoc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Géolocalisation avec l&#8217;API Google et PHP</title>
		<link>http://naeh.net/geolocalisation-avec-lapi-google-et-php/</link>
		<comments>http://naeh.net/geolocalisation-avec-lapi-google-et-php/#comments</comments>
		<pubDate>Wed, 27 Feb 2008 14:05:43 +0000</pubDate>
		<dc:creator>Naeh</dc:creator>
				<category><![CDATA[PHP / MySQL]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[développement]]></category>
		<category><![CDATA[geoloc]]></category>
		<category><![CDATA[geolocalisation]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://naeh.net/geolocalisation-avec-lapi-google-et-php/</guid>
		<description><![CDATA[Parmi tous les services que propose les API google, on peut trouver des choses assez intéressantes, surtout en terme de géolocalisation avec l'API google maps et surtout très pratiques, dernièrement j'ai eu l'occasion de travailler avec le web service de géolocalisation, un outil très simple à utiliser et très pratique.
le but de la manipulation est [...]]]></description>
			<content:encoded><![CDATA[<p>Parmi tous les services que propose les <a href="http://code.google.com/more/#label=APIs">API google</a>, on peut trouver des choses assez intéressantes, surtout en terme de géolocalisation avec l'API google maps et surtout très pratiques, dernièrement j'ai eu l'occasion de travailler avec le <a href="http://code.google.com/apis/maps/documentation/services.html#Geocoding_Direct">web service de géolocalisation</a>, un outil très simple à utiliser et très pratique.</p>
<p>le but de la manipulation est d'obtenir la latitude et la longitude d'un point à partir de son adresse, pour cela, rien de bien méchant :</p>

<div class="wp_codebox"><table><tr id="p4560"><td class="code" id="p45code60"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$address</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'notre adresse'</span> <span style="color: #666666; font-style: italic;">//exemple : 5 rue du taur 31000 Toulouse</span>
&nbsp;
<span style="color: #000088;">$request</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://maps.google.com/maps/geo?'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$request</span> <span style="color: #339933;">.=</span><span style="color: #0000ff;">'q='</span><span style="color: #339933;">.</span><a href="http://www.php.net/urlencode"><span style="color: #990000;">urlencode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$address</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$request</span> <span style="color: #339933;">.=</span><span style="color: #0000ff;">'&amp;key='</span><span style="color: #339933;">.</span>GOOGLE_API_KEY <span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Vous devez en avoir une comme pour toutes les API google.</span>
<span style="color: #000088;">$request</span> <span style="color: #339933;">.=</span><span style="color: #0000ff;">'&amp;output=csv'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// on peut choisir d'autres format, c'est très bien expliqué dans lien du web service</span>
&nbsp;
<span style="color: #000088;">$response</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><a href="http://www.php.net/file_get_contents"><span style="color: #990000;">file_get_contents</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$request</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// notre réponse est composée de 4 parties.</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//exemple de réponse : 200,6,42.730070,-73.690570</span>
<span style="color: #666666; font-style: italic;">//200 code réponse (200 =&gt; ok)</span>
<span style="color: #666666; font-style: italic;">//6 degré de précision</span>
<span style="color: #666666; font-style: italic;">//et les deux dernier sont les coordonnées du point que nous cherchons a géolocaliser.</span></pre></td></tr></table></div>

<p>et voilà avec ce bout de code très simple nous avons géolocalisé une adresse postale, chose très pratique, mais n'oublier pas la limitation qu'impose Google (50 000 requêtes par tranche de 24 heures).</p>
]]></content:encoded>
			<wfw:commentRss>http://naeh.net/geolocalisation-avec-lapi-google-et-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Comment convertir un texte en UTF-8</title>
		<link>http://naeh.net/comment-convertir-un-texte-en-utf-8/</link>
		<comments>http://naeh.net/comment-convertir-un-texte-en-utf-8/#comments</comments>
		<pubDate>Mon, 25 Feb 2008 14:04:27 +0000</pubDate>
		<dc:creator>Naeh</dc:creator>
				<category><![CDATA[PHP / MySQL]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[charset]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[decode]]></category>
		<category><![CDATA[encodage]]></category>
		<category><![CDATA[encode]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[utf-8]]></category>

		<guid isPermaLink="false">http://naeh.net/comment-convertir-un-texte-en-utf-8/</guid>
		<description><![CDATA[voici une fonction simple mais efficace pour convertir un texte en UTF-8 sans se préoccuper de sa provenance (encodage d'origine).

setlocale&#40;LC_ALL, 'fr_FR.utf8'&#41;; //selon la configuration du serveur cela peut être : fr_FR
&#160;
mb_detect_order&#40;array&#40;'UTF-8', 'ISO-8859-1', 'ISO-8859-15', 'Windows-1252'&#41;&#41;; //l'extention mb_string est installée par defaut sur php5
function toUTF8&#40;$string&#41;&#123;
&#160;
   $from = mb_detect_encoding&#40;$string&#41;;
&#160;
if &#40;$from != 'UTF-8'&#41; &#123;
&#160;
    [...]]]></description>
			<content:encoded><![CDATA[<p>voici une fonction simple mais efficace pour convertir un texte en UTF-8 sans se préoccuper de sa provenance (encodage d'origine).</p>

<div class="wp_codebox"><table><tr id="p4362"><td class="code" id="p43code62"><pre class="php" style="font-family:monospace;"><a href="http://www.php.net/setlocale"><span style="color: #990000;">setlocale</span></a><span style="color: #009900;">&#40;</span>LC_ALL<span style="color: #339933;">,</span> <span style="color: #0000ff;">'fr_FR.utf8'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//selon la configuration du serveur cela peut être : fr_FR</span>
&nbsp;
<a href="http://www.php.net/mb_detect_order"><span style="color: #990000;">mb_detect_order</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UTF-8'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'ISO-8859-1'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'ISO-8859-15'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Windows-1252'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//l'extention mb_string est installée par defaut sur php5</span>
<span style="color: #000000; font-weight: bold;">function</span> toUTF8<span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
   <span style="color: #000088;">$from</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mb_detect_encoding"><span style="color: #990000;">mb_detect_encoding</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$from</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'UTF-8'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
      <span style="color: #000088;">$string</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mb_convert_encoding"><span style="color: #990000;">mb_convert_encoding</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'UTF-8'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$from</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$string</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://naeh.net/comment-convertir-un-texte-en-utf-8/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
