<?php
function b_legacy_siteinfo_show($options) {
    global $xoopsConfig, $xoopsUser;
    $xoopsDB =& Database::getInstance();
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    if (!empty($options[3])) {
        $block['showgroups'] = true;
        $result = $xoopsDB->query("SELECT u.uid, u.uname, u.email, u.user_viewemail, u.user_avatar, g.name AS groupname FROM ".$xoopsDB->prefix("groups_users_link")." l LEFT JOIN ".$xoopsDB->prefix("users")." u ON l.uid=u.uid LEFT JOIN ".$xoopsDB->prefix("groups")." g ON l.groupid=g.groupid WHERE g.group_type='Admin' ORDER BY l.groupid, u.uid");
        if ($xoopsDB->getRowsNum($result) > 0) {
            $prev_caption = "";
            $i = 0;
            while  ($userinfo = $xoopsDB->fetchArray($result)) {
                if ($prev_caption != $userinfo['groupname']) {
                    $prev_caption = $userinfo['groupname'];
                    $block['groups'][$i]['name'] = $myts->htmlSpecialChars($userinfo['groupname']);
                }
                if ($xoopsUser != '') {
                    $block['groups'][$i]['users'][] = array('id' => $userinfo['uid'], 'name' => $myts->htmlspecialchars($userinfo['uname']), 'msglink' => "<a href=\"javascript:openWithSelfMain('".XOOPS_URL."/pmlite.php?send2=1&amp;to_userid=".$userinfo['uid']."','pmlite',450,370);\"><img src=\"".XOOPS_URL."/images/icons/pm_small.gif\" border=\"0\" width=\"27\" height=\"17\" alt=\"\" /></a>", 'avatar' => XOOPS_UPLOAD_URL.'/'.$userinfo['user_avatar']);
                } else {
                    if ($userinfo['user_viewemail']) {
                        $block['groups'][$i]['users'][] = array('id' => $userinfo['uid'], 'name' => $myts->htmlspecialchars($userinfo['uname']), 'msglink' => '<a href="mailto:'.$userinfo['email'].'"><img src="'.XOOPS_URL.'/images/icons/em_small.gif" border="0" width="16" height="14" alt="" /></a>', 'avatar' => XOOPS_UPLOAD_URL.'/'.$userinfo['user_avatar']);
                    } else {
                        $block['groups'][$i]['users'][] = array('id' => $userinfo['uid'], 'name' => $myts->htmlspecialchars($userinfo['uname']), 'msglink' => '&nbsp;', 'avatar' => XOOPS_UPLOAD_URL.'/'.$userinfo['user_avatar']);
                    }
                }
                $i++;
            }
        }
    } else {
        $block['showgroups'] = false;
    }
    $block['logourl'] = XOOPS_URL.'/images/'.$options[2];
    if (is_object($xoopsUser)) {
        $block['recoomendtime'] = time();
    } else {
        $block['recoomendtime'] = 0;
    }
    $block['popup_width'] = $options[0];
    $block['popup_height'] = $options[1];
    return $block;
}

function b_legacy_siteinfo_edit($options) {
    $form = _MB_BASE_PWWIDTH."&nbsp;";
    $form .= "<input type='text' name='options[]' value='".$options[0]."' />";
    $form .= "<br />"._MB_BASE_PWHEIGHT."&nbsp;";
    $form .= "<input type='text' name='options[]' value='".$options[1]."' />";
    $form .= "<br />".sprintf(_MB_BASE_LOGO,XOOPS_URL."/images/")."&nbsp;";
    $form .= "<input type='text' name='options[]' value='".$options[2]."' />";
    $chk = "";
    $form .= "<br />"._MB_BASE_SADMIN."&nbsp;";
    if ( $options[3] == 1 ) {
        $chk = " checked='checked'";
    }
    $form .= "<input type='radio' name='options[3]' value='1'".$chk." />&nbsp;"._YES."";
    $chk = "";
    if ( $options[3] == 0 ) {
        $chk = " checked=\"checked\"";
    }
    $form .= "&nbsp;<input type='radio' name='options[3]' value='0'".$chk." />"._NO."";
    return $form;
}
?>
