<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="https://uname.pingveno.net/blog/index.php/feed/rss2/xslt" ?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title># uname -a - Mot-clé - php</title>
    <link>https://uname.pingveno.net/blog/index.php/</link>
    <atom:link href="https://uname.pingveno.net/blog/index.php/feed/tag/php/rss2" rel="self" type="application/rss+xml" />
    <description>Le blog de uname.pingveno.net</description>
    <language>fr</language>
    <pubDate>Sun, 17 May 2026 16:16:57 +0200</pubDate>
    <copyright>Mathieu Pellegrin</copyright>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <generator>Dotclear</generator>
          <item>
        <title>Drupal 8 / 9 / 10 : Programmatically render a view with contextual and exposed filters input</title>
        <link>https://uname.pingveno.net/blog/index.php/post/2024/03/10/Drupal-8-/-9-/-10-%3A-The-right-way-to-programatically-render-a-view-while-setting-exposed-and-contextual-filters-input</link>
        <guid isPermaLink="false">urn:md5:28fceab459140a8a74e0ec4b7befc8fc</guid>
        <pubDate>Sun, 10 Mar 2024 19:45:00 +0100</pubDate>
        <dc:creator>Mathieu</dc:creator>
                  <category>Informatique</category>
                          <category>drupal</category>
                  <category>drupal 10</category>
                  <category>drupal 8</category>
                  <category>drupal 9</category>
                  <category>php</category>
                <description>&lt;p&gt;&lt;strong&gt;Exposed Input&lt;/strong&gt; and &lt;strong&gt;Contextual Input&lt;/strong&gt; are two different ways of providing input to Drupal Views.&lt;/p&gt;

&lt;p&gt;Contextual filters work with an ordered list of parameters, while Exposed Input works with a form that has a couple name/value for every input parameter.&lt;/p&gt;          &lt;h2&gt;Contextual Filters&lt;/h2&gt;

&lt;p&gt;The right way to render a view result with &lt;strong&gt;contextual filters&lt;/strong&gt; is to generate a render array:&lt;/p&gt;

&lt;blockquote&gt;
&lt;pre&gt;
$render_array = [
  '#type' =&amp;gt; 'view',
  '#name' =&amp;gt; 'YOUR_VIEW_NAME',
  '#display_id' =&amp;gt; 'YOUR_VIEW_DISPLAY',
  '#arguments' =&amp;gt; [CONTEXTUAL_FILTER_1, CONTEXTUAL_FILTER_2, ...],
];&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can then send the render array to a Twig variable, or render it programatically:&lt;/p&gt;

&lt;blockquote&gt;
&lt;pre&gt;
$result = \Drupal::service('renderer')-&amp;gt;render($render_array);
return $result-&amp;gt;__toString();&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;We are using the &lt;code&gt;__toString()&lt;/code&gt; function to get the rendered HTML because the result returned by Drupal Render service is an object containing cache metadata.&lt;/p&gt;

&lt;h2&gt;Exposed Filters&lt;/h2&gt;

&lt;p&gt;The right way to render a view result with &lt;strong&gt;exposed filters&lt;/strong&gt; is to generate a render array, and set the &lt;code&gt;'#view#'&lt;/code&gt; parameter with a view object where you can initialize the filters:&lt;/p&gt;

&lt;blockquote&gt;
&lt;pre&gt;
$view = \Drupal\views\Views::getView('YOUR_VIEW_NAME');
$view-&amp;gt;setExposedInput([
    'YOUR_FILTER_NAME' =&amp;gt; 'YOUR_FILTER_VALUE',
]);
$render_array = [
  '#type' =&amp;gt; 'view',
  '#name' =&amp;gt; 'YOUR_VIEW_NAME',
  '#view' =&amp;gt; $view,
  '#display_id' =&amp;gt; 'YOUR_VIEW_DISPLAY',
  '#arguments' =&amp;gt; [CONTEXTUAL_FILTER_1, CONTEXTUAL_FILTER_2, ...],
];&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can then send the render array to a Twig variable, or render it programatically:&lt;/p&gt;

