php类
程序员文章站
2023-11-28 21:07:52
<?php
/*----------------------------------------------------------------//
* class:: ini
* function:: to install the system which is requested from client
* author:: kevin#
* qq:: 84529890
* date:: 2006.10.24
//----------------------------------------------------------------*/
require_once( class_sys_path . "class.db.php");
class ini {
/*
* member variable $defaultplay
* to set the variable play
*/
var $defaultplay = "main";
/*
* member variable $db
* to set the object : database
*/
var $db;
/*
* member variable $play
* record the parameter of play
*/
var $play;
//////@@@@ member function list @@@@\\\\\\\
//-======================================-\\
// lastmodifytime::2006.11.16
//-======================================-\\
////////////////////////////////////////////
/*
* function :: setdb($db)
* set the global database object
*/
function setdb($db){
return $this->db = $db;
}
/*
* function::loadsystem($play)
* load system
*/
function loadsystem($play){
if( $this->isvalidplay($play) ){
require_once("class.smarttemplate.php");
require_once( $play );
$playlikeabird = new main;
}else{
$this->halt("invalid access....");
}
}
/*
* function:: inicon()
* install database
*/
function inicon(){
global $db;
$db = new db( host_addr , host_user , host_psw , db_name );
}
/*
* function::getdb()
* to get the current database object
*/
function getdb(){
return $this->db;
}
/*
* function::getplay()
* get the play which is post from client
*/
function getplay(){
return $play = empty( $_request["play"] ) ? $this->defaultplay : $_request["play"];
}
/*
* function:: isvalidplay($play)
* to check legitimacy if the play parameter is
*/
function isvalidplay($play){
if( file_exists( $play ) ){
return true;
}else{
return false;
}
}
/*
* function:: halt($msg)
* show message on the browser
*/
function halt($msg){
echo "<font color=\"#ff0000\">" . $msg . "</font>\n<br />";
}
/*
* function :: inisystem()
* install system
*/
function inisystem(){
$this->inicon();
$this->setdb($db);
$play = $this->getplay();
return $play = $this->resetplay($play);
}
/*
* function :: resetplay($p)
* to re-define the play's parameter
*/
function resetplay($p){
return $p = class_path . entry_first_format . $p . entry_last_format;
}
/*
* function:: ini()
* to link the database and get the play which post from client
*/
function ini(){
$play = $this->inisystem();
$this->debug($play);
$this->loadsystem($play);
$this->close();
}
/*
* function:: debug($play)
* to show the debug information
*/
function debug($play){
if( debug ) $this->halt("play -> $play");
}
/*
* function::close()
* unset database
*/
function close(){
return $this->db = null;
}
///////@@@@@@@@@@@@@@@@@@@@@@@@@ define class over @@@@@@@@@@@@@@@@@@@@@@@@@\\\\\\\\
}
?>
/*----------------------------------------------------------------//
* class:: ini
* function:: to install the system which is requested from client
* author:: kevin#
* qq:: 84529890
* date:: 2006.10.24
//----------------------------------------------------------------*/
require_once( class_sys_path . "class.db.php");
class ini {
/*
* member variable $defaultplay
* to set the variable play
*/
var $defaultplay = "main";
/*
* member variable $db
* to set the object : database
*/
var $db;
/*
* member variable $play
* record the parameter of play
*/
var $play;
//////@@@@ member function list @@@@\\\\\\\
//-======================================-\\
// lastmodifytime::2006.11.16
//-======================================-\\
////////////////////////////////////////////
/*
* function :: setdb($db)
* set the global database object
*/
function setdb($db){
return $this->db = $db;
}
/*
* function::loadsystem($play)
* load system
*/
function loadsystem($play){
if( $this->isvalidplay($play) ){
require_once("class.smarttemplate.php");
require_once( $play );
$playlikeabird = new main;
}else{
$this->halt("invalid access....");
}
}
/*
* function:: inicon()
* install database
*/
function inicon(){
global $db;
$db = new db( host_addr , host_user , host_psw , db_name );
}
/*
* function::getdb()
* to get the current database object
*/
function getdb(){
return $this->db;
}
/*
* function::getplay()
* get the play which is post from client
*/
function getplay(){
return $play = empty( $_request["play"] ) ? $this->defaultplay : $_request["play"];
}
/*
* function:: isvalidplay($play)
* to check legitimacy if the play parameter is
*/
function isvalidplay($play){
if( file_exists( $play ) ){
return true;
}else{
return false;
}
}
/*
* function:: halt($msg)
* show message on the browser
*/
function halt($msg){
echo "<font color=\"#ff0000\">" . $msg . "</font>\n<br />";
}
/*
* function :: inisystem()
* install system
*/
function inisystem(){
$this->inicon();
$this->setdb($db);
$play = $this->getplay();
return $play = $this->resetplay($play);
}
/*
* function :: resetplay($p)
* to re-define the play's parameter
*/
function resetplay($p){
return $p = class_path . entry_first_format . $p . entry_last_format;
}
/*
* function:: ini()
* to link the database and get the play which post from client
*/
function ini(){
$play = $this->inisystem();
$this->debug($play);
$this->loadsystem($play);
$this->close();
}
/*
* function:: debug($play)
* to show the debug information
*/
function debug($play){
if( debug ) $this->halt("play -> $play");
}
/*
* function::close()
* unset database
*/
function close(){
return $this->db = null;
}
///////@@@@@@@@@@@@@@@@@@@@@@@@@ define class over @@@@@@@@@@@@@@@@@@@@@@@@@\\\\\\\\
}
?>