Пример #1
0
function send_profile($arg = '')
{
    global $C, $F, $H, $I, $P, $U, $db;
    print_start('profile');
    echo "<div style=\"text-align:center;\"><{$H['form']}>{$H['commonform']}" . hidden('action', 'profile') . hidden('do', 'save') . "<h2>{$I['profile']}</h2><i>{$arg}</i><table style=\"margin-left:auto;margin-right:auto;\">";
    thr();
    array_multisort(array_map('strtolower', array_keys($P)), SORT_ASC, SORT_STRING, $P);
    $ignored = array();
    $ignore = get_ignored();
    foreach ($ignore as $ign) {
        if ($ign['by'] === $U['nickname']) {
            $ignored[] = $ign['ignored'];
        }
    }
    if (count($ignored) > 0) {
        echo "<tr><td><table style=\"width:100%;text-align:left;\"><tr><th>{$I['unignore']}</th><td style=\"text-align:right;\">";
        echo "<select name=\"unignore\" size=\"1\"><option value=\"\">{$I['choose']}</option>";
        foreach ($ignored as $ign) {
            $style = '';
            foreach ($P as $user) {
                if ($ign === $user[0]) {
                    $style = " style=\"{$user['1']}\"";
                    break;
                }
            }
            echo "<option value=\"{$ign}\"{$style}>{$ign}</option>";
        }
        echo '</select></td></tr></table></td></tr>';
        thr();
    }
    if (count($P) - count($ignored) > 1) {
        echo "<tr><td><table style=\"width:100%;text-align:left;\"><tr><th>{$I['ignore']}</th><td style=\"text-align:right;\">";
        echo "<select name=\"ignore\" size=\"1\"><option value=\"\">{$I['choose']}</option>";
        $stmt = $db->query("SELECT poster FROM {$C['prefix']}messages GROUP BY poster;");
        while ($nick = $stmt->fetch(PDO::FETCH_NUM)) {
            $nicks[] = $nick[0];
        }
        foreach ($P as $user) {
            if ($U['nickname'] !== $user[0] && !in_array($user[0], $ignored) && in_array($user[0], $nicks)) {
                echo "<option value=\"{$user['0']}\" style=\"{$user['1']}\">{$user['0']}</option>";
            }
        }
        echo '</select></td></tr></table></td></tr>';
        thr();
    }
    echo "<tr><td><table style=\"width:100%;text-align:left;\"><tr><th>{$I['refreshrate']}</th><td style=\"text-align:right;\">";
    echo "<input type=\"number\" name=\"refresh\" size=\"3\" maxlength=\"3\" min=\"5\" max=\"150\" value=\"{$U['refresh']}\"></td></tr></table></td></tr>";
    thr();
    if (!isset($_COOKIE[$C['cookiename']])) {
        $param = "&session={$U['session']}&lang={$C['lang']}";
    } else {
        $param = '';
    }
    preg_match('/#([0-9a-f]{6})/i', $U['style'], $matches);
    echo "<tr><td><table style=\"width:100%;text-align:left;\"><tr><td><b>{$I['fontcolour']}</b> (<a href=\"{$_SERVER['SCRIPT_NAME']}?action=colours{$param}\" target=\"view\">{$I['viewexample']}</a>)</td><td style=\"text-align:right;\">";
    echo "<input type=\"text\" size=\"6\" maxlength=\"6\" pattern=\"[a-fA-F0-9]{6}\" value=\"{$matches['1']}\" name=\"colour\"></td></tr></table></td></tr>";
    thr();
    echo "<tr><td><table style=\"width:100%;text-align:left;\"><tr><td><b>{$I['bgcolour']}</b> (<a href=\"{$_SERVER['SCRIPT_NAME']}?action=colours{$param}\" target=\"view\">{$I['viewexample']}</a>)</td><td style=\"text-align:right;\">";
    echo "<input type=\"text\" size=\"6\" maxlength=\"6\" pattern=\"[a-fA-F0-9]{6}\" value=\"{$U['bgcolour']}\" name=\"bgcolour\"></td></tr></table></td></tr>";
    thr();
    if ($U['status'] >= 3) {
        echo "<tr><td><table style=\"width:100%;text-align:left;\"><tr><th>{$I['fontface']}</th><td><table style=\"border-spacing:0px;margin-left:auto;\">";
        echo "<tr><td>&nbsp;</td><td><select name=\"font\" size=\"1\"><option value=\"\">* {$I['roomdefault']} *</option>";
        foreach ($F as $name => $font) {
            echo "<option style=\"{$font}\" ";
            if (strpos($U['style'], $font) !== false) {
                echo 'selected ';
            }
            echo "value=\"{$name}\">{$name}</option>";
        }
        echo '</select></td><td>&nbsp;</td><td><input type="checkbox" name="bold" id="bold" value="on"';
        if (strpos($U['style'], 'font-weight:bold;') !== false) {
            echo ' checked';
        }
        echo "><label for=\"bold\"><b>{$I['bold']}</b></label></td><td>&nbsp;</td><td><input type=\"checkbox\" name=\"italic\" id=\"italic\" value=\"on\"";
        if (strpos($U['style'], 'font-style:italic;') !== false) {
            echo ' checked';
        }
        echo "><label for=\"italic\"><i>{$I['italic']}</i></label></td></tr></table></td></tr></table></td></tr>";
        thr();
    }
    echo '<tr><td>' . style_this("{$U['nickname']} : {$I['fontexample']}", $U['style']) . '</td></tr>';
    thr();
    echo "<tr><td><table style=\"width:100%;text-align:left;\"><tr><th>{$I['timestamps']}</th><td style=\"text-align:right;\">";
    echo '<input type="checkbox" name="timestamps" id="timestamps" value="on"';
    if ($U['timestamps']) {
        echo ' checked';
    }
    echo "><label for=\"timestamps\"><b>{$I['enabled']}</b></label></td></tr></table></td></tr>";
    thr();
    if (get_setting('imgembed')) {
        echo "<tr><td><table style=\"width:100%;text-align:left;\"><tr><th>{$I['embed']}</th><td style=\"text-align:right;\">";
        echo '<input type="checkbox" name="embed" id="embed" value="on"';
        if ($U['embed'] && isset($_COOKIE[$C['cookiename']])) {
            echo ' checked';
        }
        echo "><label for=\"embed\"><b>{$I['enabled']}</b></label></td></tr></table></td></tr>";
        thr();
    }
    if ($U['status'] >= 5 && get_setting('incognito')) {
        echo "<tr><td><table style=\"width:100%;text-align:left;\"><tr><th>{$I['incognito']}</th><td style=\"text-align:right;\">";
        echo '<input type="checkbox" name="incognito" id="incognito" value="on"';
        if ($U['incognito']) {
            echo ' checked';
        }
        echo "><label for=\"incognito\"><b>{$I['enabled']}</b></label></td></tr></table></td></tr>";
        thr();
    }
    echo "<tr><td><table style=\"width:100%;text-align:left;\"><tr><th>{$I['pbsize']}</th><td><table style=\"border-spacing:0px;margin-left:auto;\">";
    echo "<tr><td>&nbsp;</td><td>{$I['width']}</td><td><input type=\"number\" name=\"boxwidth\" size=\"3\" maxlength=\"3\" value=\"{$U['boxwidth']}\"></td>";
    echo "<td>&nbsp;</td><td>{$I['height']}</td><td><input type=\"number\" name=\"boxheight\" size=\"3\" maxlength=\"3\" value=\"{$U['boxheight']}\"></td>";
    echo '</tr></table></td></tr></table></td></tr>';
    thr();
    if ($U['status'] >= 5) {
        echo "<tr><td><table style\"width:100%;text-align:left;\"><tr><th>{$I['nbsize']}</th><td><table style=\"border-spacing:0px;margin-left:auto;\">";
        echo "<tr><td>&nbsp;</td><td>{$I['width']}</td><td><input type=\"number\" name=\"notesboxwidth\" size=\"3\" maxlength=\"3\" value=\"{$U['notesboxwidth']}\"></td>";
        echo "<td>&nbsp;</td><td>{$I['height']}</td><td><input type=\"number\" name=\"notesboxheight\" size=\"3\" maxlength=\"3\" value=\"{$U['notesboxheight']}\"></td>";
        echo '</tr></table></td></tr></table></td></tr>';
        thr();
    }
    if ($U['status'] >= 2) {
        echo "<tr><td><table style=\"width:100%;text-align:left;\"><tr><th>{$I['changepass']}</th></tr>";
        echo '<tr><td><table style="border-spacing:0px;margin-left:auto;">';
        echo "<tr><td>&nbsp;</td><td>{$I['oldpass']}</td><td><input type=\"password\" name=\"oldpass\" size=\"20\"></td></tr>";
        echo "<tr><td>&nbsp;</td><td>{$I['newpass']}</td><td><input type=\"password\" name=\"newpass\" size=\"20\"></td></tr>";
        echo "<tr><td>&nbsp;</td><td>{$I['confirmpass']}</td><td><input type=\"password\" name=\"confirmpass\" size=\"20\"></td></tr>";
        echo '</table></td></tr></table></td></tr>';
        thr();
        echo "<tr><td><table style=\"width:100%;text-align:left;\"><tr><th>{$I['changenickname']}</th></tr>";
        echo '<tr><td><table style="border-spacing:0px;margin-left:auto;">';
        echo "<tr><td>&nbsp;</td><td>{$I['newnickname']}</td><td><input type=\"text\" name=\"newnickname\" size=\"20\"></td></tr>";
        echo "<tr><td>&nbsp;</td><td>{$I['newpass']}</td><td><input type=\"password\" name=\"new_pass\" size=\"20\"></td></tr>";
        echo '</table></td></tr></table></td></tr>';
        thr();
    }
    echo '<tr><td>' . submit($I['savechanges']) . "</td></tr></table></form><br>{$H['backtochat']}</div>";
    print_end();
}
Пример #2
0
<?php

function thr($doit)
{
    try {
        var_dump("try");
        if ($doit) {
            throw new Exception('done');
        }
    } catch (Exception $e) {
        var_dump("catch");
    } finally {
        var_dump("finally");
    }
}
thr(true);
thr(false);