function ajax_table_info()
{
    global $wpdb;
    $table_name = $_POST['table_name'];
    $results = get_table_info($table_name);
    return_and_finish($results);
}
Beispiel #2
0
function update_tables_to_300()
{
    $dbupdater = new WfdownloadsDbupdater();
    if (!wfdownloads_TableExists('wfdownloads_meta')) {
        // Create table wfdownloads_meta
        $table = new WfdownloadsTable('wfdownloads_meta');
        $table->setStructure("CREATE TABLE %s (\n        \t\t\t\t\t\tmetakey varchar(50) NOT NULL default '',\n        \t\t\t\t\t\tmetavalue varchar(255) NOT NULL default '',\n        \t\t\t\t\t\tPRIMARY KEY (metakey))\n        \t\t\t\t\t\tENGINE=MyISAM;");
        $table->setData(sprintf("'version', %s", round($GLOBALS['xoopsModule']->getVar('version') / 100, 2)));
        if ($dbupdater->updateTable($table)) {
            echo "wfdownloads_meta table created<br />";
        }
    }
    $download_fields = array("lid" => array("Type" => "int(11) unsigned NOT NULL auto_increment", "Default" => false), "cid" => array("Type" => "int(5) unsigned NOT NULL default '0'", "Default" => true), "title" => array("Type" => "varchar(100) NOT NULL default ''", "Default" => true), "url" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "filename" => array("Type" => "varchar(150) NOT NULL default ''", "Default" => true), "filetype" => array("Type" => "varchar(100) NOT NULL default ''", "Default" => true), "homepage" => array("Type" => "varchar(100) NOT NULL default ''", "Default" => true), "version" => array("Type" => "varchar(20) NOT NULL default ''", "Default" => true), "size" => array("Type" => "int(8) NOT NULL default '0'", "Default" => true), "platform" => array("Type" => "varchar(50) NOT NULL default ''", "Default" => true), "screenshot" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "submitter" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true), "publisher" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "status" => array("Type" => "tinyint(2) NOT NULL default '0'", "Default" => true), "date" => array("Type" => "int(10) NOT NULL default '0'", "Default" => true), "hits" => array("Type" => "int(11) unsigned NOT NULL default '0'", "Default" => true), "rating" => array("Type" => "double(6,4) NOT NULL default '0.0000'", "Default" => true), "votes" => array("Type" => "int(11) unsigned NOT NULL default '0'", "Default" => true), "comments" => array("Type" => "int(11) unsigned NOT NULL default '0'", "Default" => true), "license" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "mirror" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "price" => array("Type" => "varchar(10) NOT NULL default 'Free'", "Default" => true), "paypalemail" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "features" => array("Type" => "text NOT NULL", "Default" => false), "requirements" => array("Type" => "text NOT NULL", "Default" => false), "homepagetitle" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "forumid" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true), "limitations" => array("Type" => "varchar(255) NOT NULL default '30 day trial'", "Default" => true), "dhistory" => array("Type" => "text NOT NULL", "Default" => false), "published" => array("Type" => "int(11) NOT NULL default '1089662528'", "Default" => true), "expired" => array("Type" => "int(10) NOT NULL default '0'", "Default" => true), "updated" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true), "offline" => array("Type" => "tinyint(1) NOT NULL default '0'", "Default" => true), "description" => array("Type" => "text NOT NULL", "Default" => false), "ipaddress" => array("Type" => "varchar(120) NOT NULL default '0'", "Default" => true), "notifypub" => array("Type" => "int(1) NOT NULL default '0'", "Default" => true), "summary" => array("Type" => "text NOT NULL", "Default" => false));
    $renamed_fields = array("logourl" => "screenshot");
    echo "<br /><B>Checking Download table</B><br />";
    $download_handler = xoops_getmodulehandler('download', 'wfdownloads');
    $download_table = new WfdownloadsTable("wfdownloads_downloads");
    $fields = get_table_info($download_handler->table, $download_fields);
    // Check for renamed fields
    rename_fields($download_table, $renamed_fields, $fields, $download_fields);
    update_table($download_fields, $fields, $download_table);
    if ($dbupdater->updateTable($download_table)) {
        echo "Downloads table updated<br />";
    }
    unset($fields);
    $mod_fields = array("requestid" => array("Type" => "int(11) NOT NULL auto_increment", "Default" => false), "lid" => array("Type" => "int(11) unsigned NOT NULL default '0'", "Default" => true), "cid" => array("Type" => "int(5) unsigned NOT NULL default '0'", "Default" => true), "title" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "url" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "filename" => array("Type" => "varchar(150) NOT NULL default ''", "Default" => true), "filetype" => array("Type" => "varchar(100) NOT NULL default ''", "Default" => true), "homepage" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "version" => array("Type" => "varchar(20) NOT NULL default ''", "Default" => true), "size" => array("Type" => "int(8) NOT NULL default '0'", "Default" => true), "platform" => array("Type" => "varchar(50) NOT NULL default ''", "Default" => true), "screenshot" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "submitter" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true), "publisher" => array("Type" => "text NOT NULL", "Default" => false), "status" => array("Type" => "tinyint(2) NOT NULL default '0'", "Default" => true), "date" => array("Type" => "int(10) NOT NULL default '0'", "Default" => true), "hits" => array("Type" => "int(11) unsigned NOT NULL default '0'", "Default" => true), "rating" => array("Type" => "double(6,4) NOT NULL default '0.0000'", "Default" => true), "votes" => array("Type" => "int(11) unsigned NOT NULL default '0'", "Default" => true), "comments" => array("Type" => "int(11) unsigned NOT NULL default '0'", "Default" => true), "license" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "mirror" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "price" => array("Type" => "varchar(10) NOT NULL default 'Free'", "Default" => true), "paypalemail" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "features" => array("Type" => "text NOT NULL", "Default" => false), "requirements" => array("Type" => "text NOT NULL", "Default" => false), "homepagetitle" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "forumid" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true), "limitations" => array("Type" => "varchar(255) NOT NULL default '30 day trial'", "Default" => true), "dhistory" => array("Type" => "text NOT NULL", "Default" => false), "published" => array("Type" => "int(10) NOT NULL default '0'", "Default" => true), "expired" => array("Type" => "int(10) NOT NULL default '0'", "Default" => true), "updated" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true), "offline" => array("Type" => "tinyint(1) NOT NULL default '0'", "Default" => true), "summary" => array("Type" => "text NOT NULL", "Default" => false), "description" => array("Type" => "text NOT NULL", "Default" => false), "modifysubmitter" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true), "requestdate" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true));
    $renamed_fields = array("logourl" => "screenshot");
    echo "<br /><B>Checking Modified Downloads table</B><br />";
    $mod_handler = xoops_getmodulehandler('modification', 'wfdownloads');
    $mod_table = new WfdownloadsTable("wfdownloads_mod");
    $fields = get_table_info($mod_handler->table, $mod_fields);
    rename_fields($mod_table, $renamed_fields, $fields, $mod_fields);
    update_table($mod_fields, $fields, $mod_table);
    if ($dbupdater->updateTable($mod_table)) {
        echo "Modified Downloads table updated <br />";
    }
    unset($fields);
    $cat_fields = array("cid" => array("Type" => "int(5) unsigned NOT NULL auto_increment", "Default" => false), "pid" => array("Type" => "int(5) unsigned NOT NULL default '0'", "Default" => true), "title" => array("Type" => "varchar(50) NOT NULL default ''", "Default" => true), "imgurl" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "description" => array("Type" => "text NOT NULL default ''", "Default" => true), "total" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true), "summary" => array("Type" => "text NOT NULL", "Default" => false), "spotlighttop" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true), "spotlighthis" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true), "dohtml" => array("Type" => "tinyint(1) NOT NULL default '1'", "Default" => true), "dosmiley" => array("Type" => "tinyint(1) NOT NULL default '1'", "Default" => true), "doxcode" => array("Type" => "tinyint(1) NOT NULL default '1'", "Default" => true), "doimage" => array("Type" => "tinyint(1) NOT NULL default '1'", "Default" => true), "dobr" => array("Type" => "tinyint(1) NOT NULL default '1'", "Default" => true), "weight" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true));
    echo "<br /><B>Checking Category table</B><br />";
    $cat_handler = xoops_getmodulehandler('category', 'wfdownloads');
    $cat_table = new WfdownloadsTable("wfdownloads_cat");
    $fields = get_table_info($cat_handler->table, $cat_fields);
    update_table($cat_fields, $fields, $cat_table);
    if ($dbupdater->updateTable($cat_table)) {
        echo "Category table updated<br />";
    }
    unset($fields);
    $broken_fields = array("reportid" => array("Type" => "int(5) NOT NULL auto_increment", "Default" => false), "lid" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true), "sender" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true), "ip" => array("Type" => "varchar(20) NOT NULL default ''", "Default" => true), "date" => array("Type" => "varchar(11) NOT NULL default '0'", "Default" => true), "confirmed" => array("Type" => "enum('0','1') NOT NULL default '0'", "Default" => true), "acknowledged" => array("Type" => "enum('0','1') NOT NULL default '0'", "Default" => true));
    echo "<br /><B>Checking Broken Report table</B><br />";
    $broken_handler = xoops_getmodulehandler('report', 'wfdownloads');
    $broken_table = new WfdownloadsTable("wfdownloads_broken");
    $fields = get_table_info($broken_handler->table, $broken_fields);
    update_table($broken_fields, $fields, $broken_table);
    if ($dbupdater->updateTable($broken_table)) {
        echo "Broken Reports table updated<br />";
    }
    unset($fields);
}
				<?php 
        } while ($row_tables_edit = mysql_fetch_assoc($tables_edit));
        ?>
		</select>
		</div>
	</div><!-- ./Form Group -->
