?? show.php
字號:
<?
class CModule extends CUserApp
{
function execute()
{
if($this->input[action] == "sendMail") $this->sendEmail();
elseif($this->input[action] == "showEmail") $this->showEmail();
elseif($this->input[down]) $this->downObject();
else $this->showObject();
}
function showEmail()
{
eval("\$this->output(\"".$this->getTemplate("sendEmail")."\");");
}
function sendEmail()
{
if(empty($this->input[to_email]) || empty($this->input[subject]) || empty($this->input[content])) $this->showMsg("[收信人Email][Email主題][Email內容]不可為空!!", "");
if(!eregi(".*\@.*\..*",$this->input[to_email]) && $this->input[to_email] != "") $this->showMsg("您的Email格式錯誤!", "");
@mail($this->input[to_email], $this->input[subject], $this->input[content], "From:{$this->input[from_name]}({$this->input[from_email]})");
$this->showMsg("恭喜,您的Email已成功發送!", "");
}
function showObject()
{
$aObject = new CSoft;
$aObject->open();
if(!$aObject->find($this->input[id])) $this->showMsg("出錯:您要查看的目標ID非法!", "");
$id = $aObject->getAbsolutePosition();
//查看次數加一
$this->plugNum("VIEW", $aObject);
// 獲取分類名稱
$aClass = new CClass;
$aClass->open();
if(!$aClass->find($aObject->class_id)) errorview("小類ID非法!");
$type2 = $aClass->class_name;
$sort1id = $aClass->class_category_id;
$aCategory = new CCategory;
$aCategory->open();
if(!$aCategory->find($sort1id)) errorview("大類ID非法!");
$type1 = $aCategory->category_name;
$aClass->close();
$aCategory->close();
//圖片處理
$img = $aObject->img;
if(!Empty($img)) $img = "<a href={$aObject->img} target=_blank><img src={$this->tplPath}/images/img.gif title=點擊查看圖片 border=0></a>";
//日期處理
$date = date($this->set[dateformat], $aObject->updatetime);
//簡介處理
if (empty($aObject->brief)) $brief = "無";
else $brief = $aObject->brief;
$brief = str_replace("\n", "\n<br>\n", $brief);
$brief = str_replace(" ", "\n \n", $brief);
//下載處理
if (!empty($aObject->down1)) $downs .= "<a href='index.php?modules=show&id=".$id."&down=1'>下載1</a>\n";
if (!empty($aObject->down2)) $downs .= "<a href='index.php?modules=show&id=".$id."&down=2'>下載2</a>\n";
if (!empty($aObject->down3)) $downs .= "<a href='index.php?modules=show&id=".$id."&down=3''>下載3</a>\n";
if (!empty($aObject->down4)) $downs .= "<a href='index.php?modules=show&id=".$id."&down=4'>下載4</a>\n";
if (!empty($aObject->down5)) $downs .= "<a href='index.php?modules=show&id=".$id."&down=5'>下載5</a>\n";
//送給朋友/錯誤報告處理
$errmsg = "您好,這是一封來自pkyDown的錯誤報告:";
$errmsg.= "{$aObject->name}的下載連接有問題,現無法下載!";
$errmsg.="請您速由:{$this->set[sysPath]}/index.php?modules=show查看。";
$tellmsg = "您好,這是一封來自pkyDown的推薦Email:";
$tellmsg.= "您的朋友為向您推薦一款為{$aObject->name}的軟件,非常棒!";
$tellmsg.="請您速到:{$this->set[sysPath]}/index.php?modules=show中下載。";
$errorurl = "[<a href='javascript:;'onClick='javascript:window.open(\"index.php?modules=show&action=showEmail&to_email={$this->set[mgrEmail]}&subject=pkyDown下載出錯報告&content=$errmsg\", \"錯誤報告\",\"width=418,height=450,resizable=1,scrollbars=yes,menubar=no,status=no\")'>出錯報告</a>]</a>";
$tellurl = " [<a href='javascript:;'onClick='javascript:window.open(\"index.php?modules=show&action=showEmail&subject=pkyDown軟件推薦&content=$tellmsg\", \"送給朋友\",\"width=418,height=450,resizable=1,scrollbars=yes,menubar=no,status=no\")'>送給朋友</a>]\n";
$reviewurl = " [<a href='javascript:;'onClick='javascript:window.open(\"index.php?modules=review&id=$id\", \"送給朋友\",\"width=418,height=450,resizable=1,scrollbars=yes,menubar=no,status=no\")'>相關評論</a>]\n";
$header = $this->Header("查看軟件");
$banner = $this->printBanner($aObject->category_id, "", "index.php?modules=list");
$hot = $this->showDownTop($aObject->category_id, $aObject->class_id);
$relatives = $this->getRelatives($aObject->keywords);
eval("\$this->output(\"".$this->getTemplate("show")."\");");
}
function getRelatives($keywords)
{
$aSoft = new CSoft;
$aSoft->open();
$posList = $aSoft->RelativeSoft($keywords);
$box_title = "相關軟件";
for($i = 0; $i< count($posList); $i ++)
{
$serial = $i + 1;
$aSoft->setAbsolutePosition($posList[$i]);
$box_content .= "$serial.<a href=index.php?modules=show&id=$posList[$i] target = _blank>$aSoft->name</a>(<font color = red>$aSoft->downnum</font>)<br>";
}
$aSoft->close();
eval ("\$result .= \"".$this->getTemplate("box")."\";");
return $result;
}
function plugNum($mod, &$aObject)
{
if($mod == "VIEW") $aObject->viewnum++;
elseif($mod == "DOWN")
{
//下載總數加一
$aObject->downnum++;
$now_time=date("m").date("d");
if ($now_time == $aObject->lastdowntime) $aObject->daydowntimes++;
//當天第一次
else
{
$aObject->lastdowntime = $now_time;
$aObject->daydowntimes = "1";
}
}
$aObject->update();
}
function downObject()
{
$aObject = new CSoft;
$aObject->open();
if(!$aObject->find($this->input[id])) showMsg("出錯:您要查看的目標ID非法!", "");
//下載次數加一
$this->plugNum("DOWN", $aObject);
$downid = "down".$this->input[down];
$downurl = $aObject->$downid;
header ("Location:".$downurl);
}
}//end class
?>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -