Create a new file src/commands/motd.class.php.
Paste the following into it and edit it to your liking:
- Code: Select all
<?php
/**
* motd.class.php
*
* Copyright © 2008 MaDc0w <MaDc0w@undergroundz.org>
* phpFreeChat Copyright © 2008 Stephane Gully <stephane.gully@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
require_once(dirname(__FILE__)."/../pfccommand.class.php");
class pfcCommand_motd extends pfcCommand
{
var $usage = "/motd";
function run(&$xml_reponse, $p)
{
$clientid = $p["clientid"];
$param = $p["param"];
$sender = $p["sender"];
$recipient = $p["recipient"];
$recipientid = $p["recipientid"];
$c =& pfcGlobalConfig::Instance();
$u =& pfcUserConfig::Instance();
$ct =& pfcContainer::Instance();
$msg = "";
$msg .= "<center><h2>Message of the day:</h2></center>";
$msg .= "<div style="float: center; text-align: center; height: 100%; width: 100%; background: white; border: 1px solid black;">";"
$msg .= </div>";
$msg .= "<span style="font-size: 20pt; font-family: Arial; color: green;">Welcome to the chat!</span><br>";
$msg .= "<ul>";
$msg .= "<b>Type /help to see available commands</b><br>";
$msg .= "<li style="margin-left: 20px; font-weight: bold;">Have fun.</li>";
$msg .= "<li style="margin-left: 20px; font-weight: bold;">Give feedback!</li>";
$msg .= "</ul>";
$msg .= "<a href="http://www.phpfreechat.net/forum/viewtopic.php?id=3145" target="_blank">";
$msg .= "<img src="http://www.phpfreechat.net/pub/logo2_80x15.png" alt="">";
$msg .= "</a>";
$msg .= "<i> Get your own copy of motd now!</i>";
$xml_reponse->script("pfc.handleResponse('help', 'ok', '".addslashes($msg)."');");
}
}
?>
To make it run automatically:
Open src/commands/connect.class.php and add before:
- Code: Select all
$xml_reponse->script("pfc.handleResponse('".$this->name."', 'ok', Array('".addslashes($nick)."'));");
These 2 lines:
- Code: Select all
$cmd =& pfcCommand::Factory('motd');
$cmd->run($xml_reponse, $cmdp);
Have fun.
MaDc0w