</form>
</div>
<?php 
    } else {
        echo "<p>No tables have been defined. <a href='" . $base_url . "index.php?section=admin&amp;go=judging_tables&amp;action=add'>Tables must be defined</a> before flights can be assigned to them.</p>";
    }
}
if ($filter != "default" && $filter != "rounds") {
    // get variables
    $entry_count = get_table_info(1, "count_total", $row_tables_edit['id'], $dbTable, "default");
    $flight_count = ceil($entry_count / $_SESSION['jPrefsFlightEntries']);
    ?>

<script type="text/javascript">
function updateButCount(e) {

	// Get event from W3C or IE event model
	var e = e || window.event; 

	// Test that appropriate features are supported
	if (!document.getElementsByTagName || !document.getElementById) return;

	// Initialise variable for keeping count
	var butCount = {
		<?php 
// end if ($action == "edit")
?>


<?php 
if ($action == "default" && $filter == "orphans") {
    ?>
<h3>Style Categories with Entries Not Assigned to Tables</h3>
<?php 
    if ($totalRows_tables > 0) {
        do {
            if (get_table_info($row_styles['brewStyleNum'] . "^" . $row_styles['brewStyleGroup'], "count", "", $dbTable, "default")) {
                $a[] = 0;
                if (!get_table_info($row_styles['id'], "styles", $id, $dbTable, "default")) {
                    $a[] = $row_styles['id'];
                    echo "<ul><li>" . $row_styles['brewStyleGroup'] . $row_styles['brewStyleNum'] . " " . style_convert($row_styles['brewStyleGroup'], "1") . ": " . $row_styles['brewStyle'] . " (" . get_table_info($row_styles['brewStyleNum'] . "^" . $row_styles['brewStyleGroup'], "count", "default", $dbTable, "default") . " entries)</li></ul>";
                }
            }
        } while ($row_styles = mysql_fetch_assoc($styles));
        $b = array_sum($a);
        if ($b == 0) {
            echo "<p>All style categories with entries have been assigned to tables.</p>";
        }
    } else {
        echo "<p>No tables have been defined.";
        if ($go == "judging_tables") {
            echo " <a href='index.php?section=admin&amp;go=judging_tables&amp;action=add'>Add a table?</a></p>";
        }
    }
    // end else
}
        <th class="dataHeading bdr1B" width="5%">Round #</th>
        <?php 
            if ($_SESSION['jPrefsQueued'] == "N") {
                ?>
        <th class="dataHeading bdr1B" width="5%">Flight #</th>
        <?php 
            }
            ?>
    </tr>
    </thead>
    <tbody>
    <?php 
            do {
                $judge_info = explode("^", brewer_info($row_assignments['bid']));
                $table_info = explode("^", get_table_info("none", "basic", $row_assignments['assignTable'], $dbTable, "default"));
                $location_info = explode("^", get_table_info($row_assignments['assignLocation'], "location", "1", $dbTable, "default"));
                $judge_ranks = str_replace(",", ", ", $judge_info['3']);
                ?>
    <tr>
    	<td class="bdr1B_gray"><?php 
                echo ucfirst(strtolower($judge_info['1'])) . ", " . ucfirst(strtolower($judge_info['0']));
                ?>
</td>
        <td class="data bdr1B_gray"><?php 
                echo $judge_ranks;
                ?>
</td>
        <td class="data bdr1B_gray"><?php 
                echo table_location($row_assignments['assignTable'], $_SESSION['prefsDateFormat'], $_SESSION['prefsTimeZone'], $_SESSION['prefsTimeFormat'], "default");
                ?>
</td>
function table_assignments($uid, $method, $time_zone, $date_format, $time_format, $method2 = 0)
{
    // Gather and output the judging or stewarding assignments for a user
    require CONFIG . 'config.php';
    mysql_select_db($database, $brewing);
    $output = "";
    $output_extend = "";
    $query_table_assignments = sprintf("SELECT assignTable FROM %s WHERE bid='%s' AND assignment='%s'", $prefix . "judging_assignments", $uid, $method);
    $table_assignments = mysql_query($query_table_assignments, $brewing) or die(mysql_error());
    $row_table_assignments = mysql_fetch_assoc($table_assignments);
    $totalRows_table_assignments = mysql_num_rows($table_assignments);
    if ($totalRows_table_assignments > 0) {
        do {
            $table_info = explode("^", get_table_info(1, "basic", $row_table_assignments['assignTable'], "default", "default"));
            $location = explode("^", get_table_info($table_info[2], "location", $row_table_assignments['assignTable'], "default", "default"));
            //$output .= "\t<table class='dataTableCompact' style='margin-left: -5px'>\n";
            if ($method2 == 0) {
                $output .= "\t\t<tr>\n";
                $output .= "\t\t\t<td class='dataList'>" . $location[2] . "</td>\n";
                $output .= "\t\t\t<td class='dataList'>" . getTimeZoneDateTime($time_zone, $location[0], $date_format, $time_format, "long", "date-time") . "</td>\n";
                $output .= "\t\t\t<td class='dataList'>Table #" . $table_info[0] . " - " . $table_info[1] . "</td>\n";
                $output .= "\t\t</tr>\n";
            } elseif ($method2 == "1") {
                if ($method == "J") {
                    $output .= "<a href='" . $base_url . "index.php?section=admin&amp;action=assign&amp;go=judging_tables&amp;filter=judges&id=" . $table_info[3] . "' title='Assign/Unassign Judges to " . $table_info[0] . " - " . $table_info[1] . "'>" . $table_info[0] . "</a>,&nbsp;";
                }
                if ($method == "S") {
                    $output .= "<a href='" . $base_url . "index.php?section=admin&amp;action=assign&amp;go=judging_tables&amp;filter=stewards&id=" . $table_info[3] . "' title='Assign/Unassign Stewards to " . $table_info[0] . " - " . $table_info[1] . "'>" . $table_info[0] . "</a>,&nbsp;";
                }
            } else {
                $output .= "\t\t\t<td class='dataList bdr1B'>" . $location[2] . "</td>\n";
                $output .= "\t\t\t<td class='dataList bdr1B'>" . getTimeZoneDateTime($time_zone, $location[0], $date_format, $time_format, "long", "date-time") . "</td>\n";
                $output .= "\t\t\t<td class='dataList bdr1B'>Table #" . $table_info[0] . " - " . $table_info[1] . "</td>\n";
                $output .= "\t\t</tr>\n";
            }
            //$output .= "\t</table>\n";
        } while ($row_table_assignments = mysql_fetch_assoc($table_assignments));
    }
    if ($totalRows_table_assignments == 0 && $method2 == "1") {
        $output_extend = "No assignment(s)";
    }
    return $output . $output_extend;
}
<?php

$query_scores = sprintf("SELECT scoreEntry,scorePlace,scoreType FROM {$judging_scores_db_table} WHERE eid='%s'", $row_sql['id']);
$scores = mysql_query($query_scores, $brewing) or die(mysql_error());
$row_scores = mysql_fetch_assoc($scores);
$query_flight = sprintf("SELECT * FROM {$judging_flights_db_table} WHERE flightEntryID='%s'", $row_sql['id']);
$flight = mysql_query($query_flight, $brewing) or die(mysql_error());
$row_flight = mysql_fetch_assoc($flight);
$query_bos = sprintf("SELECT scorePlace FROM {$judging_scores_bos_db_table} WHERE eid='%s'", $row_sql['id']);
$bos = mysql_query($query_bos, $brewing) or die(mysql_error());
$row_bos = mysql_fetch_assoc($bos);
$totalRows_bos = mysql_num_rows($bos);
if ($totalRows_bos > 0) {
    $bos_place = $row_bos['scorePlace'];
} else {
    $bos_place = "";
}
$style_type = style_type($row_scores['scoreType'], 2, "bcoe");
$location = explode("^", get_table_info(1, "location", $row_flight['flightTable'], "default", "default"));
$table_info = explode("^", get_table_info(1, "basic", $row_flight['flightTable'], "default", "default"));
$table_name = sprintf("%02s", $table_info[0]) . ": " . $table_info[1];
                ?>
></td>
                        <td><?php 
                echo $row_styles['brewStyleGroup'] . $row_styles['brewStyleNum'];
                ?>
</td>
                        <td><?php 
                echo style_convert($row_styles['brewStyleGroup'], "1");
                ?>
</td>
                        <td><?php 
                echo $row_styles['brewStyle'] . get_table_info($row_styles['id'], "assigned", "default", $dbTable, "default");
                ?>
</td>
                        <td style="text-align:right;"><?php 
                echo get_table_info($row_styles['brewStyleNum'] . "^" . $row_styles['brewStyleGroup'], "count", "default", $dbTable, "default");
                ?>
</td>
                    </tr>
                    <?php 
            }
            ?>
                    <?php 
        } while ($row_styles = mysql_fetch_assoc($styles));
        ?>
				</tbody>
			</table>
		<?php 
    } else {
        echo "There are no available sub-styles.";
    }
Beispiel #9
0
function get_infoByid($cateid, $id)
{
    $resulttable = get_table_info($cateid);
    //默认 判断字段中是否存在 status 有的话  默认显示true
    $model = M($resulttable['name']);
    $is_status = $model->field('status')->find();
    $firfield = explode(',', $resulttable['fields']);
    //读取字段中  首个字段
    $where = empty($is_status) ? array($firfield[0] => $id) : array('status' => 1, $firfield[0] => $id);
    $lists = $model->field($resulttable['fields'])->where($where)->find();
    return array_values($lists);
}
function table_assignments($uid, $method, $time_zone, $date_format, $time_format, $method2 = 0)
{
    // Gather and output the judging or stewarding assignments for a user
    require CONFIG . 'config.php';
    mysql_select_db($database, $brewing);
    $output = "";
    $query_table_assignments = sprintf("SELECT assignTable FROM %s WHERE bid='%s' AND assignment='%s'", $prefix . "judging_assignments", $uid, $method);
    $table_assignments = mysql_query($query_table_assignments, $brewing) or die(mysql_error());
    $row_table_assignments = mysql_fetch_assoc($table_assignments);
    $totalRows_table_assignments = mysql_num_rows($table_assignments);
    if ($totalRows_table_assignments > 0) {
        do {
            $table_info = explode("^", get_table_info(1, "basic", $row_table_assignments['assignTable'], "default", "default"));
            $location = explode("^", get_table_info($table_info[2], "location", $row_table_assignments['assignTable'], "default", "default"));
            //$output .= "\t<table class='dataTableCompact' style='margin-left: -5px'>\n";
            $output .= "\t\t<tr>\n";
            if ($method2 == 0) {
                $output .= "\t\t\t<td class='dataList'>" . $location[2] . "</td>\n";
                $output .= "\t\t\t<td class='dataList'>" . getTimeZoneDateTime($time_zone, $location[0], $date_format, $time_format, "long", "date-time") . "</td>\n";
                $output .= "\t\t\t<td class='dataList'>Table #" . $table_info[0] . " - " . $table_info[1] . "</td>\n";
            } else {
                $output .= "\t\t\t<td class='dataList bdr1B'>" . $location[2] . "</td>\n";
                $output .= "\t\t\t<td class='dataList bdr1B'>" . getTimeZoneDateTime($time_zone, $location[0], $date_format, $time_format, "long", "date-time") . "</td>\n";
                $output .= "\t\t\t<td class='dataList bdr1B'>Table #" . $table_info[0] . " - " . $table_info[1] . "</td>\n";
            }
            $output .= "\t\t</tr>\n";
            //$output .= "\t</table>\n";
        } while ($row_table_assignments = mysql_fetch_assoc($table_assignments));
    }
    return $output;
}