function gb_checkupdaterights($id = '0')
{
    global $db_guestbook, $cfg, $usr, $admin;
    if ($id > '0') {
        $sql = sed_sql_query("SELECT gb_authorid FROM {$db_guestbook} WHERE gb_id='{$id}' LIMIT 1 ");
        $row = mysql_fetch_array($sql);
        if ($row['gb_authorid'] == $usr['id'] && $row['gb_authorid'] > 0 && $cfg['plugin']['guestbook']['editable'] == 'Yes') {
            return TRUE;
        } elseif ($admin == TRUE) {
            return TRUE;
        } else {
            return FALSE;
        }
    } else {
        return FALSE;
    }
}
<?php

/* ====================
[BEGIN_SED_EXTPLUGIN]
Code=hidefuturepages
Part=page
File=hidefuturepages.page.edit.update.done
Hooks=page.edit.update.done
Tags=
Order=10
[END_SED_EXTPLUGIN]
==================== */
defined('SED_CODE') or die('Wrong URL');
if ((int) $rpagebegin > (int) $sys['now_offset']) {
    $id = (int) $id;
    sed_sql_query("UPDATE {$db_pages} SET page_state='3' WHERE page_id='{$id}'");
    sed_log("Edited page #" . $id, 'adm');
    sed_redirect(sed_url('admin', 'm=page&s=queue', NULL, TRUE));
}
 }
 if ($uwd_counter > 0) {
     sed_log("User watchdog plugin sent " . $uwd_counter . " inactivity warning(s)", 'adm');
 }
 //delete user which reached the reprieve date
 $sql = sed_sql_query("SELECT user_id, user_name FROM {$db_users} WHERE " . $uwd_reprieveslot . ">'0' AND " . $uwd_reprieveslot . "<'{$uwd_reprieve}'");
 while ($row = sed_sql_fetcharray($sql)) {
     //if there is the trashcan enabled, we put it there
     if ($cfg['trash_user']) {
         $sqltrash = sed_sql_query("SELECT * FROM {$db_users} WHERE user_id='" . $row['user_id'] . "'");
         if ($rowtrash = sed_sql_fetchassoc($sqltrash)) {
             sed_trash_put('user', $L['User'] . " #" . $rowtrash['user_id'] . " " . $rowtrash['user_name'], $rowtrash['user_id'], $rowtrash);
         }
     }
     $sqldel = sed_sql_query("DELETE FROM {$db_users} WHERE user_id='" . $row['user_id'] . "'");
     $sqldel = sed_sql_query("DELETE FROM {$db_groups_users} WHERE gru_userid='" . $row['user_id'] . "'");
     if ($cfg['plugin']['userwatchdog']['uwd_delpfs']) {
         sed_pfs_deleteall($row['user_id']);
         //Avatar, Photo, Signature cleaning idea by Kilandor
         $uwd_avatar = $cfg['av_dir'] . $row['user_id'] . "-avatar.gif";
         $uwd_photo = $cfg['photos_dir'] . $row['user_id'] . "-photo.gif";
         $uwd_signature = $cfg['sig_dir'] . $row . "-signature.gif";
         @unlink($avatar);
         @unlink($photo);
         @unlink($signature);
     }
     if ($cfg['trash_user']) {
         sed_log("User Watchdog trashed #" . $row['user_id'] . " " . $row['user_name'], 'adm');
     } else {
         sed_log("User Watchdog deleted #" . $row['user_id'] . " " . $row['user_name'], 'adm');
     }
    $error_string .= strlen($nletter_email) < 4 || !eregi("^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]{2,})+\$", $nletter_email) ? $L['plu_email_invalid'] . "<br />" : '';
    $error_string .= $row['nletter_active'] == 1 ? $L['plu_email_exists'] . "<br />" : '';
    if (empty($error_string)) {
        if (isset($row['nletter_active'])) {
            $nletter_activation = $cfg['mainurl'] . "/plug.php?e=newsletter&email=" . $nletter_email . "&activate=" . $row['nletter_activation'];
        } else {
            $sql = sed_sql_query("INSERT INTO sed_newsletter (nletter_email, nletter_date, nletter_activation) values ('{$nletter_email}', '" . $sys['now'] . "', '{$nletter_activation}')");
            $nletter_activation = $cfg['mainurl'] . "/plug.php?e=newsletter&email=" . $nletter_email . "&activate=" . $nletter_activation;
        }
        $nlsubject = $L['plu_amail_subject'];
        $nlbody = sprintf($L['plu_amail_body'], $nletter_activation);
        sed_mail($nletter_email, $nlsubject, $nlbody);
        $plugin_body = "<p style=\"text-align:center;\">" . $L['plu_joined'] . "</p>";
    }
} elseif ($a == $L['plu_cancel']) {
    $sql = sed_sql_query("SELECT nletter_activation FROM sed_newsletter WHERE nletter_email='{$nletter_email}' LIMIT 1");
    $error_string .= sed_sql_numrows($sql) != 1 ? $L['plu_email_cancelfailed'] . "<br />" : '';
    if (empty($error_string)) {
        $row = sed_sql_fetcharray($sql);
        $nletter_cancel = $cfg['mainurl'] . "/plug.php?e=newsletter&email=" . $nletter_email . "&cancel=" . $row['nletter_activation'];
        $nlsubject = $L['plu_cmail_subject'];
        $nlbody = sprintf($L['plu_cmail_body'], $nletter_cancel);
        sed_mail($nletter_email, $nlsubject, $nlbody);
        $plugin_body = "<p style=\"text-align:center;\">" . $L['plu_canceled'] . "</p>";
    }
}
if (empty($plugin_body)) {
    $plugin_body .= $L['plu_intro'];
    $plugin_body .= $error_string ? "<p><span style=\"color:red;\">" . $error_string . "</span></p>" : "";
    $plugin_body .= "<form name='newsletter' action='plug.php?e=newsletter' method='post'>";
    $plugin_body .= "<p>" . $L['plu_email'] . ":<input type=\"text\" name=\"nletter_email\" value=\"\" size=\"36\" maxlength=\"64\">";
if ($a == 'unvalidate') {
    sed_check_xg();
    $sql = sed_sql_query("SELECT page_ownerid, page_cat FROM {$db_pages} WHERE page_id='{$id}' LIMIT 1");
    if ($row = sed_sql_fetcharray($sql)) {
        $usr['isadmin'] = sed_auth('page', $row['page_cat'], 'A');
        $usr['isadmin'] = $row['page_ownerid'] == $usr['id'] ? TRUE : $usr['isadmin'];
        sed_block($usr['isadmin']);
        $sql = sed_sql_query("UPDATE {$db_pages} SET page_state=1 WHERE page_id='{$id}'");
        sed_cache_clear('latestpages');
        header("Location: list.php?c=" . $row['page_cat']);
        exit;
    } else {
        sed_die();
    }
}
$sql = sed_sql_query("SELECT * FROM {$db_pages} WHERE page_id='{$id}' LIMIT 1");
sed_die(sed_sql_numrows($sql) == 0);
$pag = sed_sql_fetcharray($sql);
$pag['page_date'] = sed_selectbox_date($pag['page_date'] + $usr['timezone'] * 3600, 'long');
$pag['page_begin'] = sed_selectbox_date($pag['page_begin'] + $usr['timezone'] * 3600, 'long', '_beg');
$pag['page_expire'] = sed_selectbox_date($pag['page_expire'] + $usr['timezone'] * 3600, 'long', '_exp');
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = sed_auth('page', $pag['page_cat']);
$usr['isadmin'] = $pag['page_ownerid'] == $usr['id'] ? TRUE : $usr['isadmin'];
sed_block($usr['isadmin']);
$page_form_delete = "<input type=\"radio\" class=\"radio\" name=\"rpagedelete\" value=\"1\" />" . $L['Yes'] . " <input type=\"radio\" class=\"radio\" name=\"rpagedelete\" value=\"0\" checked=\"checked\" />" . $L['No'];
$page_form_categories = sed_selectbox_categories($pag['page_cat'], 'rpagecat');
$page_form_type = "<select name=\"rpagetype\" size=\"1\">";
$selected0 = $pag['page_type'] == 0 ? "selected=\"selected\"" : '';
$selected1 = $pag['page_type'] == 1 ? "selected=\"selected\"" : '';
$selected2 = $pag['page_type'] == 2 && $usr['maingrp'] == 5 ? "selected=\"selected\"" : '';
$page_form_type .= "<option value=\"0\" {$selected0}>" . $L['Default'] . "</option>";
    }
    $t->parse("MAIN.GUESTBOOK_FORM_EDIT");
}
if ($a == "") {
    if ($write == FALSE) {
        $gb_signguestbook = $L['plu_regonly'];
    } else {
        $gb_signguestbook = "<a href=\"plug.php?e=guestbook&amp;a=sign\">" . $L['plu_signguestbook'] . "</a>";
    }
    $t->assign(array("GUESTBOOK_SIGNGUESTBOOK" => $gb_signguestbook));
    $t->parse("MAIN.GUESTBOOK_SIGNGUESTBOOK");
    if (empty($d)) {
        $d = '0';
    }
    $sql = sed_sql_query("SELECT * from {$db_guestbook} ORDER BY gb_id DESC LIMIT {$d}, " . $cfg['plugin']['guestbook']['maxposts'] . "");
    $sql1 = sed_sql_query("SELECT COUNT(*) FROM {$db_guestbook} ");
    $totalentries = mysql_result($sql1, 0, "COUNT(*)");
    $totalpages = ceil($totalentries / $cfg['plugin']['guestbook']['maxposts']) != 0 ? ceil($totalentries / $cfg['plugin']['guestbook']['maxposts']) : "1";
    $currentpage = ceil($d / $cfg['plugin']['guestbook']['maxposts']) + 1;
    unset($pageprev, $pagenext);
    if ($d > 0) {
        $prevpage = $d - $cfg['plugin']['guestbook']['maxposts'];
        if ($prevpage < 0) {
            $prevpage = 0;
        }
        $pageprev = "<a href=\"plug.php?e=guestbook&amp;d={$prevpage}\">{$sed_img_left} " . $L['plu_previous'] . "</a>";
    }
    if ($d + $cfg['plugin']['guestbook']['maxposts'] < $totalentries) {
        $nextpage = $d + $cfg['plugin']['guestbook']['maxposts'];
        $pagenext = "<a href=\"plug.php?e=guestbook&amp;d={$nextpage}\">" . $L['plu_next'] . " {$sed_img_right}</a>";
    }
                    $expirepages_result['page_expire'] = (int) $newtempexpiredate;
                    $expirepages_result['page_state'] = 1;
                    $expirepages_result['page_comcount'] = 0;
                    sed_trash_put('page', $expirepages_result['page_title'], $expirepages_result['page_id'], $expirepages_result);
                }
                $sql_pagestatus = sed_sql_query("DELETE FROM {$db_pages} WHERE page_id='" . (int) $expirepages_result['page_id'] . "'");
                sed_log("Deleted page #" . (int) $expirepages_result['page_id'], 'adm');
                sed_sql_query("UPDATE {$db_structure} SET structure_pagecount=structure_pagecount-1 WHERE structure_code='" . sed_sql_prep($expirepages_result['page_cat']) . "'");
                if ($cfg['plugin']['hidefuturepages']['deletepagerelated'] == 'Yes') {
                    $pagecode = "p" . $pageid;
                    sed_sql_query("DELETE FROM {$db_ratings} WHERE rating_code='{$pagecode}'");
                    sed_sql_query("DELETE FROM {$db_rated} WHERE rated_code='{$pagecode}'");
                    sed_sql_query("DELETE FROM {$db_com} WHERE com_code='{$pagecode}'");
                }
                break;
            case 'hide':
                $sql_pagestatus = sed_sql_query("UPDATE {$db_pages} SET page_state='4' WHERE page_id='{$pageid}'");
                break;
        }
        if ($sql_pagestatus) {
            $expirepages_count++;
        }
    }
    if ($expirepages_count > 0 && $cfg['trash_page'] && $pageexpireaction == 'delete') {
        sed_log($expirepages_count . " page(s) had expired and were put in the trash", 'adm');
    } elseif ($expirepages_count > 0 && $pageexpireaction == 'delete') {
        sed_log($expirepages_count . " page(s) had expired and were deleted", 'adm');
    } elseif ($expirepages_count > 0 && $pageexpireaction == 'update') {
        sed_log($expirepages_count . " page(s) had expired and set to be hidden.", 'adm');
    }
}
http://www.neocrome.net

