Patch by Jean-Marc Liotier providing post restriction by user level and IRC notification.
51a52,96
> // --------------------------------------------------------
> // Begin IRC notification preliminary declarations
> // --------------------------------------------------------
> include_once('/usr/share/php/Net/SmartIRC.php');
> // FIXME The notification channel should of course be set by the user.
> $IRC_notification_channel = '#b^2';
> class myIRCnotifier
> {
> function IRC_notification(&$irc)
> {
> global $IRC_notify_once_id;
> global $IRC_notification_channel;
> global $db;
> global $URLMethod;
> $linkres=new Link;
> $linkres->id=$link_id = strip_tags($_POST['id']);
> $linkres->read();
> $IRC_notification_pligg_username = $db->get_var("SELECT user_login FROM " . table_users . " WHERE user_id = $linkres->author");
> if ($URLMethod == 1) {
> $IRC_link_url=my_base_url.my_pligg_base."/story.php?id=".$link_id;
> }
> if ($URLMethod == 2) {
> $IRC_link_url=my_base_url.my_pligg_base."/story/".$link_id;
> }
> $IRC_notification_message = $IRC_notification_pligg_username. ' posted "' .$linkres->title. '" at ' .$IRC_link_url;
> $irc->message(SMARTIRC_TYPE_CHANNEL, $IRC_notification_channel, $IRC_notification_message);
> $irc->unregisterTimeid($IRC_notify_once_id);
> }
>
> function IRC_termination(&$irc)
> {
> global $IRC_termination_id;
> $irc->quit();
> $irc->unregisterTimeid($IRC_termination_id);
> }
> }
> $IRCnotifier = &new myIRCnotifier();
> $irc = &new Net_SmartIRC();
> $irc->setUseSockets(TRUE);
> $IRC_notify_once_id = $irc->registerTimehandler(0, $IRCnotifier, 'IRC_notification');
> $IRC_termination_id = $irc->registerTimehandler(1, $IRCnotifier, 'IRC_termination');
> // --------------------------------------------------------
> // End IRC notification preliminary declarations
> // --------------------------------------------------------
>
58c103,113
< do_submit0();
---
> $canIhaveAccess = 0;
> $canIhaveAccess = $canIhaveAccess + checklevel('god');
> $canIhaveAccess = $canIhaveAccess + checklevel('admin');
> if($canIhaveAccess == 1)
> {
> do_submit0();
> }
> else
> {
> echo 'Only admins can post. I you are a #b^2 member or friend thereof you may request admin status so that you can post';
> }
66a122,129
> // Begin IRC notification
> // FIXME The connect and login parameters should of course be set by the user.
> $irc->connect('irc.eu.freenode.net', 6667);
> $irc->login('PliggNotifier', 'Pligg PHP IRC notification service', '0', 'PliggNotifier');
> $irc->join(array($IRC_notification_channel));
> $irc->listen();
> $irc->disconnect();
> // End IRC notification
293c356,357
< ?>
\ No newline at end of file
---
> ?>
>