1 (edited by NettiCat 2009-10-28 14:29)

Topic: [extension release] Add useragent to posts and replies

This extension adds useragent information (just the header string) after the last line of topics and replies. Not added for administrators and localhost.

I know there already exist similar extensions, however this one is slightly different what was important for me.



<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE extension SYSTEM "ext-1.0.dtd">

<!--
/**
 * Add useragent to posts
 *
 * @package add_useragent_to_posts and replies
 */
-->

    <extension engine="1.0">
    <id>add_useragent_to_posts</id>
    <title>Add useragent to posts and replies</title>
    <version>1.0</version>
    <description>
        Adds useragent information (just the header string) after the last line of topics and replies. Not added for administrators and localhost.
    </description>
    <author>NettiCat</author>
    <minversion>1.3</minversion>
    <maxtestedon>1.3.4</maxtestedon>




    <hooks>
        <hook id="po_end_validation" priority="10"><![CDATA[
            if (empty($errors) && !isset($_POST['preview']))
            {
                $user_agent = $_SERVER["HTTP_USER_AGENT"];
                if($forum_user['g_id'] != FORUM_ADMIN  && $_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR'])
                    $message = $message."\r\n\r\n".$user_agent;
            }
        ]]>
        </hook>
    </hooks>

</extension>

Re: [extension release] Add useragent to posts and replies

    <install>
        <![CDATA[
        ]]>
    </install>
    
    <uninstall>
        <![CDATA[
        ]]>
    </uninstall>

By the way, you may not write install and uninstall sectios in manifest.xml if they are empty.