[BEGIN_SED]
File=plugins/welcomepm/welcomepm.php
Version=100
Updated=2006-apr-23
Type=Plugin
Author=riptide
Description=Sends a welcome PM to every new registered user
[END_SED]

[BEGIN_SED_EXTPLUGIN]
Code=welcomepm
Part=main
File=welcomepm
Hooks=users.register.add.done
Minlevel=0
Order=10
Tags=
[END_SED_EXTPLUGIN]

==================== */
if (!defined('SED_CODE')) {
    die("Wrong URL.");
}
require 'plugins/welcomepm/lang/welcomepm.' . $usr['lang'] . '.lang.php';
$welcometext = str_replace("[username]", $rusername, $L['plu_pmtext']);
$sql = sed_sql_query("SELECT user_id FROM {$db_users} WHERE user_name='{$rusername}' AND user_email='{$ruseremail}'");
$row = sed_sql_fetcharray($sql);
$sql = sed_sql_query("INSERT INTO {$db_pm} (pm_state, pm_date, pm_fromuserid, pm_fromuser, pm_touserid, pm_title, pm_text) values ('0', '" . $sys['now_offset'] . "', '" . $cfg['plugin']['welcomepm']['fromuserid'] . "', '" . $cfg['plugin']['welcomepm']['fromusername'] . "', '" . $row['user_id'] . "', '" . $L['plu_pmtitle'] . "', '" . $welcometext . "')");
sed_stat_inc('totalpms');
Type=Plugin
Author=riptide
Description=Delete users which stayed off your website too long automaticaly
[END_SED]

