Esempio n. 1
0
function get_content($page)
{
    if (!isset($page)) {
        $page = "";
    }
    switch ($page) {
        case 'add_user':
            add_user();
            break;
        case 'get_fed_balance':
            get_fed_balance();
            break;
        case 'change_fed_pin':
            change_fed_pin();
            break;
        case 'change_fed_password':
            change_fed_password();
            break;
        case 'transfer_to_bank':
            transfer_to_bank();
            break;
        case 'transfer_internal_funds':
            transfer_internal_funds();
            break;
        case 'view_account_funds':
            view_account_funds();
            break;
        case 'view_transactions':
            view_transactions();
            break;
        case 'pay_bill':
            pay_bill();
            break;
        case 'change_local_password':
            change_local_password();
            break;
        case 'change_page':
            change_page();
            break;
        default:
            echo "Please Select Choice.";
    }
}
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();
}