// Display error messages and controls for entering.
            foreach ($errors as $value) {
                echo "<span style=\"color:#ff6666;font-weight:bold\">Error: {$value}</span><br />";
            }
            display_controls();
        } else {
            // Perform database actions
            edit_or_add_field();
        }
    }
} else {
    echo "<p class=text><a href=\"profile_fields.php?action=add\">Add new field</a></p>\n";
    // Get a list of all fields.
    $query_str = "SELECT * FROM `ProfilesDesc` ORDER BY `order` ASC";
    $res = db_res($query_str);
    display_fields($res);
}
ContentBlockFoot();
BottomCode();
/**
 * Display profile fields in a table.
 * @param $res		Recordset of profile fields.
 */
function display_fields($res)
{
    global $modified;
    global $mandatory;
    echo "<table width=\"100%\" border=\"1\" class=\"profile_fields\">\n";
    echo '
		<tr style="font-weight:bold">
			<td>name</td>
示例#2
0
}
echo "<accounts count=\"" . count($accounts) . "\">\n";
$acct_num = 0;
foreach ($accounts as $acct) {
    echo "<account id=\"" . $acct->id . "\" name=\"" . $acct->name . "\" currContactCount=\"" . $acct->currContactCount . "\" " . "maxContactCount=\"" . $acct->maxContactCount . "\" monthEmailCount=\"" . $acct->monthEmailCount . "\" " . "currHostingSize=\"" . $acct->currHostingSize . "\" maxHostingSize=\"" . $acct->maxHostingSize . "\">\n";
    // Now login to the subaccount using the agency account, but specifying the subaccount ID in the login.
    $login_result = bronto_agency_login($acct->id);
    if (!$login_result) {
        echo "<error text=\"INVALID ACCOUNT\"/>\n";
    } else {
        $binding = $login_result['binding'];
        if ($disp_lists) {
            display_lists($binding);
        }
        if ($disp_fields) {
            display_fields($binding);
        }
        if ($disp_contacts) {
            display_contacts($binding, $disp_contact_fields);
        }
        if ($disp_messages) {
            display_messages($binding);
        }
        if ($disp_deliveries) {
            display_deliveries($binding);
        }
    }
    echo "</account>\n";
    $acct_num++;
    if ($max_accounts > 0 && $acct_num >= $max_accounts) {
        break;
function main_code()
{
    global $site;
    global $modified;
    switch ($_REQUEST['action']) {
        // menu to move field to another join page
        case 'edit':
            // get element name, etc
            $id = (int) $_GET['id'];
            // get properties of field by it's id
            $query = "SELECT `name`, `namedisp`, `join_page`, FLOOR(`join_page` / 1000) as `jp`, `check` FROM `ProfilesDesc` WHERE `ID` = '{$id}'";
            $field_arr = db_arr($query);
            if (!$field_arr) {
                return "";
            }
            // calculate number of join pages
            $query = "SELECT FLOOR(`join_page` / 1000) as `jp` FROM `ProfilesDesc` WHERE `visible` & 2 AND (FIND_IN_SET('0',`show_on_page`) OR FIND_IN_SET('3',`show_on_page`)) AND `join_page` >= 1000 GROUP BY `jp`";
            $respd = db_res($query);
            $pages_num = mysql_num_rows($respd);
            $pages_num++;
            $content = "\n\t\t\t\t<form name=\"j_editform\" id=\"j_editform\" action=\"{$_SERVER['PHP_SELF']}\" method=\"POST\">\n\t\t\t\t\t<table width=\"100%\">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td valign=\"top\">\n\t\t\t\t\t\t\t\tField name - " . $field_arr['name'] . "<br />\n\t\t\t\t\t\t\t\tField caption - " . _t($field_arr['namedisp']) . "<br />\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td valign=\"top\">\n\t\t\t\t\t\t\t\tselect part of join page:&nbsp;\n\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"change_page\">\n\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"id\" value=\"{$id}\">\n\t\t\t\t\t\t\t\t<select name=\"new_jp\" id=\"j_page\" onchange=\"javascript: document.forms['j_editform'].submit();\">\n\t\t\t\t\t\t\t\t\t<option value=\"0\">invisible</option>";
            for ($i = 1; $i <= $pages_num; $i++) {
                $selected = $i == $field_arr['jp'] ? 'selected' : '';
                $content .= "\n\t\t\t\t\t\t\t\t\t<option value=\"{$i}\" {$selected}>join page, part {$i}</option>";
            }
            $content .= "\n\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td valign=\"top\">\n\t\t\t\t\t\t\t\t<a href=\"{$_SERVER['PHP_SELF']}\">Back</a>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</form>";
            return $content;
            // reset join form
        // reset join form
        case 'reset':
            $query = "UPDATE `ProfilesDesc` SET `join_page` = `order` + 1000";
            $respd = db_res($query);
            break;
            // move field to another join page
        // move field to another join page
        case 'change_page':
            $res = db_res("SELECT `ID`, `name`, `namedisp`, `join_page`, `type`, `group_mark`, FLOOR(`join_page` / 1000) as `jp` FROM `ProfilesDesc` WHERE `visible` & 2 AND (FIND_IN_SET('0',`show_on_page`) OR FIND_IN_SET('3',`show_on_page`)) ORDER BY `join_page` ASC");
            // Process deleting
            change_page($_POST['id'], $_POST['new_jp'], $res);
            echo "<p><span style=\"color:#ff6666;font-weight:bold\">Join page changed.</span></p>\n";
            $modified = (int) $_POST['id'];
            break;
        case 'up':
            $res = db_res("SELECT `ID`, `name`, `namedisp`, `join_page`, `type`, `group_mark`, FLOOR(`join_page` / 1000) as `jp` FROM `ProfilesDesc` WHERE `visible` & 2 AND (FIND_IN_SET('0',`show_on_page`) OR FIND_IN_SET('3',`show_on_page`)) ORDER BY `join_page` ASC");
            if (!move_up($_GET['id'], $res)) {
                echo "<p><span style=\"color:#ff6666;font-weight:bold\">Can't move up field.</span></p>\n";
            } else {
                $modified = (int) $_GET['id'];
            }
            break;
        case 'down':
            $res = db_res("SELECT `ID`, `name`, `namedisp`, `join_page`, `type`, `group_mark`, FLOOR(`join_page` / 1000) as `jp` FROM `ProfilesDesc` WHERE `visible` & 2 AND (FIND_IN_SET('0',`show_on_page`) OR FIND_IN_SET('3',`show_on_page`)) ORDER BY `join_page` ASC");
            if (!move_down($_GET['id'], $res)) {
                echo "<p><span style=\"color:#ff6666;font-weight:bold\">Can't move down field.</span></p>\n";
            } else {
                $modified = (int) $_GET['id'];
            }
            break;
    }
    $reset_link = "<a href=\"{$_SERVER['PHP_SELF']}?action=reset\">reset join form to default</a><br>&nbsp;<br>";
    return $reset_link . display_fields();
}