しばらくの間、サードパーティのスクリプトをいじっていましたが、PHP の残りの部分にランダムに配置された、異常な PHPBB フレームワーク コードがいくつかあることに気付きました。私が理解する必要があるのは、このコードに特に特別な点があるかどうか (通常の PHP ではできないことを実行できるかどうか) と、コードに特別な点がない場合、フレームワークなしでコードを PHP にスムーズに移行する方法です。 .
<?
include('bar.php');
include "../includes/config.inc.php";
include "loggedin.inc.php";
include "../includes/countries.inc.php";
$auction_id = isset($_REQUEST['aid']) ? $_REQUEST['aid'] : "";
?>
<?
define("DATAGRID_DIR", "../datagrid/");
define("PEAR_DIR", "../datagrid/pear/");
require_once(DATAGRID_DIR . 'datagrid.class.php');
require_once(PEAR_DIR . 'PEAR.php');
require_once(PEAR_DIR . 'DB.php');
$DB_USER = $DbUser;
$DB_PASS = $DbPassword;
$DB_HOST = $DbHost;
$DB_NAME = $DbDatabase;
ob_start();
$db_conn = DB::factory('mysql');
$result_conn = $db_conn->connect(DB::parseDSN('mysql://' . $DB_USER . ':' . $DB_PASS . '@' . $DB_HOST . '/' . $DB_NAME));
if (DB::isError($result_conn)) {
die($result_conn->getDebugInfo());
}
$sql = "SELECT u.id, u.nick, COUNT(b.bidder) AS bid_count, 'View offers' AS link
FROM BPLA_bids b
INNER JOIN BPLA_users u ON b.bidder=u.id
WHERE b.auction=$auction_id
GROUP BY b.bidder";
$unique_prefix = "au_";
$dgrid = new DataGrid($debug_mode, $messaging, $unique_prefix, DATAGRID_DIR);
$default_order_field = "nick";
$default_order_type = "ASC";
$dgrid->dataSource($db_conn, $sql, $default_order_field, $default_order_type);
$dg_language = "en";
$dgrid->setInterfaceLang($dg_language);
$direction = "ltr";
$dgrid->setDirection($direction);
$modes = array(
"add" => array(
"view" => false,
"edit" => false,
"type" => "link"
),
"edit" => array(
"view" => false,
"edit" => false,
"type" => "link",
"byFieldValue" => ""
),
"cancel" => array(
"view" => false,
"edit" => false,
"type" => "link"
),
"details" => array(
"view" => false,
"edit" => false,
"type" => "link"
),
"delete" => array(
"view" => false,
"edit" => false,
"type" => "image"
)
);
$dgrid->setModes($modes);
$http_get_vars = array(
"aid"
);
$dgrid->setHttpGetVars($http_get_vars);
$printing_option = false;
$dgrid->allowPrinting($printing_option);
$exporting_option = false;
$exporting_directory = "";
$dgrid->allowExporting($exporting_option, $exporting_directory);
$sorting_option = true;
$dgrid->allowSorting($sorting_option);
$paging_option = true;
$rows_numeration = false;
$numeration_sign = "N #";
$dgrid->allowPaging($paging_option, $rows_numeration, $numeration_sign);
$bottom_paging = array();
$top_paging = array();
$pages_array = array(
"10" => "10",
"25" => "25",
"50" => "50",
"100" => "100",
"250" => "250"
);
$default_page_size = 10;
$paging_arrows = array(
"first" => "|<<",
"previous" => "<<",
"next" => ">>",
"last" => ">>|"
);
$dgrid->setPagingSettings($bottom_paging, $top_paging, $pages_array, $default_page_size, $paging_arrows);
$dgrid->setViewModeTableProperties($vm_table_properties);
$vm_colimns = array(
"nick" => array(
"header" => "Nick",
"type" => "label",
"summarize" => "false",
"visible" => "true"
),
"bid_count" => array(
"header" => "Bid count",
"type" => "label",
"summarize" => "false",
"visible" => "true"
),
"link" => array(
"header" => " ",
"type" => "link",
"field_key" => "id",
"field_data" => "link",
"href" => "auction_users_bids.php?aid=$auction_id&uid={0}"
)
);
$dgrid->setColumnsInViewMode($vm_colimns);
$dgrid->bind();
ob_end_flush();
?>