[BEGIN_SED_EXTPLUGIN]
Code=userwatchdog
Part=users.auth.check.done
File=userwatchdog.auth
Hooks=users.auth.check.done
Tags=
Minlevel=0
Order=10
[END_SED_EXTPLUGIN]

==================== */
if (!defined('SED_CODE')) {
    die("Wrong URL.");
}
if ($cfg['plugin']['userwatchdog']['uwd_enableplugin'] == 'yes') {
    $uwd_reprieveslot = $cfg['plugin']['userwatchdog']['uwd_reprieveslot'];
    if ($rusername != '') {
        //check if it is a user with a reprieve and if yes, clear the reprieve date
        $uwd_sql = sed_sql_query("UPDATE {$db_users} SET " . $uwd_reprieveslot . "='' WHERE " . $uwd_reprieveslot . ">'0' AND user_name='" . sed_sql_prep($rusername) . "' LIMIT 1");
        $uwd_backagain = sed_sql_affectedrows($uwd_sql);
        if ($uwd_backagain > 0) {
            sed_log("User watchdog plugin welcomes back: " . sed_sql_prep($rusername) . "", 'adm');
        }
        unset($uwd_backagain);
    }
}
 $plugin_body .= "<a href='admin.php?m=tools&amp;p=newsletter" . $shr . "'>" . $shtr . "</a>";
 $plugin_body .= "</p>";
 if ($a == "showreceivers") {
     $sql = sed_sql_query("SELECT nletter_email FROM sed_newsletter WHERE nletter_active='1'");
     while ($row = sed_sql_fetcharray($sql)) {
         $nletter_receivers .= $row['nletter_email'] . ", ";
     }
     $plugin_body .= "<p>" . substr($nletter_receivers, 0, -2) . "</p>";
 }
 if ($totalinactive > '0') {
     $plugin_body .= "<p>" . $L['plu_form_totalinactive'] . ": <strong>" . $totalinactive . "</strong>&nbsp;";
     $shi = $a != "showinactive" ? "&amp;a=showinactive" : "";
     $shti = $a != "showinactive" ? $L['plu_showinactive'] : $L['plu_hideinactive'];
     $plugin_body .= "<a href='admin.php?m=tools&amp;p=newsletter" . $shi . "'>" . $shti . "</a>&nbsp;";
     if ($a == "showinactive") {
         $sql = sed_sql_query("SELECT nletter_email FROM sed_newsletter WHERE nletter_active='0'");
         while ($row = sed_sql_fetcharray($sql)) {
             $nletter_inactive .= $row['nletter_email'] . ", ";
         }
         $plugin_body .= "<p>" . substr($nletter_inactive, 0, -2) . "</p>";
     }
 }
 $plugin_body .= "<form name='newsletter' action='admin.php?m=tools&amp;p=newsletter&amp;a=send' method=post>";
 $plugin_body .= "<p>" . $L['plu_form_title'] . ":<br /><input type='text' name='nltitle' value='{$nltitle}' size='48' maxlength='64'></p>";
 $plugin_body .= "<p>" . $L['plu_form_message'] . ":<br /><textarea name='nlmessage' rows='12' cols='80'>{$nlmessage}</textarea></p>";
 $plugin_body .= "<p><input type='submit' value=' " . $L['plu_form_sendbutton'] . " '></p></form>";
 $plugin_body .= "<hr>";
 $plugin_body .= "<p><strong>" . $L['plu_addorremove'] . "</strong><br />";
 $plugin_body .= $L['plu_addorremove_hint'] . "</p>";
 $plugin_body .= $ar_error_string ? "<p><span style=\"color:red;\">" . $ar_error_string . "</span></p>" : "";
 $plugin_body .= "<form name='addorremove' action='admin.php?m=tools&amp;p=newsletter&amp;a=addorremove' method='post'>";
<?php

/* ====================
[BEGIN_SED_EXTPLUGIN]
Code=hidefuturepages
Part=page
File=hidefuturepages.page.edit.update.first
Hooks=page.edit.update.first
Tags=
Order=10
[END_SED_EXTPLUGIN]
==================== */
defined('SED_CODE') or die('Wrong URL');
$sql_pagestate = sed_sql_query("SELECT page_state FROM {$db_pages} WHERE page_id='{$id}'");
$result_currentpagestate = sed_sql_fetchassoc($sql_pagestate);
$currentpagestate = $result_currentpagestate['page_state'];
function hfp_tool_action_set_to_display($id)
{
    global $db_pages, $cfg, $sys, $usr, $db_structure;
    sed_check_xg();
    $id = (int) $id;
    $state = sed_import('state', 'G', 'INT', 1);
    if ($id > 0) {
        $sql = sed_sql_query("SELECT page_cat FROM {$db_pages} WHERE page_id='" . $id . "'");
        if ($result = sed_sql_fetchassoc($sql)) {
            $pageexpire = hfp_tool_get_yearstillexpire();
            sed_sql_query("UPDATE {$db_pages} SET page_begin='" . (int) $sys['now_offset'] . "', page_expire='" . $pageexpire . "', page_state='0' WHERE page_id='{$id}'");
            sed_sql_query("UPDATE {$db_structure} SET structure_pagecount=structure_pagecount+1 WHERE structure_code='" . sed_sql_prep($result['page_cat']) . "'");
        }
    }
    sed_redirect(sed_url('admin', 'm=tools&p=hidefuturepages&state=' . $state, NULL, TRUE));
}
Part=main
File=toplastseen
Hooks=standalone
Tags=
Order=10
[END_SED_EXTPLUGIN]

