Exemplo n.º 1
0
if (isset($_POST['submit'])) {
    if (isset($_POST['months'])) {
        $months = intval($_POST['months']);
    } elseif (isset($_POST['department'])) {
        $dest_dep = $_POST['department'][0];
        $old_dep = $_POST['old_dep'];
    }

    $count = 0;
    $line = strtok($_POST['user_names'], "\n");
    while ($line !== false) {
        // strip comments
        $line = preg_replace('/#.*/', '', trim($line));

        if (!empty($line)) {
            $u = usernameToUid($line); // fetch uid
            $line = q($line); // escape for messages below
            if (!$u) {
                $error_mgs[] = "$langErrorDelete: " . q($line);
            } else {
                if (isset($_POST['delete'])) {
                    // for uids with no admin rights
                    if (get_admin_rights($u) < 0) {
                        // delete user progress report
                        if (deleteUser($u, true)) {
                            $success_mgs[] = "$langWithUsername $line $langWasDeleted";
                            $count++;
                        } else {
                            $error_mgs[] = "$langErrorDelete: " . $line;
                        }
                    } else {
Exemplo n.º 2
0
require_once 'include/lib/user.class.php';
require_once 'include/lib/hierarchy.class.php';
require_once 'hierarchy_validations.php';
$tree = new Hierarchy();
$user = new User();
$toolName = $langMultiDelUser;
$navigation[] = array('url' => 'index.php', 'name' => $langAdmin);
load_js('tools.js');
if (isset($_POST['submit'])) {
    $line = strtok($_POST['user_names'], "\n");
    while ($line !== false) {
        // strip comments
        $line = preg_replace('/#.*/', '', trim($line));
        if (!empty($line)) {
            // fetch uid
            $u = usernameToUid($line);
            // for real uids not equal to admin
            if ($u !== false && $u > 1) {
                // full deletion
                $success = deleteUser($u, true);
                // progress report
                if ($success === true) {
                    Session::Messages("{$langUserWithId} {$line} {$langWasDeleted}", 'alert-success');
                    redirect_to_home_page('modules/admin/multideluser.php');
                } else {
                    Session::Messages("{$langErrorDelete}: {$line}", 'alert-danger');
                    redirect_to_home_page('modules/admin/multideluser.php');
                }
            }
        }
    }
Exemplo n.º 3
0
<?php

/*
Wiki Wide Web user stats and RSS generator
Author: Jacob I. Torrey
Date: 11/28/07
*/
include 'lib/misc.inc.php';
include 'lib/classes.class.php';
include 'lib/cache.lib.php';
define(NUMITEMS, 5);
if (!isset($_GET['username']) || ($user = usernameToUid($_GET['username'])) == -1) {
    die("User not found");
}
$u = new User();
$u->populateUser($user);
if (isset($_GET['rss'])) {
    header("Content-type: application/rss+xml");
    print '<?xml version="1.0"?><rss version="2.0"><channel>' . "\r\n";
    print "<title>" . ucfirst($u->username) . "'s Wiki Wide Web Feed</title>\r\n";
    print "<link>http://{$_SERVER['SERVER_NAME']}" . $_SERVER['PHP_SELF'] . "?username={$_GET['username']}</link>\r\n";
    print "<description>" . ucfirst($_GET['username']) . "'s Wiki Wide Web Feed</description>\r\n";
    print "<language>en-us</language>\r\n";
    $db = new DB();
    $db->query("SELECT diff.did, site.address, diff.comment, UNIX_TIMESTAMP(diff.time) FROM diff, site WHERE diff.uid = '{$u->uid}' AND site.sid = diff.sid ORDER BY diff.time DESC LIMIT " . NUMITEMS . ";");
    while ($row = $db->fetchRow()) {
        print "<item>\r\n";
        print "<title>Diff #{$row[0]} - {$row[2]}</title>\r\n";
        print "<link>{$row[1]}</link>\r\n";
        print "<description>" . ucfirst($_GET['username']) . " modified {$row[1]} on " . date(DATE_RFC822, $row[3]) . "</description>\r\n";
        print "<pubDate>" . date(DATE_RFC822, $row[3]) . "</pubDate>\r\n";