&lt;blockquote&gt;
&lt;pre&gt;
$result = \Drupal::service('renderer')-&amp;gt;render($render_array);
return $result-&amp;gt;__toString();&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;We are using the &lt;code&gt;__toString()&lt;/code&gt; function to get the rendered HTML because the result returned by Drupal Render service is an object containing cache metadata.&lt;/p&gt;

&lt;h2&gt;Leaked Metadata and Early Rendering&lt;/h2&gt;

&lt;p&gt;If you render a view while rendering a controller output that is suppose&amp;nbsp; to provide its own cache metadata (&lt;code&gt;CacheableJsonResponse&lt;/code&gt; for instance), and run on the error:&lt;/p&gt;

&lt;blockquote&gt;
&lt;pre&gt;
LogicException: The controller result claims to be providing relevant cache metadata, but leaked metadata was detected. Please ensure you are not rendering content too early.&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;Just wrap the rendering in a render context:&lt;/p&gt;

&lt;blockquote&gt;
&lt;pre&gt;
$context = new Drupal\Core\Render\RenderContext\RenderContext();
$html = \Drupal::service('renderer')-&amp;gt;executeInRenderContext($context, function () {
  $render_array = [
    '#type' =&amp;gt; 'view',
    '#name' =&amp;gt; 'YOUR_VIEW_NAME',
    '#display_id' =&amp;gt; 'YOUR_VIEW_DISPLAY',
    '#arguments' =&amp;gt; [CONTEXTUAL_FILTER_1, CONTEXTUAL_FILTER_2, ...],
  ];
  $result = \Drupal::service('renderer')-&amp;gt;render($render_array);
  return $result-&amp;gt;__toString();
});
&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;h2&gt;Sources&lt;/h2&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;https://drupal.stackexchange.com/a/295496&quot;&gt;https://drupal.stackexchange.com/a/295496&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;https://www.drupal.org/docs/drupal-apis/render-api/render-arrays&quot;&gt;https://www.drupal.org/docs/drupal-apis/render-api/render-arrays&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;https://api.drupal.org/api/drupal/10/search/setExposedInput&quot;&gt;https://api.drupal.org/api/drupal/10/search/setExposedInput&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;https://www.lullabot.com/articles/early-rendering-a-lesson-in-debugging-drupal-8&quot;&gt;https://www.lullabot.com/articles/early-rendering-a-lesson-in-debugging-drupal-8&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
        
              </item>
          <item>
        <title>Drupal 8 : create a custom Rule Action</title>
        <link>https://uname.pingveno.net/blog/index.php/post/2016/07/27/Drupal-8-%3A-create-a-custom-Rule-action</link>
        <guid isPermaLink="false">urn:md5:4028da17989c185a5f86e2d3f8a25968</guid>
        <pubDate>Wed, 27 Jul 2016 10:56:00 +0200</pubDate>
        <dc:creator>Mathieu</dc:creator>
                  <category>Hacks</category>
                          <category>action</category>
                  <category>drupal</category>
                  <category>drupal 8</category>
                  <category>module</category>
                  <category>php</category>
                  <category>rules</category>
                <description>          &lt;p&gt;Warning : the Rule plugin for Drupal 8 was not considered stable when I wrote this post.&lt;/p&gt;

&lt;h3&gt;1. Drupal 8: the new modules paradigm&lt;/h3&gt;

&lt;p&gt;Drupal 8 modules structure changed, and many modules are now using the new API.&lt;/p&gt;

&lt;p&gt;No more plain old functions name like hook_something, no more obscurous PHP for menu entries. Instead, Object Oriented programming, YAML configuration files, magic comments, and Symfony routing.&lt;/p&gt;

&lt;p&gt;Let's give it a try, let's make our first simplest module.&lt;/p&gt;

&lt;h3&gt;2. Base module configuration&lt;/h3&gt;

&lt;p&gt;If you already know how to do this, jumb to next section.&lt;/p&gt;

&lt;p&gt;Create a directory for your module, for instance &lt;strong&gt;mymodule&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Create an info file in YAML format : &lt;strong&gt;mymodule/mymodule.info.yaml&lt;/strong&gt;:&lt;/p&gt;

&lt;pre&gt;
name: 'My Module'
type: module
core: 8.x
package: Custom&lt;/pre&gt;

&lt;p&gt;You don't need more! You don't need routing as you will plug into Rules.&lt;/p&gt;

&lt;h3&gt;3. File names and Namespaces&lt;/h3&gt;

&lt;p&gt;Create the &lt;strong&gt;RulesAction&lt;/strong&gt; directory and its parents: &lt;strong&gt;mymodule/src/Plugin/RulesAction/&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Create a PHP file for your class: &lt;strong&gt;MyAction.php&lt;/strong&gt;. The class will be loaded with the autoload system.&lt;/p&gt;

&lt;p&gt;Edit the file you just created, and specify the namespace at the beginning of the file:&lt;/p&gt;

&lt;pre&gt;
/**
 * @file
 * Contains \Drupal\mymodule\Plugin\RulesAction\MyAction.
 */
namespace Drupal\mymodule\Plugin\RulesAction;
use Drupal\rules\Core\RulesActionBase;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;The namespace must correspond to your module name and class name!&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;4. Rule Action specifications and parameters&lt;/h3&gt;

&lt;p&gt;Comments are very important as they are also specifications. You will define your Action id, description, and parameters. For instance, here is a copied sample from the predefined action DataSet:&lt;/p&gt;

&lt;pre&gt;
/**
 * Provides a 'My action' action.
 *
 * @RulesAction(
 *   id = &quot;rules_myaction&quot;,
 *   label = @Translation(&quot;Set a data value&quot;),
 *   category = @Translation(&quot;Data&quot;),
 *   context = {
 *     &quot;data&quot; = @ContextDefinition(&quot;any&quot;,
 *       label = @Translation(&quot;Data&quot;),
 *       description = @Translation(&quot;Specifies the data to be modified using a data selector, e.g. 'node:author:name'.&quot;),
 *       allow_null = TRUE,
 *       assignment_restriction = &quot;selector&quot;
 *     ),
 *     &quot;value&quot; = @ContextDefinition(&quot;any&quot;,
 *       label = @Translation(&quot;Value&quot;),
 *       description = @Translation(&quot;The new value to set for the specified data.&quot;),
 *       default_value = NULL,
 *       required = FALSE
 *     )
 *   }
 * )
 */
&lt;/pre&gt;

&lt;p&gt;The Rule id is &lt;strong&gt;rules_myaction&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The category of the action in the dropdown menu is &lt;strong&gt;Data&lt;/strong&gt; and it will be labeled &lt;strong&gt;Set a data value&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The current action will have two parameters : the data that will be changed, and the corresponding value.&lt;/p&gt;

&lt;h3&gt;5. Rule Action callback&lt;/h3&gt;

&lt;p&gt;Again, no more plain callback, the function &lt;strong&gt;doExecute&lt;/strong&gt; will be called to execute your Action:&lt;/p&gt;

&lt;pre&gt;
class MyAction extends RulesActionBase {

  /**
   * Executes the Plugin.
   *
   * @param mixed $data
   *   Original value of an element which is being updated.
   * @param mixed $value
   *   A new value which is being set to an element identified by data selector.
   */
  protected function doExecute($data, $value) {
    $typed_data = $this-&amp;gt;getContext('data')-&amp;gt;getContextData();
    $typed_data-&amp;gt;setValue($value);
  }

  /**
   * {@inheritdoc}
   */
  public function autoSaveContext() {
    // Saving is done at the root of the typed data tree, for example on the
    // entity level.
    $typed_data = $this-&amp;gt;getContext('data')-&amp;gt;getContextData();
    $root = $typed_data-&amp;gt;getRoot();
    $value = $root-&amp;gt;getValue();
    // Only save things that are objects and have a save() method.
    if (is_object($value) &amp;amp;&amp;amp; method_exists($value, 'save')) {
      return ['data'];
    }
    return [];
  }

}&lt;/pre&gt;

&lt;p&gt;The class name has to correspond to your file name.&lt;/p&gt;

&lt;p&gt;In this sample, the parameter &lt;strong&gt;$value&lt;/strong&gt; will be set to &lt;strong&gt;$data&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;6. Troubleshooting&lt;/h3&gt;

&lt;pre&gt;
Uncaught PHP Exception Drupal\\Component\\Plugin\\Exception\\PluginException: &quot;Plugin (rules_myaction) instance class &quot;Drupal\\tbh_system\\Plugin\\RulesAction\\MyAction&quot; does not exist.&quot;&lt;/pre&gt;

&lt;p&gt;Your namespace/classname/filename/directoryname is probably wrong.&lt;/p&gt;

&lt;h3&gt;Source&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://fago.gitbooks.io/rules-docs/content/extending_rules/rules_action_plugins.html&quot; hreflang=&quot;en&quot;&gt;Drupal 8 Rules Action documentation&lt;/a&gt;&lt;/p&gt;</description>
        
              </item>
          <item>
        <title>&quot;SQLSTATE[HY000] [2002] No such file or directory&quot; for compiled PHP</title>
        <link>https://uname.pingveno.net/blog/index.php/post/2016/04/19/SQLSTATE%5BHY000%5D-%5B2002%5D-No-such-file-or-directory-for-compiled-PHP</link>
        <guid isPermaLink="false">urn:md5:fe7ea9121022705600cf591fb8363708</guid>
        <pubDate>Tue, 19 Apr 2016 22:52:00 +0200</pubDate>
        <dc:creator>Mathieu</dc:creator>
                  <category>Hacks</category>
                          <category>compiled</category>
                  <category>debian</category>
                  <category>mysql</category>
                  <category>php</category>
                <description>          &lt;p&gt;Let's say you connect to MySQL using &quot;localhost&quot;&lt;/p&gt;

&lt;p&gt;Let's say you compiled PHP&lt;/p&gt;

&lt;p&gt;Let's say you didn't specify the --with-mysql-sock= parameter in your configure command when you built mysql&lt;/p&gt;

&lt;p&gt;And let's suppose you cannot connect to MySQL using PHP. CLI works fine, but not CGI.&lt;/p&gt;

&lt;p&gt;Solution : fix the default sockets in php.ini (use your own working socket paths) :&lt;/p&gt;

&lt;pre&gt;
pdo_mysql.default_socket=/var/run/mysqld/mysqld.sock
mysqli.default_socket = /var/run/mysqld/mysqld.sock

# You shouldn't use mysql_ extension, but if you did:
mysql.default_socket = /var/run/mysqld/mysqld.sock&lt;/pre&gt;

