⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 down.class.php

📁 采用模块化开发
💻 PHP
字号:
<?php 
defined('IN_PHPCMS') or exit('Access Denied');

class down
{
	var $channelid;
	var $downid;
	var $db;
	var $table_down;
	function down($channelid)
    {
		global $db;
		$this->channelid = $channelid;
		$this->downid = 0;
		$this->db = &$db;
		$this->table_down = channel_table('down', $channelid);
		register_shutdown_function(array(&$this, '__destruct'));
    }

	function __destruct()
	{
		unset($this->channelid);
		unset($this->downid);
		unset($this->db);
		unset($this->table_down);
	}
	function add($down)
	{
		$sql1 = $sql2 = $s = "";
		foreach($down as $key=>$value)
		{
			$sql1 .= $s.$key;
			$sql2 .= $s."'".$value."'";
			$s = ",";
		}
		$this->db->query("INSERT INTO ".$this->table_down." ($sql1) VALUES($sql2) ");
		if(!$this->db->affected_rows()) return FALSE;
		$downid = $this->db->insert_id();
		if(!$down['islink'])
		{
			$linkurl = item_url('url', $down['catid'], $down['ishtml'], $down['urlruleid'], $down['htmldir'], $down['prefix'], $downid, $down['addtime']);
			$this->db->query("UPDATE ".$this->table_down." SET linkurl='$linkurl' WHERE downid=$downid ");
		}
		return $downid;
	}

	function edit($down)
	{
		$downid = $this->downid;
		if(!$down['islink'])
		{
			$down['linkurl'] = item_url('url', $down['catid'], $down['ishtml'], $down['urlruleid'], $down['htmldir'], $down['prefix'], $downid, $down['addtime']);
		}
		$sql = $s = "";
		foreach($down as $key=>$value)
		{
			$sql .= $s.$key."='".$value."'";
			$s = ",";
		}
		$this->db->query("UPDATE ".$this->table_down." SET $sql WHERE downid=$downid ");
		return TRUE;
	}

	function delete($downids, $file = 0)//File涓

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -