Exemple #1
0
function table_exists($table_name)
{
    if (isset($table_name)) {
        $table_name = adjust_prefix($table_name);
        $rs = safe_query("select * from {$table_name} WHERE 1=0");
    }
    if (isset($rs) && $rs) {
        return TRUE;
    } else {
        return FALSE;
    }
}
function admin_edit($table_name, $edit_id, $edit, $edit_exclude)
{
    global $message, $m, $lang;
    $an = NULL;
    $at = NULL;
    $al = NULL;
    $af = NULL;
    $az = NULL;
    if (isset($table_name)) {
        $table_name = adjust_prefix($table_name);
    }
    if (isset($edit) && isset($table_name)) {
        $sql = "select * from {$table_name} where {$edit_id}={$edit}";
        $r2 = safe_query($sql);
    }
    if ($r2) {
        if ($f = mysql_fetch_array($r2)) {
            for ($j = 0; $j < mysql_num_fields($r2); $j++) {
                $an .= mysql_field_name($r2, $j) . "|";
                $at .= mysql_field_type($r2, $j) . "|";
                $al .= "50|";
                /* Some field lengths seem unset or inconsistent. CSS classes would handle this better. */
                /* $al .= mysql_field_len($r2, $j) . "|"; */
                $af .= mysql_field_flags($r2, $j) . "|";
                $az .= $f[$j] . "|";
            }
            if ($m == 'static') {
                echo "\n\t\t\t\t<div class=\"admin_form form_static\">\n\n\t\t\t\t\t";
            } else {
                echo "\n\t\t\t\t<div class=\"admin_form\">\n\n\t\t\t\t\t";
            }
            if (isset($table_name)) {
                if (!isset($nam)) {
                    $nam = NULL;
                }
                $Blank = new ShowBlank($an, $at, $al, $af, $az, $nam, $edit_exclude, $table_name);
                $Blank->ShowBody();
            }
            echo "\n\t\t\t\t</div>";
        }
    } else {
        $message = $lang['form_build_fail'];
    }
}