Example #1
0
     $res = SQL_Query_exec("SELECT id, username FROM users WHERE id != {$CURUSER['id']} AND enabled = 'yes' AND status = 'confirmed' {$where} ORDER BY username");
     if (mysql_num_rows($res)) {
         $to = "<select name=\"userid\">\n";
         while ($arr = mysql_fetch_assoc($res)) {
             $to .= "<option value=\"{$arr['id']}\">{$arr['username']}</option>\n";
         }
         $to .= "</select>\n";
     }
 }
 if (isset($_GET['id']) && !$to) {
     print T_("INVALID_USER_ID");
 } elseif (!isset($_GET['id']) && !$to) {
     print T_("NO_FRIENDS");
 } else {
     /******** compose frame ********/
     begin_form(rem_get('compose'), 'name="compose"');
     if ($subject) {
         $hidden .= "<input type=\"hidden\" name=\"oldsubject\" value=\"{$subject}\" />";
     }
     if ($hidden) {
         print $hidden;
     }
     echo "<table width='600px' border='0' align='center' cellpadding='0' cellspacing='0'>";
     if (!isset($_GET['templates'])) {
         tr2("To:", $to, 1);
         $res = SQL_Query_exec("SELECT * FROM `messages` WHERE `sender` = {$CURUSER['id']} AND `location` = 'template' ORDER BY `subject`");
         if (mysql_num_rows($res)) {
             $tmp = "<select name=\"usetemplate\" onchange=\"toggleTemplate(this);\">\n<option name=\"0\">---</option>\n";
             while ($arr = mysql_fetch_assoc($res)) {
                 $tmp .= "<option value=\"{$arr['id']}\">{$arr['subject']}</option>\n";
             }
function th($x, $field = 0, $style = '', $col = 1)
{
    if (is_string($field)) {
        if (isset($_GET['sort']) && $field != $_GET['sort']) {
            $x = "<a href=\"" . add_get('sort', $field) . "\">{$x}</a>";
        } elseif (!isset($_GET['reverse'])) {
            $x = "<a href=\"" . add_get('reverse') . "\">{$x}</a> &darr;";
        } else {
            $x = "<a href=\"" . rem_get('reverse') . "\">{$x}</a> &uarr;";
        }
    }
    $col = $col > 1 ? " colspan=\"{$col}\"" : '';
    if (!empty($noesc)) {
        $x = str_replace("\n", "<br />\n", htmlspecialchars($x));
    }
    if ($style) {
        return "<th style=\"{$style}\"{$col}>{$x}</th>";
    }
    return "<th>{$x}</th>";
}