&lt;p&gt;I suppose that automatically converting &quot;localhost&quot; to an unix socket is done for performance reason on unix systems.&lt;/p&gt;</description>
        
              </item>
          <item>
        <title>DomPDF : load custom local fonts in you own folder</title>
        <link>https://uname.pingveno.net/blog/index.php/post/2016/02/12/DomPDF-%3A-load-custom-local-fonts-in-you-own-folder</link>
        <guid isPermaLink="false">urn:md5:64ccb411255b47015d970c64cf67b956</guid>
        <pubDate>Fri, 12 Feb 2016 23:28:00 +0100</pubDate>
        <dc:creator>Mathieu</dc:creator>
                  <category>Hacks</category>
                          <category>dompdf</category>
                  <category>font</category>
                  <category>html</category>
                  <category>pdf</category>
                  <category>php</category>
                  <category>ttf</category>
                <description>          &lt;p&gt;I needed custom fonts for &lt;a href=&quot;https://github.com/dompdf/dompdf&quot;&gt;domPDF&lt;/a&gt;, but I didn&amp;#8217;t want to use the &amp;#8220;remote&amp;#8221; capabilities of domPDF, and I didn&amp;#8217;t wanted to spoil my &amp;#8220;contrib&amp;#8221; folder with my own fonts. Dependencies should remain clean.&lt;/p&gt;&lt;p&gt;My domPDF version was &lt;strong&gt;0.6.3&lt;/strong&gt;.&lt;/p&gt;&lt;p&gt;To use your own &amp;#8220;fonts&amp;#8221; folder in order to autoload you own fonts, do&amp;#160;:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;Creates a directory for your fonts and font cache&amp;#160;:&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;pre&gt;mkdir myfonts&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;Copy your &lt;strong&gt;.ttf&lt;/strong&gt; files in this folder.&lt;/li&gt;&lt;li&gt;Creates a file named &lt;strong&gt;dompdf_font_family_cache.php&lt;/strong&gt; in the &lt;strong&gt;myfonts&lt;/strong&gt; folder, and reference your files. As a sample, you can use the file &lt;strong&gt;dompdf/lib/fonts/dompdf_font_family_cache.dist.php&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;In your configuration (&lt;strong&gt;dompdf_config.custom.inc.php&lt;/strong&gt;), change the &lt;strong&gt;DOMPDF_FONT_DIR&lt;/strong&gt; and &lt;strong&gt;DOMPDF_FONT_CACHE&lt;/strong&gt; to point on your folder &lt;strong&gt;myfonts&lt;/strong&gt; (relative use &lt;strong&gt;realpath&lt;/strong&gt; on relative paths).&lt;/li&gt;&lt;li&gt;Use your fonts like native fonts in font-family declarations.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;I hope it will be useful to you.&lt;/p&gt;</description>
        
              </item>
          <item>
        <title>Drupal 7 : create your own image effect for use in image styles</title>
        <link>https://uname.pingveno.net/blog/index.php/post/2015/02/25/Drupal-7-%3A-create-your-own-image-effect-for-use-in-image-styles</link>
        <guid isPermaLink="false">urn:md5:07800b84eeef05debd24db6354b32e72</guid>
        <pubDate>Wed, 25 Feb 2015 18:56:00 +0100</pubDate>
        <dc:creator>Mathieu</dc:creator>
                  <category>Hacks</category>
                          <category>drupal</category>
                  <category>drupal 7</category>
                  <category>effect</category>
                  <category>image</category>
                  <category>module</category>
                  <category>php</category>
                  <category>style</category>
                <description>&lt;p&gt;Drupal comes with many predefined effects, you can combine them in image styles to get the picture you want. But what if you have to make your own effect&amp;#160;? Here is how.&lt;/p&gt;          &lt;h3&gt;Step 1&amp;#160;: create a module&lt;/h3&gt;

&lt;p&gt;If you are a drupal developer, you should know how to make a module. Okay, I am lazy too&amp;#160;:&lt;/p&gt;

&lt;p&gt;myeffect.info&amp;#160;:&lt;/p&gt;

&lt;pre&gt;
name = My Effect
description = &quot;My wonderful border effect&quot;
core = 7.x
dependencies[] = image
files[] = myeffect.module
package = Media&lt;/pre&gt;

&lt;h3&gt;Step 2&amp;#160;: declare your effect&lt;/h3&gt;

&lt;p&gt;Implement hook_image_effect_info&amp;#160;:&lt;/p&gt;

&lt;pre&gt;
function myeffect_image_effect_info() {
  $effects = array(
    'myeffect_image_border' =&amp;gt; array(
      'label' =&amp;gt; t('My Effect - Border'),
      'help' =&amp;gt; t('Add border to an image'),
      'effect callback' =&amp;gt; '_myeffect_image_border_effect',
// Let's make things simpler...
//      'form callback' =&amp;gt; '_myeffect_image_border_form',
//      'summary theme' =&amp;gt; '_myeffect_image_border_summary',
    ),
  );
  return $effects;
}&lt;/pre&gt;

&lt;h3&gt;Step 3&amp;#160;: write the callback&lt;/h3&gt;

&lt;pre&gt;
function _myeffect_image_border_effect(&amp;amp;$image, $data) {
  if (!_myeffect_image_border($image, $data)) {
    watchdog('image', 'Image add border failed using the %toolkit toolkit on %path (%mimetype)', array(
      '%toolkit' =&amp;gt; $image-&amp;gt;toolkit,
      '%path' =&amp;gt; $image-&amp;gt;source,
      '%mimetype' =&amp;gt; $image-&amp;gt;info['mime_type'],
    ), WATCHDOG_ERROR);
    return FALSE;
  }
  return TRUE;
}

