0) ? $father_id : 0; //$qry = $this->getClass($id); if ($id > 0)//isset($qry)) { $sql = "update $bas_cl set BAS_NAME = '$name' , FATHER_ID = '$father_id' , REMARK = '$remark' , BAS_NO = '$no' where BAS_ID = '$id'"; } else { $sql = "insert into $bas_cl (BAS_NAME, FATHER_ID, REMARK) values ('$name', '$father_id', '$remark')"; }DebugMsg($sql); $db->Query($sql); } function getClassAll() { global $db; $result = $this->getClList(0); $num = $db->NumRows($result); DebugMsg($num); for ($i=0;$i<$num;$i++) { $allrow[$i] = $db->FetchRow($result); $tmpName = StrSplitToLan($allrow[$i]['BAS_NAME']); $allrow[$i]['ARY_NAME'] = $tmpName; $tmpRemark = StrSplitToLan($allrow[$i]['REMARK']); $allrow[$i]['ARY_REMARK'] = $tmpRemark; $tmpFatherName = StrSplitToLan($allrow[$i]['FATHER_NAME']); $allrow[$i]['ARY_FATHER_NAME'] = $tmpFatherName; $ItemQry = $this->getClList($allrow[$i]['BAS_ID']); $ItemNum = $db->NumRows($ItemQry); DebugMsg($ItemNum); for ($j=0; $j<$ItemNum; $j++) { $ItemRow = $db->FetchRow($ItemQry); $allrow[$i]['Children'][$j] = $ItemRow; $tmpName = StrSplitToLan($allrow[$i]['Children'][$j]['BAS_NAME']); $allrow[$i]['Children'][$j]['ARY_NAME'] = $tmpName; $tmpRemark = StrSplitToLan($allrow[$i]['Children'][$j]['REMARK']); $allrow[$i]['Children'][$j]['ARY_REMARK'] = $tmpRemark; $tmpFatherName = StrSplitToLan($allrow[$i]['Children'][$j]['FATHER_NAME']); $allrow[$i]['Children'][$j]['ARY_FATHER_NAME'] = $tmpFatherName; } $db->FreeResult($ItemQry); } $db->FreeResult($result); return $allrow; } function getClList($father_id) { global $bas_cl, $db; $tbl = $bas_cl; $sql = "select a.*, b.BAS_NAME AS FATHER_NAME from $tbl a left join $tbl b on a.FATHER_ID = b.BAS_ID "; if ($father_id>0) $sql .= " where a.father_id = " . $father_id; if ($father_id==0) $sql .= " where a.father_id is null or a.father_id = 0"; $sql .= " order by a.bas_id desc "; //DebugMsg($sql); SetCharset(); $qry = $db->Query($sql); return $qry; } function getClass($id) { global $bas_cl, $db; $tbl = $bas_cl; $sql = "select a.*, b.BAS_NAME AS FATHER_NAME from $tbl a left join $tbl b on a.FATHER_ID = b.BAS_ID "; if ($id>0) $sql .= " where a.bas_id = " . $id; else return false; //DebugMsg($sql); SetCharset(); $qry = $db->Query($sql); return $qry; } function getPrdList($aParam) { global $bas_cl, $bas_prd, $db; $tbl = $bas_prd; $cl_id = $aParam['CL_ID']; $i_start = $aParam['I_START']; $page_size = $aParam['PAGE_SIZE']; $s_keyType = $aParam['S_KEYTYPE']; $s_key = $aParam['S_KEY']; $sql = "select a.* from $tbl a , $bas_cl b where a.CL_ID = b.BAS_ID "; if ($cl_id>0) $sql .= " and (b.BAS_ID = $cl_id or b.FATHER_ID = $cl_id) "; if ($s_key!="") $sql .= " and a." . (strlen($s_keyType) > 0 ? $s_keyType : "BAS_NAME") . " like '%" . $s_key . "%'"; $sql .= " order by a.bas_id desc "; if ($i_start>=0 && $page_size>0) $sql .= " limit $i_start, $page_size "; //DebugMsg($sql); SetCharset(); $qry = $db->Query($sql); return $qry; } function getPrdDetail($aParam) { global $bas_prd, $db; $tbl = $bas_prd; $bas_id = $aParam['BAS_ID']; $sql = "select a.* from $tbl a where a.BAS_ID = " . $bas_id; //DebugMsg($sql); SetCharset(); $qry = $db->Query($sql); return $qry; } } class CNews { var $_Type; var $_Title; var $_Tbl; var $_Ver; function CNews($aParam) { //DebugMsg($aParam); $this->_Type = empty($aParam['sType']) ? '' : $aParam['sType']; $this->_Title = empty($aParam['sTitle']) ? '' : $aParam['sTitle']; $this->_Tbl = empty($aParam['sTbl']) ? '' : $aParam['sTbl']; $this->_Ver = empty($aParam['sVer']) ? '' : $aParam['sVer']; //DebugMsg($this); } function addNews($aParam) { global $bas_news, $db; $tbl = !empty($this->_Tbl) ? $this->_Tbl : $bas_news; $CONTENT = getSqlStr($aParam['CONTENT']); $TITLE = getSqlStr($aParam['sTitle']); $BAS_ID = $aParam['BAS_ID']; $TYPE = $aParam['sType']; $dt = date('Y-m-d H:i:s'); $TYPE = (!empty($TYPE) && $TYPE > 0) ? $TYPE : 0; if ($BAS_ID>0) { $sql = "UPDATE $tbl SET CONTENT='$CONTENT' , TITLE='$TITLE' , TYPE='$TYPE' , ADDDATE='$dt' WHERE BAS_ID='$BAS_ID'"; } else { $sql = "INSERT INTO $tbl(TYPE, TITLE, CONTENT, ADDDATE) VALUES('$TYPE', '$TITLE', '$CONTENT', '$dt') "; } DebugMsg($sql); $db->Query($sql); } function getNewsInfo() { global $bas_news, $db; $tbl = !empty($this->_Tbl) ? $this->_Tbl : $bas_news; //DebugMsg($this); $sql = "select * from $tbl where 1 = 1 "; if ($this->_Type > 0) $sql .= " and Type = '" . $this->_Type . "'"; if (strlen($this->_Title) > 0) $sql .= " and Title = '" . $this->_Title . "'"; DebugMsg($sql); SetCharset(); $qry = $db->Query($sql); return $qry; } function getNews($id) { if ($id > 0) { global $bas_news, $db; $tbl = !empty($this->_Tbl) ? $this->_Tbl : $bas_news; //DebugMsg($this); $sql = "select * from $tbl where BAS_ID = " . $id; SetCharset(); $qry = $db->Query($sql); return $qry; } } function getNewsList($aParam) { global $bas_cl, $bas_prd, $db; $tbl = !empty($this->_Tbl) ? $this->_Tbl : $bas_news; $i_start = $aParam['I_START']; $page_size = $aParam['PAGE_SIZE']; $s_keyType = $aParam['S_KEYTYPE']; $s_key = $aParam['S_KEY']; $sql = "select a.* from $tbl a where 1 = 1 "; if ($this->_Type > 0) $sql .= " and a.Type = '" . $this->_Type . "'"; if ($s_key!="") $sql .= " and a." . (strlen($s_keyType) > 0 ? $s_keyType : "title") . " like '%" . $s_key . "%'"; $sql .= " order by a.bas_id desc "; if ($i_start>=0 && $page_size>0) $sql .= " limit $i_start, $page_size "; //DebugMsg($sql); SetCharset(); $qry = $db->Query($sql); return $qry; } } //取多语言参数的值 //smallkind0 smallkind1 smallkind2 function GetMutiVal($param) { $lan = $GLOBALS['CY_language_cfg']; $re = ""; for ($i=0; $i 0) $re .= SPLIT_STR; $re .= GetVal($param . $i); //DebugMsg($i); //DebugMsg($smallkind); } return $re; } //类别下拉列表 function GetSelClass($selName, $selected, $isEnable, $hasTopSelection) { global $db; //DebugMsg($selName); if (strlen($selName) == 0) $selName = "father_id"; $re = ""; //DebugMsg($re); return $re; } //php4 php5 好像不一样。。。 function getSqlStr($str) { global $_PHP_VER; if ($_PHP_VER > 4) { return str_replace("'", "\'", $str); } else { return $str; } } //随机生成的密码 function GetRandPwd($len) { global $letters; $a = 1; for ($i=1; $i<$len; $i++) { $a = $a * 10; } $b = $a * 10 - 1; $n = rand($a, $b);//随机数 //字母 $p1 = $n % 52;//第一个字母 $p2 = ceil($p1 / 2); $s1 = $letters[$p1]; $s2 = $letters[$p2]; //插入字母的位置 (分割位置) $sp = rand(1, $len); if (floor($n/2) == 1) $re = substr($n, 1, $sp) . $s1 . substr($n, $sp+1) . $s2; else $re = $s2 . substr($n, 0, $sp-1) . $s1 . substr($n, $sp+1); return $re; } function SetOption($aryOptions, $selected = '') { $aParams = array( 'aryOptions' => $aryOptions, 'selected' => $selected); SmartyOptions($aParams); } function SmartyOptions( $params ) { extract($params); while ($option = each($aryOptions)) { $sel = ""; if ($option['key'] == $selected) $sel = " selected=\"selected\""; echo ""; } } ?>
Fatal error: Class 'CPRD' not found in /var/www/vhosts/hkgcp.com/httpdocs/head.inc.php on line 26