==================== */
if (!defined('SED_CODE') || !defined('SED_PLUG')) {
    die('Wrong URL.');
}
if (!$cfg['plugin']['toplastseen']['limit']) {
    $cfg['plugin']['toplastseen']['limit'] = "10";
}
$plugin_title = $L['plu_title'] . $cfg['plugin']['toplastseen']['limit'];
$sql = sed_sql_query("SELECT user_id, user_name, user_lastlog FROM {$db_users} WHERE user_id <> '" . $usr['id'] . "' AND user_lastlog <> '0' AND user_maingrp > '3' ORDER BY user_lastlog DESC LIMIT " . $cfg['plugin']['toplastseen']['limit'] . " ");
$plugin_body .= "<table><tr><td align='center' width='40'><em>" . $L['plu_rank'] . "</em></td><td><em>" . $L['plu_username'] . "</em></td>";
$plugin_body .= "<td><em>" . $L['plu_lastseen'] . "</em></td></tr>";
$ii = 1;
while ($row = sed_sql_fetcharray($sql)) {
    $user_id = $row["user_id"];
    $user_name = $row["user_name"];
    $user_lastlog = $row["user_lastlog"];
    $plugin_body .= "<tr><td align='center'>" . $ii . "</td>";
    $plugin_body .= "<td><a href='users.php?m=details&id=" . $user_id . "'>" . $user_name . "</a></td>";
    $time_between_lastlog = sed_build_timegap($user_lastlog, $sys['now_offset']);
    $plugin_body .= "<td>" . $time_between_lastlog;
    if ($cfg['plugin']['toplastseen']['showtimestamp'] == 'yes') {
        $plugin_body .= "  (" . date($cfg['dateformat'], $user_lastlog + $usr['timezone'] * 3600) . ")";
    }
    $plugin_body .= "</td>";