function _myeffect_image_border(stdClass $image, $data) {
  if ($image-&amp;gt;toolkit == 'gd') {
    $params = array($image, $data);
    return call_user_func_array('_myeffect_gd_border', $params);
  } else {
    watchdog('image', 'The selected image handling toolkit %toolkit can not correctly process %function.', array(
      '%toolkit' =&amp;gt; $image-&amp;gt;toolkit,
      '%function' =&amp;gt; $function,
    ), WATCHDOG_ERROR);
    return FALSE;
  }
}&lt;/pre&gt;

&lt;h3&gt;Step 4&amp;#160;: make your effect&amp;#160;!&lt;/h3&gt;

&lt;pre&gt;
function _myeffect_gd_border(stdClass $image, $data) {

  $width = $image-&amp;gt;info['width'];
  $height = $image-&amp;gt;info['height'];

  // Note : source image is in $image-&amp;gt;resource
  $dst = imagecreatetruecolor($width, $height);

...

  // Update image object.
  $image-&amp;gt;resource = $dst;
  $image-&amp;gt;info['width'] = $width;
  $image-&amp;gt;info['height'] = $height;

  return TRUE;
}&lt;/pre&gt;

&lt;h3&gt;Source&lt;/h3&gt;

&lt;p&gt;The content of this article is widely based on the module &lt;a href=&quot;https://www.drupal.org/project/iek&quot; hreflang=&quot;en&quot;&gt;Image Effect Kit&lt;/a&gt;, you can download and read it for a more complete example.&lt;/p&gt;</description>
        
              </item>
          <item>
        <title>Drupal 7 : change page title on node form</title>
        <link>https://uname.pingveno.net/blog/index.php/post/2014/11/10/Drupal-%3A-change-page-title-on-node-form</link>
        <guid isPermaLink="false">urn:md5:8b7c0fea8cafc55192f6b58aac77c5a4</guid>
        <pubDate>Mon, 10 Nov 2014 11:19:00 +0100</pubDate>
        <dc:creator>Mathieu</dc:creator>
                  <category>Hacks</category>
                          <category>drupal</category>
                  <category>php</category>
                <description>          &lt;p&gt;Every rule has its exceptions, setting &lt;code&gt;drupal_set_title&lt;/code&gt; directly on form_alter doesn&amp;#8217;t work for node form title. To customize pages like &amp;#8220;Add node&amp;#8221;, or &amp;#8220;Edit node&amp;#8221;&amp;#160;:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;p&gt;Make a module&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add a function to implement hook_form_alter&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Add a form afterbuild in your hook_form_alter implementation&lt;/strong&gt;: &lt;code&gt;$form['#after_build'][] = '_my_callback_form_set_title'&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In &lt;code&gt;'_my_callback_form_set_title'&lt;/code&gt;, use &lt;code&gt;drupal_set_title&lt;/code&gt; to change the form title: &lt;code&gt;drupal_set_title(...)&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Update system table to have the weight of your module greater than Node module&lt;/strong&gt; (on a default install, core modules are weighted 0, so set your module weight to 1).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Rebuild registry, clear caches.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;</description>
        
              </item>
          <item>
        <title>osTicket, wget, crontab and FastCGI</title>
        <link>https://uname.pingveno.net/blog/index.php/post/2013/06/29/osTicket%2C-wget%2C-crontab-and-FastCGI</link>
        <guid isPermaLink="false">urn:md5:ead2d7950681e1bbacd37bc7f0d81ed4</guid>
        <pubDate>Sat, 29 Jun 2013 23:27:00 +0200</pubDate>
        <dc:creator>Mathieu</dc:creator>
                  <category>Hacks</category>
                          <category>fastcgi</category>
                  <category>osTicket</category>
                  <category>php</category>
                  <category>wget</category>
                <description>          &lt;p&gt;After a long night trying to get HTTP cron for osTickets to work, here is my solution&amp;#160;:&lt;/p&gt;
&lt;h3&gt;Things to know&lt;/h3&gt;
&lt;ul&gt;&lt;li&gt;Rewritting the URLs of a FastCGI-running PHP application, using Apache2 mod_rewrite on PATH_INFO is broken, &lt;strong&gt;it does not work&lt;/strong&gt;. &lt;strong&gt;Never&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;osTicket &lt;strong&gt;needs&lt;/strong&gt; POST requests to its API.&lt;/li&gt;
&lt;li&gt;osTicket uses an unsafe way to get PATH_INFO, obviously it will not work with FastCGI.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;How to get it work&lt;/h3&gt;
&lt;p&gt;Open &lt;code&gt;&lt;strong&gt;includes/class.osticket.php&lt;/strong&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Replace&amp;#160;:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //TODO: conruct possible path info.&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
&lt;br /&gt;With&amp;#160;:
&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $path_info = str_replace(BASE_URI.&quot;/&quot;, &quot;&quot;, $_SERVER['REQUEST_URI']);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!empty($path_info)) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return $path_info;&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;And call the cron like that&amp;#160;:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;code&gt;&amp;nbsp;/usr/bin/wget -q --no-cache -O /dev/null --post-data '' --header='X-API-Key:your_api_key_here' 'http://example.com&lt;strong&gt;/api/http.php/tasks/cron&lt;/strong&gt;'&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;</description>
        
              </item>
          <item>
        <title>C99Shell et dé-obfuscation</title>
        <link>https://uname.pingveno.net/blog/index.php/post/2010/04/06/C99Shell-et-d%C3%A9obfuscation</link>
        <guid isPermaLink="false">urn:md5:c334dfd4f04f400c05f8c7ff1e5d51f7</guid>
        <pubDate>Tue, 06 Apr 2010 18:05:00 +0200</pubDate>
        <dc:creator>Mathieu</dc:creator>
                  <category>Hacks</category>
                          <category>c99shell</category>
                  <category>php</category>
                  <category>phpmyvisites</category>
                <description>&lt;p&gt;Ayant eu récemment l'occasion de travailler sur un site s'étant fait
own3d par un script kiddie via la faille &lt;a hreflang=&quot;en&quot; href=&quot;http://www.phpmyvisites.us/phpmv2/CHANGELOG&quot;&gt;phpMyVisites&lt;/a&gt;,
j'ai eu l'occasion d'essayer C99Shell, l'outil qui était utilisé par ces
derniers pour accéder au backend du site.&lt;/p&gt;          &lt;p&gt;&lt;img title=&quot;Capture c99Shell, avr. 2010&quot; alt=&quot;Capture c99Shell&quot; src=&quot;https://uname.pingveno.net/blog/public/captures/.c99shell-hacked_m.jpg&quot; /&gt;&lt;/p&gt;
&lt;p&gt;C99Shell est un outil pour script kiddie qui permet de faire, entre autre :&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;BruteForce FTP&lt;/li&gt;
&lt;li&gt;Execution de code arbitraire&lt;/li&gt;
&lt;li&gt;Upload/Modification/Lecture de fichiers&lt;/li&gt;
&lt;li&gt;Recherche automatique de mots de passe phpBB et autres&lt;/li&gt;
&lt;li&gt;...&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Non je ne fournit pas le code. J'ai pourtant été obligé pour le lancer et pour contourner le mot de passe qui était hardcodé dans le code, de le dé-obfusquer.&lt;/p&gt;
&lt;p&gt;Voici donc un petit script pour dé-obfusquer rapidement ce genre de code qui est créé à coup de eval(base64_decode(...)) :&amp;nbsp;&lt;a href=&quot;https://uname.pingveno.net/blog/public/code/bash/decode_eval_base64.sh&quot;&gt;decode_eval_base64sh&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Pour servir à d'autres, ou à moi comme aide mémoire (nécessite php5-cli).&lt;/p&gt;</description>
        
              </item>
      </channel>
</rss>
