code stringlengths 1 2.01M | repo_name stringlengths 3 62 | path stringlengths 1 267 | language stringclasses 231 values | license stringclasses 13 values | size int64 1 2.01M |
|---|---|---|---|---|---|
<?php
class smtp
{
/* Public Variables */
var $smtp_port;
var $time_out;
var $host_name;
var $log_file;
var $relay_host;
var $debug;
var $auth;
var $user;
var $pass;
/* Private Variables */
var $sock;
/* Constractor */
function smtp($relay_host = "", $smtp_port = 25,$auth = false,$user,$pass)
{
$this->debug = FALSE;
$this->smtp_port = $smtp_port;
$this->relay_host = $relay_host;
$this->time_out = 30; //is used in fsockopen()
#
$this->auth = $auth;//auth
$this->user = $user;
$this->pass = $pass;
#
$this->host_name = "localhost"; //is used in HELO command
$this->log_file = "";
$this->sock = FALSE;
}
/* Main Function */
function sendmail($to, $from, $subject = "", $body = "", $mailtype, $cc = "", $bcc = "", $additional_headers = "")
{
$mail_from = $this->get_address($this->strip_comment($from));
$body = ereg_replace("(^|(\r\n))(\.)", "\1.\3", $body);
$header = "MIME-Version:1.0\r\n";
if($mailtype=="HTML"){
$header .= "Content-Type:text/html\r\n";
}
$header .= "To: ".$to."\r\n";
if ($cc != "") {
$header .= "Cc: ".$cc."\r\n";
}
$header .= "From: $from<".$from.">\r\n";
$header .= "Subject: ".$subject."\r\n";
$header .= $additional_headers;
$header .= "Date: ".date("r")."\r\n";
$header .= "X-Mailer:By Redhat (PHP/".phpversion().")\r\n";
list($msec, $sec) = explode(" ", microtime());
$header .= "Message-ID: <".date("YmdHis", $sec).".".($msec*1000000).".".$mail_from.">\r\n";
$TO = explode(",", $this->strip_comment($to));
if ($cc != "") {
$TO = array_merge($TO, explode(",", $this->strip_comment($cc)));
}
if ($bcc != "") {
$TO = array_merge($TO, explode(",", $this->strip_comment($bcc)));
}
$sent = TRUE;
foreach ($TO as $rcpt_to) {
$rcpt_to = $this->get_address($rcpt_to);
if (!$this->smtp_sockopen($rcpt_to)) {
$this->log_write("Error: Cannot send email to ".$rcpt_to."\n");
$sent = FALSE;
continue;
}
if ($this->smtp_send($this->host_name, $mail_from, $rcpt_to, $header, $body)) {
$this->log_write("E-mail has been sent to <".$rcpt_to.">\n");
} else {
$this->log_write("Error: Cannot send email to <".$rcpt_to.">\n");
$sent = FALSE;
}
fclose($this->sock);
$this->log_write("Disconnected from remote host\n");
}
return $sent;
}
/* Private Functions */
function smtp_send($helo, $from, $to, $header, $body = "")
{
if (!$this->smtp_putcmd("HELO", $helo)) {
return $this->smtp_error("sending HELO command");
}
#auth
if($this->auth){
if (!$this->smtp_putcmd("AUTH LOGIN", base64_encode($this->user))) {
return $this->smtp_error("sending HELO command");
}
if (!$this->smtp_putcmd("", base64_encode($this->pass))) {
return $this->smtp_error("sending HELO command");
}
}
#
if (!$this->smtp_putcmd("MAIL", "FROM:<".$from.">")) {
return $this->smtp_error("sending MAIL FROM command");
}
if (!$this->smtp_putcmd("RCPT", "TO:<".$to.">")) {
return $this->smtp_error("sending RCPT TO command");
}
if (!$this->smtp_putcmd("DATA")) {
return $this->smtp_error("sending DATA command");
}
if (!$this->smtp_message($header, $body)) {
return $this->smtp_error("sending message");
}
if (!$this->smtp_eom()) {
return $this->smtp_error("sending <CR><LF>.<CR><LF> [EOM]");
}
if (!$this->smtp_putcmd("QUIT")) {
return $this->smtp_error("sending QUIT command");
}
return TRUE;
}
function smtp_sockopen($address)
{
if ($this->relay_host == "") {
return $this->smtp_sockopen_mx($address);
} else {
return $this->smtp_sockopen_relay();
}
}
function smtp_sockopen_relay()
{
$this->log_write("Trying to ".$this->relay_host.":".$this->smtp_port."\n");
$this->sock = @fsockopen($this->relay_host, $this->smtp_port, $errno, $errstr, $this->time_out);
if (!($this->sock && $this->smtp_ok())) {
$this->log_write("Error: Cannot connenct to relay host ".$this->relay_host."\n");
$this->log_write("Error: ".$errstr." (".$errno.")\n");
return FALSE;
}
$this->log_write("Connected to relay host ".$this->relay_host."\n");
return TRUE;;
}
function smtp_sockopen_mx($address)
{
$domain = ereg_replace("^.+@([^@]+)$", "\1", $address);
if (!@getmxrr($domain, $MXHOSTS)) {
$this->log_write("Error: Cannot resolve MX \"".$domain."\"\n");
return FALSE;
}
foreach ($MXHOSTS as $host) {
$this->log_write("Trying to ".$host.":".$this->smtp_port."\n");
$this->sock = @fsockopen($host, $this->smtp_port, $errno, $errstr, $this->time_out);
if (!($this->sock && $this->smtp_ok())) {
$this->log_write("Warning: Cannot connect to mx host ".$host."\n");
$this->log_write("Error: ".$errstr." (".$errno.")\n");
continue;
}
$this->log_write("Connected to mx host ".$host."\n");
return TRUE;
}
$this->log_write("Error: Cannot connect to any mx hosts (".implode(", ", $MXHOSTS).")\n");
return FALSE;
}
function smtp_message($header, $body)
{
fputs($this->sock, $header."\r\n".$body);
$this->smtp_debug("> ".str_replace("\r\n", "\n"."> ", $header."\n> ".$body."\n> "));
return TRUE;
}
function smtp_eom()
{
fputs($this->sock, "\r\n.\r\n");
$this->smtp_debug(". [EOM]\n");
return $this->smtp_ok();
}
function smtp_ok()
{
$response = str_replace("\r\n", "", fgets($this->sock, 512));
$this->smtp_debug($response."\n");
if (!ereg("^[23]", $response)) {
fputs($this->sock, "QUIT\r\n");
fgets($this->sock, 512);
$this->log_write("Error: Remote host returned \"".$response."\"\n");
return FALSE;
}
return TRUE;
}
function smtp_putcmd($cmd, $arg = "")
{
if ($arg != "") {
if($cmd=="") $cmd = $arg;
else $cmd = $cmd." ".$arg;
}
fputs($this->sock, $cmd."\r\n");
$this->smtp_debug("> ".$cmd."\n");
return $this->smtp_ok();
}
function smtp_error($string)
{
$this->log_write("Error: Error occurred while ".$string.".\n");
return FALSE;
}
function log_write($message)
{
$this->smtp_debug($message);
if ($this->log_file == "") {
return TRUE;
}
$message = date("M d H:i:s ").get_current_user()."[".getmypid()."]: ".$message;
if (!@file_exists($this->log_file) || !($fp = @fopen($this->log_file, "a"))) {
$this->smtp_debug("Warning: Cannot open log file \"".$this->log_file."\"\n");
return FALSE;;
}
flock($fp, LOCK_EX);
fputs($fp, $message);
fclose($fp);
return TRUE;
}
function strip_comment($address)
{
$comment = "\([^()]*\)";
while (ereg($comment, $address)) {
$address = ereg_replace($comment, "", $address);
}
return $address;
}
function get_address($address)
{
$address = ereg_replace("([ \t\r\n])+", "", $address);
$address = ereg_replace("^.*<(.+)>.*$", "\1", $address);
return $address;
}
function smtp_debug($message)
{
if ($this->debug) {
echo $message;
}
}
}
?>
| zyyhong | trunk/jiaju001/news/include/mail.class.php | PHP | asf20 | 7,044 |
<?php
//class SiteMap
//--------------------------------
if(!defined('DEDEINC'))
{
exit("Request Error!");
}
require_once(dirname(__FILE__)."/inc_channel_unit_functions.php");
class SiteMap
{
var $dsql;
var $artDir;
var $baseDir;
//-------------
//php5构造函数
//-------------
function __construct()
{
$this->idCounter = 0;
$this->artDir = $GLOBALS['cfg_arcdir'];
$this->baseDir = $GLOBALS['cfg_cmspath'].$GLOBALS['cfg_basedir'];
$this->idArrary = "";
$this->dsql = new DedeSql(false);
}
function SiteMap()
{
$this->__construct();
}
//------------------
//清理类
//------------------
function Close()
{
$this->dsql->Close();
}
//---------------------------
//获取网站地图
//$maptype = "site" 或 "rss"
//---------------------------
function GetSiteMap($maptype="site")
{
$mapString = "<style>.mdiv{ margin:0px;margin-bottom:10px;padding:3px; }</style><div>";
if($maptype=="rss") $this->dsql->SetQuery("Select ID,typedir,isdefault,defaultname,typename,ispart,namerule2 From #@__arctype where ishidden<>1 And reID=0 And ispart<2 order by sortrank");
else $this->dsql->SetQuery("Select ID,typedir,isdefault,defaultname,typename,ispart,namerule2 From #@__arctype where reID=0 And ishidden<>1 order by sortrank");
$this->dsql->Execute(0);
while($row=$this->dsql->GetObject(0))
{
if($maptype=="site") $typelink = GetTypeUrl($row->ID,MfTypedir($row->typedir),$row->isdefault,$row->defaultname,$row->ispart,$row->namerule2);
else $typelink = $GLOBALS['cfg_plus_dir']."/rss/".$row->ID.".xml";
$mapString .= "<div><a href='$typelink'><b>".$row->typename."</b></a></div>\r\n";
$mapString .= $this->LogicListAllSunType($row->ID,$maptype,0);
}
$mapString .= "</div>";
return $mapString;
}
//获得子类目的递归调用
function LogicListAllSunType($ID,$maptype,$pd)
{
$fid = $ID;
$mapString = "";
$pd = $pd + 15;
if($maptype=="rss") $this->dsql->SetQuery("Select ID,typedir,isdefault,defaultname,typename,ispart,namerule2 From #@__arctype where reID='".$ID."' And ishidden<>1 And ispart<2 order by sortrank");
else $this->dsql->SetQuery("Select ID,typedir,isdefault,defaultname,typename,ispart,namerule2 From #@__arctype where reID='".$ID."' And ishidden<>1 order by sortrank");
$this->dsql->Execute($fid);
$mapString .= "<div style='margin-left:{$pd}px'>";
while($row=$this->dsql->GetObject($fid))
{
if($maptype=="site") $typelink = GetTypeUrl($row->ID,MfTypedir($row->typedir),$row->isdefault,$row->defaultname,$row->ispart,$row->namerule2);
else $typelink = $GLOBALS['cfg_plus_dir']."/rss/".$row->ID.".xml";
$lastLink = " <a href='$typelink'>".$row->typename."</a> ";
$mapString .= $lastLink;
$mok = $this->LogicListAllSunType($row->ID,$maptype,$pd);
if(ereg("<a",$mok)){
//$mapString = str_replace($lastLink,"<div style='margin-left:{$pd}px'>$lastLink",$mapString);
$mapString .= $mok;
}
}
$mapString .= "</div>\r\n";
return $mapString;
}
}
?> | zyyhong | trunk/jiaju001/news/include/inc_sitemap.php | PHP | asf20 | 3,087 |
<?php
require_once './../../site/cache/ad_index.php'; $ad= unserialize(stripslashes($ad));
?>
<div class="fr col_l">
<div class="note"><div style="text-align:right"><div style="float:left"><strong>活动与公告</strong></div><a href='http://www.homebjjj.com/huodong/'>更多>></a></div>
<?php
if($ad['event']){foreach($ad['event'] as $a){echo '<a href="http://www.homebjjj.com',$a['url'],'">',$a['title'],'</a><br />';}}?></div>
<div class="tit2 mt5"><div class="tl"><div>品牌推荐</div></div><div class="tr"></div></div>
<div class="tbox">
<?php
if($ad['shop']){foreach($ad['shop'] as $a){echo '<a href="http://www.homebjjj.com',$a['url'],'" title="',$a['title'],'"><img class="b4" src="http://www.homebjjj.com/images/',$a['img'],'" alt="',$a['title'],'"></a> ';}}?>
</div>
<div class="tb"><div class="tbl"></div><div class="tbr"></div><div class="hack"></div></div>
<div class="tit2"><div class="tl"><div>相关产品</div></div><div class="tr"></div></div>
<div class="tbox">
<?php
if($ad['goods']){
foreach($ad['goods'] as $a){
echo '<a href="http://www.homebjjj.com',$a['url'],'" title="',$a['title'],'"><img class="b4" src="http://www.homebjjj.com/images/p/s.',substr($a['img'],4,40),'" alt="',$a['title'],'"></a> ';
}
}
?></div>
<div class="tb"><div class="tbl"></div><div class="tbr"></div><div class="hack"></div></div>
</div> | zyyhong | trunk/jiaju001/news/include/right1.php | PHP | asf20 | 1,383 |
<?php
if(!defined('DEDEINC'))
{
exit("Request Error!");
}
$dsql = $db = new DedeSql(false);
global $sqlsaefCheck;
$sqlsaefCheck = true;
if(defined('DEDEADMIN')) $sqlsaefCheck = false;
class DedeSql
{
var $linkID;
var $dbHost;
var $dbUser;
var $dbPwd;
var $dbName;
var $dbPrefix;
var $result;
var $queryString;
var $parameters;
var $isClose;
var $safeCheck;
//用外部定义的变量初始类,并连接数据库
function __construct($pconnect=false,$nconnect=true)
{
global $sqlsaefCheck;
$this->isClose = false;
$this->safeCheck = $sqlsaefCheck;
if($nconnect) $this->Init($pconnect);
}
function DedeSql($pconnect=false,$nconnect=true)
{
$this->__construct($pconnect,$nconnect);
}
function Init($pconnect=false)
{
$this->linkID = 0;
$this->queryString = "";
$this->parameters = Array();
$this->dbHost = $GLOBALS["cfg_dbhost"];
$this->dbUser = $GLOBALS["cfg_dbuser"];
$this->dbPwd = $GLOBALS["cfg_dbpwd"];
$this->dbName = $GLOBALS["cfg_dbname"];
$this->dbPrefix = $GLOBALS["cfg_dbprefix"];
$this->result["me"] = 0;
$this->Open($pconnect);
}
//
//用指定参数初始数据库信息
//
function SetSource($host,$username,$pwd,$dbname,$dbprefix="dede_")
{
$this->dbHost = $host;
$this->dbUser = $username;
$this->dbPwd = $pwd;
$this->dbName = $dbname;
$this->dbPrefix = $dbprefix;
$this->result["me"] = 0;
}
function SelectDB($dbname)
{
mysql_select_db($dbname);
}
//
//设置SQL里的参数
//
function SetParameter($key,$value){
$this->parameters[$key]=$value;
}
//
//连接数据库
//
function Open($pconnect=false)
{
global $dsql;
//连接数据库
if($dsql && !$dsql->isClose) $this->linkID = $dsql->linkID;
else
{
if(!$pconnect){ $this->linkID = @mysql_connect($this->dbHost,$this->dbUser,$this->dbPwd); }
else{ $this->linkID = @mysql_pconnect($this->dbHost,$this->dbUser,$this->dbPwd); }
//复制一个对象副本
CopySQLPoint($this);
}
//处理错误,成功连接则选择数据库
if(!$this->linkID){
//echo $this->GetError();
$this->DisplayError("DedeCms错误警告:<font color='red'>连接数据库失败,可能数据库密码不对或数据库服务器出错,如未安装本系统,请先运行安装程序,如果已经安装,请检查MySQL服务或修改include/config_base.php的配置!</font>");
exit();
}
@mysql_select_db($this->dbName);
$mysqlver = explode('.',$this->GetVersion());
$mysqlver = $mysqlver[0].'.'.$mysqlver[1];
if($mysqlver>4.0) @mysql_query("SET NAMES '".$GLOBALS['cfg_db_language']."',character_set_client=binary;",$this->linkID);
if($mysqlver>5.0) @mysql_query("SET sql_mode='' ;", $this->linkID);
return true;
}
//
//获得错误描述
//
function GetError()
{
$str = ereg_replace("'|\"","`",mysql_error());
return $str;
}
//
//关闭数据库
//
function Close()
{
@mysql_close($this->linkID);
$this->isClose = true;
if(is_object($GLOBALS['dsql'])){ $GLOBALS['dsql']->isClose = true; }
$this->FreeResultAll();
}
//-----------------
//定期清理死连接
//-----------------
function ClearErrLink()
{
global $cfg_dbkill_time;
if(empty($cfg_dbkill_time)) $cfg_dbkill_time = 30;
@$result=mysql_query("SHOW PROCESSLIST",$this->linkID);
if($result)
{
while($proc=mysql_fetch_assoc($result))
{
if($proc['Command']=='Sleep'
&& $proc['Time']>$cfg_dbkill_time) @mysql_query("KILL ".$proc["Id"],$this->linkID);
}
}
}
//
//关闭指定的数据库连接
//
function CloseLink($dblink)
{
@mysql_close($dblink);
}
//
//执行一个不返回结果的SQL语句,如update,delete,insert等
//
function ExecuteNoneQuery($sql="")
{
global $dsql;
if($dsql->isClose){
$this->Open(false);
$dsql->isClose = false;
}
if($sql!='') $this->SetQuery($sql);
if(is_array($this->parameters))
{
foreach($this->parameters as $key=>$value){
$this->queryString = str_replace("@".$key,"'$value'",$this->queryString);
}
}
//SQL语句安全检查
if($this->safeCheck) check_sql($this->queryString,'update');
return mysql_query($this->queryString,$this->linkID);
}
//
//执行一个返回影响记录条数的SQL语句,如update,delete,insert等
//
function ExecuteNoneQuery2($sql="")
{
global $dsql;
if($dsql->isClose){
$this->Open(false);
$dsql->isClose = false;
}
if($sql!='') $this->SetQuery($sql);
if(is_array($this->parameters)){
foreach($this->parameters as $key=>$value){
$this->queryString = str_replace("@".$key,"'$value'",$this->queryString);
}
}
mysql_query($this->queryString,$this->linkID);
return mysql_affected_rows($this->linkID);
}
function ExecNoneQuery($sql="")
{
return $this->ExecuteNoneQuery($sql);
}
//
//执行一个带返回结果的SQL语句,如SELECT,SHOW等
//
function Execute($id="me",$sql="")
{
global $dsql;
if($dsql->isClose){
$this->Open(false);
$dsql->isClose = false;
}
if($sql!='') $this->SetQuery($sql);
//SQL语句安全检查
if($this->safeCheck) check_sql($this->queryString);
$this->result[$id] = @mysql_query($this->queryString,$this->linkID);
if(!$this->result[$id])
{
$this->DisplayError(mysql_error()." - Execute Query False! <font color='red'>".$this->queryString."</font>");
}
}
function Query($id='me',$sql='')
{
$this->Execute($id,$sql);
}
//
//执行一个SQL语句,返回前一条记录或仅返回一条记录
//
function GetOne($sql="",$acctype=MYSQL_BOTH)
{
global $dsql;
if($dsql->isClose){
$this->Open(false);
$dsql->isClose = false;
}
if($sql!=""){
if(!eregi("limit",$sql)) $this->SetQuery(eregi_replace("[,;]$","",trim($sql))." limit 0,1;");
else $this->SetQuery($sql);
}
$this->Execute("one");
$arr = $this->GetArray("one",$acctype);
if(!is_array($arr)) return("");
else { @mysql_free_result($this->result["one"]); return($arr);}
}
//
//执行一个不与任何表名有关的SQL语句,Create等
//
function ExecuteSafeQuery($sql,$id="me")
{
global $dsql;
if($dsql->isClose){
$this->Open(false);
$dsql->isClose = false;
}
$this->result[$id] = @mysql_query($sql,$this->linkID);
}
//
//返回当前的一条记录并把游标移向下一记录
// MYSQL_ASSOC、MYSQL_NUM、MYSQL_BOTH
//
function GetArray($id="me",$acctype=MYSQL_BOTH)
{
if($this->result[$id]==0) return false;
else return mysql_fetch_array($this->result[$id],$acctype);
}
function GetObject($id="me")
{
if($this->result[$id]==0) return false;
else return mysql_fetch_object($this->result[$id]);
}
//
//检测是否存在某数据表
//
function IsTable($tbname)
{
$this->result[0] = mysql_list_tables($this->dbName,$this->linkID);
while ($row = mysql_fetch_array($this->result[0]))
{
if(strtolower($row[0])==strtolower($tbname))
{
mysql_freeresult($this->result[0]);
return true;
}
}
mysql_freeresult($this->result[0]);
return false;
}
//
//获得MySql的版本号
//
function GetVersion()
{
global $dsql;
if($dsql->isClose){
$this->Open(false);
$dsql->isClose = false;
}
$rs = mysql_query("SELECT VERSION();",$this->linkID);
$row = mysql_fetch_array($rs);
$mysql_version = $row[0];
mysql_free_result($rs);
return $mysql_version;
}
//
//获取特定表的信息
//
function GetTableFields($tbname,$id="me")
{
$this->result[$id] = mysql_list_fields($this->dbName,$tbname,$this->linkID);
}
//
//获取字段详细信息
//
function GetFieldObject($id="me")
{
return mysql_fetch_field($this->result[$id]);
}
//
//获得查询的总记录数
//
function GetTotalRow($id="me")
{
if($this->result[$id]==0) return -1;
else return mysql_num_rows($this->result[$id]);
}
//
//获取上一步INSERT操作产生的ID
//
function GetLastID()
{
//如果 AUTO_INCREMENT 的列的类型是 BIGINT,则 mysql_insert_id() 返回的值将不正确。
//可以在 SQL 查询中用 MySQL 内部的 SQL 函数 LAST_INSERT_ID() 来替代。
//$rs = mysql_query("Select LAST_INSERT_ID() as lid",$this->linkID);
//$row = mysql_fetch_array($rs);
//return $row["lid"];
//return mysql_insert_id($this->linkID);
return ($id = mysql_insert_id($this->linkID)) >= 0 ? $id : mysql_result($this->query("SELECT last_insert_id()"), 0);
}
//
//释放记录集占用的资源
//
function FreeResult($id="me")
{
@mysql_free_result($this->result[$id]);
}
function FreeResultAll()
{
if(!is_array($this->result)) return "";
foreach($this->result as $kk => $vv){
if($vv) @mysql_free_result($vv);
}
}
//
//设置SQL语句,会自动把SQL语句里的#@__替换为$this->dbPrefix(在配置文件中为$cfg_dbprefix)
//
function SetQuery($sql)
{
$prefix="#@__";
$sql = str_replace($prefix,$this->dbPrefix,$sql);
$this->queryString = $sql;
//echo $sql."<hr />\r\n";
}
function SetSql($sql)
{
$this->SetQuery($sql);
}
//
//显示数据链接错误信息
//
function DisplayError($msg)
{
echo "<html>\r\n";
echo "<head>\r\n";
echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>\r\n";
echo "<title>DedeCms Error Track</title>\r\n";
echo "</head>\r\n";
echo "<body>\r\n<p style='line-helght:150%;font-size:10pt'>\r\n";
echo $msg;
echo "<br/><br/>";
echo "</p>\r\n</body>\r\n";
echo "</html>";
//$this->Close();
//exit();
}
}
//复制一个对象副本
function CopySQLPoint(&$ndsql)
{
$GLOBALS['dsql'] = $ndsql;
}
//SQL语句过滤程序,由80sec提供,这里作了适当的修改
function check_sql($db_string,$querytype='select')
{
global $cfg_cookie_encode;
$clean = '';
$error='';
$old_pos = 0;
$pos = -1;
$log_file = dirname(__FILE__).'/../data/'.md5($cfg_cookie_encode).'_safe.txt';
$userIP = GetIP();
$getUrl = GetCurUrl();
//如果是普通查询语句,直接过滤一些特殊语法
if($querytype=='select')
{
$notallow1 = "[^0-9a-z@\._-]{1,}(union|sleep|benchmark|load_file|outfile)[^0-9a-z@\.-]{1,}";
if(eregi($notallow1,$db_string))
{
fputs(fopen($log_file,'a+'),"$userIP||$getUrl||$db_string||SelectBreak\r\n");
exit("<font size='5' color='red'>Safe Alert: Request Error step 1 !</font>");
}
}
//完整的SQL检查
while (true)
{
$pos = strpos($db_string, '\'', $pos + 1);
if ($pos === false)
break;
$clean .= substr($db_string, $old_pos, $pos - $old_pos);
while (true)
{
$pos1 = strpos($db_string, '\'', $pos + 1);
$pos2 = strpos($db_string, '\\', $pos + 1);
if ($pos1 === false)
break;
elseif ($pos2 == false || $pos2 > $pos1)
{
$pos = $pos1;
break;
}
$pos = $pos2 + 1;
}
$clean .= '$s$';
$old_pos = $pos + 1;
}
$clean .= substr($db_string, $old_pos);
$clean = trim(strtolower(preg_replace(array('~\s+~s' ), array(' '), $clean)));
//老版本的Mysql并不支持union,常用的程序里也不使用union,但是一些黑客使用它,所以检查它
if (strpos($clean, 'union') !== false && preg_match('~(^|[^a-z])union($|[^[a-z])~s', $clean) != 0)
{
$fail = true;
$error="union detect";
}
//发布版本的程序可能比较少包括--,#这样的注释,但是黑客经常使用它们
elseif (strpos($clean, '/*') > 2 || strpos($clean, '--') !== false || strpos($clean, '#') !== false)
{
$fail = true;
$error="comment detect";
}
//这些函数不会被使用,但是黑客会用它来操作文件,down掉数据库
elseif (strpos($clean, 'sleep') !== false && preg_match('~(^|[^a-z])sleep($|[^[a-z])~s', $clean) != 0)
{
$fail = true;
$error="slown down detect";
}
elseif (strpos($clean, 'benchmark') !== false && preg_match('~(^|[^a-z])benchmark($|[^[a-z])~s', $clean) != 0)
{
$fail = true;
$error="slown down detect";
}
elseif (strpos($clean, 'load_file') !== false && preg_match('~(^|[^a-z])load_file($|[^[a-z])~s', $clean) != 0)
{
$fail = true;
$error="file fun detect";
}
elseif (strpos($clean, 'into outfile') !== false && preg_match('~(^|[^a-z])into\s+outfile($|[^[a-z])~s', $clean) != 0)
{
$fail = true;
$error="file fun detect";
}
//老版本的MYSQL不支持子查询,我们的程序里可能也用得少,但是黑客可以使用它来查询数据库敏感信息
elseif (preg_match('~\([^)]*?select~s', $clean) != 0)
{
$fail = true;
$error="sub select detect";
}
if (!empty($fail))
{
fputs(fopen($log_file,'a+'),"$userIP||$getUrl||$db_string||$error\r\n");
exit("<font size='5' color='red'>Safe Alert: Request Error!</font>");
}
else
{
return $db_string;
}
}
?> | zyyhong | trunk/jiaju001/news/include/pub_db_mysql.php | PHP | asf20 | 13,156 |
<?php
//class TypeTree
//目录树(用于选择栏目)
//--------------------------------
require_once(dirname(__FILE__)."/../data/cache/inc_catalog_base.php");
class TypeTreeMember
{
var $dsql;
var $artDir;
var $baseDir;
var $idCounter;
var $idArrary;
var $shortName;
//-------------
//php5构造函数
//-------------
function __construct()
{
$this->idCounter = 0;
$this->artDir = $GLOBALS['cfg_cmspath'].$GLOBALS['cfg_arcdir'];
$this->baseDir = $GLOBALS['cfg_basedir'];
$this->shortName = $GLOBALS['art_shortname'];
$this->idArrary = "";
$this->dsql = 0;
}
function TypeTreeMember()
{
$this->__construct();
}
//------------------
//清理类
//------------------
function Close()
{
if($this->dsql){
@$this->dsql->Close();
}
$this->idArrary = "";
$this->idCounter = 0;
}
//
//----读出所有分类,在类目管理页(list_type)中使用----------
//
function ListAllType($nowdir=0,$issend=-1,$opall=false,$channelid=0)
{
if(!is_object($this->dsql)){ $this->dsql = new DedeSql(false); }
$this->dsql->SetQuery("Select ID,typedir,typename,ispart,channeltype,issend From #@__arctype where reID=0 order by sortrank");
$this->dsql->Execute(0);
$lastID = GetCookie('lastCidTree');
while($row=$this->dsql->GetObject(0))
{
$typeDir = $row->typedir;
$typeName = $row->typename;
$ispart = $row->ispart;
$ID = $row->ID;
$dcid = $row->channeltype;
$dissend = $row->issend;
if($ispart>=2||TestHasChannel($ID,$channelid,$issend)==0) continue;
if($ispart==0 || ($ispart==1 && $opall))
{//普通列表
if(($channelid==0 || $channelid==$dcid)
&& ($issend!=1 || $dissend==1))
{
$smenu = " <input type='checkbox' name='selid' id='selid$ID' class='np' onClick=\"ReSel($ID,'$typeName')\"> ";
}else{
$smenu = "[×]";
}
}else if($ispart==1)
{//带封面的频道
$smenu = "[封面]";
}
echo "<dl class='topcc'>\n";
echo "<dd><img style='cursor:hand' onClick=\"LoadSuns('suns{$ID}',{$ID},{$channelid});\" src='img/tree_explode.gif' width='11' height='11'> $typeName{$smenu}</dd>\n";
echo "</dl>\n";
echo "<div id='suns".$ID."' class='sunct'>";
if($lastID==$ID){
$this->LogicListAllSunType($ID," ",$opall,$issend,$channelid);
}
echo "</div>\r\n";
}
}
//获得子类目的递归调用
function LogicListAllSunType($ID,$step,$opall,$issend,$channelid,$nums=0)
{
$fid = $ID;
if($nums){
$step = ' '.$step;
}
$nums = 1;
$this->dsql->SetQuery("Select ID,reID,typedir,typename,ispart,channeltype,issend From #@__arctype where reID='".$ID."' order by sortrank");
$this->dsql->Execute($fid);
if($this->dsql->GetTotalRow($fid)>0)
{
while($row=$this->dsql->GetObject($fid))
{
$typeDir = $row->typedir;
$typeName = $row->typename;
$reID = $row->reID;
$ID = $row->ID;
$ispart = $row->ispart;
$dcid = $row->channeltype;
$dissend = $row->issend;
if($ispart>=2||TestHasChannel($ID,$channelid,$issend)==0) continue;
//普通列表
if(($ispart==0 || ($ispart==1 && $opall))
&& ($issend!=1 || $dissend==1))
{
if($channelid==0 || $channelid==$dcid) $smenu = " <input type='checkbox' name='selid' id='selid$ID' class='np' onClick=\"ReSel($ID,'$typeName')\"> ";
else $smenu = "[×]";
$timg = " <img src='img/tree_list.gif'> ";
}
//带封面的频道
else if($ispart==1){
$timg = " <img src='img/tree_part.gif'> ";
$smenu = "[封面]";
}
echo '<dl class="topcc">'."\n";
echo '<dd>'.$step.$typeName."{$smenu}</dd>\n";
echo "</dl>\n";
$this->LogicListAllSunType($ID,$step,$opall,$issend,$channelid, $nums);
}
}
}
}
?> | zyyhong | trunk/jiaju001/news/include/inc_type_tree_member.php | PHP | asf20 | 3,851 |
<?php
//随机字符串,请在"#,"后填上你网站的广告语或网址
#start#------本行不允许更改
#,字串1
#,字串2
#,字串3
#,字串4
#,字串5
#,字串6
#,字串7
#,字串8
#,字串9
#end#--------本行不允许更改
//------------------------------
?> | zyyhong | trunk/jiaju001/news/include/data/downmix.php | PHP | asf20 | 290 |
<?php
require_once(dirname(__FILE__)."/pub_charset.php");
/*******************************
//HTML解析器
function c____DedeHtml();
********************************/
class DedeHtml
{
var $SourceHtml = "";
var $Title = "";
var $IsJump = false;
var $IsFrame = false;
var $JumpUrl = "";
var $BodyText = "";
var $KeywordText = "";
var $Links = "";
var $LinkCount = 0;
var $CharSet = "";
var $BaseUrl = "";
var $BaseUrlPath = "";
var $HomeUrl = "";
var $IsHead = false; //是否已经分析HTML头<head></head>部份,
//如果不想分析HTML头,可在SetSource之前直接设这个值为true
var $IsParseText = true; //是否需要获得HTML里的文本
var $ImgWidth = 0;
var $ImgHeight = 0;
var $NotEncodeText = "";
//设置HTML的内容和来源网址
function SetSource($html,$url="")
{
$this->CAtt = new DedeAttribute();
$url = trim($url);
$this->SourceHtml = $html;
$this->BaseUrl = $url;
//判断文档相对于当前的路径
$urls = @parse_url($url);
$this->HomeUrl = $urls["host"];
if(isset($urls["path"])) $this->BaseUrlPath = $this->HomeUrl.$urls["path"];
else $this->BaseUrlPath = $this->HomeUrl;
$this->BaseUrlPath = preg_replace("/\/([^\/]*)\.(.*)$/","/",$this->BaseUrlPath);
$this->BaseUrlPath = preg_replace("/\/$/","",$this->BaseUrlPath);
if($html!="") $this->Analyser();
}
//
//解析HTML
//
function Analyser()
{
$cAtt = new DedeAttribute();
$cAtt->IsTagName = false;
$c = "";
$i = 0;
$startPos = 0;
$endPos = 0;
$wt = 0;
$ht = 0;
$scriptdd = 0;
$attStr = "";
$tmpValue = "";
$tmpValue2 = "";
$tagName = "";
$hashead = 0;
$slen = strlen($this->SourceHtml);
for(;$i < $slen; $i++)
{
$c = $this->SourceHtml[$i];
if($c=="<")
{
//如果IsParseText==false表示不获取网页的额外资源,只获取多媒体信息
//这种情况一般是用于采集程序的模式
$tagName = "";
$j = 0;
for($i=$i+1; $i < $slen; $i++)
{
if($j>10) break;
$j++;
if(!ereg("[ <>\r\n\t]",$this->SourceHtml[$i])){
$tagName .= $this->SourceHtml[$i];
}
else break;
}
$tagName = strtolower($tagName);
if($tagName=="!--")
{
$endPos = strpos($this->SourceHtml,"-->",$i);
if($endPos!==false) $i=$endPos+2;
continue;
}
//简单模式,只获取多媒体资源
if(!$this->IsParseText)
{
$needTag = "img|embed";
if(ereg($needTag,$tagName))
{
$startPos = $i;
$endPos = strpos($this->SourceHtml,">",$i+1);
if($endPos===false) break;
$attStr = substr($this->SourceHtml,$i+1,$endPos-$startPos-1);
$cAtt->SetSource($attStr);
}
}
//巨型模式,获取所有附加信息
else
{
$startPos = $i;
$endPos = strpos($this->SourceHtml,">",$i+1);
if($endPos===false) break;
$attStr = substr($this->SourceHtml,$i+1,$endPos-$startPos-1);
$cAtt->SetSource($attStr);
}
//检测HTML头信息
if(!$this->IsHead && $this->IsParseText)
{
if($tagName=="meta")
{
//分析name属性
$tmpValue = strtolower($cAtt->GetAtt("name"));
if($tmpValue=="keywords")
$this->BodyText .= trim($this->TrimSymbol($cAtt->GetAtt("content")))." ";
if($tmpValue=="description")
{
$this->BodyText .= trim($this->TrimSymbol($cAtt->GetAtt("content")))." ";
}
//分析http-equiv属性
$tmpValue = strtolower($cAtt->GetAtt("http-equiv"));
if($tmpValue=="refresh")
{
$tmpValue2 = InsertUrl($this->ParRefresh($cAtt->GetAtt("content")),"meta");
if($tmpValue2!=""){
$this->IsJump = true;
$this->JumpUrl = $tmpValue2;
}
}
if($tmpValue=="content-type")
{
if($this->CharSet=="")
{ $this->CharSet = strtolower($this->ParCharSet($cAtt->GetAtt("content"))); }
}
} //End meta 分析
else if($tagName=="title") //获得网页的标题
{
$t_startPos = strpos($this->SourceHtml,'>',$i);
$t_endPos = strpos($this->SourceHtml,'<',$t_startPos);
if($t_endPos>$t_startPos){
$textLen = $t_endPos-$t_startPos;
$this->Title = substr($this->SourceHtml,$t_startPos+1,$textLen-1);
}
if($t_endPos > $i) $i = $t_endPos + 6;
}
else if($tagName=="/head"||$tagName=="body")
{
$this->IsHead = true;
$i = $i+5;
}
}
else
{
//小型分析的数据
//只获得内容里的多媒体资源链接,不获取text
if($tagName=="img")//获取图片中的网址
{
if($cAtt->GetAtt("alt")!="" && $this->IsParseText)
{ $this->BodyText .= trim($this->TrimSymbol($cAtt->GetAtt("alt")))." "; }
$wt = $cAtt->GetAtt("width");
$ht = $cAtt->GetAtt("height");
if(!ereg("[^0-9]",$wt)&&!ereg("[^0-9]",$ht)){
if($wt >= $this->ImgWidth && $ht>= $this->ImgHeight){
$this->InsertUrl($cAtt->GetAtt("src"),"images");
}
}
}
else if($tagName=="embed")//获得Flash或其它媒体的内容
{
$wt = $cAtt->GetAtt("width");
$ht = $cAtt->GetAtt("height");
if(!ereg("[^0-9]",$wt)&&!ereg("[^0-9]",$ht))
{ $this->InsertUrl($cAtt->GetAtt("src"),$cAtt->GetAtt("type")); }
}
//
//下面情况适用于获取HTML的所有附加信息的情况(蜘蛛程序)
//
if($this->IsParseText)
{
if($tagName=="a"||$tagName=="area")//获得超链接
$this->InsertUrl($cAtt->GetAtt("href"),"hyperlink");
else if($tagName=="frameset")//处理框架网页
$this->IsFrame = true;
else if($tagName=="frame"){
$tmpValue = $this->InsertUrl($cAtt->GetAtt("src"),"frame");
if($tmpValue!=""){
$tmpValue2 = $cAtt->GetAtt("name");
if(eregi("(main|body)",$tmpValue2)){
$this->IsJump = true;
$this->JumpUrl = $tmpValue;
}
}
}
else if(ereg("^(sc|st)",$tagName)){
$scriptdd++;
}
else if(ereg("^(/sc|/st)",$tagName)){
$scriptdd--;
}
////////////获取标记间的文本//////////////
if($scriptdd==0){
$tmpValue = trim($this->GetInnerText($i));
if($tmpValue!=""){
if(strlen($this->KeywordText)<512){
if($this->IsHot($tagName,$cAtt)){
$this->KeywordText .= $tmpValue;
}}
$this->BodyText .= $tmpValue." ";
}
}
}//IsParseText
}//结束解析body的内容
}//End if char
}//End for
//对分析出来的文本进行简单处理
if($this->BodyText!="")
{
$this->BodyText = $this->TrimSymbol($this->BodyText);
if($this->NotEncodeText!="") $this->BodyText = $this->TrimSymbol($this->NotEncodeText).$this->BodyText;
$this->BodyText = preg_replace("/&#{0,1}([a-zA-Z0-9]{3,5})( {0,1})/"," ",$this->BodyText);
$this->BodyText = preg_replace("/[ -]{1,}/"," ",$this->BodyText);
$this->BodyText = preg_replace("/-{1,}/","-",$this->BodyText);
$this->NotEncodeText = "";
}
if($this->KeywordText!="")
{
$this->KeywordText = $this->TrimSymbol($this->KeywordText);
$this->KeywordText = preg_replace("/&#{0,1}([a-zA-Z0-9]{3,5})( {0,1})/"," ",$this->KeywordText);
$this->KeywordText = preg_replace("/ {1,}/"," ",$this->KeywordText);
$this->KeywordText = preg_replace("/-{1,}/","-",$this->KeywordText);
}
if($this->Title==""){
$this->Title = $this->BaseUrl;
}else{
$this->Title = $this->TrimSymbol($this->Title);
$this->Title = preg_replace("/&#{0,1}([a-zA-Z0-9]{3,5})( {0,1})/"," ",$this->Title);
$this->Title = preg_replace("/ {1,}/"," ",$this->Title);
$this->Title = preg_replace("/-{1,}/","-",$this->Title);
}
}
//
//重置资源
//
function Clear()
{
$this->SourceHtml = "";
$this->Title = "";
$this->IsJump = false;
$this->IsFrame = false;
$this->JumpUrl = "";
$this->BodyText = "";
$this->KeywordText = "";
$this->Links = "";
$this->LinkCount = 0;
$this->CharSet = "";
$this->BaseUrl = "";
$this->BaseUrlPath = "";
$this->HomeUrl = "";
$this->NotEncodeText = "";
}
//
//分析URL,并加入指定分类中
//
function InsertUrl($url,$tagname)
{
$noUrl = true;
if(trim($url)=="") return;
if( ereg("^(javascript:|#|'|\")",$url) ) return "";
if($url=="") return "";
if($this->LinkCount>0)
{
foreach($this->Links as $k=>$v){
if($url==$v){ $noUrl = false; break; }
}
}
//如果不存在这个链接
if($noUrl)
{
$this->Links[$this->LinkCount]=$url;
$this->LinkCount++;
}
return $url;
}
//
//分析content-type中的字符类型
//
function ParCharSet($att)
{
$startdd=0;
$taglen=0;
$startdd = strpos($att,"=");
if($startdd===false) return "";
else
{
$taglen = strlen($att)-$startdd-1;
if($taglen<=0) return "";
return trim(substr($att,$startdd+1,$taglen));
}
}
//
//分析refresh中的网址
//
function ParRefresh($att)
{
return $this->ParCharSet($att);
}
//
//补全相对网址
//
function FillUrl($surl)
{
$i = 0;
$dstr = "";
$pstr = "";
$okurl = "";
$pathStep = 0;
$surl = trim($surl);
if($surl=="") return "";
$pos = strpos($surl,"#");
if($pos>0) $surl = substr($surl,0,$pos);
if($surl[0]=="/"){
$okurl = "http://".$this->HomeUrl."/".$surl;
}
else if($surl[0]==".")
{
if(strlen($surl)<=2) return "";
else if($surl[0]=="/")
{
$okurl = "http://".$this->BaseUrlPath."/".substr($surl,2,strlen($surl)-2);
}
else{
$urls = explode("/",$surl);
foreach($urls as $u){
if($u=="..") $pathStep++;
else if($i<count($urls)-1) $dstr .= $urls[$i]."/";
else $dstr .= $urls[$i];
$i++;
}
$urls = explode("/",$this->BaseUrlPath);
if(count($urls) <= $pathStep)
return "";
else{
$pstr = "http://";
for($i=0;$i<count($urls)-$pathStep;$i++)
{ $pstr .= $urls[$i]."/"; }
$okurl = $pstr.$dstr;
}
}
}
else
{
if(strlen($surl)<7)
$okurl = "http://".$this->BaseUrlPath."/".$surl;
else if(strtolower(substr($surl,0,7))=="http://")
$okurl = $surl;
else
$okurl = "http://".$this->BaseUrlPath."/".$surl;
}
$okurl = eregi_replace("^(http://)","",$okurl);
$okurl = eregi_replace("/{1,}","/",$okurl);
return "http://".$okurl;
}
//
//获得和下一个标记之间的文本内容
//
function GetInnerText($pos)
{
$startPos=0;
$endPos=0;
$textLen=0;
$str="";
$startPos = strpos($this->SourceHtml,'>',$pos);
$endPos = strpos($this->SourceHtml,'<',$startPos);
if($endPos>$startPos)
{
$textLen = $endPos-$startPos;
$str = substr($this->SourceHtml,$startPos+1,$textLen-1);
}
return $str;
}
//
//把连续多个或单个特殊符号换为空格
//如果中英文混合的串也会被分开
//
function TrimSymbol($str)
{
if(strtolower($this->CharSet)=="utf-8"){
$str = utf82gb($str);
}
else if(strtolower($this->CharSet)=="big5"){
$str = big52gb($str);
}
else if(!eregi("^gb",$this->CharSet)){
$this->NotEncodeText .= $str;
return "";
}
$str = trim($str);
$slen = strlen($str);
if($slen==0) return "";
$okstr = "";
for($i=0;$i<$slen;$i++){
if(ord($str[$i]) < 0x81){
//当字符为英文中的特殊符号
if(ereg("[^0-9a-zA-Z@.%#:/\\&-]",$str[$i])){
if($okstr!=""){ if( $okstr[strlen($okstr)-1]!=" " ) $okstr .= " "; }
}
//如果字符为非特殊符号
else{
if(strlen($okstr)>1){
if(ord($okstr[strlen($okstr)-2])>0x80) $okstr .= " ".$str[$i];
else $okstr .= $str[$i];
}
else $okstr .= $str[$i];
}
}
else
{
//如果上一个字符为非中文和非空格,则加一个空格
if(strlen($okstr)>1){
if(ord($okstr[strlen($okstr)-2]) < 0x81 && $okstr[strlen($okstr)-1]!=" ")
{ $okstr .= " "; }
}
//如果中文字符
if( isset($str[$i+1]) ){
$c = $str[$i].$str[$i+1];
$n = hexdec(bin2hex($c));
if($n < 0xB0A1)
{
if($c=="《")
{ $okstr .= " 《"; }
else if($c=="》")
{ $okstr .= "》 "; }
else if($okstr[strlen($okstr)-1]!=" ")
{ $okstr .= " "; }
}
else{
//F7 - FE 是GB2312的终结编码
if($n < 0xF8FF) $okstr .= $c;
}
$i++;
}
else{
$okstr .= $str[$i];
}
}
}//结束循环
return $okstr;
}
//
//确认标记后面是否存在跟热点词的可能性
//
function IsHot($tag,$datt)
{
$hottag="b|strong|h1|h2|h3|h4|h5|h6";
if($tag=="font"||$tag=="p"||$tag=="div"||$tag=="span")
return $this->IsRed($datt);
else
return ereg($hottag,$tag);
}
//
//检查是否使用红色字
//
function IsRed($datt)
{
$color = strtolower($datt->GetAtt("color"));
if($color=="") return false;
else
{
if($color=="red"||$color=="#ff0000"||$color=="ff0000") return true;
else return false;
}
}
}//End class
/*******************************
//属性解析器
function c____DedeAttribute();
********************************/
class DedeAttribute
{
var $SourceString = "";
var $SourceMaxSize = 1024;
var $CharToLow = FALSE; //属性值是否不分大小写(属性名统一为小写)
var $IsTagName = TRUE; //是否解析标记名称
var $Count = -1;
var $Items = ""; //属性元素的集合
//设置属性解析器源字符串
function SetSource($str="")
{
$this->Count = -1;
$this->Items = "";
$strLen = 0;
$this->SourceString = trim(preg_replace("/[ \t\r\n]{1,}/"," ",$str));
$strLen = strlen($this->SourceString);
$this->SourceString .= " "; //增加一个空格结尾,以方便处理没有属性的标记
if($strLen>0&&$strLen<=$this->SourceMaxSize){
$this->PrivateAttParse();
}
}
//获得某个属性
function GetAtt($str){
if($str=="") return "";
$str = strtolower($str);
if(isset($this->Items[$str])) return $this->Items[$str];
else return "";
}
//判断属性是否存在
function IsAtt($str){
if($str=="") return false;
$str = strtolower($str);
if(isset($this->Items[$str])) return true;
else return false;
}
//获得标记名称
function GetTagName(){
return $this->GetAtt("tagname");
}
// 获得属性个数
function GetCount(){
return $this->Count+1;
}
//解析属性(仅给SetSource调用)
function PrivateAttParse()
{
$d = "";
$tmpatt="";
$tmpvalue="";
$startdd=-1;
$ddtag="";
$strLen = strlen($this->SourceString);
$j = 0;
//这里是获得标记的名称
if($this->IsTagName)
{
//如果属性是注解,不再解析里面的内容,直接返回
if(isset($this->SourceString[2]))
{
if($this->SourceString[0].$this->SourceString[1].$this->SourceString[2]=="!--")
{ $this->Items["tagname"] = "!--"; return ;}
}
//
for($i=0;$i<$strLen;$i++){
$d = $this->SourceString[$i];
$j++;
if(ereg("[ '\"\r\n\t]",$d)){
$this->Count++;
$this->Items["tagname"]=strtolower(trim($tmpvalue));
$tmpvalue = ""; break;
}
else
{ $tmpvalue .= $d;}
}
if($j>0) $j = $j-1;
}
//遍历源字符串,获得各属性
for($i=$j;$i<$strLen;$i++)
{
$d = $this->SourceString[$i];
//获得属性的键
if($startdd==-1){
if($d!="=") $tmpatt .= $d;
else{
$tmpatt = strtolower(trim($tmpatt));
$startdd=0;
}
}
//检测属性值是用什么包围的,允许使用 '' "" 或空白
else if($startdd==0){
switch($d){
case ' ':
continue;
break;
case '\'':
$ddtag='\'';
$startdd=1;
break;
case '"':
$ddtag='"';
$startdd=1;
break;
default:
$tmpvalue.=$d;
$ddtag=' ';
$startdd=1;
break;
}
}
//获得属性的值
else if($startdd==1)
{
if($d==$ddtag){
$this->Count++;
if($this->CharToLow) $this->Items[$tmpatt] = strtolower(trim($tmpvalue));
else $this->Items[$tmpatt] = trim($tmpvalue);
$tmpatt = "";
$tmpvalue = "";
$startdd=-1;
}
else
$tmpvalue.=$d;
}
}//End for
//处理没有值的属性(必须放在结尾才有效)如:"input type=radio name=t1 value=aaa checked"
if($tmpatt!="")
{ $this->Items[$tmpatt] = "";}
}//End Function PrivateAttParse
}//End Class DedeAttribute
?> | zyyhong | trunk/jiaju001/news/include/pub_dedehtml.php | PHP | asf20 | 17,252 |
<?php
require_once(dirname(__FILE__)."/../config_base.php");
require_once(dirname(__FILE__)."/../inc_type_tree_member.php");
if(!isset($dopost)) $dopost = '';
if(!isset($c)) $c = 0;
$opall = (empty($opall) ? false : true);
$issend = (empty($issend) ? 1 : $issend);
$channelid = (empty($channelid) ? 0 : $channelid);
//载入子栏目
if($dopost=='GetSunListsTree'){
header("Pragma:no-cache\r\n");
header("Cache-Control:no-cache\r\n");
header("Expires:0\r\n");
header("Content-Type: text/html; charset=utf-8");
PutCookie('lastCidTree',$cid,3600*24,"/");
$tu = new TypeTreeMember();
$tu->dsql = new DedeSql(false);
$tu->LogicListAllSunType($cid," ",$opall,$issend,$channelid);
$tu->Close();
exit();
}
?>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>栏目选择</title>
<link href='<?php echo $cfg_phpurl?>/base2.css' rel='stylesheet' type='text/css'>
<script language="javascript" src="<?php echo $cfg_mainsite.$cfg_cmspath?>/include/dedeajax2.js"></script>
<script language="javascript">
function LoadSuns(ctid,tid,channelid)
{
if($DE(ctid).innerHTML.length < 10){
var myajax = new DedeAjax($DE(ctid),true,true,'','没子栏目','...');
myajax.SendGet('catalog_tree.php?opall=<?php echo $opall; ?>&issend=<?php echo $issend; ?>&dopost=GetSunListsTree&channelid='+channelid+'&cid='+tid);
}else{
if(document.all) showHide(ctid);
}
}
function showHide(objname)
{
if($DE(objname).style.display=="none") $DE(objname).style.display = "block";
else $DE(objname).style.display="none";
return false;
}
function ReSel(ctid,cname){
if($DE('selid'+ctid).checked){
window.opener.document.<?php echo $f?>.<?php echo $v?>.value=ctid;
window.opener.document.<?php echo $f?>.<?php echo $bt?>.value=cname;
if(document.all) window.opener=true;
window.close();
}
}
</script>
<style>
div,dd{ margin:0px; padding:0px }
.dlf { margin-right:3px; margin-left:6px; margin-top:2px; float:left }
.dlr { float:left }
.topcc{ margin-top:5px }
.suncc{ margin-bottom:3px }
dl{ clear:left; margin:0px; padding:0px }
.sunct{ }
#items1{ border-bottom: 1px solid #3885AC;
border-left: 1px solid #2FA1DB;
border-right: 1px solid #2FA1DB;
padding-left:8px;
}
.sunlist{ width:100%; padding-left:0px; margin:0px; clear:left }
.tdborder{
border-left: 1px solid #43938B;
border-right: 1px solid #43938B;
border-bottom: 1px solid #43938B;
}
.tdline-left{
border-bottom: 1px solid #656363;
border-left: 1px solid #788C47;
}
.tdline-right{
border-bottom: 1px solid #656363;
border-right: 1px solid #788C47;
}
.tdrl{
border-left: 1px solid #788C47;
border-right: 1px solid #788C47;
}
.top{cursor: hand;}
body {
scrollbar-base-color:#8CC1FE;
scrollbar-arrow-color:#FFFFFF;
scrollbar-shadow-color:#6994C2
}
</style>
</head>
<base target="main">
<body leftmargin="0" bgcolor="#86C1FF" topmargin="3" target="main">
<table width='98%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='24' background='<?php echo $cfg_phpurl?>/img/mtbg1.gif' style='border-left: 1px solid #2FA1DB; border-right: 1px solid #2FA1DB;'>
<strong>√请在要选择的栏目打勾</strong>
<input type='checkbox' name='nsel' id='selid0' class='np' onClick="ReSel(0,'请选择...')">不限栏目
</td>
</tr>
<tr bgcolor='#EEFAFE'>
<td id='items1'>
<?php
$tu = new TypeTreeMember();
$tu->ListAllType($c,$issend,$opall,$channelid);
$tu->Close();
?> </td>
</tr>
</table>
</body>
</html> | zyyhong | trunk/jiaju001/news/include/dialoguser/catalog_tree.php | PHP | asf20 | 3,613 |
<?php
//该页仅用于检测用户登录的情况,如要手工更改系统配置,请更改config_base.php
require_once(dirname(__FILE__)."/../config_base.php");
require_once(dirname(__FILE__)."/../inc_memberlogin.php");
//获得当前脚本名称,如果你的系统被禁用了$_SERVER变量,请自行更改这个选项
$dedeNowurl = "";
$s_scriptName="";
$dedeNowurl = GetCurUrl();
$dedeNowurls = explode("?",$dedeNowurl);
$s_scriptName = $dedeNowurls[0];
//检验用户登录状态
$cfg_ml = new MemberLogin();
if(!$cfg_ml->IsLogin())
{
$gurl = $cfg_memberurl."/login.php?gourl=".urlencode($dedeNowurl);
echo "<script language='javascript'>location='$gurl';</script>";
exit();
}
?> | zyyhong | trunk/jiaju001/news/include/dialoguser/config.php | PHP | asf20 | 720 |
<?php
require_once(dirname(__FILE__)."/config.php");
if(empty($mediatype)) $mediatype = 1;
require_once(dirname(__FILE__)."/all_medias.php");
?> | zyyhong | trunk/jiaju001/news/include/dialoguser/select_images.php | PHP | asf20 | 148 |
<?php
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__)."/../pub_datalist_dm.php");
require_once(dirname(__FILE__)."/../inc_functions.php");
setcookie("ENV_GOBACK_URL",$dedeNowurl,time()+3600,"/");
if(empty($f)) $f = '';
if(empty($v)) $v ='';
if(empty($mediatype)) $mediatype = 0;
function MediaType($tid,$nurl)
{
if($tid==1) return "图片<a href=\"javascript:;\" onClick=\"ChangeImage('$nurl');\"><img src='../dialog/img/picviewnone.gif' name='picview' border='0' alt='预览'></a>";
else if($tid==2) return "FLASH";
else if($tid==3) return "视频/音频";
else return "附件/其它";
}
function GetFileSize($fs){
$fs = $fs/1024;
return sprintf("%10.1f",$fs)." K";
}
if(empty($keyword)) $keyword = "";
$addsql = " where (title like '%$keyword%' Or url like '%$keyword%') ";
if($mediatype==2) $addsql .= " And (mediatype='2' OR mediatype='3') ";
else if($mediatype>0) $addsql .= " And mediatype='$mediatype' ";
$addsql .= " And memberid='{$cfg_ml->M_ID}' ";
$sql = "Select aid,title,url,mediatype,filesize,uptime From #@__uploads $addsql order by aid desc";
//echo $sql;
$dlist = new DataList();
$dlist->pageSize = 20;
$dlist->Init();
$dlist->SetParameter("mediatype",$mediatype);
$dlist->SetParameter("keyword",$keyword);
$dlist->SetParameter("f",$f);
$dlist->SetSource($sql);
include(dirname(__FILE__)."/all_medias.htm");
$dlist->Close();
?> | zyyhong | trunk/jiaju001/news/include/dialoguser/all_medias.php | PHP | asf20 | 1,436 |
td {font-size: 9pt;line-height: 1.5;}
body {
font-size: 9pt;
line-height: 1.5;
scrollbar-base-color:#C0D586;
scrollbar-arrow-color:#FFFFFF;
scrollbar-shadow-color:DEEFC6
}
a:link { font-size: 9pt; color: #000000; text-decoration: none }
a:visited{ font-size: 9pt; color: #000000; text-decoration: none }
a:hover {color: red}
input{border: 1px solid #000000;}
.np{border:none}
.linerow{border-bottom: 1px solid #ACACAC;}
.coolbg {
border-right: 2px solid #ACACAC;
border-bottom: 2px solid #ACACAC;
background-color: #E6E6E6
}
.coolbg2 {
border: 1px solid #000000;
background-color: #DFDDD2;
height:18px
}
.ll {
border-right: 2px solid #ACACAC;
border-bottom: 2px solid #ACACAC;
background-color: #E6E6E6
}
.bline {border-bottom: 1px solid #BCBCBC;background-color: #FFFFFF}
.bline2 {border-bottom: 1px solid #BCBCBC;} | zyyhong | trunk/jiaju001/news/include/dialoguser/base.css | CSS | asf20 | 874 |
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>附件数据管理</title>
<link href='base.css' rel='stylesheet' type='text/css'>
<style>
.napisdiv {left:10;top:0;width:150;height:100;position:absolute;z-index:3}
</style>
<script>
function $DE(eid){ return document.getElementById(eid); }
function ChangeImage(surl){ $DE('picview').src = surl; }
//获得选中文件的文件名
function getCheckboxItem(){
var allSel="";
if(document.form1.aids.value) return document.form1.aids.value;
for(i=0;i<document.form1.aids.length;i++)
{
if(document.form1.aids[i].checked){
if(allSel=="")
allSel=document.form1.aids[i].value;
else
allSel=allSel+","+document.form1.aids[i].value;
}
}
return allSel;
}
function nullLink(){
return;
}
function ReAddon(resrc)
{
window.opener.document.<?php echo $f?>.value=resrc;
if(window.opener.document.getElementById('<?php echo $v?>')
&& (resrc.indexOf('.jpg')>0 || resrc.indexOf('.gif')>0 || resrc.indexOf('.png')>0)
){
window.opener.document.getElementById('<?php echo $v?>').src = resrc;
}
if(document.all) window.opener=true;
window.close();
}
function AllSel(){
for(i=0;i<document.form1.aids.length;i++){
document.form1.aids[i].checked = true;
}
}
function NoneSel(){
for(i=0;i<document.form1.aids.length;i++){
document.form1.aids[i].checked = false;
}
}
</script>
</head>
<body background='img/allbg.gif' leftmargin='0' topmargin='0'>
<div id="floater" class="napisdiv">
<a href="javascript:;" onClick="ChangeImage('../dialog/img/picviewnone.gif');">
<img src='../dialog/img/picviewnone.gif' id='picview' name='picview' border='0' alt='单击关闭预览' style='z-index:10000'>
</a>
</div>
<SCRIPT language=JavaScript src="float.js"></SCRIPT>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#98CAEF">
<tr>
<td height="19" colspan="7" background="img/tbg.gif">
<table width='96%' cellpadding='0' cellspacing='0'>
<tr>
<td width='30%'><b>附件数据管理</b></td>
<td align='right'>
[<a href="#uploadnew"><u>上传新文件</u></a>]
</td>
</tr>
</table>
</td>
</tr>
<tr bgcolor="#F2FAE2" height="24">
<td colspan="7">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<form name='forms' action=''>
<input name='f' type='hidden' value='<?php echo $f; ?>'>
<tr>
<td width="10"> </td>
<td width="70" align="center">关键字:</td>
<td width="100"><input name="keyword" type="text" id="keyword" style="width:100" value="<?php echo $keyword?>"></td>
<td width="100" align="center">
<select name='mediatype' style='width:80'>
<option value='0'>文件类型</option>
<option value='1'<?php if($mediatype==1) echo " selected"?>>图片</option>
<option value='2'<?php if($mediatype==2) echo " selected"?>>FLASH</option>
<option value='3'<?php if($mediatype==3) echo " selected"?>>视频/音频</option>
<option value='4'<?php if($mediatype==4) echo " selected"?>>其它附件</option>
</select>
</td>
<td><input class="np" name="imageField" type="image" src="img/button_search.gif" width="60" height="22" border="0" style="height:22px"></td>
</tr>
</form>
</table>
</td>
</tr>
<tr bgcolor="#F8FBFB" height="24" align="center">
<td width="8%">选择</td>
<td width="32%">文件标题</td>
<td width="10%">文件大小</td>
<td width="18%">上传时间</td>
<td width="12%">文件类型</td>
<td width="8%">管理</td>
</tr>
<form name='form1'>
<?php
$mylist = $dlist->GetDataList();
while($row = $mylist->GetArray('dm'))
{
?>
<tr align="center" bgcolor="#FFFFFF" height="24" onMouseMove="javascript:this.bgColor='#EFEFEF';" onMouseOut="javascript:this.bgColor='#FFFFFF';">
<td>
<input type='checkbox' onClick="ReAddon('<?php echo $row['url']; ?>');" name='aids' id='aids<?php echo $row['aid']?>' value='<?php echo $row['aid']?>' class='np'/>
</td>
<td>
<a href="javascript:ReAddon('<?php echo $row['url']; ?>');">
<?php
if(eregi("\.(jpg|gif|png)$",$row['url'])){
echo "<img src='".$row['url']."' width='100' border='0'><br/>";
}
?>
<u><?php echo $row['title']?></u>
</a>
</td>
<td><?php echo GetFileSize($row['filesize'])?></td>
<td><?php echo strftime("%y-%m-%d %H:%M",$row['uptime'])?></td>
<td><?php echo MediaType($row['mediatype'],$row['url'])?></td>
<td>
<a href="javascript:ReAddon('<?php echo $row['url']; ?>');">选择</a>
</td>
</tr>
<?php
}
?>
<tr bgcolor="#F8FBFB" height="24">
<td colspan="6">
<input type="button" name="b4" value="全选" class="nbt" style="width:40" onClick="AllSel();">
<input type="button" name="b5" value="取消" class="nbt" style="width:40" onClick="NoneSel();">
</td>
</tr>
<tr bgcolor="#EEFAC9" height="24">
<td colspan="6" align="center">
<?php echo $dlist->GetPageList(7);?>
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#98CAEF" style="margin-top:6px;">
<tr>
<td bgcolor="#FFFFFF">
<a name='uploadnew'></a>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="24" align="center">
<form name="form2" enctype="multipart/form-data" method="post" action="medias_upload.php" style="padding:0px;margin:0px;">
标题:
<input type="text" name="title" size="width:80px">
文件:
<input type="file" name="uploadfile" size="width:150px">
<input type="submit" name="Submit" value="上传">
</form>
</td>
</tr>
<tr>
<td height="24" bgcolor="#EBF3D6" style="word-break:break-all;padding:5px">
支持的文件类型:
<?php echo $cfg_mb_mediatype; ?>
</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html> | zyyhong | trunk/jiaju001/news/include/dialoguser/all_medias.htm | HTML | asf20 | 6,384 |
<?php
require_once(dirname(__FILE__)."/config.php");
if(empty($mediatype)) $mediatype = 2;
require_once(dirname(__FILE__)."/all_medias.php");
?> | zyyhong | trunk/jiaju001/news/include/dialoguser/select_media.php | PHP | asf20 | 148 |
<?php
require_once(dirname(__FILE__)."/config.php");
if(empty($mediatype)) $mediatype = 4;
require_once(dirname(__FILE__)."/all_medias.php");
?> | zyyhong | trunk/jiaju001/news/include/dialoguser/select_soft.php | PHP | asf20 | 148 |
<!--
self.onError=null;
currentX = currentY = 0;
whichIt = null;
lastScrollX = 0; lastScrollY = 0;
NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1: 0;
function heartBeat()
{
if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; }
if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; }
if(diffY != lastScrollY)
{
percent = .1 * (diffY - lastScrollY);
if(percent > 0) percent = Math.ceil(percent);
else percent = Math.floor(percent);
if(IE) document.all.floater.style.pixelTop += percent;
if(NS) document.floater.top += percent;
lastScrollY = lastScrollY + percent;
}
if(diffX != lastScrollX)
{
percent = .1 * (diffX - lastScrollX);
if(percent > 0) percent = Math.ceil(percent);
else percent = Math.floor(percent);
if(IE) document.all.floater.style.pixelLeft += percent;
if(NS) document.floater.left += percent;
lastScrollX = lastScrollX + percent;
}
}
function checkFocus(x,y)
{
stalkerx = document.floater.pageX;
stalkery = document.floater.pageY;
stalkerwidth = document.floater.clip.width;
stalkerheight = document.floater.clip.height;
if( (x > stalkerx && x < (stalkerx+stalkerwidth)) && (y > stalkery && y < (stalkery+stalkerheight))) return true;
else return false;
}
function grabIt(e) {
if(IE)
{
whichIt = event.srcElement;
while (whichIt.id.indexOf("floater") == -1)
{
whichIt = whichIt.parentElement;
if (whichIt == null) { return true; }
}
whichIt.style.pixelLeft = whichIt.offsetLeft;
whichIt.style.pixelTop = whichIt.offsetTop;
currentX = (event.clientX + document.body.scrollLeft);
currentY = (event.clientY + document.body.scrollTop);
}
else
{
window.captureEvents(Event.MOUSEMOVE);
if(checkFocus (e.pageX,e.pageY))
{
whichIt = document.floater;
StalkerTouchedX = e.pageX-document.floater.pageX;
StalkerTouchedY = e.pageY-document.floater.pageY;
}
}
return true;
}
function moveIt(e) {
if (whichIt == null) { return false; }
if(IE) {
newX = (event.clientX + document.body.scrollLeft);
newY = (event.clientY + document.body.scrollTop);
distanceX = (newX - currentX); distanceY = (newY - currentY);
currentX = newX; currentY = newY;
whichIt.style.pixelLeft += distanceX;
whichIt.style.pixelTop += distanceY;
if(whichIt.style.pixelTop < document.body.scrollTop) whichIt.style.pixelTop = document.body.scrollTop;
if(whichIt.style.pixelLeft < document.body.scrollLeft) whichIt.style.pixelLeft = document.body.scrollLeft;
if(whichIt.style.pixelLeft > document.body.offsetWidth - document.body.scrollLeft - whichIt.style.pixelWidth - 20) whichIt.style.pixelLeft = document.body.offsetWidth - whichIt.style.pixelWidth - 20;
if(whichIt.style.pixelTop > document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5) whichIt.style.pixelTop = document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5;
event.returnValue = false;
}
else
{
whichIt.moveTo(e.pageX-StalkerTouchedX,e.pageY-StalkerTouchedY);
if(whichIt.left < 0+self.pageXOffset) whichIt.left = 0+self.pageXOffset;
if(whichIt.top < 0+self.pageYOffset) whichIt.top = 0+self.pageYOffset;
if( (whichIt.left + whichIt.clip.width) >= (window.innerWidth+self.pageXOffset-17)) whichIt.left = ((window.innerWidth+self.pageXOffset)-whichIt.clip.width)-17;
if( (whichIt.top + whichIt.clip.height) >= (window.innerHeight+self.pageYOffset+50)) whichIt.top = ((window.innerHeight+self.pageYOffset)-whichIt.clip.height)-17;
return false;
}
return false;
}
function dropIt() {
whichIt = null;
if(NS) window.releaseEvents (Event.MOUSEMOVE);
return true;
}
if(NS) {
window.captureEvents(Event.MOUSEUPEvent.MOUSEDOWN);
window.onmousedown = grabIt;
window.onmousemove = moveIt;
window.onmouseup = dropIt;
}
if(IE) {
document.onmousedown = grabIt;
document.onmousemove = moveIt;
document.onmouseup = dropIt;
}
if(NS || IE) action = window.setInterval("heartBeat()",1);
--> | zyyhong | trunk/jiaju001/news/include/dialoguser/float.js | JavaScript | asf20 | 4,203 |
<?php
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__)."/../inc_photograph.php");
if(empty($job)) $job = "";
CheckUserSpace($cfg_ml->M_ID);
//检测或创建用户目录
$rootdir = $cfg_user_dir."/".$cfg_ml->M_ID;
if(!is_dir($cfg_basedir.$rootdir)){
CreateDir($rootdir);
CloseFtp();
}
if(empty($uploadfile)) $uploadfile="";
if(!is_uploaded_file($uploadfile)){
ShowMsg("你没有选择上传的文件!","-1");
exit();
}
if($uploadfile_size > $cfg_mb_upload_size*1024){
@unlink(is_uploaded_file($uploadfile));
ShowMsg("你上传的文件超过了{$cfg_mb_upload_size}K,不允许上传!","-1");
exit();
}
if(!CheckAddonType($uploadfile_name)){
ShowMsg("你所上传的文件类型被禁止,系统只允许上传<br>".$cfg_mb_mediatype." 类型附件!","-1");
exit();
}
$fs = explode(".",$uploadfile_name);
$sname = trim($fs[count($fs)-1]);
if($sname==''){
ShowMsg("你所上传的文件无法识别,系统禁止上传<br />","-1");
exit();
}
$nowtme = time();
$filename_name = dd2char($cfg_ml->M_ID."0".strftime("%y%m%d%H%M%S",$nowtme)."0".mt_rand(1000,9999));
$filename = $filename_name.".".$sname; //这里用不带目录的文件名作标题
$fileurl = $rootdir."/".$filename;
$fullfilename = $cfg_basedir.$fileurl;
//严格检查最终的文件名
if(!CheckAddonType($fullfilename) || eregi("\.(php|asp|pl|shtml|jsp|cgi|aspx)",$fullfilename)){
ShowMsg("你所上传的文件类型被禁止,系统只允许上传<br>".$cfg_mb_mediatype." 类型附件!","-1");
exit();
}
@move_uploaded_file($uploadfile,$fullfilename);
//if(empty($resize)) $resize = 0;
$imgwidthValue = 0;
$imgheightValue = 0;
if(in_array($uploadfile_type,$cfg_photo_typenames)){
$info = "";
$sizes[0] = 0; $sizes[1] = 0;
@$sizes = getimagesize($fullfilename,$info);
$imgwidthValue = $sizes[0];
$imgheightValue = $sizes[1];
}
$fsize = filesize($fullfilename);
if(eregi('image',$uploadfile_type)) $ftype = 1;
else if(eregi('audio|video',$uploadfile_type))$ftype = 2;
else if($uploadfile_type=='application/x-shockwave-flash'||$sname=='swf') $ftype = 3;
else $ftype = 4;
if(empty($title)) $title = $filename;
$inquery = "
INSERT INTO #@__uploads(title,url,mediatype,width,height,playtime,filesize,uptime,adminid,memberid)
VALUES ('$title','$fileurl','$ftype','$imgwidthValue','$imgheightValue','0','$fsize','$nowtme','0','{$cfg_ml->M_ID}');
";
$dsql = new DedeSql(false);
$dsql->ExecuteNoneQuery($inquery);
$dsql->Close();
if(empty($ENV_GOBACK_URL)) $ENV_GOBACK_URL = "all_medias.php";
@unlink($uploadfile);
ShowMsg("成功上传附件!",$ENV_GOBACK_URL);
exit();
?> | zyyhong | trunk/jiaju001/news/include/dialoguser/medias_upload.php | PHP | asf20 | 2,754 |
/*Copyright Mihai Bazon, 2002, 2003|http://dynarch.com/mishoo/ */
Calendar = function (mondayFirst, dateStr, onSelected, onClose) {
// member variables
this.activeDiv = null;
this.currentDateEl = null;
this.getDateStatus = null;
this.timeout = null;
this.onSelected = onSelected || null;
this.onClose = onClose || null;
this.dragging = false;
this.hidden = false;
this.minYear = 1970;
this.maxYear = 2050;
this.dateFormat = Calendar._TT["DEF_DATE_FORMAT"];
this.ttDateFormat = Calendar._TT["TT_DATE_FORMAT"];
this.isPopup = true;
this.weekNumbers = true;
this.mondayFirst = mondayFirst;
this.dateStr = dateStr;
this.ar_days = null;
this.showsTime = false;
this.time24 = true;
// HTML elements
this.table = null;
this.element = null;
this.tbody = null;
this.firstdayname = null;
// Combo boxes
this.monthsCombo = null;
this.yearsCombo = null;
this.hilitedMonth = null;
this.activeMonth = null;
this.hilitedYear = null;
this.activeYear = null;
// Information
this.dateClicked = false;
// one-time initializations
if (typeof Calendar._SDN == "undefined") {
// table of short day names
if (typeof Calendar._SDN_len == "undefined")
Calendar._SDN_len = 3;
var ar = new Array();
for (var i = 8; i > 0;) {
ar[--i] = Calendar._DN[i].substr(0, Calendar._SDN_len);
}
Calendar._SDN = ar;
// table of short month names
if (typeof Calendar._SMN_len == "undefined")
Calendar._SMN_len = 3;
ar = new Array();
for (var i = 12; i > 0;) {
ar[--i] = Calendar._MN[i].substr(0, Calendar._SMN_len);
}
Calendar._SMN = ar;
}
};
// ** constants
/// "static", needed for event handlers.
Calendar._C = null;
/// detect a special case of "web browser"
Calendar.is_ie = ( /msie/i.test(navigator.userAgent) &&
!/opera/i.test(navigator.userAgent) );
/// detect Opera browser
Calendar.is_opera = /opera/i.test(navigator.userAgent);
/// detect KHTML-based browsers
Calendar.is_khtml = /Konqueror|Safari|KHTML/i.test(navigator.userAgent);
// BEGIN: UTILITY FUNCTIONS; beware that these might be moved into a separate
//library, at some point.
Calendar.getAbsolutePos = function(el) {
var SL = 0, ST = 0;
var is_div = /^div$/i.test(el.tagName);
if (is_div && el.scrollLeft)
SL = el.scrollLeft;
if (is_div && el.scrollTop)
ST = el.scrollTop;
var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST };
if (el.offsetParent) {
var tmp = Calendar.getAbsolutePos(el.offsetParent);
r.x += tmp.x;
r.y += tmp.y;
}
return r;
};
Calendar.isRelated = function (el, evt) {
var related = evt.relatedTarget;
if (!related) {
var type = evt.type;
if (type == "mouseover") {
related = evt.fromElement;
} else if (type == "mouseout") {
related = evt.toElement;
}
}
while (related) {
if (related == el) {
return true;
}
related = related.parentNode;
}
return false;
};
Calendar.removeClass = function(el, className) {
if (!(el && el.className)) {
return;
}
var cls = el.className.split(" ");
var ar = new Array();
for (var i = cls.length; i > 0;) {
if (cls[--i] != className) {
ar[ar.length] = cls[i];
}
}
el.className = ar.join(" ");
};
Calendar.addClass = function(el, className) {
Calendar.removeClass(el, className);
el.className += " " + className;
};
Calendar.getElement = function(ev) {
if (Calendar.is_ie) {
return window.event.srcElement;
} else {
return ev.currentTarget;
}
};
Calendar.getTargetElement = function(ev) {
if (Calendar.is_ie) {
return window.event.srcElement;
} else {
return ev.target;
}
};
Calendar.stopEvent = function(ev) {
ev || (ev = window.event);
if (Calendar.is_ie) {
ev.cancelBubble = true;
ev.returnValue = false;
} else {
ev.preventDefault();
ev.stopPropagation();
}
return false;
};
Calendar.addEvent = function(el, evname, func) {
if (el.attachEvent) { // IE
el.attachEvent("on" + evname, func);
} else if (el.addEventListener) { // Gecko / W3C
el.addEventListener(evname, func, true);
} else {
el["on" + evname] = func;
}
};
Calendar.removeEvent = function(el, evname, func) {
if (el.detachEvent) { // IE
el.detachEvent("on" + evname, func);
} else if (el.removeEventListener) { // Gecko / W3C
el.removeEventListener(evname, func, true);
} else {
el["on" + evname] = null;
}
};
Calendar.createElement = function(type, parent) {
var el = null;
if (document.createElementNS) {
// use the XHTML namespace; IE won't normally get here unless
// _they_ "fix" the DOM2 implementation.
el = document.createElementNS("http://www.w3.org/1999/xhtml", type);
} else {
el = document.createElement(type);
}
if (typeof parent != "undefined") {
parent.appendChild(el);
}
return el;
};
// END: UTILITY FUNCTIONS
// BEGIN: CALENDAR STATIC FUNCTIONS
/** Internal -- adds a set of events to make some element behave like a button. */
Calendar._add_evs = function(el) {
with (Calendar) {
addEvent(el, "mouseover", dayMouseOver);
addEvent(el, "mousedown", dayMouseDown);
addEvent(el, "mouseout", dayMouseOut);
if (is_ie) {
addEvent(el, "dblclick", dayMouseDblClick);
el.setAttribute("unselectable", true);
}
}
};
Calendar.findMonth = function(el) {
if (typeof el.month != "undefined") {
return el;
} else if (typeof el.parentNode.month != "undefined") {
return el.parentNode;
}
return null;
};
Calendar.findYear = function(el) {
if (typeof el.year != "undefined") {
return el;
} else if (typeof el.parentNode.year != "undefined") {
return el.parentNode;
}
return null;
};
Calendar.showMonthsCombo = function () {
var cal = Calendar._C;
if (!cal) {
return false;
}
var cal = cal;
var cd = cal.activeDiv;
var mc = cal.monthsCombo;
if (cal.hilitedMonth) {
Calendar.removeClass(cal.hilitedMonth, "hilite");
}
if (cal.activeMonth) {
Calendar.removeClass(cal.activeMonth, "active");
}
var mon = cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()];
Calendar.addClass(mon, "active");
cal.activeMonth = mon;
var s = mc.style;
s.display = "block";
if (cd.navtype < 0)
s.left = cd.offsetLeft + "px";
else
s.left = (cd.offsetLeft + cd.offsetWidth - mc.offsetWidth) + "px";
s.top = (cd.offsetTop + cd.offsetHeight) + "px";
};
Calendar.showYearsCombo = function (fwd) {
var cal = Calendar._C;
if (!cal) {
return false;
}
var cal = cal;
var cd = cal.activeDiv;
var yc = cal.yearsCombo;
if (cal.hilitedYear) {
Calendar.removeClass(cal.hilitedYear, "hilite");
}
if (cal.activeYear) {
Calendar.removeClass(cal.activeYear, "active");
}
cal.activeYear = null;
var Y = cal.date.getFullYear() + (fwd ? 1 : -1);
var yr = yc.firstChild;
var show = false;
for (var i = 12; i > 0; --i) {
if (Y >= cal.minYear && Y <= cal.maxYear) {
yr.firstChild.data = Y;
yr.year = Y;
yr.style.display = "block";
show = true;
} else {
yr.style.display = "none";
}
yr = yr.nextSibling;
Y += fwd ? 2 : -2;
}
if (show) {
var s = yc.style;
s.display = "block";
if (cd.navtype < 0)
s.left = cd.offsetLeft + "px";
else
s.left = (cd.offsetLeft + cd.offsetWidth - yc.offsetWidth) + "px";
s.top = (cd.offsetTop + cd.offsetHeight) + "px";
}
};
// event handlers
Calendar.tableMouseUp = function(ev) {
var cal = Calendar._C;
if (!cal) {
return false;
}
if (cal.timeout) {
clearTimeout(cal.timeout);
}
var el = cal.activeDiv;
if (!el) {
return false;
}
var target = Calendar.getTargetElement(ev);
ev || (ev = window.event);
Calendar.removeClass(el, "active");
if (target == el || target.parentNode == el) {
Calendar.cellClick(el, ev);
}
var mon = Calendar.findMonth(target);
var date = null;
if (mon) {
date = new Date(cal.date);
if (mon.month != date.getMonth()) {
date.setMonth(mon.month);
cal.setDate(date);
cal.dateClicked = false;
cal.callHandler();
}
} else {
var year = Calendar.findYear(target);
if (year) {
date = new Date(cal.date);
if (year.year != date.getFullYear()) {
date.setFullYear(year.year);
cal.setDate(date);
cal.dateClicked = false;
cal.callHandler();
}
}
}
with (Calendar) {
removeEvent(document, "mouseup", tableMouseUp);
removeEvent(document, "mouseover", tableMouseOver);
removeEvent(document, "mousemove", tableMouseOver);
cal._hideCombos();
_C = null;
return stopEvent(ev);
}
};
Calendar.tableMouseOver = function (ev) {
var cal = Calendar._C;
if (!cal) {
return;
}
var el = cal.activeDiv;
var target = Calendar.getTargetElement(ev);
if (target == el || target.parentNode == el) {
Calendar.addClass(el, "hilite active");
Calendar.addClass(el.parentNode, "rowhilite");
} else {
if (typeof el.navtype == "undefined" || (el.navtype != 50 && (el.navtype == 0 || Math.abs(el.navtype) > 2)))
Calendar.removeClass(el, "active");
Calendar.removeClass(el, "hilite");
Calendar.removeClass(el.parentNode, "rowhilite");
}
ev || (ev = window.event);
if (el.navtype == 50 && target != el) {
var pos = Calendar.getAbsolutePos(el);
var w = el.offsetWidth;
var x = ev.clientX;
var dx;
var decrease = true;
if (x > pos.x + w) {
dx = x - pos.x - w;
decrease = false;
} else
dx = pos.x - x;
if (dx < 0) dx = 0;
var range = el._range;
var current = el._current;
var count = Math.floor(dx / 10) % range.length;
for (var i = range.length; --i >= 0;)
if (range[i] == current)
break;
while (count-- > 0)
if (decrease) {
if (!(--i in range))
i = range.length - 1;
} else if (!(++i in range))
i = 0;
var newval = range[i];
el.firstChild.data = newval;
cal.onUpdateTime();
}
var mon = Calendar.findMonth(target);
if (mon) {
if (mon.month != cal.date.getMonth()) {
if (cal.hilitedMonth) {
Calendar.removeClass(cal.hilitedMonth, "hilite");
}
Calendar.addClass(mon, "hilite");
cal.hilitedMonth = mon;
} else if (cal.hilitedMonth) {
Calendar.removeClass(cal.hilitedMonth, "hilite");
}
} else {
if (cal.hilitedMonth) {
Calendar.removeClass(cal.hilitedMonth, "hilite");
}
var year = Calendar.findYear(target);
if (year) {
if (year.year != cal.date.getFullYear()) {
if (cal.hilitedYear) {
Calendar.removeClass(cal.hilitedYear, "hilite");
}
Calendar.addClass(year, "hilite");
cal.hilitedYear = year;
} else if (cal.hilitedYear) {
Calendar.removeClass(cal.hilitedYear, "hilite");
}
} else if (cal.hilitedYear) {
Calendar.removeClass(cal.hilitedYear, "hilite");
}
}
return Calendar.stopEvent(ev);
};
Calendar.tableMouseDown = function (ev) {
if (Calendar.getTargetElement(ev) == Calendar.getElement(ev)) {
return Calendar.stopEvent(ev);
}
};
Calendar.calDragIt = function (ev) {
var cal = Calendar._C;
if (!(cal && cal.dragging)) {
return false;
}
var posX;
var posY;
if (Calendar.is_ie) {
posY = window.event.clientY + document.body.scrollTop;
posX = window.event.clientX + document.body.scrollLeft;
} else {
posX = ev.pageX;
posY = ev.pageY;
}
cal.hideShowCovered();
var st = cal.element.style;
st.left = (posX - cal.xOffs) + "px";
st.top = (posY - cal.yOffs) + "px";
return Calendar.stopEvent(ev);
};
Calendar.calDragEnd = function (ev) {
var cal = Calendar._C;
if (!cal) {
return false;
}
cal.dragging = false;
with (Calendar) {
removeEvent(document, "mousemove", calDragIt);
removeEvent(document, "mouseover", stopEvent);
removeEvent(document, "mouseup", calDragEnd);
tableMouseUp(ev);
}
cal.hideShowCovered();
};
Calendar.dayMouseDown = function(ev) {
var el = Calendar.getElement(ev);
if (el.disabled) {
return false;
}
var cal = el.calendar;
cal.activeDiv = el;
Calendar._C = cal;
if (el.navtype != 300) with (Calendar) {
if (el.navtype == 50)
el._current = el.firstChild.data;
addClass(el, "hilite active");
addEvent(document, "mouseover", tableMouseOver);
addEvent(document, "mousemove", tableMouseOver);
addEvent(document, "mouseup", tableMouseUp);
} else if (cal.isPopup) {
cal._dragStart(ev);
}
if (el.navtype == -1 || el.navtype == 1) {
if (cal.timeout) clearTimeout(cal.timeout);
cal.timeout = setTimeout("Calendar.showMonthsCombo()", 250);
} else if (el.navtype == -2 || el.navtype == 2) {
if (cal.timeout) clearTimeout(cal.timeout);
cal.timeout = setTimeout((el.navtype > 0) ? "Calendar.showYearsCombo(true)" : "Calendar.showYearsCombo(false)", 250);
} else {
cal.timeout = null;
}
return Calendar.stopEvent(ev);
};
Calendar.dayMouseDblClick = function(ev) {
Calendar.cellClick(Calendar.getElement(ev), ev || window.event);
if (Calendar.is_ie) {
document.selection.empty();
}
};
Calendar.dayMouseOver = function(ev) {
var el = Calendar.getElement(ev);
if (Calendar.isRelated(el, ev) || Calendar._C || el.disabled) {
return false;
}
if (el.ttip) {
if (el.ttip.substr(0, 1) == "_") {
var date = null;
with (el.calendar.date) {
date = new Date(getFullYear(), getMonth(), el.caldate);
}
el.ttip = date.print(el.calendar.ttDateFormat) + el.ttip.substr(1);
}
el.calendar.tooltips.firstChild.data = el.ttip;
}
if (el.navtype != 300) {
Calendar.addClass(el, "hilite");
if (el.caldate) {
Calendar.addClass(el.parentNode, "rowhilite");
}
}
return Calendar.stopEvent(ev);
};
Calendar.dayMouseOut = function(ev) {
with (Calendar) {
var el = getElement(ev);
if (isRelated(el, ev) || _C || el.disabled) {
return false;
}
removeClass(el, "hilite");
if (el.caldate) {
removeClass(el.parentNode, "rowhilite");
}
el.calendar.tooltips.firstChild.data = _TT["SEL_DATE"];
return stopEvent(ev);
}
};
/**
*A generic "click" handler :) handles all types of buttons defined in this
*calendar.
*/
Calendar.cellClick = function(el, ev) {
var cal = el.calendar;
var closing = false;
var newdate = false;
var date = null;
if (typeof el.navtype == "undefined") {
Calendar.removeClass(cal.currentDateEl, "selected");
Calendar.addClass(el, "selected");
closing = (cal.currentDateEl == el);
if (!closing) {
cal.currentDateEl = el;
}
cal.date.setDate(el.caldate);
date = cal.date;
newdate = true;
// a date was clicked
cal.dateClicked = true;
} else {
if (el.navtype == 200) {
Calendar.removeClass(el, "hilite");
cal.callCloseHandler();
return;
}
date = (el.navtype == 0) ? new Date() : new Date(cal.date);
// unless "today" was clicked, we assume no date was clicked so
// the selected handler will know not to close the calenar when
// in single-click mode.
// cal.dateClicked = (el.navtype == 0);
cal.dateClicked = false;
var year = date.getFullYear();
var mon = date.getMonth();
function setMonth(m) {
var day = date.getDate();
var max = date.getMonthDays(m);
if (day > max) {
date.setDate(max);
}
date.setMonth(m);
};
switch (el.navtype) {
case 400:
Calendar.removeClass(el, "hilite");
var text = Calendar._TT["ABOUT"];
if (typeof text != "undefined") {
text += cal.showsTime ? Calendar._TT["ABOUT_TIME"] : "";
} else {
// FIXME: this should be removed as soon as lang files get updated!
text = "Help and about box text is not translated into this language.\n" +
"If you know this language and you feel generous please update\n" +
"the corresponding file in \"lang\" subdir to match calendar-en.js\n" +
"and send it back to <mishoo@infoiasi.ro> to get it into the distribution;-)\n\n" +
"Thank you!\n" +
"http://dynarch.com/mishoo/calendar.epl\n";
}
alert(text);
return;
case -2:
if (year > cal.minYear) {
date.setFullYear(year - 1);
}
break;
case -1:
if (mon > 0) {
setMonth(mon - 1);
} else if (year-- > cal.minYear) {
date.setFullYear(year);
setMonth(11);
}
break;
case 1:
if (mon < 11) {
setMonth(mon + 1);
} else if (year < cal.maxYear) {
date.setFullYear(year + 1);
setMonth(0);
}
break;
case 2:
if (year < cal.maxYear) {
date.setFullYear(year + 1);
}
break;
case 100:
cal.setMondayFirst(!cal.mondayFirst);
return;
case 50:
var range = el._range;
var current = el.firstChild.data;
for (var i = range.length; --i >= 0;)
if (range[i] == current)
break;
if (ev && ev.shiftKey) {
if (!(--i in range))
i = range.length - 1;
} else if (!(++i in range))
i = 0;
var newval = range[i];
el.firstChild.data = newval;
cal.onUpdateTime();
return;
case 0:
// TODAY will bring us here
if ((typeof cal.getDateStatus == "function") && cal.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate())) {
// remember, "date" was previously set to new
// Date() if TODAY was clicked; thus, it
// contains today date.
return false;
}
break;
}
if (!date.equalsTo(cal.date)) {
cal.setDate(date);
newdate = true;
}
}
if (newdate) {
cal.callHandler();
}
if (closing) {
Calendar.removeClass(el, "hilite");
cal.callCloseHandler();
}
};
// END: CALENDAR STATIC FUNCTIONS
// BEGIN: CALENDAR OBJECT FUNCTIONS
/**
*This function creates the calendar inside the given parent.If _par is
*null than it creates a popup calendar inside the BODY element.If _par is
*an element, be it BODY, then it creates a non-popup calendar (still
*hidden).Some properties need to be set before calling this function.
*/
Calendar.prototype.create = function (_par) {
var parent = null;
if (! _par) {
// default parent is the document body, in which case we create
// a popup calendar.
parent = document.getElementsByTagName("body")[0];
this.isPopup = true;
} else {
parent = _par;
this.isPopup = false;
}
this.date = this.dateStr ? new Date(this.dateStr) : new Date();
var table = Calendar.createElement("table");
this.table = table;
table.cellSpacing = 0;
table.cellPadding = 0;
table.calendar = this;
Calendar.addEvent(table, "mousedown", Calendar.tableMouseDown);
var div = Calendar.createElement("div");
this.element = div;
div.className = "calendar";
if (this.isPopup) {
div.style.position = "absolute";
div.style.display = "none";
}
div.appendChild(table);
var thead = Calendar.createElement("thead", table);
var cell = null;
var row = null;
var cal = this;
var hh = function (text, cs, navtype) {
cell = Calendar.createElement("td", row);
cell.colSpan = cs;
cell.className = "button";
if (navtype != 0 && Math.abs(navtype) <= 2)
cell.className += " nav";
Calendar._add_evs(cell);
cell.calendar = cal;
cell.navtype = navtype;
if (text.substr(0, 1) != "&") {
cell.appendChild(document.createTextNode(text));
}
else {
// FIXME: dirty hack for entities
cell.innerHTML = text;
}
return cell;
};
row = Calendar.createElement("tr", thead);
var title_length = 6;
(this.isPopup) && --title_length;
(this.weekNumbers) && ++title_length;
hh("?", 1, 400).ttip = Calendar._TT["INFO"];
this.title = hh("", title_length, 300);
this.title.className = "title";
if (this.isPopup) {
this.title.ttip = Calendar._TT["DRAG_TO_MOVE"];
this.title.style.cursor = "move";
hh("×", 1, 200).ttip = Calendar._TT["CLOSE"];
}
row = Calendar.createElement("tr", thead);
row.className = "headrow";
this._nav_py = hh("«", 1, -2);
this._nav_py.ttip = Calendar._TT["PREV_YEAR"];
this._nav_pm = hh("‹", 1, -1);
this._nav_pm.ttip = Calendar._TT["PREV_MONTH"];
this._nav_now = hh(Calendar._TT["TODAY"], this.weekNumbers ? 4 : 3, 0);
this._nav_now.ttip = Calendar._TT["GO_TODAY"];
this._nav_nm = hh("›", 1, 1);
this._nav_nm.ttip = Calendar._TT["NEXT_MONTH"];
this._nav_ny = hh("»", 1, 2);
this._nav_ny.ttip = Calendar._TT["NEXT_YEAR"];
// day names
row = Calendar.createElement("tr", thead);
row.className = "daynames";
if (this.weekNumbers) {
cell = Calendar.createElement("td", row);
cell.className = "name wn";
cell.appendChild(document.createTextNode(Calendar._TT["WK"]));
}
for (var i = 7; i > 0; --i) {
cell = Calendar.createElement("td", row);
cell.appendChild(document.createTextNode(""));
if (!i) {
cell.navtype = 100;
cell.calendar = this;
Calendar._add_evs(cell);
}
}
this.firstdayname = (this.weekNumbers) ? row.firstChild.nextSibling : row.firstChild;
this._displayWeekdays();
var tbody = Calendar.createElement("tbody", table);
this.tbody = tbody;
for (i = 6; i > 0; --i) {
row = Calendar.createElement("tr", tbody);
if (this.weekNumbers) {
cell = Calendar.createElement("td", row);
cell.appendChild(document.createTextNode(""));
}
for (var j = 7; j > 0; --j) {
cell = Calendar.createElement("td", row);
cell.appendChild(document.createTextNode(""));
cell.calendar = this;
Calendar._add_evs(cell);
}
}
if (this.showsTime) {
row = Calendar.createElement("tr", tbody);
row.className = "time";
cell = Calendar.createElement("td", row);
cell.className = "time";
cell.colSpan = 2;
cell.innerHTML = " ";
cell = Calendar.createElement("td", row);
cell.className = "time";
cell.colSpan = this.weekNumbers ? 4 : 3;
(function(){
function makeTimePart(className, init, range_start, range_end) {
var part = Calendar.createElement("span", cell);
part.className = className;
part.appendChild(document.createTextNode(init));
part.calendar = cal;
part.ttip = Calendar._TT["TIME_PART"];
part.navtype = 50;
part._range = [];
if (typeof range_start != "number")
part._range = range_start;
else {
for (var i = range_start; i <= range_end; ++i) {
var txt;
if (i < 10 && range_end >= 10) txt = '0' + i;
else txt = '' + i;
part._range[part._range.length] = txt;
}
}
Calendar._add_evs(part);
return part;
};
var hrs = cal.date.getHours();
var mins = cal.date.getMinutes();
var t12 = !cal.time24;
var pm = (hrs > 12);
if (t12 && pm) hrs -= 12;
var H = makeTimePart("hour", hrs, t12 ? 1 : 0, t12 ? 12 : 23);
var span = Calendar.createElement("span", cell);
span.appendChild(document.createTextNode(":"));
span.className = "colon";
var M = makeTimePart("minute", mins, 0, 59);
var AP = null;
cell = Calendar.createElement("td", row);
cell.className = "time";
cell.colSpan = 2;
if (t12)
AP = makeTimePart("ampm", pm ? "pm" : "am", ["am", "pm"]);
else
cell.innerHTML = " ";
cal.onSetTime = function() {
var hrs = this.date.getHours();
var mins = this.date.getMinutes();
var pm = (hrs > 12);
if (pm && t12) hrs -= 12;
H.firstChild.data = (hrs < 10) ? ("0" + hrs) : hrs;
M.firstChild.data = (mins < 10) ? ("0" + mins) : mins;
if (t12)
AP.firstChild.data = pm ? "pm" : "am";
};
cal.onUpdateTime = function() {
var date = this.date;
var h = parseInt(H.firstChild.data, 10);
if (t12) {
if (/pm/i.test(AP.firstChild.data) && h < 12)
h += 12;
else if (/am/i.test(AP.firstChild.data) && h == 12)
h = 0;
}
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
date.setHours(h);
date.setMinutes(parseInt(M.firstChild.data, 10));
date.setFullYear(y);
date.setMonth(m);
date.setDate(d);
this.dateClicked = false;
this.callHandler();
};
})();
} else {
this.onSetTime = this.onUpdateTime = function() {};
}
var tfoot = Calendar.createElement("tfoot", table);
row = Calendar.createElement("tr", tfoot);
row.className = "footrow";
cell = hh(Calendar._TT["SEL_DATE"], this.weekNumbers ? 8 : 7, 300);
cell.className = "ttip";
if (this.isPopup) {
cell.ttip = Calendar._TT["DRAG_TO_MOVE"];
cell.style.cursor = "move";
}
this.tooltips = cell;
div = Calendar.createElement("div", this.element);
this.monthsCombo = div;
div.className = "combo";
for (i = 0; i < Calendar._MN.length; ++i) {
var mn = Calendar.createElement("div");
mn.className = Calendar.is_ie ? "label-IEfix" : "label";
mn.month = i;
mn.appendChild(document.createTextNode(Calendar._SMN[i]));
div.appendChild(mn);
}
div = Calendar.createElement("div", this.element);
this.yearsCombo = div;
div.className = "combo";
for (i = 12; i > 0; --i) {
var yr = Calendar.createElement("div");
yr.className = Calendar.is_ie ? "label-IEfix" : "label";
yr.appendChild(document.createTextNode(""));
div.appendChild(yr);
}
this._init(this.mondayFirst, this.date);
parent.appendChild(this.element);
};
/** keyboard navigation, only for popup calendars */
Calendar._keyEvent = function(ev) {
if (!window.calendar) {
return false;
}
(Calendar.is_ie) && (ev = window.event);
var cal = window.calendar;
var act = (Calendar.is_ie || ev.type == "keypress");
if (ev.ctrlKey) {
switch (ev.keyCode) {
case 37: // KEY left
act && Calendar.cellClick(cal._nav_pm);
break;
case 38: // KEY up
act && Calendar.cellClick(cal._nav_py);
break;
case 39: // KEY right
act && Calendar.cellClick(cal._nav_nm);
break;
case 40: // KEY down
act && Calendar.cellClick(cal._nav_ny);
break;
default:
return false;
}
} else switch (ev.keyCode) {
case 32: // KEY space (now)
Calendar.cellClick(cal._nav_now);
break;
case 27: // KEY esc
act && cal.hide();
break;
case 37: // KEY left
case 38: // KEY up
case 39: // KEY right
case 40: // KEY down
if (act) {
var date = cal.date.getDate() - 1;
var el = cal.currentDateEl;
var ne = null;
var prev = (ev.keyCode == 37) || (ev.keyCode == 38);
switch (ev.keyCode) {
case 37: // KEY left
(--date >= 0) && (ne = cal.ar_days[date]);
break;
case 38: // KEY up
date -= 7;
(date >= 0) && (ne = cal.ar_days[date]);
break;
case 39: // KEY right
(++date < cal.ar_days.length) && (ne = cal.ar_days[date]);
break;
case 40: // KEY down
date += 7;
(date < cal.ar_days.length) && (ne = cal.ar_days[date]);
break;
}
if (!ne) {
if (prev) {
Calendar.cellClick(cal._nav_pm);
} else {
Calendar.cellClick(cal._nav_nm);
}
date = (prev) ? cal.date.getMonthDays() : 1;
el = cal.currentDateEl;
ne = cal.ar_days[date - 1];
}
Calendar.removeClass(el, "selected");
Calendar.addClass(ne, "selected");
cal.date.setDate(ne.caldate);
cal.callHandler();
cal.currentDateEl = ne;
}
break;
case 13: // KEY enter
if (act) {
cal.callHandler();
cal.hide();
}
break;
default:
return false;
}
return Calendar.stopEvent(ev);
};
/**
*(RE)Initializes the calendar to the given date and style (if mondayFirst is
*true it makes Monday the first day of week, otherwise the weeks start on
*Sunday.
*/
Calendar.prototype._init = function (mondayFirst, date) {
var today = new Date();
var year = date.getFullYear();
if (year < this.minYear) {
year = this.minYear;
date.setFullYear(year);
} else if (year > this.maxYear) {
year = this.maxYear;
date.setFullYear(year);
}
this.mondayFirst = mondayFirst;
this.date = new Date(date);
var month = date.getMonth();
var mday = date.getDate();
var no_days = date.getMonthDays();
date.setDate(1);
var wday = date.getDay();
var MON = mondayFirst ? 1 : 0;
var SAT = mondayFirst ? 5 : 6;
var SUN = mondayFirst ? 6 : 0;
if (mondayFirst) {
wday = (wday > 0) ? (wday - 1) : 6;
}
var iday = 1;
var row = this.tbody.firstChild;
var MN = Calendar._SMN[month];
var hasToday = ((today.getFullYear() == year) && (today.getMonth() == month));
var todayDate = today.getDate();
var week_number = date.getWeekNumber();
var ar_days = new Array();
for (var i = 0; i < 6; ++i) {
if (iday > no_days) {
row.className = "emptyrow";
row = row.nextSibling;
continue;
}
var cell = row.firstChild;
if (this.weekNumbers) {
cell.className = "day wn";
cell.firstChild.data = week_number;
cell = cell.nextSibling;
}
++week_number;
row.className = "daysrow";
for (var j = 0; j < 7; ++j) {
cell.className = "day";
if ((!i && j < wday) || iday > no_days) {
// cell.className = "emptycell";
cell.innerHTML = " ";
cell.disabled = true;
cell = cell.nextSibling;
continue;
}
cell.disabled = false;
cell.firstChild.data = iday;
if (typeof this.getDateStatus == "function") {
date.setDate(iday);
var status = this.getDateStatus(date, year, month, iday);
if (status === true) {
cell.className += " disabled";
cell.disabled = true;
} else {
if (/disabled/i.test(status))
cell.disabled = true;
cell.className += " " + status;
}
}
if (!cell.disabled) {
ar_days[ar_days.length] = cell;
cell.caldate = iday;
cell.ttip = "_";
if (iday == mday) {
cell.className += " selected";
this.currentDateEl = cell;
}
if (hasToday && (iday == todayDate)) {
cell.className += " today";
cell.ttip += Calendar._TT["PART_TODAY"];
}
if (wday == SAT || wday == SUN) {
cell.className += " weekend";
}
}
++iday;
((++wday) ^ 7) || (wday = 0);
cell = cell.nextSibling;
}
row = row.nextSibling;
}
this.ar_days = ar_days;
this.title.firstChild.data = Calendar._MN[month] + ", " + year;
this.onSetTime();
// PROFILE
// this.tooltips.firstChild.data = "Generated in " + ((new Date()) - today) + " ms";
};
/**
*Calls _init function above for going to a certain date (but only if the
*date is different than the currently selected one).
*/
Calendar.prototype.setDate = function (date) {
if (!date.equalsTo(this.date)) {
this._init(this.mondayFirst, date);
}
};
/**
*Refreshes the calendar.Useful if the "disabledHandler" function is
*dynamic, meaning that the list of disabled date can change at runtime.
*Just * call this function if you think that the list of disabled dates
*should * change.
*/
Calendar.prototype.refresh = function () {
this._init(this.mondayFirst, this.date);
};
/** Modifies the "mondayFirst" parameter (EU/US style). */
Calendar.prototype.setMondayFirst = function (mondayFirst) {
this._init(mondayFirst, this.date);
this._displayWeekdays();
};
/**
*Allows customization of what dates are enabled.The "unaryFunction"
*parameter must be a function object that receives the date (as a JS Date
*object) and returns a boolean value.If the returned value is true then
*the passed date will be marked as disabled.
*/
Calendar.prototype.setDateStatusHandler = Calendar.prototype.setDisabledHandler = function (unaryFunction) {
this.getDateStatus = unaryFunction;
};
/** Customization of allowed year range for the calendar. */
Calendar.prototype.setRange = function (a, z) {
this.minYear = a;
this.maxYear = z;
};
/** Calls the first user handler (selectedHandler). */
Calendar.prototype.callHandler = function () {
if (this.onSelected) {
this.onSelected(this, this.date.print(this.dateFormat));
}
};
/** Calls the second user handler (closeHandler). */
Calendar.prototype.callCloseHandler = function () {
if (this.onClose) {
this.onClose(this);
}
this.hideShowCovered();
};
/** Removes the calendar object from the DOM tree and destroys it. */
Calendar.prototype.destroy = function () {
var el = this.element.parentNode;
el.removeChild(this.element);
Calendar._C = null;
window.calendar = null;
};
/**
*Moves the calendar element to a different section in the DOM tree (changes
*its parent).
*/
Calendar.prototype.reparent = function (new_parent) {
var el = this.element;
el.parentNode.removeChild(el);
new_parent.appendChild(el);
};
// This gets called when the user presses a mouse button anywhere in the
// document, if the calendar is shown.If the click was outside the open
// calendar this function closes it.
Calendar._checkCalendar = function(ev) {
if (!window.calendar) {
return false;
}
var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev);
for (; el != null && el != calendar.element; el = el.parentNode);
if (el == null) {
// calls closeHandler which should hide the calendar.
window.calendar.callCloseHandler();
return Calendar.stopEvent(ev);
}
};
/** Shows the calendar. */
Calendar.prototype.show = function () {
var rows = this.table.getElementsByTagName("tr");
for (var i = rows.length; i > 0;) {
var row = rows[--i];
Calendar.removeClass(row, "rowhilite");
var cells = row.getElementsByTagName("td");
for (var j = cells.length; j > 0;) {
var cell = cells[--j];
Calendar.removeClass(cell, "hilite");
Calendar.removeClass(cell, "active");
}
}
this.element.style.display = "block";
this.hidden = false;
if (this.isPopup) {
window.calendar = this;
Calendar.addEvent(document, "keydown", Calendar._keyEvent);
Calendar.addEvent(document, "keypress", Calendar._keyEvent);
Calendar.addEvent(document, "mousedown", Calendar._checkCalendar);
}
this.hideShowCovered();
};
/**
*Hides the calendar.Also removes any "hilite" from the class of any TD
*element.
*/
Calendar.prototype.hide = function () {
if (this.isPopup) {
Calendar.removeEvent(document, "keydown", Calendar._keyEvent);
Calendar.removeEvent(document, "keypress", Calendar._keyEvent);
Calendar.removeEvent(document, "mousedown", Calendar._checkCalendar);
}
this.element.style.display = "none";
this.hidden = true;
this.hideShowCovered();
};
/**
*Shows the calendar at a given absolute position (beware that, depending on
*the calendar element style -- position property -- this might be relative
*to the parent's containing rectangle).
*/
Calendar.prototype.showAt = function (x, y) {
var s = this.element.style;
s.left = x + "px";
s.top = y + "px";
this.show();
};
/** Shows the calendar near a given element. */
Calendar.prototype.showAtElement = function (el, opts) {
var self = this;
var p = Calendar.getAbsolutePos(el);
if (!opts || typeof opts != "string") {
this.showAt(p.x, p.y + el.offsetHeight);
return true;
}
this.element.style.display = "block";
Calendar.continuation_for_the_fucking_khtml_browser = function() {
var w = self.element.offsetWidth;
var h = self.element.offsetHeight;
self.element.style.display = "none";
var valign = opts.substr(0, 1);
var halign = "l";
if (opts.length > 1) {
halign = opts.substr(1, 1);
}
// vertical alignment
switch (valign) {
case "T": p.y -= h; break;
case "B": p.y += el.offsetHeight; break;
case "C": p.y += (el.offsetHeight - h) / 2; break;
case "t": p.y += el.offsetHeight - h; break;
case "b": break; // already there
}
// horizontal alignment
switch (halign) {
case "L": p.x -= w; break;
case "R": p.x += el.offsetWidth; break;
case "C": p.x += (el.offsetWidth - w) / 2; break;
case "r": p.x += el.offsetWidth - w; break;
case "l": break; // already there
}
self.showAt(p.x, p.y);
};
if (Calendar.is_khtml)
setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()", 10);
else
Calendar.continuation_for_the_fucking_khtml_browser();
};
/** Customizes the date format. */
Calendar.prototype.setDateFormat = function (str) {
this.dateFormat = str;
};
/** Customizes the tooltip date format. */
Calendar.prototype.setTtDateFormat = function (str) {
this.ttDateFormat = str;
};
/**
*Tries to identify the date represented in a string.If successful it also
*calls this.setDate which moves the calendar to the given date.
*/
Calendar.prototype.parseDate = function (str, fmt) {
var y = 0;
var m = -1;
var d = 0;
var a = str.split(/\W+/);
if (!fmt) {
fmt = this.dateFormat;
}
var b = [];
fmt.replace(/(%.)/g, function(str, par) {
return b[b.length] = par;
});
var i = 0, j = 0;
var hr = 0;
var min = 0;
for (i = 0; i < a.length; ++i) {
if (b[i] == "%a" || b[i] == "%A") {
continue;
}
if (b[i] == "%d" || b[i] == "%e") {
d = parseInt(a[i], 10);
}
if (b[i] == "%m") {
m = parseInt(a[i], 10) - 1;
}
if (b[i] == "%Y" || b[i] == "%y") {
y = parseInt(a[i], 10);
(y < 100) && (y += (y > 29) ? 1900 : 2000);
}
if (b[i] == "%b" || b[i] == "%B") {
for (j = 0; j < 12; ++j) {
if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; }
}
} else if (/%[HIkl]/.test(b[i])) {
hr = parseInt(a[i], 10);
} else if (/%[pP]/.test(b[i])) {
if (/pm/i.test(a[i]) && hr < 12)
hr += 12;
} else if (b[i] == "%M") {
min = parseInt(a[i], 10);
}
}
if (y != 0 && m != -1 && d != 0) {
this.setDate(new Date(y, m, d, hr, min, 0));
return;
}
y = 0; m = -1; d = 0;
for (i = 0; i < a.length; ++i) {
if (a[i].search(/[a-zA-Z]+/) != -1) {
var t = -1;
for (j = 0; j < 12; ++j) {
if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { t = j; break; }
}
if (t != -1) {
if (m != -1) {
d = m+1;
}
m = t;
}
} else if (parseInt(a[i], 10) <= 12 && m == -1) {
m = a[i]-1;
} else if (parseInt(a[i], 10) > 31 && y == 0) {
y = parseInt(a[i], 10);
(y < 100) && (y += (y > 29) ? 1900 : 2000);
} else if (d == 0) {
d = a[i];
}
}
if (y == 0) {
var today = new Date();
y = today.getFullYear();
}
if (m != -1 && d != 0) {
this.setDate(new Date(y, m, d, hr, min, 0));
}
};
Calendar.prototype.hideShowCovered = function () {
var self = this;
Calendar.continuation_for_the_fucking_khtml_browser = function() {
function getVisib(obj){
var value = obj.style.visibility;
if (!value) {
if (document.defaultView && typeof (document.defaultView.getComputedStyle) == "function") { // Gecko, W3C
if (!Calendar.is_khtml)
value = document.defaultView.
getComputedStyle(obj, "").getPropertyValue("visibility");
else
value = '';
} else if (obj.currentStyle) { // IE
value = obj.currentStyle.visibility;
} else
value = '';
}
return value;
};
var tags = new Array("applet", "iframe", "select");
var el = self.element;
var p = Calendar.getAbsolutePos(el);
var EX1 = p.x;
var EX2 = el.offsetWidth + EX1;
var EY1 = p.y;
var EY2 = el.offsetHeight + EY1;
for (var k = tags.length; k > 0; ) {
var ar = document.getElementsByTagName(tags[--k]);
var cc = null;
for (var i = ar.length; i > 0;) {
cc = ar[--i];
p = Calendar.getAbsolutePos(cc);
var CX1 = p.x;
var CX2 = cc.offsetWidth + CX1;
var CY1 = p.y;
var CY2 = cc.offsetHeight + CY1;
if (self.hidden || (CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) {
if (!cc.__msh_save_visibility) {
cc.__msh_save_visibility = getVisib(cc);
}
cc.style.visibility = cc.__msh_save_visibility;
} else {
if (!cc.__msh_save_visibility) {
cc.__msh_save_visibility = getVisib(cc);
}
cc.style.visibility = "hidden";
}
}
}
};
if (Calendar.is_khtml)
setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()", 10);
else
Calendar.continuation_for_the_fucking_khtml_browser();
};
/** Internal function; it displays the bar with the names of the weekday. */
Calendar.prototype._displayWeekdays = function () {
var MON = this.mondayFirst ? 0 : 1;
var SUN = this.mondayFirst ? 6 : 0;
var SAT = this.mondayFirst ? 5 : 6;
var cell = this.firstdayname;
for (var i = 0; i < 7; ++i) {
cell.className = "day name";
if (!i) {
cell.ttip = this.mondayFirst ? Calendar._TT["SUN_FIRST"] : Calendar._TT["MON_FIRST"];
cell.navtype = 100;
cell.calendar = this;
Calendar._add_evs(cell);
}
if (i == SUN || i == SAT) {
Calendar.addClass(cell, "weekend");
}
cell.firstChild.data = Calendar._SDN[i + 1 - MON];
cell = cell.nextSibling;
}
};
/** Internal function.Hides all combo boxes that might be displayed. */
Calendar.prototype._hideCombos = function () {
this.monthsCombo.style.display = "none";
this.yearsCombo.style.display = "none";
};
/** Internal function.Starts dragging the element. */
Calendar.prototype._dragStart = function (ev) {
if (this.dragging) {
return;
}
this.dragging = true;
var posX;
var posY;
if (Calendar.is_ie) {
posY = window.event.clientY + document.body.scrollTop;
posX = window.event.clientX + document.body.scrollLeft;
} else {
posY = ev.clientY + window.scrollY;
posX = ev.clientX + window.scrollX;
}
var st = this.element.style;
this.xOffs = posX - parseInt(st.left);
this.yOffs = posY - parseInt(st.top);
with (Calendar) {
addEvent(document, "mousemove", calDragIt);
addEvent(document, "mouseover", stopEvent);
addEvent(document, "mouseup", calDragEnd);
}
};
// BEGIN: DATE OBJECT PATCHES
/** Adds the number of days array to the Date object. */
Date._MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
/** Constants used for time computations */
Date.SECOND = 1000 /* milliseconds */;
Date.MINUTE = 60 * Date.SECOND;
Date.HOUR = 60 * Date.MINUTE;
Date.DAY= 24 * Date.HOUR;
Date.WEEK =7 * Date.DAY;
/** Returns the number of days in the current month */
Date.prototype.getMonthDays = function(month) {
var year = this.getFullYear();
if (typeof month == "undefined") {
month = this.getMonth();
}
if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) {
return 29;
} else {
return Date._MD[month];
}
};
/** Returns the number of day in the year. */
Date.prototype.getDayOfYear = function() {
var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
var then = new Date(this.getFullYear(), 0, 1, 0, 0, 0);
var time = now - then;
return Math.floor(time / Date.DAY);
};
/** Returns the number of the week in year, as defined in ISO 8601. */
Date.prototype.getWeekNumber = function() {
var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
var then = new Date(this.getFullYear(), 0, 1, 0, 0, 0);
var time = now - then;
var day = then.getDay(); // 0 means Sunday
if (day == 0) day = 7;
(day > 4) && (day -= 4) || (day += 3);
return Math.round(((time / Date.DAY) + day) / 7);
};
/** Checks dates equality (ignores time) */
Date.prototype.equalsTo = function(date) {
return ((this.getFullYear() == date.getFullYear()) &&
(this.getMonth() == date.getMonth()) &&
(this.getDate() == date.getDate()) &&
(this.getHours() == date.getHours()) &&
(this.getMinutes() == date.getMinutes()));
};
/** Prints the date in a string according to the given format. */
Date.prototype.print = function (str) {
var m = this.getMonth();
var d = this.getDate();
var y = this.getFullYear();
var wn = this.getWeekNumber();
var w = this.getDay();
var s = {};
var hr = this.getHours();
var pm = (hr >= 12);
var ir = (pm) ? (hr - 12) : hr;
var dy = this.getDayOfYear();
if (ir == 0)
ir = 12;
var min = this.getMinutes();
var sec = this.getSeconds();
s["%a"] = Calendar._SDN[w]; // abbreviated weekday name [FIXME: I18N]
s["%A"] = Calendar._DN[w]; // full weekday name
s["%b"] = Calendar._SMN[m]; // abbreviated month name [FIXME: I18N]
s["%B"] = Calendar._MN[m]; // full month name
// FIXME: %c : preferred date and time representation for the current locale
s["%C"] = 1 + Math.floor(y / 100); // the century number
s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31)
s["%e"] = d; // the day of the month (range 1 to 31)
// FIXME: %D : american date style: %m/%d/%y
// FIXME: %E, %F, %G, %g, %h (man strftime)
s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format)
s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format)
s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366)
s["%k"] = hr; // hour, range 0 to 23 (24h format)
s["%l"] = ir; // hour, range 1 to 12 (12h format)
s["%m"] = (m < 9) ? ("0" + (1+m)) : (1+m); // month, range 01 to 12
s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59
s["%n"] = "\n"; // a newline character
s["%p"] = pm ? "PM" : "AM";
s["%P"] = pm ? "pm" : "am";
// FIXME: %r : the time in am/pm notation %I:%M:%S %p
// FIXME: %R : the time in 24-hour notation %H:%M
s["%s"] = Math.floor(this.getTime() / 1000);
s["%S"] = (sec < 10) ? ("0" + sec) : sec; // seconds, range 00 to 59
s["%t"] = "\t"; // a tab character
// FIXME: %T : the time in 24-hour notation (%H:%M:%S)
s["%U"] = s["%W"] = s["%V"] = (wn < 10) ? ("0" + wn) : wn;
s["%u"] = w + 1; // the day of the week (range 1 to 7, 1 = MON)
s["%w"] = w; // the day of the week (range 0 to 6, 0 = SUN)
// FIXME: %x : preferred date representation for the current locale without the time
// FIXME: %X : preferred time representation for the current locale without the date
s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99)
s["%Y"] = y; // year with the century
s["%%"] = "%"; // a literal '%' character
var re = Date._msh_formatRegexp;
if (typeof re == "undefined") {
var tmp = "";
for (var i in s)
tmp += tmp ? ("|" + i) : i;
Date._msh_formatRegexp = re = new RegExp("(" + tmp + ")", 'g');
}
return str.replace(re, function(match, par) { return s[par]; });
};
// END: DATE OBJECT PATCHES
// global object that remembers the calendar
window.calendar = null;
var oldLink = null;
// code to change the active stylesheet
function setActiveStyleSheet(link, title) {
var i, a, main;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
a.disabled = true;
if(a.getAttribute("title") == title) a.disabled = false;
}
}
if (oldLink) oldLink.style.fontWeight = 'normal';
oldLink = link;
link.style.fontWeight = 'bold';
return false;
}
// This function gets called when the end-user clicks on some date.
function selected(cal, date) {
cal.sel.value = date; // just update the date in the input field.
if (cal.dateClicked && (cal.sel.id == "sel1" || cal.sel.id == "sel3"))
// if we add this call we close the calendar on single-click.
// just to exemplify both cases, we are using this only for the 1st
// and the 3rd field, while 2nd and 4th will still require double-click.
cal.callCloseHandler();
}
// And this gets called when the end-user clicks on the _selected_ date,
// or clicks on the "Close" button.It just hides the calendar without
// destroying it.
function closeHandler(cal) {
cal.hide();// hide the calendar
cal.destroy();
calendar = null;
}
// This function shows the calendar under the element having the given id.
// It takes care of catching "mousedown" signals on document and hiding the
// calendar if the click was outside.
function showCalendar(id, format, showsTime) {
var el = document.getElementById(id);
if (calendar != null) {
// we already have some calendar created
calendar.hide(); // so we hide it first.
} else {
// first-time call, create the calendar.
var cal = new Calendar(true, null, selected, closeHandler);
// uncomment the following line to hide the week numbers
// cal.weekNumbers = false;
if (typeof showsTime == "string") {
cal.showsTime = true;
cal.time24 = (showsTime == "24");
}
calendar = cal;// remember it in the global var
cal.setRange(1900, 2070);// min/max year allowed.
cal.create();
}
calendar.setDateFormat(format);// set the specified date format
calendar.parseDate(el.value);// try to parse the text in field
calendar.sel = el; // inform it what input field we use
// the reference element that we pass to showAtElement is the button that
// triggers the calendar.In this example we align the calendar bottom-right
// to the button.
calendar.showAtElement(el.nextSibling, "Br");// show the calendar
return false;
}
var MINUTE = 60 * 1000;
var HOUR = 60 * MINUTE;
var DAY = 24 * HOUR;
var WEEK = 7 * DAY;
function isDisabled(date) {
var today = new Date();
return (Math.abs(date.getTime() - today.getTime()) / DAY) > 10;
}
function flatSelected(cal, date) {
var el = document.getElementById("preview");
el.innerHTML = date;
}
function showFlatCalendar() {
var parent = document.getElementById("display");
// construct a calendar giving only the "selected" handler.
var cal = new Calendar(true, null, flatSelected);
// hide week numbers
cal.weekNumbers = false;
// We want some dates to be disabled; see function isDisabled above
cal.setDisabledHandler(isDisabled);
cal.setDateFormat("%A, %B %e");
// this call must be the last as it might use data initialized above; if
// we specify a parent, as opposite to the "showCalendar" function above,
// then we create a flat calendar -- not popup.Hidden, though, but...
cal.create(parent);
// ... we can show it here.
cal.show();
} | zyyhong | trunk/jiaju001/news/include/calendar/calendar.js | JavaScript | asf20 | 49,864 |
.calendar {
position: relative;
display: none;
border-top: 2px solid #fff;
border-right: 2px solid #000;
border-bottom: 2px solid #000;
border-left: 2px solid #fff;
font-size: 11px;
color: #000;
cursor: default;
background: #d4d0c8;
font-family: tahoma,verdana,sans-serif;
}
.calendar table {
border-top: 1px solid #000;
border-right: 1px solid #fff;
border-bottom: 1px solid #fff;
border-left: 1px solid #000;
font-size: 11px;
color: #000;
cursor: default;
background: #d4d0c8;
font-family: tahoma,verdana,sans-serif;
}
.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */
text-align: center;
padding: 1px;
border-top: 1px solid #fff;
border-right: 1px solid #000;
border-bottom: 1px solid #000;
border-left: 1px solid #fff;
}
.calendar .nav {
background: transparent url(menuarrow.gif) no-repeat 100% 100%;
}
.calendar thead .title { /* This holds the current "month, year" */
font-weight: bold;
padding: 1px;
border: 1px solid #000;
background: #848078;
color: #fff;
text-align: center;
}
.calendar thead .headrow { /* Row <TR> containing navigation buttons */
}
.calendar thead .daynames { /* Row <TR> containing the day names */
}
.calendar thead .name { /* Cells <TD> containing the day names */
border-bottom: 1px solid #000;
padding: 2px;
text-align: center;
background: #f4f0e8;
}
.calendar thead .weekend { /* How a weekend day name shows in header */
color: #f00;
}
.calendar thead .hilite { /* How do the buttons in header appear when hover */
border-top: 2px solid #fff;
border-right: 2px solid #000;
border-bottom: 2px solid #000;
border-left: 2px solid #fff;
padding: 0px;
background-color: #e4e0d8;
}
.calendar thead .active { /* Active (pressed) buttons in header */
padding: 2px 0px 0px 2px;
border-top: 1px solid #000;
border-right: 1px solid #fff;
border-bottom: 1px solid #fff;
border-left: 1px solid #000;
background-color: #c4c0b8;
}
/* The body part -- contains all the days in month. */
.calendar tbody .day { /* Cells <TD> containing month days dates */
width: 2em;
text-align: right;
padding: 2px 4px 2px 2px;
}
.calendar table .wn {
padding: 2px 3px 2px 2px;
border-right: 1px solid #000;
background: #f4f0e8;
}
.calendar tbody .rowhilite td {
background: #e4e0d8;
}
.calendar tbody .rowhilite td.wn {
background: #d4d0c8;
}
.calendar tbody td.hilite { /* Hovered cells <TD> */
padding: 1px 3px 1px 1px;
border-top: 1px solid #fff;
border-right: 1px solid #000;
border-bottom: 1px solid #000;
border-left: 1px solid #fff;
}
.calendar tbody td.active { /* Active (pressed) cells <TD> */
padding: 2px 2px 0px 2px;
border-top: 1px solid #000;
border-right: 1px solid #fff;
border-bottom: 1px solid #fff;
border-left: 1px solid #000;
}
.calendar tbody td.selected { /* Cell showing selected date */
font-weight: bold;
border-top: 1px solid #000;
border-right: 1px solid #fff;
border-bottom: 1px solid #fff;
border-left: 1px solid #000;
padding: 2px 2px 0px 2px;
background: #e4e0d8;
}
.calendar tbody td.weekend { /* Cells showing weekend days */
color: #f00;
}
.calendar tbody td.today { /* Cell showing today date */
font-weight: bold;
color: #00f;
}
.calendar tbody .disabled { color: #999; }
.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */
visibility: hidden;
}
.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */
display: none;
}
/* The footer part -- status bar and "Close" button */
.calendar tfoot .footrow { /* The <TR> in footer (only one right now) */
}
.calendar tfoot .ttip { /* Tooltip (status bar) cell <TD> */
background: #f4f0e8;
padding: 1px;
border: 1px solid #000;
background: #848078;
color: #fff;
text-align: center;
}
.calendar tfoot .hilite { /* Hover style for buttons in footer */
border-top: 1px solid #fff;
border-right: 1px solid #000;
border-bottom: 1px solid #000;
border-left: 1px solid #fff;
padding: 1px;
background: #e4e0d8;
}
.calendar tfoot .active { /* Active (pressed) style for buttons in footer */
padding: 2px 0px 0px 2px;
border-top: 1px solid #000;
border-right: 1px solid #fff;
border-bottom: 1px solid #fff;
border-left: 1px solid #000;
}
/* Combo boxes (menus that display months/years for direct selection) */
.combo {
position: absolute;
display: none;
width: 4em;
top: 0px;
left: 0px;
cursor: default;
border-top: 1px solid #fff;
border-right: 1px solid #000;
border-bottom: 1px solid #000;
border-left: 1px solid #fff;
background: #e4e0d8;
font-size: smaller;
padding: 1px;
}
.combo .label,
.combo .label-IEfix {
text-align: center;
padding: 1px;
}
.combo .label-IEfix {
width: 4em;
}
.combo .active {
background: #c4c0b8;
padding: 0px;
border-top: 1px solid #000;
border-right: 1px solid #fff;
border-bottom: 1px solid #fff;
border-left: 1px solid #000;
}
.combo .hilite {
background: #048;
color: #fea;
}
.calendar td.time {
border-top: 1px solid #000;
padding: 1px 0px;
text-align: center;
background-color: #f4f0e8;
}
.calendar td.time .hour,
.calendar td.time .minute,
.calendar td.time .ampm {
padding: 0px 3px 0px 4px;
border: 1px solid #889;
font-weight: bold;
background-color: #fff;
}
.calendar td.time .ampm {
text-align: center;
}
.calendar td.time .colon {
padding: 0px 2px 0px 3px;
font-weight: bold;
}
.calendar td.time span.hilite {
border-color: #000;
background-color: #766;
color: #fff;
}
.calendar td.time span.active {
border-color: #f00;
background-color: #000;
color: #0f0;
} | zyyhong | trunk/jiaju001/news/include/calendar/calendar-win2k-1.css | CSS | asf20 | 5,917 |
// ** I18N
// Calendar EN language
// Author: Mihai Bazon, <mishoo@infoiasi.ro>
// Encoding: any
// Distributed under the same terms as the calendar itself.
// For translators: please use UTF-8 if possible. We strongly believe that
// Unicode is the answer to a real internationalized world. Also please
// include your contact information in the header, as can be seen above.
// full day names
Calendar._DN = new Array
("星期日","星期一","星期二","星期三","星期四","星期五","星期六","星期日");
// Please note that the following array of short day names (and the same goes
// for short month names, _SMN) isn't absolutely necessary. We give it here
// for exemplification on how one can customize the short day names, but if
// they are simply the first N letters of the full name you can simply say:
//
Calendar._SDN_len = 6; // short day name length
Calendar._SMN_len = 9; // short month name length
//
// If N = 3 then this is not needed either since we assume a value of 3 if not
// present, to be compatible with translation files that were written before
// this feature.
// short day names
Calendar._SDN = new Array
("周日","周一","周二","周三","周四","周五","周六","周日");
// full month names
Calendar._MN = new Array
("一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月");
// short month names
Calendar._SMN = new Array
("一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月");
// tooltips
Calendar._TT = {};
Calendar._TT["INFO"] = "关于";
Calendar._TT["ABOUT"] =
"DHTML Date/Time Selector\n" +
"(c) dynarch.com 2002-2003\n" + // don't translate this this ;-)
"For latest version visit: http://dynarch.com/mishoo/calendar.epl\n" +
"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." +
"\n\n" +
"Date selection:\n" +
"- Use the \xab, \xbb buttons to select year\n" +
"- Use the " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " buttons to select month\n" +
"- Hold mouse button on any of the above buttons for faster selection.";
Calendar._TT["ABOUT_TIME"] = "\n\n" +
"Time selection:\n" +
"- Click on any of the time parts to increase it\n" +
"- or Shift-click to decrease it\n" +
"- or click and drag for faster selection.";
Calendar._TT["PREV_YEAR"] = "上一年";
Calendar._TT["PREV_MONTH"] = "上一月";
Calendar._TT["GO_TODAY"] = "今天";
Calendar._TT["NEXT_MONTH"] = "下一月";
Calendar._TT["NEXT_YEAR"] = "下一年";
Calendar._TT["SEL_DATE"] = "请选择日期";
Calendar._TT["DRAG_TO_MOVE"] = "拖动";
Calendar._TT["PART_TODAY"] = "(今天)";
Calendar._TT["MON_FIRST"] = "周一在前";
Calendar._TT["SUN_FIRST"] = "周日在前";
Calendar._TT["CLOSE"] = "关闭";
Calendar._TT["TODAY"] = "今天";
Calendar._TT["TIME_PART"] = "(Shift-)Click or drag to change value";
// date formats
Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";
Calendar._TT["WK"] = "wk";
| zyyhong | trunk/jiaju001/news/include/calendar/calendar-cn.js | JavaScript | asf20 | 3,135 |
<?php
if(!defined('DEDEINC'))
{
exit("Request Error!");
}
require_once(DEDEINC."/inc_channel_unit_functions.php");
require_once(DEDEINC."/pub_dedetag.php");
require_once(DEDEINC."/inc_bookfunctions.php");
/******************************************************
//Copyright 2004-2006 by DedeCms.com itprato
//本类的用途是用于连载频道的内容浏览
******************************************************/
@set_time_limit(0);
class BookView
{
var $dsql;
var $dtp;
var $InitType;
var $CatalogID;
var $BookID;
var $ContentID;
var $ChapterID;
var $BookType;
var $PageNo;
var $TotalPage;
var $TotalResult;
var $PageSize;
var $CacheArray;
var $PreNext;
var $Keys;
//-------------------------------
//php5构造函数
//-------------------------------
function __construct($rsid=0,$inittype='catalog',$kws='')
{
global $cfg_basedir,$PubFields;
$this->CacheArray = Array();
$this->PreNext = Array();
$this->InitType = $inittype;
$this->CatalogID = 0;;
$this->BookID = 0;
$this->ContentID = 0;
$this->ChapterID = 0;
$this->TotalResult = -1;
$this->BookType = 'story';
if(is_array($kws)) $this->Keys = $kws;
else $this->Keys = Array();
$this->dsql = new DedeSql(false);
$this->dtp = new DedeTagParse();
$this->dtp->SetNameSpace("dede","{","}");
$this->Fields['id'] = $rsid;
$this->Fields['position'] = '';
$this->Fields['title'] = '';
//设置一些全局参数的值
foreach($PubFields as $k=>$v) $this->Fields[$k] = $v;
$this->MakeFirst($inittype,$rsid);
//如果分类有上级栏目,获取其信息
$this->Fields['pclassname'] = '';
if($inittype!='index' && $inittype!='search')
{
if($this->Fields['pid']>0){
$row = $this->dsql->GetOne("Select classname From #@__story_catalog where id='{$this->Fields['pid']}' ");
$this->Fields['pclassname'] = $row['classname'];
}
$this->Fields['fulltitle'] = $this->Fields['title'];
if($this->Fields['pclassname']!=''){
$this->Fields['fulltitle'] = $this->Fields['fulltitle']." - ".$this->Fields['pclassname'];
}
}
}
//php4构造函数
//---------------------------
function BookView($rsid=0,$inittype='catalog',$kws='')
{
$this->__construct($rsid,$inittype);
}
/*---------------------------
//根据初始化的类型获取filed值,并载入模板
--------------------------*/
function MakeFirst($inittype,$rsid)
{
global $cfg_basedir,$PubFields;
//列表
if($inittype=='catalog')
{
$this->CatalogID = $rsid;
$row = $this->dsql->GetOne("Select * From #@__story_catalog where id='$rsid' ");
foreach($row as $k=>$v) if(ereg('[^0-9]',$k)) $this->Fields[$k] = $v;
unset($row);
$this->dtp->LoadTemplet($cfg_basedir.$PubFields['templetdef'].'/books_list.htm');
$this->Fields['title'] = $this->Fields['classname'];
$this->Fields['catid'] = $this->Fields['id'];
$this->Fields['bcatid'] = $this->Fields['pid'];
$this->Fields['position'] = $this->GetPosition($this->Fields['catid'],$this->Fields['bcatid']);
}
//图书
else if($inittype=='book')
{
$this->BookID = $rsid;
$row = $this->dsql->GetOne("Select c.classname,c.pid,bk.* From #@__story_books bk left join #@__story_catalog c on c.id=bk.catid where bk.id='$rsid' ");
foreach($row as $k=>$v) if(ereg('[^0-9]',$k)) $this->Fields[$k] = $v;
unset($row);
$this->dtp->LoadTemplet($cfg_basedir.$PubFields['templetdef'].'/books_book.htm');
$this->Fields['title'] = $this->Fields['bookname'];
$this->CatalogID = $this->Fields['catid'];
if($this->Fields['status']==1) $this->Fields['status']='已完成连载';
else $this->Fields['status']='连载中...';
$this->Fields['position'] = $this->GetPosition($this->Fields['catid'],$this->Fields['bcatid']);
}
//内容
else if($inittype=='content')
{
$this->ContentID = $rsid;
$nquery = "Select c.classname,c.pid,ct.*,cp.chaptername,cp.chapnum
From #@__story_content ct
left join #@__story_catalog c on c.id=ct.catid
left join #@__story_chapter cp on cp.id=ct.chapterid
where ct.id='$rsid' ";
$row = $this->dsql->GetOne($nquery,MYSQL_ASSOC);
if(!is_array($row)) {showmsg('内容不存在','javascript:;');exit();}
$this->ChapterID = $row['chapterid'];
$this->BookID = $row['bookid'];
$this->Fields['bookurl'] = GetBookUrl($row['bookid'],$row['bookname']);
foreach($row as $k=>$v) if(ereg('[^0-9]',$k)) $this->Fields[$k] = $v;
unset($row);
if($this->Fields['booktype']==1) $this->dtp->LoadTemplet($cfg_basedir.$PubFields['templetdef'].'/books_photo.htm');
else $this->dtp->LoadTemplet($cfg_basedir.$PubFields['templetdef'].'/books_story.htm');
$this->Fields['position'] = $this->GetPosition($this->Fields['catid'],$this->Fields['bcatid']);
$row = $this->dsql->GetOne("Select freenum From #@__story_books where id='{$this->Fields['bookid']}' ");
$this->Fields['freenum'] = $row['freenum'];
$this->Fields['body'] = GetBookText($this->Fields['id']);
$this->Fields['bookid'] = $this->BookID;
}
//封面
else if($inittype=='index')
{
$this->dtp->LoadTemplet($cfg_basedir.$PubFields['templetdef'].'/books_index.htm');
}
//搜索界面
else if($inittype=='search')
{
if($this->Keys['id']>0) $this->CatalogID = $this->Keys['id'];
$this->dtp->LoadTemplet($cfg_basedir.$PubFields['templetdef'].'/books_search.htm');
}
}
//-------------------------------
//解析固定模板标记
//-----------------------------
function ParseTempletsFirst()
{
if( !is_array($this->dtp->CTags) ) return 0;
foreach($this->dtp->CTags as $tagid=>$ctag)
{
$tagname = $ctag->GetTagName();
//字段
if($tagname=='field')
{
if(isset($this->Fields[$ctag->GetAtt('name')])) $this->dtp->Assign($tagid,$this->Fields[$ctag->GetAtt('name')]);
else $this->dtp->Assign($tagid,"");
}
//章节信息
else if($tagname=='chapter')
{
$this->dtp->Assign($tagid, $this->GetChapterList($this->BookID, $ctag->GetInnerText()) );
}
//栏目信息
else if($tagname=='catalog')
{
$pid = 0;
if($ctag->GetAtt('type')=='son') $pid = $this->Fields['catid'];
$this->dtp->Assign($tagid, $this->GetCatalogList($pid,$ctag->GetInnerText()));
}
//当前图书的最新章节
else if($tagname=='newcontent')
{
if($ctag->GetAtt('bookid')=='') $bid = $this->BookID;
if(empty($bid)) $this->dtp->Assign($tagid,'');
else $this->dtp->Assign($tagid, $this->GetNewContentLink($bid,$ctag->GetInnerText()));
}
//指定记录的图书
else if($tagname=='booklist')
{
if($ctag->GetAtt('catid')!='') $catid = $ctag->GetAtt('catid');
else $catid = $this->CatalogID;
$this->dtp->Assign($tagid,
$this->GetBookList(
$ctag->GetAtt('row'),
$ctag->GetAtt('booktype'),
$ctag->GetAtt('titlelen'),
$ctag->GetAtt('orderby'),
$catid,$this->BookID,
$ctag->GetAtt('author'),0,
$ctag->GetInnerText(),0,
$ctag->GetAtt('imgwidth'),
$ctag->GetAtt('imgheight')
)
);
}
//指定记录的章节
else if($tagname=='contentlist')
{
$this->dtp->Assign($tagid,
$this->GetBookList(
$ctag->GetAtt('row'),
$ctag->GetAtt('booktype'),
$ctag->GetAtt('titlelen'),
'lastpost',$ctag->GetAtt('catid'),0,
'',1,$ctag->GetInnerText()
)
);
}
else if($tagname=='prenext'){
$this->dtp->Assign($tagid, $this->GetPreNext($ctag->GetAtt('get')));
}
}//End Foreach
}
//---------------------
//解析动态标签
//即是指和页码相关的标记
//---------------------
function ParseDmFields($mtype,$pageno)
{
if(empty($pageno)) $this->PageNo = 1;
else $this->PageNo=$pageno;
$ctag = $this->dtp->GetTag('list');
//先处理 list 标记,因为这个标记包含统计信息
$this->dtp->AssignName('list',
$this->GetBookList(
0,
$ctag->GetAtt('booktype'),
$ctag->GetAtt('titlelen'),
$ctag->GetAtt('orderby'),
$this->CatalogID,0,'',-1,
$ctag->GetInnerText(),
$ctag->GetAtt('pagesize'),
$ctag->GetAtt('imgwidth'),
$ctag->GetAtt('imgheight')
)
);
//其它动态标记
foreach($this->dtp->CTags as $tagid=>$ctag)
{
$tagname = $ctag->GetTagName();
if($tagname=='pagelist'){
if($mtype=='dm') $this->dtp->Assign($tagid,$this->GetPageListDM($ctag->GetAtt('listsize'),$ctag->GetAtt('listitem')) );
}
}
}
//------------------
//生成HTML(仅图书,内容页因为考虑到收费图书问题,不生成HTML)
//$isclose 是是否关闭数据库,
//由于mysql每PHP进程只需关闭一次mysql连接,因此在批量更新HTML的时候此选项应该用 false
//------------------
function MakeHtml($isclose=true)
{
global $cfg_basedir;
$bookdir = GetBookUrl($this->Fields['id'],$this->Fields['bookname'],1);
$bookurl = GetBookUrl($this->Fields['id'],$this->Fields['bookname']);
if(!is_dir($cfg_basedir.$bookdir)) CreateDir($bookdir);
$this->ParseTempletsFirst();
$fp = fopen($cfg_basedir.$bookurl,'w');
fwrite($fp,$this->dtp->GetResult());
fclose($fp);
if($isclose) $this->Close();
//if($displaysucc) echo "<a href='{$bookurl}' target='_blank'>创建或更新'{$this->Fields['bookname']}'的HTML成功!</a><br />\r\n";
return $bookurl;
}
//------------------
//显示内容
//------------------
function Display()
{
global $PageNo;
$this->ParseTempletsFirst();
if($this->InitType=='catalog' || $this->InitType=='search'){
$this->ParseDmFields('dm',$PageNo);
}
$this->dtp->Display();
$this->Close();
}
//------------------
//获得指定条件的图书列表
//-------------------
function GetBookList($num=12,$booktype='-1',$titlelen=24,$orderby='lastpost',$catid=0,$bookid=0,$author='',$getcontent=0,$innertext='',$pagesize=0,$imgwidth=90,$imgheight=110)
{
global $cfg_cmspath;
if(empty($num)) $num = 12;
if($booktype=='') $booktype = -1;
if(empty($titlelen)) $titlelen = 24;
if(empty($orderby)) $orderby = 'lastpost';
if(empty($bookid)) $bookid = 0;
$addquery = '';
if(empty($innertext)){
//普通图书列表
if($getcontent==0) $innertext = GetSysTemplets('book_booklist.htm');
//分页图书列表
else if($getcontent==-1) $innertext = GetSysTemplets('book_booklist_m.htm');
//最新章节列表
else $innertext = GetSysTemplets('book_contentlist.htm');
}
if($booktype!=-1) $addquery .= " And b.booktype='{$booktype}' ";
if($bookid>0) $addquery .= " And b.id<>'{$bookid}' ";
if($orderby=='commend'){
$addquery .= " And b.iscommend=1 ";
$orderby = 'lastpost';
}
if($catid>0){
$addquery .= " And (b.catid='$catid' Or b.bcatid='$catid') ";
}
//分页、搜索列表选项
if($getcontent==-1)
{
if(empty($pagesize)) $this->PageSize = 20;
else $this->PageSize = $pagesize;
$limitnum = ($this->PageSize * ($this->PageNo-1)).','.$this->PageSize;
}
else{
$limitnum = $num;
}
if(!empty($this->Keys['author'])) $author = $this->Keys['author'];
if(!empty($author)){
$addquery .= " And b.author like '$author' ";
}
//关键字条件
if(!empty($this->Keys['keyword'])){
$keywords = explode(' ',$this->Keys['keyword']);
$keywords = array_unique($keywords);
if(count($keywords)>0) $addquery .= " And (";
foreach($keywords as $v) $addquery .= " CONCAT(b.author,b.bookname,b.keywords) like '%$v%' OR";
$addquery = ereg_replace(" OR$","",$addquery);
$addquery .= ")";
}
$clist = '';
$query = "Select SQL_CALC_FOUND_ROWS b.id,b.catid,b.ischeck,b.booktype,b.iscommend,b.click,b.bookname,b.lastpost,
b.author,b.memberid,b.litpic,b.pubdate,b.weekcc,b.monthcc,b.description,c.classname,c.classname as typename,c.booktype as catalogtype
From #@__story_books b left join #@__story_catalog c on c.id=b.catid
where b.postnum>0 And b.ischeck>0 $addquery order by b.{$orderby} desc limit $limitnum";
$this->dsql->SetQuery($query);
$this->dsql->Execute();
//统计记录数
if($this->TotalResult==-1 && $getcontent==-1)
{
$row = $this->dsql->GetOne("SELECT FOUND_ROWS() as dd ");
$this->TotalResult = $row['dd'];
$this->TotalPage = ceil($this->TotalResult/$this->PageSize);
}
$ndtp = new DedeTagParse();
$ndtp->SetNameSpace("field","[","]");
$GLOBALS['autoindex'] = 0;
while($row = $this->dsql->GetArray())
{
$GLOBALS['autoindex']++;
$row['title'] = $row['bookname'];
$ndtp->LoadString($innertext);
//获得图书最新的一个更新章节
$row['contenttitle'] = '';
$row['contentid'] = '';
if($getcontent==1){
$nrow = $this->GetNewContent($row['id']);
$row['contenttitle'] = $nrow['title'];
$row['contentid'] = $nrow['id'];
//echo "{$row['contenttitle']} 0 {$row['contentid']}";
}
if($row['booktype']==1) $row['contenturl'] = $cfg_cmspath.'/book/story.php?id='.$row['id'];
else $row['contenturl'] = $cfg_cmspath.'/book/show-photo.php?id='.$row['id'];
//动态网址
$row['dmbookurl'] = $cfg_cmspath.'/book/book.php?id='.$row['id'];
//静态网址
$row['bookurl'] = $row['url'] = GetBookUrl($row['id'],$row['bookname']);
$row['catalogurl'] = $cfg_cmspath.'/book/list.php?id='.$row['catid'];
$row['cataloglink'] = "<a href='{$row['catalogurl']}'>{$row['classname']}</a>";
$row['booklink'] = "<a href='{$row['bookurl']}'>{$row['bookname']}</a>";
$row['contentlink'] = "<a href='{$row['contenturl']}'>{$row['contenttitle']}</a>";
$row['imglink'] = "<a href='{$row['bookurl']}'><img src='{$row['litpic']}' width='$imgwidth' height='$imgheight' border='0' /></a>";
if($row['ischeck']==2) $row['ischeck']='已完成连载';
else $row['ischeck']='连载中...';
if($row['booktype']==0) $row['booktypename']='小说';
else $row['booktypename']='漫画';
if(is_array($ndtp->CTags))
{
foreach($ndtp->CTags as $tagid=>$ctag)
{
$tagname = $ctag->GetTagName();
if(isset($row[$tagname])) $ndtp->Assign($tagid,$row[$tagname]);
else $ndtp->Assign($tagid,'');
}
}
$clist .= $ndtp->GetResult();
}
return $clist;
}
//------------------
//获得指定条件的内容
//-------------------
function GetNewContent($bid)
{
$row = $this->dsql->GetOne("Select id,title,chapterid From #@__story_content where bookid='$bid' order by id desc ");
return $row;
}
//------------------
//获得指定条件的内容
//-------------------
function GetNewContentLink($bid,$innertext='')
{
global $cfg_cmspath;
$rstr = '';
$row = $this->GetNewContent($bid);
if(!is_array($row)) return '';
if(empty($innertext)) $innertext = "<a href='[field:url/]'>[field:title/]</a>";
if($this->Fields['booktype']==1){
$burl = $cfg_cmspath.'/book/show-photo.php?id='.$row['id'];
}else{
$burl = $cfg_cmspath.'/book/story.php?id='.$row['id'];
}
$rstr = preg_replace("/\[field:url([\s]{0,})\/\]/isU",$burl,$innertext);
//$rstr = preg_replace("/\[field:ch([\s]{0,})\/\]/isU",$row['chapterid'],$rstr);
$rstr = preg_replace("/\[field:title([\s]{0,})\/\]/isU",$row['title'],$rstr);
return $rstr;
}
//------------------
//获得章节列表
//-------------------
function GetChapterList($bookid,$innertext)
{
global $cfg_cmspath;
$clist = '';
$this->dsql->SetQuery("Select id,chaptername,chapnum From #@__story_chapter where bookid='{$bookid}' order by chapnum asc ");
$this->dsql->Execute();
$ndtp = new DedeTagParse();
$ndtp->SetNameSpace("in","{","}");
$ch = 0;
while($row = $this->dsql->GetArray())
{
$ch++;
$ndtp->LoadString($innertext);
if(is_array($ndtp->CTags))
{
foreach($ndtp->CTags as $tagid=>$ctag)
{
$tagname = $ctag->GetTagName();
//field类型
if($tagname=='field')
{
if(isset($row[$ctag->GetAtt('name')])) $ndtp->Assign($tagid,$row[$ctag->GetAtt('name')]);
else $ndtp->Assign($tagid,'');
}
//内容列表
else if($tagname=='content')
{
$this->dsql->SetQuery("Select id,title,sortid From #@__story_content where chapterid='{$row['id']}' order by sortid asc");
$this->dsql->Execute('ch');
$ct = 0;
$nlist = '';
while($rowch = $this->dsql->GetArray('ch'))
{
$ct++;
if($this->Fields['booktype']==1){
$rowch['url'] = $cfg_cmspath.'/book/show-photo.php?id='.$rowch['id'];
//$rowch['title'] = "";
}else{
$rowch['url'] = $cfg_cmspath.'/book/story.php?id='.$rowch['id'];
}
$rbtext = preg_replace("/\[field:url([\s]{0,})\/\]/isU",$rowch['url'],$ctag->GetInnerText());
$rbtext = preg_replace("/\[field:ch([\s]{0,})\/\]/isU",$rowch['sortid'],$rbtext);
$rbtext = preg_replace("/\[field:title([\s]{0,})\/\]/isU",$rowch['title'],$rbtext);
$nlist .= $rbtext;
}
$ndtp->Assign($tagid,$nlist);
}
}//End foreach
$clist .= $ndtp->GetResult();
}
}
return $clist;
}
//------------------
//获得栏目列表
//-------------------
function GetCatalogList($pid,$innertext)
{
global $cfg_cmspath;
$clist = '';
$this->dsql->SetQuery("Select id,pid,classname From #@__story_catalog where pid='{$pid}' order by rank asc ");
$this->dsql->Execute();
$ndtp = new DedeTagParse();
$ndtp->SetNameSpace("in","{","}");
$ch = 0;
if(trim($innertext)==""){
if($pid==0) $innertext = GetSysTemplets('book_catalog.htm');
else $innertext = GetSysTemplets('book_catalog_son.htm');
}
while($row = $this->dsql->GetArray())
{
$ch++;
$ndtp->LoadString($innertext);
$row['url'] = $cfg_cmspath.'/book/list.php?id='.$row['id'];
if(is_array($ndtp->CTags))
{
foreach($ndtp->CTags as $tagid=>$ctag)
{
$tagname = $ctag->GetTagName();
//field类型
if($tagname=='field')
{
if(isset($row[$ctag->GetAtt('name')])) $ndtp->Assign($tagid,$row[$ctag->GetAtt('name')]);
else $ndtp->Assign($tagid,'');
}
//内容列表
else if($tagname=='sonlist')
{
$this->dsql->SetQuery("Select id,pid,classname From #@__story_catalog where pid='{$row['id']}' order by rank asc");
$this->dsql->Execute('ch');
$ct = 0;
$nlist = '';
while($rowch = $this->dsql->GetArray('ch'))
{
$ct++;
$rowch['url'] = $cfg_cmspath.'/book/list.php?id='.$rowch['id'];
$rbtext = preg_replace("/\[field:url([\s]{0,})\/\]/isU",$rowch['url'],$ctag->GetInnerText());
$rbtext = preg_replace("/\[field:id([\s]{0,})\/\]/isU",$rowch['id'],$rbtext);
$rbtext = preg_replace("/\[field:classname([\s]{0,})\/\]/isU",$rowch['classname'],$rbtext);
$nlist .= $rbtext;
}
$ndtp->Assign($tagid,$nlist);
}
}//End foreach
$clist .= $ndtp->GetResult();
}
}
return $clist;
}
//-----------------
//获取栏目导航
//--------------
function GetPosition($catid,$bcatid)
{
global $cfg_cmspath,$cfg_list_symbol;
$oklink = '';
$this->dsql->SetQuery("Select id,classname From #@__story_catalog where id='$catid' Or id='$bcatid' order by pid asc ");
$this->dsql->Execute();
$row = $this->dsql->GetArray();
if(is_array($row)) $oklink = "<a href='{$cfg_cmspath}/book/list.php?id={$row['id']}'>{$row['classname']}</a>";
$row = $this->dsql->GetArray();
if(is_array($row)) $oklink .= " ".trim($cfg_list_symbol)." {$row['classname']}";
return $oklink;
}
//---------------------------
//关闭相关资源
//---------------------------
function Close()
{
@$this->dsql->Close();
unset($this->dtp);
}
//-------------------
//获取上一页连接
//-------------------
function GetPreNext($gtype)
{
if(count($this->PreNext)==0)
{
$chapnum = $this->Fields['chapnum'];
//获得上一条记录
$row = $this->dsql->GetOne("Select id,title,sortid From #@__story_content where bookid={$this->Fields['bookid']} And chapterid={$this->Fields['chapterid']} And sortid<{$this->Fields['sortid']} order by sortid desc ");
if(!is_array($row)){
$row = $this->dsql->GetOne("Select id From #@__story_chapter where bookid={$this->Fields['bookid']} And chapnum<$chapnum order by chapnum desc ");
if(is_array($row)){
$row = $this->dsql->GetOne("Select id,title,sortid From #@__story_content where bookid={$this->Fields['bookid']} And chapterid='{$row['id']}' order by sortid desc ");
}
}
if(!is_array($row)){
$this->PreNext['pre']['id']=0;
$this->PreNext['pre']['link']="javascript:alert('刚开始哦');";
$this->PreNext['pre']['title']='这是第一页';
}else{
$this->PreNext['pre']['id']=$row['id'];
$this->PreNext['pre']['title']=$row['title'];
if($this->Fields['booktype']==1){
$this->PreNext['pre']['link']="show-photo.php?id=".$row['id'];
$this->PreNext['pre']['title'] = "上一页";
}
else $this->PreNext['pre']['link']="story.php?id=".$row['id'];
}
//获得下一条记录
$row = $this->dsql->GetOne("Select id,title,sortid From #@__story_content where bookid={$this->Fields['bookid']} And chapterid={$this->Fields['chapterid']} And sortid>{$this->Fields['sortid']} order by sortid asc ");
if(!is_array($row)){
$row = $this->dsql->GetOne("Select id From #@__story_chapter where bookid={$this->Fields['bookid']} And chapnum>$chapnum order by chapnum asc ");
if(is_array($row)){
$row = $this->dsql->GetOne("Select id,title,sortid From #@__story_content where bookid={$this->Fields['bookid']} And chapterid={$row['id']} order by sortid asc ");
}
}
if(!is_array($row)){
$this->PreNext['next']['id']=0;
$this->PreNext['next']['link']="javascript:alert('没有了哦');";
$this->PreNext['next']['title']='这是最后一页';
}else{
$this->PreNext['next']['id']=$row['id'];
$this->PreNext['next']['title']=$row['title'];
if($this->Fields['booktype']==1){
$this->PreNext['next']['link']="show-photo.php?id=".$row['id'];
$this->PreNext['next']['title'] = "下一页";
}
else $this->PreNext['next']['link']="story.php?id=".$row['id'];
}
}
if($gtype=='prelink') return "<a href='{$this->PreNext['pre']['link']}'>$this->PreNext['pre']['title']</a>";
else if($gtype=='nextlink') return "<a href='{$this->PreNext['next']['link']}'>$this->PreNext['next']['title']</a>";
else if($gtype=='preurl') return $this->PreNext['pre']['link'];
else if($gtype=='nexturl') return $this->PreNext['next']['link'];
else return "";
}
//---------------------------------
//获取动态的分页列表
//---------------------------------
function GetPageListDM($list_len,$listitem="index,end,pre,next,pageno")
{
$prepage="";
$nextpage="";
$prepagenum = $this->PageNo-1;
$nextpagenum = $this->PageNo+1;
if($list_len==""||ereg("[^0-9]",$list_len)) $list_len=3;
$totalpage = ceil($this->TotalResult/$this->PageSize);
//页面小于或等于一
if($totalpage<=1 && $this->TotalResult>0) return "共1页/".$this->TotalResult."条记录";
if($this->TotalResult == 0) return "共0页/".$this->TotalResult."条记录";
$maininfo = "<dd><span>共{$totalpage}页/".$this->TotalResult."条记录</span></dd>";
$purl = $this->GetCurUrl();
$geturl = "id=".$this->CatalogID."&keyword=".$this->Keys['keyword']."&author=".$this->Keys['author']."&";
$hidenform = "<input type='hidden' name='id' value='".$this->CatalogID."'>\r\n";
$hidenform .= "<input type='hidden' name='keyword' value='".$this->Keys['keyword']."'>\r\n";
$hidenform .= "<input type='hidden' name='author' value='".$this->Keys['author']."'>\r\n";
$purl .= "?".$geturl;
//获得上一页和下一页的链接
if($this->PageNo != 1){
$prepage.="<dd><a href='".$purl."PageNo=$prepagenum'>上一页</a></dd>\r\n";
$indexpage="<dd><a href='".$purl."PageNo=1'>首页</a></dd>\r\n";
}
else{
$indexpage="";
}
if($this->PageNo!=$totalpage && $totalpage>1){
$nextpage.="<dd><a href='".$purl."PageNo=$nextpagenum'>下一页</a></dd>\r\n";
$endpage="<dd><a href='".$purl."PageNo=$totalpage'>末页</a></dd>\r\n";
}
else{
$endpage="";
}
//获得数字链接
$listdd="";
$total_list = $list_len * 2 + 1;
if($this->PageNo >= $total_list) {
$j = $this->PageNo-$list_len;
$total_list = $this->PageNo+$list_len;
if($total_list>$totalpage) $total_list=$totalpage;
}else{
$j=1;
if($total_list>$totalpage) $total_list=$totalpage;
}
for($j;$j<=$total_list;$j++){
if($j==$this->PageNo) $listdd.= "<dd><span>$j</span></dd>\r\n";
else $listdd.="<dd><a href='".$purl."PageNo=$j'>[".$j."]</a></dd>\r\n";
}
$plist = "<form name='pagelist' action='".$this->GetCurUrl()."'>$hidenform";
$plist .= "<dl id='dedePageList'>\r\n";
$plist .= $maininfo.$indexpage.$prepage.$listdd.$nextpage.$endpage;
if($totalpage>$total_list){
$plist.="<dd><input type='text' name='PageNo' style='width:30px;height:18px' value='".$this->PageNo."'></dd>\r\n";
$plist.="<dd><input type='submit' name='plistgo' value='GO' style='width:24px;height:18px;font-size:9pt'></dd>\r\n";
}
$plist .= "</dl>\r\n</form>\r\n";
return $plist;
}
//---------------
//获得当前的页面文件的url
//----------------
function GetCurUrl()
{
if(!empty($_SERVER["REQUEST_URI"])){
$nowurl = $_SERVER["REQUEST_URI"];
$nowurls = explode("?",$nowurl);
$nowurl = $nowurls[0];
}else{ $nowurl = $_SERVER["PHP_SELF"]; }
return $nowurl;
}
}//End Class
?> | zyyhong | trunk/jiaju001/news/include/inc_arcbook_view.php | PHP | asf20 | 26,744 |
<?php
header("Location:vdimgck.php\r\n");
?> | zyyhong | trunk/jiaju001/news/include/validateimg.php | PHP | asf20 | 47 |
<?php
/*----------------------------------------------
Copyright 2004-2006 by DedeCms.com itprato
Dede Tag模板解析引挚 V4.1 版
最后修改日期:2006-7-4 PHP版本要求:大于或等于php 4.1
---------------------------------------------*/
/****************************************
class DedeTag 标记的数据结构描述
function c____DedeTag();
**************************************/
class DedeTag
{
var $IsReplace=FALSE; //标记是否已被替代,供解析器使用
var $TagName=""; //标记名称
var $InnerText=""; //标记之间的文本
var $StartPos=0; //标记起始位置
var $EndPos=0; //标记结束位置
var $CAttribute=""; //标记属性描述,即是class DedeAttribute
var $TagValue=""; //标记的值
var $TagID=0;
//获取标记的名称和值
function GetName(){
return strtolower($this->TagName);
}
function GetValue(){
return $this->TagValue;
}
//下面两个成员函数仅是为了兼容旧版
function GetTagName(){
return strtolower($this->TagName);
}
function GetTagValue(){
return $this->TagValue;
}
//获取标记的指定属性
function IsAttribute($str){
return $this->CAttribute->IsAttribute($str);
}
function GetAttribute($str){
return $this->CAttribute->GetAtt($str);
}
function GetAtt($str){
return $this->CAttribute->GetAtt($str);
}
function GetInnerText(){
return $this->InnerText;
}
}
/**********************************************
//DedeTagParse Dede织梦模板类
function c____DedeTagParse();
***********************************************/
class DedeTagParse
{
var $NameSpace = 'dede'; //标记的名字空间
var $TagStartWord = '{'; //标记起始
var $TagEndWord = '}'; //标记结束
var $TagMaxLen = 64; //标记名称的最大值
var $CharToLow = true; // true表示对属性和标记名称不区分大小写
//////////////////////////////////////////////////////
var $IsCache = FALSE; //是否使用缓冲
var $TempMkTime = 0;
var $CacheFile = '';
/////////////////////////////
var $SourceString = '';//模板字符串
var $CTags = ''; //标记集合
var $Count = -1; //$Tags标记个数
function __construct()
{
if(!isset($GLOBALS['cfg_dede_cache'])) $GLOBALS['cfg_dede_cache'] = 'N';
if($GLOBALS['cfg_dede_cache']=='Y') $this->IsCache = true;
else $this->IsCache = FALSE;
$this->NameSpace = 'dede';
$this->TagStartWord = '{';
$this->TagEndWord = '}';
$this->TagMaxLen = 64;
$this->CharToLow = true;
$this->SourceString = '';
$this->CTags = Array();
$this->Count = -1;
$this->TempMkTime = 0;
$this->CacheFile = '';
}
function DedeTagParse(){
$this->__construct();
}
//设置标记的命名空间,默认为dede
function SetNameSpace($str,$s="{",$e="}"){
$this->NameSpace = strtolower($str);
$this->TagStartWord = $s;
$this->TagEndWord = $e;
}
//重置成员变量或Clear
function SetDefault(){
$this->SourceString = '';
$this->CTags = '';
$this->Count=-1;
}
function GetCount(){
return $this->Count+1;
}
function Clear(){
$this->SetDefault();
}
//检测模板缓冲
function LoadCache($filename)
{
if(!$this->IsCache) return false;
$cdir = dirname($filename);
$ckfile = str_replace($cdir,'',$filename).'.cache';
$ckfullfile = $cdir.''.$ckfile;
$ckfullfile_t = $cdir.''.$ckfile.'.t';
$this->CacheFile = $ckfullfile;
$this->TempMkTime = filemtime($filename);
if(!file_exists($ckfullfile)||!file_exists($ckfullfile_t)) return false;
//检测模板最后更新时间
$fp = fopen($ckfullfile_t,'r');
$time_info = trim(fgets($fp,64));
fclose($fp);
if($time_info != $this->TempMkTime){ return false; }
//引入缓冲数组
include($this->CacheFile);
//把缓冲数组内容读入类
if(isset($z) && is_array($z)){
foreach($z as $k=>$v){
$this->Count++;
$ctag = new DedeTAg();
$ctag->CAttribute = new DedeAttribute();
$ctag->IsReplace = FALSE;
$ctag->TagName = $v[0];
$ctag->InnerText = $v[1];
$ctag->StartPos = $v[2];
$ctag->EndPos = $v[3];
$ctag->TagValue = '';
$ctag->TagID = $k;
if(isset($v[4]) && is_array($v[4])){
$i = 0;
foreach($v[4] as $k=>$v){
$ctag->CAttribute->Count++;
$ctag->CAttribute->Items[$k]=$v;
}
}
$this->CTags[$this->Count] = $ctag;
}
}
else{//模板没有缓冲数组
$this->CTags = '';
$this->Count = -1;
}
return true;
}
//写入缓冲
function SaveCache()
{
$fp = fopen($this->CacheFile.'.t',"w");
fwrite($fp,$this->TempMkTime."\n");
fclose($fp);
$fp = fopen($this->CacheFile,"w");
flock($fp,3);
fwrite($fp,'<'.'?php'."\r\n");
if(is_array($this->CTags)){
foreach($this->CTags as $tid=>$ctag){
$arrayValue = 'Array("'.$ctag->TagName.'",';
$arrayValue .= '"'.str_replace('$','\$',str_replace("\r","\\r",str_replace("\n","\\n",str_replace('"','\"',$ctag->InnerText)))).'"';
$arrayValue .= ",{$ctag->StartPos},{$ctag->EndPos});";
fwrite($fp,"\$z[$tid]={$arrayValue}\n");
if(is_array($ctag->CAttribute->Items)){
foreach($ctag->CAttribute->Items as $k=>$v){
$k = trim(str_replace("'","",$k));
if($k=="") continue;
if($k!='tagname') fwrite($fp,"\$z[$tid][4]['$k']=\"".str_replace('$','\$',str_replace("\"","\\\"",$v))."\";\n");
}
}
}
}
fwrite($fp,"\n".'?'.'>');
fclose($fp);
}
//载入模板文件
function LoadTemplate($filename){
$this->SetDefault();
$fp = @fopen($filename,"r") or die("DedeTag Engine Load Template False!");
while($line = fgets($fp,1024))
$this->SourceString .= $line;
fclose($fp);
if($this->LoadCache($filename)) return;
else $this->ParseTemplet();
}
function LoadTemplet($filename){
$this->LoadTemplate($filename);
}
function LoadFile($filename){
$this->LoadTemplate($filename);
}
//载入模板字符串
function LoadSource($str){
$this->SetDefault();
$this->SourceString = $str;
$this->IsCache = FALSE;
$this->ParseTemplet();
}
function LoadString($str){
$this->LoadSource($str);
}
//获得指定名称的Tag的ID(如果有多个同名的Tag,则取没有被取代为内容的第一个Tag)
function GetTagID($str){
if($this->Count==-1) return -1;
if($this->CharToLow) $str=strtolower($str);
foreach($this->CTags as $ID=>$CTag){
if($CTag->TagName==$str && !$CTag->IsReplace){
return $ID;
break;
}
}
return -1;
}
//获得指定名称的CTag数据类(如果有多个同名的Tag,则取没有被分配内容的第一个Tag)
function GetTag($str){
if($this->Count==-1) return "";
if($this->CharToLow) $str=strtolower($str);
foreach($this->CTags as $ID=>$CTag){
if($CTag->TagName==$str && !$CTag->IsReplace){
return $CTag;
break;
}
}
return "";
}
function GetTagByName($str)
{ return $this->GetTag($str); }
//获得指定ID的CTag数据类
function GetTagByID($ID){
if(isset($this->CTags[$ID])) return $this->CTags[$ID];
else return "";
}
//
//分配指定ID的标记的值
//
function Assign($tagid,$str,$runfunc = true)
{
if(isset($this->CTags[$tagid]))
{
$this->CTags[$tagid]->IsReplace = true;
if( $this->CTags[$tagid]->GetAtt("function")!="" && $runfunc ){
$this->CTags[$tagid]->TagValue = $this->EvalFunc(
$str,
$this->CTags[$tagid]->GetAtt("function")
);
}
else
{ $this->CTags[$tagid]->TagValue = $str; }
}
}
//分配指定名称的标记的值,如果标记包含属性,请不要用此函数
function AssignName($tagname,$str)
{
foreach($this->CTags as $ID=>$CTag){
if($CTag->TagName==$tagname) $this->Assign($ID,$str);
}
}
//处理特殊标记
function AssignSysTag()
{
for($i=0;$i<=$this->Count;$i++)
{
$CTag = $this->CTags[$i];
//获取一个外部变量
if( $CTag->TagName == "global" ){
$this->CTags[$i]->IsReplace = true;
$this->CTags[$i]->TagValue = $this->GetGlobals($CTag->GetAtt("name"));
if( $this->CTags[$i]->GetAtt("function")!="" ){
$this->CTags[$i]->TagValue = $this->EvalFunc(
$this->CTags[$i]->TagValue,$this->CTags[$i]->GetAtt("function")
);
}
}
//引入静态文件
else if( $CTag->TagName == "include" ){
$this->CTags[$i]->IsReplace = true;
$this->CTags[$i]->TagValue = $this->IncludeFile($CTag->GetAtt("file"),$CTag->GetAtt("ismake"));
}
//循环一个普通数组
else if( $CTag->TagName == "foreach" )
{
$rstr = "";
$arr = $this->CTags[$i]->GetAtt("array");
if(isset($GLOBALS[$arr]))
{
foreach($GLOBALS[$arr] as $k=>$v){
$istr = "";
$istr .= preg_replace("/\[field:key([\r\n\t\f ]+)\/\]/is",$k,$this->CTags[$i]->InnerText);
$rstr .= preg_replace("/\[field:value([\r\n\t\f ]+)\/\]/is",$v,$istr);
}
}
$this->CTags[$i]->IsReplace = true;
$this->CTags[$i]->TagValue = $rstr;
}
//运行PHP接口
if( $CTag->GetAtt("runphp") == "yes" )
{
$DedeMeValue = "";
if($CTag->GetAtt("source")=='value')
{ $runphp = $this->CTags[$i]->TagValue; }
else{
$DedeMeValue = $this->CTags[$i]->TagValue;
$runphp = $CTag->GetInnerText();
}
$runphp = eregi_replace("'@me'|\"@me\"|@me",'$DedeMeValue',$runphp);
eval($runphp.";");
$this->CTags[$i]->IsReplace = true;
$this->CTags[$i]->TagValue = $DedeMeValue;
}
}
}
//把分析模板输出到一个字符串中
//不替换没被处理的值
function GetResultNP()
{
$ResultString = "";
if($this->Count==-1){
return $this->SourceString;
}
$this->AssignSysTag();
$nextTagEnd = 0;
$strok = "";
for($i=0;$i<=$this->Count;$i++){
if($this->CTags[$i]->GetValue()!=""){
if($this->CTags[$i]->GetValue()=='#@Delete@#') $this->CTags[$i]->TagValue = "";
$ResultString .= substr($this->SourceString,$nextTagEnd,$this->CTags[$i]->StartPos-$nextTagEnd);
$ResultString .= $this->CTags[$i]->GetValue();
$nextTagEnd = $this->CTags[$i]->EndPos;
}
}
$slen = strlen($this->SourceString);
if($slen>$nextTagEnd){
$ResultString .= substr($this->SourceString,$nextTagEnd,$slen-$nextTagEnd);
}
return $ResultString;
}
//把分析模板输出到一个字符串中,并返回
function GetResult()
{
$ResultString = "";
if($this->Count==-1){
return $this->SourceString;
}
$this->AssignSysTag();
$nextTagEnd = 0;
$strok = "";
for($i=0;$i<=$this->Count;$i++){
$ResultString .= substr($this->SourceString,$nextTagEnd,$this->CTags[$i]->StartPos-$nextTagEnd);
$ResultString .= $this->CTags[$i]->GetValue();
$nextTagEnd = $this->CTags[$i]->EndPos;
}
$slen = strlen($this->SourceString);
if($slen>$nextTagEnd){
$ResultString .= substr($this->SourceString,$nextTagEnd,$slen-$nextTagEnd);
}
return $ResultString;
}
//直接输出分析模板
function Display()
{
echo $this->GetResult();
}
//把分析模板输出为文件
function SaveTo($filename)
{
$fp = @fopen($filename,"w") or die("DedeTag Engine Create File False");
fwrite($fp,$this->GetResult());
fclose($fp);
}
//解析模板
function ParseTemplet()
{
$TagStartWord = $this->TagStartWord;
$TagEndWord = $this->TagEndWord;
$sPos = 0; $ePos = 0;
$FullTagStartWord = $TagStartWord.$this->NameSpace.":";
$sTagEndWord = $TagStartWord."/".$this->NameSpace.":";
$eTagEndWord = "/".$TagEndWord;
$tsLen = strlen($FullTagStartWord);
$sourceLen=strlen($this->SourceString);
if( $sourceLen <= ($tsLen + 3) ) return;
$cAtt = new DedeAttributeParse();
$cAtt->CharToLow = $this->CharToLow;
//遍历模板字符串,请取标记及其属性信息
for($i=0;$i<$sourceLen;$i++)
{
$tTagName = "";
//这个设置可以保证两全紧密相连的标记可识别
if($i - 1 > 0) $t = $i - 1;
else $t = 0;
$sPos = strpos($this->SourceString,$FullTagStartWord,$t);
$isTag = $sPos;
if($i==0){
$headerTag = substr($this->SourceString,0,strlen($FullTagStartWord));
if($headerTag==$FullTagStartWord){ $isTag=true; $sPos=0; }
}
if($isTag===FALSE) break;
if($sPos > ($sourceLen-$tsLen-3) ) break;
for($j=($sPos+$tsLen);$j<($sPos+$tsLen+$this->TagMaxLen);$j++)
{
if($j>($sourceLen-1)) break;
else if(ereg("[ \t\r\n]",$this->SourceString[$j])
||$this->SourceString[$j] == $this->TagEndWord) break;
else $tTagName .= $this->SourceString[$j];
}
if(strtolower($tTagName)=="comments")
{
$endPos = strpos($this->SourceString,$sTagEndWord ."comments",$i);
if($endPos!==false) $i=$endPos+strlen($sTagEndWord)+8;
continue;
}
$i = $sPos+$tsLen;
$sPos = $i;
$fullTagEndWord = $sTagEndWord.$tTagName;
$endTagPos1 = strpos($this->SourceString,$eTagEndWord,$i);
$endTagPos2 = strpos($this->SourceString,$fullTagEndWord,$i);
$newStartPos = strpos($this->SourceString,$FullTagStartWord,$i);
if($endTagPos1===FALSE) $endTagPos1=0;
if($endTagPos2===FALSE) $endTagPos2=0;
if($newStartPos===FALSE) $newStartPos=0;
//判断用何种标记作为结束
if($endTagPos1>0 &&
($endTagPos1 < $newStartPos || $newStartPos==0) &&
($endTagPos1 < $endTagPos2 || $endTagPos2==0 ))
{
$ePos = $endTagPos1;
$i = $ePos + 2;
}
else if($endTagPos2>0){
$ePos = $endTagPos2;
$i = $ePos + strlen($fullTagEndWord)+1;
}
else{
echo "Parse error the tag ".($this->GetCount()+1)." $tTagName' is incorrect ! <br/>";
}
//分析所找到的标记位置等信息
$attStr = "";
$innerText = "";
$startInner = 0;
for($j=$sPos;$j < $ePos;$j++)
{
if($startInner==0 && $this->SourceString[$j]==$TagEndWord)
{ $startInner=1; continue; }
if($startInner==0) $attStr .= $this->SourceString[$j];
else $innerText .= $this->SourceString[$j];
}
$cAtt->SetSource($attStr);
if($cAtt->CAttribute->GetTagName()!="")
{
$this->Count++;
$CDTag = new DedeTag();
$CDTag->TagName = $cAtt->CAttribute->GetTagName();
$CDTag->StartPos = $sPos - $tsLen;
$CDTag->EndPos = $i;
$CDTag->CAttribute = $cAtt->CAttribute;
$CDTag->IsReplace = FALSE;
$CDTag->TagID = $this->Count;
$CDTag->InnerText = $innerText;
$this->CTags[$this->Count] = $CDTag;
//定义函数或执行PHP语句
if( $CDTag->TagName == "define"){
@eval($CDTag->InnerText);
}
}
}//结束遍历模板字符串
if($this->IsCache) $this->SaveCache();
}
//处理某字段的函数
function EvalFunc($fieldvalue,$functionname)
{
$DedeFieldValue = $fieldvalue;
$functionname = str_replace("{\"","[\"",$functionname);
$functionname = str_replace("\"}","\"]",$functionname);
$functionname = eregi_replace("'@me'|\"@me\"|@me",'$DedeFieldValue',$functionname);
$functionname = "\$DedeFieldValue = ".$functionname;
eval($functionname.";"); //or die("<xmp>$functionname</xmp>");
if(empty($DedeFieldValue)) return "";
else return $DedeFieldValue;
}
//获得一个外部变量
function GetGlobals($varname)
{
$varname = trim($varname);
//禁止在模板文件读取数据库密码
if($varname=="dbuserpwd"||$varname=="cfg_dbpwd") return "";
//正常情况
if(isset($GLOBALS[$varname])) return $GLOBALS[$varname];
else return "";
}
//引入文件
function IncludeFile($filename,$ismake='no')
{
global $cfg_df_style;
$restr = "";
if(file_exists($filename)){ $okfile = $filename; }
else if( file_exists(dirname(__FILE__)."/".$filename) ){ $okfile = dirname(__FILE__)."/".$filename; }
else if( file_exists(dirname(__FILE__)."/../".$filename) ){ $okfile = dirname(__FILE__)."/../".$filename; }
else if( file_exists(dirname(__FILE__)."/../templets/".$filename) ){ $okfile = dirname(__FILE__)."/../templets/".$filename; }
else if( file_exists(dirname(__FILE__)."/../templets/".$cfg_df_style."/".$filename) ){ $okfile = dirname(__FILE__)."/../templets/".$cfg_df_style."/".$filename; }
else{ return "无法在这个位置找到: $filename"; }
//编译
if($ismake=="yes"){
require_once(dirname(__FILE__)."/inc_arcpart_view.php");
$pvCopy = new PartView();
$pvCopy->SetTemplet($okfile,"file");
$restr = $pvCopy->GetResult();
}else{
$fp = @fopen($okfile,"r");
while($line=fgets($fp,1024)) $restr.=$line;
fclose($fp);
}
return $restr;
}
}
/**********************************************
//class DedeAttribute Dede模板标记属性集合
function c____DedeAttribute();
**********************************************/
//属性的数据描述
class DedeAttribute
{
var $Count = -1;
var $Items = ""; //属性元素的集合
//获得某个属性
function GetAtt($str){
if($str=="") return "";
if(isset($this->Items[$str])) return $this->Items[$str];
else return "";
}
//同上
function GetAttribute($str){
return $this->GetAtt($str);
}
//判断属性是否存在
function IsAttribute($str){
if(isset($this->Items[$str])) return true;
else return false;
}
//获得标记名称
function GetTagName(){
return $this->GetAtt("tagname");
}
// 获得属性个数
function GetCount(){
return $this->Count+1;
}
}
/*******************************
//属性解析器
function c____DedeAttributeParse();
********************************/
class DedeAttributeParse
{
var $SourceString = "";
var $SourceMaxSize = 1024;
var $CAttribute = ""; //属性的数据描述类
var $CharToLow = true;
//////设置属性解析器源字符串////////////////////////
function SetSource($str="")
{
$this->CAttribute = new DedeAttribute();
//////////////////////
$strLen = 0;
$this->SourceString = trim(preg_replace("/[ \t\r\n]{1,}/"," ",$str));
$strLen = strlen($this->SourceString);
if($strLen>0&&$strLen<=$this->SourceMaxSize){
$this->ParseAttribute();
}
}
//////解析属性(私有成员,仅给SetSource调用)/////////////////
function ParseAttribute()
{
$d = "";
$tmpatt="";
$tmpvalue="";
$startdd=-1;
$ddtag="";
$notAttribute=true;
$strLen = strlen($this->SourceString);
// 这里是获得Tag的名称,可视情况是否需要
// 如果不在这个里解析,则在解析整个Tag时解析
// 属性中不应该存在tagname这个名称
for($i=0;$i<$strLen;$i++)
{
$d = substr($this->SourceString,$i,1);
if($d==' '){
$this->CAttribute->Count++;
if($this->CharToLow) $this->CAttribute->Items["tagname"]=strtolower(trim($tmpvalue));
else $this->CAttribute->Items["tagname"]=trim($tmpvalue);
$tmpvalue = "";
$notAttribute = false;
break;
}
else
$tmpvalue .= $d;
}
//不存在属性列表的情况
if($notAttribute)
{
$this->CAttribute->Count++;
if($this->CharToLow) $this->CAttribute->Items["tagname"]=strtolower(trim($tmpvalue));
else $this->CAttribute->Items["tagname"]=trim($tmpvalue);
}
//如果字符串含有属性值,遍历源字符串,并获得各属性
if(!$notAttribute){
for($i;$i<$strLen;$i++)
{
$d = substr($this->SourceString,$i,1);
if($startdd==-1){
if($d!="=") $tmpatt .= $d;
else{
if($this->CharToLow) $tmpatt = strtolower(trim($tmpatt));
else $tmpatt = trim($tmpatt);
$startdd=0;
}
}
else if($startdd==0)
{
switch($d){
case ' ':
continue;
break;
case '\'':
$ddtag='\'';
$startdd=1;
break;
case '"':
$ddtag='"';
$startdd=1;
break;
default:
$tmpvalue.=$d;
$ddtag=' ';
$startdd=1;
break;
}
}
else if($startdd==1)
{
if($d==$ddtag){
$this->CAttribute->Count++;
$this->CAttribute->Items[$tmpatt] = trim($tmpvalue);//strtolower(trim($tmpvalue));
$tmpatt = "";
$tmpvalue = "";
$startdd=-1;
}
else
$tmpvalue.=$d;
}
}//for
if($tmpatt!=""){
$this->CAttribute->Count++;
$this->CAttribute->Items[$tmpatt]=trim($tmpvalue);//strtolower(trim($tmpvalue));
}
}//完成属性解析//has Attribute
}// end func
}
?> | zyyhong | trunk/jiaju001/news/include/pub_dedetag.php | PHP | asf20 | 20,583 |
<?php
if(!defined('DEDEINC'))
{
exit("Request Error!");
}
session_start();
$GLOBALS['groupRanks'] = '';
//检验用户是否有权使用某功能
function TestPurview($n)
{
global $groupRanks;
$rs = false;
$purview = $GLOBALS['cuserLogin']->getPurview();
if(eregi('admin_AllowAll',$purview)) return true;
if($n=='') return true;
if(!is_array($groupRanks)){ $groupRanks = explode(' ',$purview); }
$ns = explode(',',$n);
foreach($ns as $v){ //只要找到一个匹配的权限,即可认为用户有权访问此页面
if($v=='') continue;
if(in_array($v,$groupRanks)){ $rs = true; break; }
}
return $rs;
}
function CheckPurview($n)
{
if(!TestPurview($n)){
ShowMsg("对不起,你没有权限执行此操作!<br/><br/><a href='javascript:history.go(-1);'>点击此返回上一页>></a>",'javascript:;');
exit();
}
}
//是否没权限限制(超级管理员)
function TestAdmin(){
$purview = $GLOBALS['cuserLogin']->getPurview();
if(eregi('admin_AllowAll',$purview)) return true;
else return false;
}
$DedeUserCatalogs = Array();
//获得用户授权的所有栏目ID
function GetMyCatalogs($dsql,$cid)
{
$GLOBALS['DedeUserCatalogs'][] = $cid;
$dsql->SetQuery("Select ID From #@__arctype where reID='$cid'");
$dsql->Execute($cid);
while($row = $dsql->GetObject($cid)){
GetMyCatalogs($dsql,$row->ID);
}
}
function MyCatalogs(){
global $dsql;
if(count($GLOBALS['DedeUserCatalogs'])==0){
if(!is_array($dsql)) $dsql = new DedeSql(true);
$ids = $GLOBALS['cuserLogin']->getUserChannel();
$ids = ereg_replace('[><]','',str_replace('><',',',$ids));
$ids = explode(',',$ids);
if(is_array($ids))
{
foreach($ids as $id)
{ GetMyCatalogs($dsql,$id); }
}
}
return $GLOBALS['DedeUserCatalogs'];
}
function MyCatalogInArr()
{
$r = '';
$arr = MyCatalogs();
if(is_array($arr))
{
foreach($arr as $v){
if($r=='') $r .= $v;
else $r .= ','.$v;
}
}
return $r;
}
//检测用户是否有权限操作某栏目
function CheckCatalog($cid,$msg)
{
if(!CheckCatalogTest($cid)){
ShowMsg(" $msg <br/><br/><a href='javascript:history.go(-1);'>点击此返回上一页>></a>",'javascript:;');
exit();
}
return true;
}
//检测用户是否有权限操作某栏目
function CheckCatalogTest($cid,$uc=''){
if(empty($uc)) $uc = $GLOBALS['cuserLogin']->getUserChannel();
if(empty($uc)||$uc==-1||TestAdmin()) return true;
if(!in_array($cid,MyCatalogs())) return false;
else return true;
}
$admincachefile = DEDEINC.'/../data/admin_'.cn_substr(md5($cfg_cookie_encode),24).'.php';
if(!file_exists($admincachefile)) {
$fp = fopen($admincachefile,'w');
fwrite($fp,'<'.'?php $admin_path ='." ''; ?".'>');
fclose($fp);
}
require_once($admincachefile);
//登录类
class userLogin
{
var $userName = '';
var $userPwd = '';
var $userID = '';
var $userType = '';
var $userChannel = '';
var $userPurview = '';
var $adminDir = '';
var $keepUserIDTag = "dede_admin_id";
var $keepUserTypeTag = "dede_admin_type";
var $keepUserChannelTag = "dede_admin_channel";
var $keepUserNameTag = "dede_admin_name";
var $keepUserPurviewTag = "dede_admin_purview";
//php5构造函数
function __construct()
{
global $admin_path;
if(isset($_SESSION[$this->keepUserIDTag]))
{
$this->userID=$_SESSION[$this->keepUserIDTag];
$this->userType=$_SESSION[$this->keepUserTypeTag];
$this->userChannel=$_SESSION[$this->keepUserChannelTag];
$this->userName=$_SESSION[$this->keepUserNameTag];
$this->userPurview=$_SESSION[$this->keepUserPurviewTag];
}
$this->adminDir = $admin_path;
}
function userLogin()
{
$this->__construct($admindir);
}
//检验用户是否正确
function checkUser($username,$userpwd)
{
//只允许用户名和密码用0-9,a-z,A-Z,'@','_','.','-'这些字符
$this->userName = ereg_replace("[^0-9a-zA-Z_@\!\.-]",'',$username);
$this->userPwd = ereg_replace("[^0-9a-zA-Z_@\!\.-]",'',$userpwd);
$pwd = substr(md5($this->userPwd),0,24);
$dsql = new DedeSql(false);
$dsql->SetQuery("Select * From #@__admin where userid='".$this->userName."' limit 0,1");
$dsql->Execute();
$row = $dsql->GetObject();
if(!isset($row->pwd)){
$dsql->Close();
return -1;
}
else if($pwd!=$row->pwd){
$dsql->Close();
return -2;
}
else{
$loginip = GetIP();
$this->userID = $row->ID;
$this->userType = $row->usertype;
$this->userChannel = $row->typeid;
$this->userName = $row->uname;
$groupSet = $dsql->GetOne("Select * From #@__admintype where rank='".$row->usertype."'");
$this->userPurview = $groupSet['purviews'];
$dsql->SetQuery("update #@__admin set loginip='$loginip',logintime='".strftime("%Y-%m-%d %H:%M:%S",time())."' where ID='".$row->ID."'");
$dsql->ExecuteNoneQuery();
$dsql->Close();
return 1;
}
}
//保持用户的会话状态
//成功返回 1 ,失败返回 -1
function keepUser($admindir)
{
global $admincachefile;
if($this->userID!='' && $this->userType!='')
{
session_register($this->keepUserIDTag);
$_SESSION[$this->keepUserIDTag] = $this->userID;
session_register($this->keepUserTypeTag);
$_SESSION[$this->keepUserTypeTag] = $this->userType;
session_register($this->keepUserChannelTag);
$_SESSION[$this->keepUserChannelTag] = $this->userChannel;
session_register($this->keepUserNameTag);
$_SESSION[$this->keepUserNameTag] = $this->userName;
session_register($this->keepUserPurviewTag);
$_SESSION[$this->keepUserPurviewTag] = $this->userPurview;
$fp = fopen($admincachefile,'w');
fwrite($fp,'<'.'?php $admin_path ='." '$admindir'; ?".'>');
fclose($fp);
return 1;
}
else
return -1;
}
//结束用户的会话状态
function exitUser()
{
global $admincachefile;
@session_unregister($this->keepUserIDTag);
@session_unregister($this->keepUserTypeTag);
@session_unregister($this->keepUserChannelTag);
@session_unregister($this->keepUserNameTag);
@session_unregister($this->keepUserPurviewTag);
$fp = fopen($admincachefile,'w');
fwrite($fp,'<'.'?php $admin_path ='." ''; ?".'>');
fclose($fp);
session_destroy();
}
//-----------------------------
//获得用户管理频道的值
//-----------------------------
function getUserChannel(){
if($this->userChannel!='') return $this->userChannel;
else return -1;
}
//获得用户的权限值
function getUserType(){
if($this->userType!='') return $this->userType;
else return -1;
}
function getUserRank(){
return $this->getUserType();
}
//获得用户的ID
function getUserID(){
if($this->userID!='') return $this->userID;
else return -1;
}
//获得用户的笔名
function getUserName(){
if($this->userName!='') return $this->userName;
else return -1;
}
//用户权限表
function getPurview(){
return $this->userPurview;
}
}
?> | zyyhong | trunk/jiaju001/news/include/inc_userlogin.php | PHP | asf20 | 7,070 |
<?php
/*-------------------------------------------------------
使用方法
1、把本文件放到 include 文件夹
2、在 inc_archives_view.php 中引入本文件
require_once(dirname(__FILE__)."/inc_downclass.php");
3、然后文章模板的{dede:field name='body'/}标记中加入 function='RndString(@me)'
即是改为 {dede:field name='body' function='RndString(@me)'/}
-----------------------------------------------------------*/
function RndString($body)
{
//最大间隔距离(如果在检测不到p标记的情况下,加入混淆字串的最大间隔距离)
$maxpos = 1024;
//font 的字体颜色
$fontColor = "#FFFFFF";
//div span p 标记的随机样式
$st1 = chr(mt_rand(ord('A'),ord('Z'))).chr(mt_rand(ord('a'),ord('z'))).chr(mt_rand(ord('a'),ord('z'))).mt_rand(100,999);
$st2 = chr(mt_rand(ord('A'),ord('Z'))).chr(mt_rand(ord('a'),ord('z'))).chr(mt_rand(ord('a'),ord('z'))).mt_rand(100,999);
$st3 = chr(mt_rand(ord('A'),ord('Z'))).chr(mt_rand(ord('a'),ord('z'))).chr(mt_rand(ord('a'),ord('z'))).mt_rand(100,999);
$st4 = chr(mt_rand(ord('A'),ord('Z'))).chr(mt_rand(ord('a'),ord('z'))).chr(mt_rand(ord('a'),ord('z'))).mt_rand(100,999);
$rndstyle[1]['value'] = ".{$st1} { display:none; }";
$rndstyle[1]['name'] = $st1;
$rndstyle[2]['value'] = ".{$st2} { display:none; }";
$rndstyle[2]['name'] = $st2;
$rndstyle[3]['value'] = ".{$st3} { display:none; }";
$rndstyle[3]['name'] = $st3;
$rndstyle[4]['value'] = ".{$st4} { display:none; }";
$rndstyle[4]['name'] = $st4;
$mdd = mt_rand(1,4);
//以后内容如果你不懂其含义,请不要改动
//---------------------------------------------------
$rndstyleValue = $rndstyle[$mdd]['value'];
$rndstyleName = $rndstyle[$mdd]['name'];
$reString = "<style> $rndstyleValue </style>\r\n";
//附机标记
$rndem[1] = 'font';
$rndem[2] = 'div';
$rndem[3] = 'span';
$rndem[4] = 'p';
//读取字符串数据
$fp = fopen(dirname(__FILE__).'/data/downmix.php','r');
$start = 0;
$totalitem = 0;
while(!feof($fp)){
$v = trim(fgets($fp,128));
if($start==1){
if(ereg("#end#",$v)) break;
if($v!=""){ $totalitem++; $rndstring[$totalitem] = ereg_replace("#,","",$v); }
}
if(ereg("#start#",$v)){ $start = 1; }
}
fclose($fp);
//处理要防采集的字段
$bodylen = strlen($body) - 1;
$prepos = 0;
for($i=0;$i<=$bodylen;$i++){
if($i+2 >= $bodylen || $i<50) $reString .= $body[$i];
else{
@$ntag = strtolower($body[$i].$body[$i+1].$body[$i+2]);
if($ntag=='</p' || ($ntag=='<br' && $i-$prepos>$maxpos) ){
$dd = mt_rand(1,4);
$emname = $rndem[$dd];
$dd = mt_rand(1,$totalitem);
$rnstr = $rndstring[$dd];
if($emname!='font') $rnstr = " <$emname class='$rndstyleName'>$rnstr</$emname> ";
else $rnstr = " <font color='$fontColor'>$rnstr</font> ";
$reString .= $rnstr.$body[$i];
$prepos = $i;
}
else $reString .= $body[$i];
}
}
unset($body);
return $reString;
}//函数结束
?> | zyyhong | trunk/jiaju001/news/include/inc_downclass.php | PHP | asf20 | 3,092 |
<?php
if(!defined('DEDEINC'))
{
exit("Request Error!");
}
require_once(DEDEINC."/pub_dedetag.php");
require_once(DEDEINC."/inc_channel_unit_functions.php");
$GLOBALS['cfg_softinfos'] = '';
/*----------------------------------
表示特定频道的附加数据结构信息
function C____ChannelUnit();
-----------------------------------*/
class ChannelUnit
{
var $ChannelInfos;
var $ChannelFields;
var $AllFieldNames;
var $ChannelID;
var $ArcID;
var $dsql;
var $SplitPageField;
//-------------
//php5构造函数
//-------------
function __construct($cid,$aid=0)
{
$this->ChannelInfos = "";
$this->ChannelFields = "";
$this->AllFieldNames = "";
$this->SplitPageField = "";
$this->ChannelID = $cid;
$this->ArcID = $aid;
$this->dsql = new DedeSql(false);
$this->ChannelInfos = $this->dsql->GetOne("Select * from #@__channeltype where ID='$cid'");
if(!is_array($this->ChannelInfos)){
echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>\r\n";
echo "<div style='font-size:14px;line-height:150%;margin-left:20px'>";
echo "读取频道 {$cid} 信息失败,无法进行后续操作!<br/>\r\n";
echo "你可以尝试先对错误文档进行清理,然后再刷新本页。<br/>\r\n";
echo "请选择操作: <a href='javascript:location.reload();'>[重试]</a> <a href='archives_clear.php' target='_blank'>[清理错误文档]</a> ";
echo "</div>";
exit();
}
$dtp = new DedeTagParse();
$dtp->SetNameSpace("field","<",">");
$dtp->LoadSource($this->ChannelInfos["fieldset"]);
if(is_array($dtp->CTags))
{
$tnames = Array();
foreach($dtp->CTags as $ctag){
$tname = $ctag->GetName();
if(isset($tnames[$tname]))
{ return; }
$tnames[$tname] = 1;
if($this->AllFieldNames!="") $this->AllFieldNames .= ",".$tname;
else $this->AllFieldNames .= $tname;
$this->ChannelFields[$tname]["innertext"] = $ctag->GetInnerText();
$this->ChannelFields[$tname]["type"] = $ctag->GetAtt("type");
$this->ChannelFields[$tname]["default"] = $ctag->GetAtt("default");
$this->ChannelFields[$tname]["rename"] = $ctag->GetAtt("rename");
$this->ChannelFields[$tname]["function"] = $ctag->GetAtt("function");
$this->ChannelFields[$tname]["value"] = "";
//----------------------------------------------------------------
$this->ChannelFields[$tname]["itemname"] = $ctag->GetAtt("itemname");
if($this->ChannelFields[$tname]["itemname"]=="")
{ $this->ChannelFields[$tname]["itemname"]=$tname; }
$this->ChannelFields[$tname]["isnull"] = $ctag->GetAtt("isnull");
$this->ChannelFields[$tname]["maxlength"] = $ctag->GetAtt("maxlength");
if($ctag->GetAtt("page")=="split") $this->SplitPageField = $tname;
}
}
$dtp->Clear();
}
function ChannelUnit($cid,$aid=0)
{
$this->__construct($cid,$aid);
}
//设置档案ID
//-----------------------
function SetArcID($aid)
{
$this->ArcID = $aid;
}
//处理某个字段的值
//----------------------
function MakeField($fname,$fvalue,$addvalue="")
{
if($fvalue==""){ $fvalue = $this->ChannelFields[$fname]["default"]; }
$ftype = $this->ChannelFields[$fname]["type"];
//执行函数
if($this->ChannelFields[$fname]["function"]!=""){
$fvalue = $this->EvalFunc($fvalue,$this->ChannelFields[$fname]["function"]);
}
//处理各种数据类型
if($ftype=="text"||$ftype=="textchar"){
$fvalue = ClearHtml($fvalue);
}
else if($ftype=="multitext"){
$fvalue = ClearHtml($fvalue);
$fvalue = Text2Html($fvalue);
}
else if($ftype=="img"){
$fvalue = $this->GetImgLinks($fvalue);
}
else if($ftype=="textdata"){
if(!is_file($GLOBALS['cfg_basedir'].$fvalue)) return "";
$fp = fopen($GLOBALS['cfg_basedir'].$fvalue,'r');
$fvalue = "";
while(!feof($fp)){ $fvalue .= fgets($fp,1024); }
fclose($fp);
}
else if($ftype=="addon"){
$foldvalue = $fvalue;
$tempStr = GetSysTemplets("channel/channel_addon.htm");
$tempStr = str_replace('~phppath~',$GLOBALS['cfg_plus_dir'],$tempStr);
$tempStr = str_replace('~link~',$foldvalue,$tempStr);
$fvalue = $tempStr;
}
else if($ftype=="softlinks"){
$fvalue = $this->GetAddLinkPage($fvalue);
}
else if($ftype=="specialtopic"){
$fvalue = $this->GetSpecList($fname,$fvalue,$addvalue);
}
return $fvalue;
}
//获得专题文章的列表
//--------------------------------
function GetSpecList($fname,$noteinfo,$noteid="")
{
if(!isset($GLOBALS['__SpGetFullList'])) require_once(dirname(__FILE__)."/inc/inc_fun_SpFullList.php");
if($noteinfo=="") return "";
$rvalue = "";
$tempStr = GetSysTemplets("channel/channel_spec_note.htm");
$dtp = new DedeTagParse();
$dtp->LoadSource($noteinfo);
if(is_array($dtp->CTags))
{
foreach($dtp->CTags as $k=>$ctag){
$notename = $ctag->GetAtt("name");
if($noteid!="" && $ctag->GetAtt("noteid")!=$noteid){ continue; } //指定名称的专题节点
$isauto = $ctag->GetAtt("isauto");
$idlist = trim($ctag->GetAtt("idlist"));
$rownum = trim($ctag->GetAtt("rownum"));
if(empty($rownum)) $rownum = 40;
$keywords = "";
$stypeid = 0;
if($isauto==1){
$idlist = "";
$keywords = trim($ctag->GetAtt("keywords"));
$stypeid = $ctag->GetAtt("typeid");
}
if(trim($ctag->GetInnerText())!="") $listTemplet = $ctag->GetInnerText();
else $listTemplet = GetSysTemplets("spec_arclist.htm");
$idvalue = SpGetFullList($this->dsql,$stypeid,0,$rownum,$ctag->GetAtt("titlelen"),$ctag->GetAtt("infolen"),
$keywords,$listTemplet,$idlist,'',0,'',$ctag->GetAtt("imgwidth"),$ctag->GetAtt("imgheight"));
$notestr = str_replace("~notename~",$notename,$tempStr);
$notestr = str_replace("~spec_arclist~",$idvalue,$notestr);
$rvalue .= $notestr;
if($noteid!="" && $ctag->GetAtt("noteid")==$noteid){ break; }
}
}
$dtp->Clear();
return $rvalue;
}
//获得进入附件下载页面的链接
//---------------------------------
function GetAddLinkPage($fvalue)
{
$row = $this->dsql->GetOne("Select downtype From #@__softconfig");
$phppath = $GLOBALS["cfg_plus_dir"];
$downlinkpage = "";
if($row['downtype']=='0'){
return $this->GetAddLinks($fvalue,$this->ArcID,$this->ChannelID);
}else{
$tempStr = GetSysTemplets("channel/channel_downlinkpage.htm");
$links = $phppath."/download.php?open=0&aid=".$this->ArcID."&cid=".$this->ChannelID;
$downlinkpage = str_replace("~link~",$links,$tempStr);
return $downlinkpage;
}
}
//获得附件的下载所有链接地址
//-----------------------------------
function GetAddLinks($fvalue,$aid,$cid)
{
global $cfg_softinfos;
if(!is_array($cfg_softinfos)){
$cfg_softinfos = $this->dsql->GetOne("Select ismoresite,sites,gotojump,showlocal From #@__softconfig");
}
$phppath = $GLOBALS['cfg_phpurl'];
$downlinks = "";
$dtp = new DedeTagParse();
$dtp->LoadSource($fvalue);
if(!is_array($dtp->CTags)){
$dtp->Clear();
return "无链接信息!";
}
$tempStr = GetSysTemplets("channel/channel_downlinks.htm");
foreach($dtp->CTags as $ctag)
{
if($ctag->GetName()=="link")
{
$links = trim($ctag->GetInnerText());
$serverName = trim($ctag->GetAtt("text"));
if(!isset($firstLink)){ $firstLink = $links; }
if($cfg_softinfos['showlocal']==0 || $cfg_softinfos['ismoresite']!=1)
{
if($cfg_softinfos['gotojump']==1) $links = $phppath."/download.php?open=1&aid=$aid&cid=$cid&link=".urlencode(base64_encode($links));
$temp = str_replace("~link~",$links,$tempStr);
$temp = str_replace("~server~",$serverName,$temp);
$downlinks .= $temp;
}
}
}
$dtp->Clear();
//启用镜像功能的情况
if($cfg_softinfos['ismoresite']==1 && !empty($cfg_softinfos['sites']) && isset($firstLink))
{
if(!empty($GLOBALS['cfg_basehost'])) $firstLink = eregi_replace($GLOBALS['cfg_basehost'],"",$firstLink);
$cfg_softinfos['sites'] = ereg_replace("\n{1,}","\n",str_replace("\r","\n",$cfg_softinfos['sites']));
$sites = explode("\n",trim($cfg_softinfos['sites']));
foreach($sites as $site)
{
if(trim($site)=='') continue;
list($link,$serverName) = explode('|',$site);
if(!eregi("^(http|ftp)://",$firstLink)) $flink = trim($link).$firstLink;
else $flink = $firstLink;
if($cfg_softinfos['gotojump']==1) $flink = $phppath."/download.php?open=1&aid=$aid&cid=$cid&link=".urlencode(base64_encode($flink));
$temp = str_replace("~link~",$flink,$tempStr);
$temp = str_replace("~server~",$serverName,$temp);
$downlinks .= $temp;
}
}
return $downlinks;global $cfg_softinfos;
if(!is_array($cfg_softinfos)){
$cfg_softinfos = $this->dsql->GetOne("Select ismoresite,sites,gotojump,showlocal From #@__softconfig");
}
$phppath = $GLOBALS['cfg_phpurl'];
$downlinks = "";
$dtp = new DedeTagParse();
$dtp->LoadSource($fvalue);
if(!is_array($dtp->CTags)){
$dtp->Clear();
return "无链接信息!";
}
$tempStr = GetSysTemplets("channel/channel_downlinks.htm");
foreach($dtp->CTags as $ctag)
{
if($ctag->GetName()=="link")
{
$links = trim($ctag->GetInnerText());
$serverName = trim($ctag->GetAtt("text"));
if(!isset($firstLink)){ $firstLink = $links; }
if($cfg_softinfos['showlocal']==0 || $cfg_softinfos['ismoresite']!=1)
{
if($cfg_softinfos['gotojump']==1) $links = $phppath."/download.php?open=1&aid=$aid&cid=$cid&link=".urlencode(base64_encode($links));
$temp = str_replace("~link~",$links,$tempStr);
$temp = str_replace("~server~",$serverName,$temp);
$downlinks .= $temp;
}
}
}
$dtp->Clear();
//启用镜像功能的情况
if($cfg_softinfos['ismoresite']==1 && !empty($cfg_softinfos['sites']) && isset($firstLink))
{
if(!empty($GLOBALS['cfg_basehost'])) $firstLink = eregi_replace($GLOBALS['cfg_basehost'],"",$firstLink);
$cfg_softinfos['sites'] = ereg_replace("\n{1,}","\n",str_replace("\r","\n",$cfg_softinfos['sites']));
$sites = explode("\n",trim($cfg_softinfos['sites']));
foreach($sites as $site)
{
if(trim($site)=='') continue;
list($link,$serverName) = explode('|',$site);
if(!eregi("^(http|ftp)://",$firstLink)) $flink = trim($link).$firstLink;
else $flink = $firstLink;
if($cfg_softinfos['gotojump']==1) $flink = $phppath."/download.php?open=1&aid=$aid&cid=$cid&link=".urlencode(base64_encode($flink));
$temp = str_replace("~link~",$flink,$tempStr);
$temp = str_replace("~server~",$serverName,$temp);
$downlinks .= $temp;
}
}
return $downlinks;
}
//获得图片的展示页面
//---------------------------
function GetImgLinks($fvalue)
{
$revalue = "";
$dtp = new DedeTagParse();
$dtp->LoadSource($fvalue);
if(!is_array($dtp->CTags)){
$dtp->Clear();
return "无图片信息!";
}
$ptag = $dtp->GetTag("pagestyle");
if(is_object($ptag)){
$pagestyle = $ptag->GetAtt('value');
$maxwidth = $ptag->GetAtt('maxwidth');
$ddmaxwidth = $ptag->GetAtt('ddmaxwidth');
$irow = $ptag->GetAtt('row');
$icol = $ptag->GetAtt('col');
if(empty($maxwidth)) $maxwidth = $GLOBALS['cfg_album_width'];
}else{
$pagestyle = 2;
$maxwidth = $GLOBALS['cfg_album_width'];
$ddmaxwidth = 200;
}
if($pagestyle == 3){
if(empty($irow)) $irow = 4;
if(empty($icol)) $icol = 4;
}
//遍历图片信息
$mrow = 0;
$mcol = 0;
$photoid = 0;
$images = array();
$sysimgpath = $GLOBALS['cfg_templeturl']."/sysimg";
foreach($dtp->CTags as $ctag){
if($ctag->GetName()=="img"){
$iw = $ctag->GetAtt('width');
$ih = $ctag->GetAtt('heigth');
$alt = str_replace("'","",$ctag->GetAtt('text'));
$src = trim($ctag->GetInnerText());
$ddimg = $ctag->GetAtt('ddimg');
if($iw > $maxwidth) $iw = $maxwidth;
$iw = (empty($iw) ? "" : "width='$iw'");
//全部列出式或分页式图集
if($pagestyle<3){
if($revalue==""){
if($pagestyle==2){
$playsys = "
<div class='butbox'>
<a href='$src' target='_blank' class='c1'>原始图片</a>\r\n
<a href='javascript:dPlayPre();' class='c1'>上一张</a>\r\n
<a href='javascript:dPlayNext();' class='c1'>下一张</a>\r\n
<a href='javascript:dStopPlay();' class='c1'>自动 / 暂停播放</a>\r\n
</div>\r\n";
$revalue = " {$playsys}
<div class='imgview'>\r\n
<center>
<a href='javascript:dPlayNext();'><img src='$src' alt='$alt'/></a>\r\n
</center>
</div>\r\n
<script language='javascript'>dStartPlay();</script>\r\n";
}
else $revalue = "
<div class='imgview'>\r\n
<center>
<a href='$src' target='_blank'><img src='$src' alt='$alt' /></a>\r\n
</center>
</div>\r\n";
}else{
if($pagestyle==2){
$playsys = "
<div class='butbox'>
<a href='$src' target='_blank' class='c1'>原始图片</a>\r\n
<a href='javascript:dPlayPre();' class='c1'>上一张</a>\r\n
<a href='javascript:dPlayNext();' class='c1'>下一张</a>\r\n
<a href='javascript:dStopPlay();' class='c1'>自动 / 暂停播放</a>\r\n
</div>\r\n";
$revalue .= "#p#分页标题#e# {$playsys}
<div class='imgview'>\r\n
<center>
<a href='javascript:dPlayNext();'><img src='$src' alt='$alt'/></a>\r\n
</center>
</div>\r\n
<script language='javascript'>dStartPlay();</script>\r\n";
}
else $revalue .= "
<div class='imgview'>\r\n
<center>
<a href='$src' target='_blank'><img src='$src' alt='$alt' /></a>\r\n
</center>
</div>\r\n";
}
//多列式图集
}else if($pagestyle==3){
$images[$photoid][0] = $src;
$images[$photoid][1] = $alt;
$images[$photoid][2] = $ddimg;
$photoid++;
}
}
}
//重新运算多列式图集
if($pagestyle==3){
if(empty($ddmaxwidth)) $ddmaxwidth = 200;
$picnum = count($images);
$sPos = 0;
if($icol==0) $icol = 1;
$tdwidth = ceil(100 / $icol);
while($sPos < $picnum){
for($i=0;$i < $irow;$i++){
//$revalue .= "<ul class='imgline'>\r\n";
for($j=0;$j < $icol;$j++){
if(!isset($images[$sPos])){ $revalue .= ""; }
else{
$src = $images[$sPos][0];
$alt = $images[$sPos][1];
$litsrc = $images[$sPos][2];
$tpwidth = $ddmaxwidth;
if($litsrc==''){
$litsrc = $src;
$tpwidth = '';
}else{
$tpwidth = " width='$tpwidth'";
}
//多行多列imgurls标签生成代码
$revalue .= "<dl>\r\n
<dt><a href='{$GLOBALS['cfg_phpurl']}/showphoto.php?aid={$this->ArcID}&src=".urlencode($src)."&npos=$sPos' target='_blank'><img src='$litsrc' alt='$alt'{$tpwidth} border='0'/></a></dt>\r\n
<dd class='title'><img src='/templets/images/ico_15.gif' /><a href='{$GLOBALS['cfg_phpurl']}/showphoto.php?aid={$this->ArcID}&src=".urlencode($src)."&npos=$sPos' target='_blank'>$alt</a></dd>\r\n
</dl>\r\n";
$sPos++;
}
}
//$revalue .= "</ul>\r\n";
if(!isset($images[$sPos])) break;
}
if(!isset($images[$sPos])){
break;
}else{
$revalue .= "#p#分页标题#e#";
}
}
}
unset($dtp);
unset($images);
return $revalue;
}
//处理引用的函数的字段
//-----------------------------
function EvalFunc($fvalue,$functionname)
{
$DedeMeValue = $fvalue;
$phpcode = preg_replace("/'@me'|\"@me\"|@me/isU",'$DedeMeValue',$functionname);
eval($phpcode.";");
return $DedeMeValue;
}
//关闭所占用的资源
//------------------
function Close(){
$this->dsql->Close();
}
}//End class ChannelUnit
?> | zyyhong | trunk/jiaju001/news/include/inc_channel_unit.php | PHP | asf20 | 16,528 |
<?php
/*-----------------------------
本函数用于作为通用的标记解析器
考虑性能原因,大部份使用引用调用,使用时必须注意
------------------------*/
function MakePublicTag(&$thisObj,&$tagObj,&$partObj,&$typeLink,$envTypeid=0,$envArcid=0,$envChannelid=0)
{
//解析模板
//-------------------------
if( is_array($tagObj->CTags) )
{
foreach($tagObj->CTags as $tagid=>$ctag)
{
$tagname = $ctag->GetName();
//字段
if($tagname=="field"){
if(isset($thisObj->Fields[$ctag->GetAtt('name')]))
$tagObj->Assign($tagid,$thisObj->Fields[$ctag->GetAtt('name')]);
else
$tagObj->Assign($tagid,"");
}
//单个栏目
else if($tagname=="onetype"||$tagname=="type"){
$typeid = $ctag->GetAtt('typeid');
if($typeid=="") $typeid = 0;
if($typeid=="") $typeid = $envTypeid;
$tagObj->Assign($tagid,$partObj->GetOneType($typeid,$ctag->GetInnerText()));
}
//下级频道列表
else if($tagname=="channel"){
$typeid = trim($ctag->GetAtt('typeid'));
if( empty($typeid) && $envTypeid > 0 ){
$typeid = $envTypeid;
$reid = $typeLink->TypeInfos['reID'];
}else{
$reid=0;
}
$tagObj->Assign($tagid,
$typeLink->GetChannelList(
$typeid,$reid,$ctag->GetAtt("row"),
$ctag->GetAtt("type"),$ctag->GetInnerText(),
$ctag->GetAtt("col"),$ctag->GetAtt("tablewidth"),
$ctag->GetAtt("currentstyle")
)
);
}
//热门关键字
else if($tagname=="hotwords"){
$tagObj->Assign($tagid,
GetHotKeywords($thisObj->dsql,$ctag->GetAtt('num'),$ctag->GetAtt('subday'),$ctag->GetAtt('maxlength')));
}
//自定义标记
else if($tagname=="mytag"){
$tagObj->Assign($tagid,
$partObj->GetMyTag($envTypeid,$ctag->GetAtt("name"),$ctag->GetAtt("ismake"))
);
}
//广告代码
else if($tagname=="myad"){
$tagObj->Assign($tagid,
$partObj->GetMyAd($envTypeid,$ctag->GetAtt("name"))
);
}
//频道下级栏目文档列表
else if($tagname=="channelartlist"){
//类别ID
if(trim($ctag->GetAtt('typeid'))=="" && $envTypeid!=0){ $typeid = $envTypeid; }
else{ $typeid = trim( $ctag->GetAtt('typeid') ); }
$tagObj->Assign($tagid,
$partObj->GetChannelList($typeid,$ctag->GetAtt('col'),$ctag->GetAtt('tablewidth'),$ctag->GetInnerText())
);
}
//投票
else if($tagname=="vote"){
$tagObj->Assign($tagid,
$partObj->GetVote(
$ctag->GetAtt("id"),$ctag->GetAtt("lineheight"),
$ctag->GetAtt("tablewidth"),$ctag->GetAtt("titlebgcolor"),
$ctag->GetAtt("titlebackground"),$ctag->GetAtt("tablebgcolor")
)
);
}
//友情链接
//------------------
else if($tagname=="friendlink"||$tagname=="flink")
{
$tagObj->Assign($tagid,
$partObj->GetFriendLink(
$ctag->GetAtt("type"),$ctag->GetAtt("row"),$ctag->GetAtt("col"),
$ctag->GetAtt("titlelen"),$ctag->GetAtt("tablestyle"),$ctag->GetAtt("linktyle"),$ctag->GetInnerText()
)
);
}
//站点新闻
//---------------------
else if($tagname=="mynews")
{
$tagObj->Assign($tagid,
$partObj->GetMyNews($ctag->GetAtt("row"),$ctag->GetAtt("titlelen"),$ctag->GetInnerText())
);
}
//调用论坛主题
//----------------
else if($tagname=="loop")
{
$tagObj->Assign($tagid,
$partObj->GetTable(
$ctag->GetAtt("table"),
$ctag->GetAtt("row"),
$ctag->GetAtt("sort"),
$ctag->GetAtt("if"),
$ctag->GetInnerText()
)
);
}
//数据表操作
else if($tagname=="sql"){
$tagObj->Assign($tagid,
$partObj->GetSql($ctag->GetAtt("sql"),$ctag->GetInnerText())
);
}
else if($tagname=="tag"){
if($ctag->GetAtt('type') == 'current'){
$arcid = $thisObj->ArcID;
$tagObj->Assign($tagid,
GetCurrentTags($thisObj->dsql,$arcid, $ctag->GetInnerText())
);
}else{
//数据表操作
$tagObj->Assign($tagid,
$partObj->GetTags($ctag->GetAtt("row"),$ctag->GetAtt("sort"),$ctag->GetInnerText())
);
}
}
else if($tagname=="toparea"){
//数据表操作
$tagObj->Assign($tagid,
$partObj->gettoparea($ctag->GetInnerText())
);
}
//特定条件的文档调用
else if($tagname=="arclist"||$tagname=="artlist"||$tagname=="hotart"
||$tagname=="imglist"||$tagname=="imginfolist"||$tagname=="coolart")
{
$channelid = $ctag->GetAtt("channelid");
if($tagname=="imglist"||$tagname=="imginfolist"){ $listtype = "image"; }
else if($tagname=="coolart"){ $listtype = "commend"; }
else{ $listtype = $ctag->GetAtt('type'); }
//对相应的标记使用不同的默认innertext
if(trim($ctag->GetInnerText())!="") $innertext = $ctag->GetInnerText();
else if($tagname=="imglist") $innertext = GetSysTemplets("part_imglist.htm");
else if($tagname=="imginfolist") $innertext = GetSysTemplets("part_imginfolist.htm");
else $innertext = GetSysTemplets("part_arclist.htm");
if($tagname=="hotart") $orderby = "click";
else $orderby = $ctag->GetAtt('orderby');
$typeid = trim($ctag->GetAtt("typeid"));
if(empty($typeid)) $typeid = $envTypeid;
if(!empty($thisObj->TempletsFile)) $tmpfile = $thisObj->TempletsFile;
else $tmpfile = '';
if(!empty($thisObj->maintable)) $maintable = '#@__archives';
else $maintable = '';
if(!isset($titlelen)) $titlelen = 0;
if(!isset($infolen)) $infolen = 0;
$idlist = '';
if($tagname=="likeart"){
if(!empty($thisObj->Fields['likeid'])) $idlist = $thisObj->Fields['likeid'];
}else{
$idlist = $ctag->GetAtt("idlist");
}
if($idlist!=''){ $typeid = '0'; $channelid = '0';}
$tagObj->Assign($tagid,
$partObj->GetArcList(
$tmpfile,
$typeid,
$ctag->GetAtt("row"),
$ctag->GetAtt("col"),
$ctag->GetAtt("titlelen"),
$ctag->GetAtt("infolen"),
$ctag->GetAtt("imgwidth"),
$ctag->GetAtt("imgheight"),
$listtype,
$orderby,
$ctag->GetAtt("keyword"),
$innertext,
$ctag->GetAtt("tablewidth"),
0,$idlist,$channelid,
$ctag->GetAtt("limit"),
$ctag->GetAtt("att"),
$ctag->GetAtt("orderway"),
$ctag->GetAtt("subday"),
-1,
$ctag->GetAtt("ismember"),
$maintable
)
);
}
else if($tagname=="groupthread")
{
//圈子主题
$tagObj->Assign($tagid,
$partObj->GetThreads($ctag->GetAtt("gid"),$ctag->GetAtt("row"),
$ctag->GetAtt("orderby"),$ctag->GetAtt("orderway"),$ctag->GetInnerText())
);
}
else if($tagname=="group")
{
//圈子
$tagObj->Assign($tagid,
$partObj->GetGroups($ctag->GetAtt("row"),$ctag->GetAtt("orderby"),$ctag->GetInnerText())
);
}
else if($tagname=="ask")
{
//问答
$tagObj->Assign($tagid,
$partObj->GetAsk($ctag->GetAtt("row"),$ctag->GetAtt("qtype"),$ctag->GetInnerText()),$ctag->GetAtt("typeid")
);
}
else if($tagname=="spnote")
{
$noteid = $ctag->GetAtt('noteid');
//专题节点
$tagObj->Assign($tagid,
getNote($noteid, $thisObj)
);
}
//特定条件的文档调用
else if($tagname=="arcfulllist"||$tagname=="fulllist"||$tagname=="likeart"||$tagname=="specart")
{
$channelid = $ctag->GetAtt("channelid");
if($tagname=="specart"){ $channelid = -1; }
$typeid = trim($ctag->GetAtt("typeid"));
if(empty($typeid)) $typeid = $envTypeid;
$idlist = '';
if($tagname=="likeart"){
if(!empty($thisObj->Fields['likeid'])) $idlist = $thisObj->Fields['likeid'];
}else{
$idlist = $ctag->GetAtt("idlist");
}
if($idlist!=''){ $typeid = '0'; $channelid = '0';}
$tagObj->Assign($tagid,
$partObj->GetFullList(
$typeid,$channelid,$ctag->GetAtt("row"),$ctag->GetAtt("titlelen"),$ctag->GetAtt("infolen"),
$ctag->GetAtt("keyword"),$ctag->GetInnerText(),$idlist,$ctag->GetAtt("limitv"),$ctag->GetAtt("ismember"),
$ctag->GetAtt("orderby"),$ctag->GetAtt("imgwidth"),$ctag->GetAtt("imgheight")
)
);
}
}//结束模板循环
}
}
//
function getNote($noteid, &$thisObj)
{
$addtable = $thisObj->ChannelUnit->ChannelInfos['addtable'];
global $dsql;
$row = $dsql->getone("select note from {$addtable} where aid={$thisObj->ArcID}");
$rs = $thisObj->ChannelUnit->MakeField('note',$row['note'], $noteid);
return $rs;
}
//获得当前页面的tag
function GetCurrentTags(&$dsql,$aid, $innerText='')
{
global $cfg_cmspath;
$tags = '';
$innerText = trim($innerText);
if($innerText == '') $innerText = GetSysTemplets('tag_current.htm');
$ctp = new DedeTagParse();
$ctp->SetNameSpace("field","[","]");
$ctp->LoadSource($innerText);
$dsql->Execute('t',"Select i.tagname From #@__tag_list t left join #@__tag_index i on i.id=t.tid where t.aid='$aid' ");
while($row = $dsql->GetArray('t',MYSQL_ASSOC)){
$row['link'] = $cfg_cmspath."/tag.php?/".urlencode($row['tagname'])."/";
foreach($ctp->CTags as $tagid=>$ctag){
if(isset($row[$ctag->GetName()])) $ctp->Assign($tagid,$row[$ctag->GetName()]);
}
$tags .= $ctp->GetResult();
}
return $tags;
}
?> | zyyhong | trunk/jiaju001/news/include/inc_pubtag_make.php | PHP | asf20 | 10,181 |
<?php
if(!defined('DEDEINC'))
{
exit("Request Error!");
}
/*------------------------
DedeCms在线采集程序V2
作者:IT柏拉图
开发时间 2006年9月 最后更改时间 2007-1-17
-----------------------*/
require_once(DEDEINC."/pub_httpdown.php");
require_once(DEDEINC."/pub_dedetag.php");
require_once(DEDEINC."/pub_charset.php");
require_once(DEDEINC."/pub_collection_functions.php"); //采集扩展函数
require_once(DEDEINC."/inc_photograph.php");
require_once(DEDEINC."/pub_dedehtml2.php");
@set_time_limit(0);
class DedeCollection
{
var $Item = array(); //采集节点的基本配置信息
var $List = array(); //采集节点的来源列表处理信息
var $Art = array(); //采集节点的文章处理信息
var $ArtNote = array(); //文章采集的字段信息
var $dsql = "";
var $NoteId = "";
var $CDedeHtml = "";
var $CHttpDown = "";
var $MediaCount = 0;
var $tmpUnitValue = "";
var $tmpLinks = array();
var $tmpHtml = "";
var $breImage = "";
//-------------------------------
//兼容php5构造函数
//-------------------------------
function __construct(){
$this->dsql = new DedeSql(false);
$this->CHttpDown = new DedeHttpDown();
$this->CDedeHtml = new DedeHtml2();
}
function DedeCollection(){
$this->__construct();
}
function Init(){
//仅兼容性函数
}
//析放资源
//---------------------------
function Close(){
$this->dsql->Close();
unset($this->Item);
unset($this->List);
unset($this->Art);
unset($this->ArtNote);
unset($this->tmpLinks);
unset($this->dsql);
unset($this->CDedeHtml);
unset($this->CHttpDown);
unset($this->tmpUnitValue);
unset($this->tmpHtml);
}
//-------------------------------
//从数据库里载入某个节点
//-------------------------------
function LoadNote($nid)
{
$this->NoteId = $nid;
$this->dsql->SetSql("Select * from #@__conote where nid='$nid'");
$this->dsql->Execute();
$row = $this->dsql->Getarray();
$this->LoadConfig($row["noteinfo"]);
$this->dsql->FreeResult();
}
//-------------------------------
//从数据库里载入某个节点
//-------------------------------
function LoadFromDB($nid)
{
$this->NoteId = $nid;
$this->dsql->SetSql("Select * from #@__conote where nid='$nid'");
$this->dsql->Execute();
$row = $this->dsql->GetArray();
$this->LoadConfig($row["noteinfo"]);
$this->dsql->FreeResult();
}
//----------------------------
//分析节点的配置信息
//----------------------------
function LoadConfig($configString)
{
$dtp = new DedeTagParse();
$dtp->SetNameSpace("dede","{","}");
$dtp2 = new DedeTagParse();
$dtp2->SetNameSpace("dede","{","}");
$dtp3 = new DedeTagParse();
$dtp3->SetNameSpace("dede","{","}");
$dtp->LoadString($configString);
for($i=0;$i<=$dtp->Count;$i++)
{
$ctag = $dtp->CTags[$i];
//item 配置
//节点基本信息
if($ctag->GetName()=="item")
{
$this->Item["name"] = $ctag->GetAtt("name");
$this->Item["typeid"] = $ctag->GetAtt("typeid");
$this->Item["imgurl"] = $ctag->GetAtt("imgurl");
$this->Item["imgdir"] = $ctag->GetAtt("imgdir");
$this->Item["language"] = $ctag->GetAtt("language");
$this->Item["matchtype"] = $ctag->GetAtt("matchtype");
$this->Item["isref"] = $ctag->GetAtt("isref");
$this->Item["refurl"] = $ctag->GetAtt("refurl");
$this->Item["exptime"] = $ctag->GetAtt("exptime");
if($this->Item["matchtype"]=="") $this->Item["matchtype"]="string";
//创建图片保存目录
$updir = dirname(__FILE__)."/".$this->Item["imgdir"]."/";
$updir = str_replace("\\","/",$updir);
$updir = preg_replace("/\/{1,}/","/",$updir);
if(!is_dir($updir)) MkdirAll($updir,$GLOBALS['cfg_dir_purview']);
}
//list 配置
//要采集的列表页的信息
else if($ctag->GetName()=="list")
{
$this->List["varstart"]= $ctag->GetAtt("varstart");
$this->List["varend"] = $ctag->GetAtt("varend");
$this->List["source"] = $ctag->GetAtt("source");
$this->List["sourcetype"] = $ctag->GetAtt("sourcetype");
$dtp2->LoadString($ctag->GetInnerText());
for($j=0;$j<=$dtp2->Count;$j++)
{
$ctag2 = $dtp2->CTags[$j];
$tname = $ctag2->GetName();
if($tname=="need"){
$this->List["need"] = trim($ctag2->GetInnerText());
}else if($tname=="cannot"){
$this->List["cannot"] = trim($ctag2->GetInnerText());
}
else if($tname=="linkarea"){
$this->List["linkarea"] = trim($ctag2->GetInnerText());
}else if($tname=="url")
{
$gurl = trim($ctag2->GetAtt("value"));
//手工指定列表网址
if($this->List["source"]=="app")
{
$turl = trim($ctag2->GetInnerText());
$turls = explode("\n",$turl);
$l_tj = 0;
foreach($turls as $turl){
$turl = trim($turl);
if($turl=="") continue;
if(!eregi("^http://",$turl)) $turl = "http://".$turl;
$this->List["url"][$l_tj] = $turl;
$l_tj++;
}
}
//用分页变量产生的网址
else
{
if(eregi("var:分页",trim($ctag2->GetAtt("value")))){
if($this->List["varstart"]=="") $this->List["varstart"]=1;
if($this->List["varend"]=="") $this->List["varend"]=10;
$l_tj = 0;
for($l_em = $this->List["varstart"];$l_em<=$this->List["varend"];$l_em++){
$this->List["url"][$l_tj] = str_replace("[var:分页]",$l_em,$gurl);
$l_tj++;
}
}//if set var
else{
$this->List["url"][0] = $gurl;
}
}
}
}//End inner Loop1
}
//art 配置
//要采集的文章页的信息
else if($ctag->GetName()=="art")
{
$dtp2->LoadString($ctag->GetInnerText());
for($j=0;$j<=$dtp2->Count;$j++)
{
$ctag2 = $dtp2->CTags[$j];
//文章要采集的字段的信息及处理方式
if($ctag2->GetName()=="note"){
$field = $ctag2->GetAtt('field');
if($field == "") continue;
$this->ArtNote[$field]["value"] = $ctag2->GetAtt('value');
$this->ArtNote[$field]["isunit"] = $ctag2->GetAtt('isunit');
$this->ArtNote[$field]["isdown"] = $ctag2->GetAtt('isdown');
$dtp3->LoadString($ctag2->GetInnerText());
for($k=0;$k<=$dtp3->Count;$k++)
{
$ctag3 = $dtp3->CTags[$k];
if($ctag3->GetName()=="trim"){
$this->ArtNote[$field]["trim"][] = $ctag3->GetInnerText();
}
else if($ctag3->GetName()=="match"){
$this->ArtNote[$field]["match"] = $ctag3->GetInnerText();
}
else if($ctag3->GetName()=="function"){
$this->ArtNote[$field]["function"] = $ctag3->GetInnerText();
}
}
}
else if($ctag2->GetName()=="sppage"){
$this->ArtNote["sppage"] = $ctag2->GetInnerText();
$this->ArtNote["sptype"] = $ctag2->GetAtt('sptype');
}
}//End inner Loop2
}
}//End Loop
$dtp->Clear();
$dtp2->Clear();
}
//-----------------------------
//下载其中一个网址,并保存
//-----------------------------
function DownUrl($aid,$dourl)
{
$this->tmpLinks = array();
$this->tmpUnitValue = "";
$this->tmpHtml = "";
$this->breImage = "";
$GLOBALS['RfUrl'] = $dourl;
$html = $this->DownOnePage($dourl);
$this->tmpHtml = $html;
//检测是否有分页字段,并预先处理
if(!empty($this->ArtNote["sppage"])){
$noteid = "";
foreach($this->ArtNote as $k=>$sarr){
if($sarr["isunit"]==1){ $noteid = $k; break;}
}
$this->GetSpPage($dourl,$noteid,$html);
}
//分析所有内容,并保存
$body = addslashes($this->GetPageFields($dourl,true));
$query = "Update #@__courl set dtime='".time()."',result='$body',isdown='1' where aid='$aid'";
$this->dsql->SetSql($query);
if(!$this->dsql->ExecuteNoneQuery()){
echo $this->dsql->GetError();
}
unset($body);
unset($query);
unset($html);
}
//------------------------
//获取分页区域的内容
//------------------------
function GetSpPage($dourl,$noteid,&$html,$step=0){
$sarr = $this->ArtNote[$noteid];
$linkareaHtml = $this->GetHtmlArea("[var:分页区域]",$this->ArtNote["sppage"],$html);
if($linkareaHtml==""){
if($this->tmpUnitValue=="") $this->tmpUnitValue .= $this->GetHtmlArea("[var:内容]",$sarr["match"],$html);
else $this->tmpUnitValue .= "#p#副标题#e#".$this->GetHtmlArea("[var:内容]",$sarr["match"],$html);
return;
}
//完整的分页列表
if($this->ArtNote["sptype"]=="full"||$this->ArtNote["sptype"]==""){
$this->tmpUnitValue .= $this->GetHtmlArea("[var:内容]",$sarr["match"],$html);
$this->CDedeHtml->GetLinkType = "link";
$this->CDedeHtml->SetSource($linkareaHtml,$dourl,false);
foreach($this->CDedeHtml->Links as $k=>$t){
$k = $this->CDedeHtml->FillUrl($k);
if($k==$dourl) continue;
$nhtml = $this->DownOnePage($k);
if($nhtml!=""){
$this->tmpUnitValue .= "#p#副标题#e#".$this->GetHtmlArea("[var:内容]",$sarr["match"],$nhtml);
}
}
}
//上下页形式或不完整的分页列表
else{
if($step>50) return;
if($step==0) $this->tmpUnitValue .= "#e#".$this->GetHtmlArea("[var:内容]",$sarr["match"],$html);
$this->CDedeHtml->GetLinkType = "link";
$this->CDedeHtml->SetSource($linkareaHtml,$dourl,false);
$hasLink = false;
foreach($this->CDedeHtml->Links as $k=>$t){
$k = $this->CDedeHtml->FillUrl($k);
if(in_array($k,$this->tmpLinks)) continue;
else{
$nhtml = $this->DownOnePage($k);
if($nhtml!=""){
$this->tmpUnitValue .= "#p#副标题#e#".$this->GetHtmlArea("[var:内容]",$sarr["match"],$nhtml);
}
$hasLink = true;
$this->tmpLinks[] = $k;
$dourl = $k;
$step++;
}
}
if($hasLink) $this->GetSpPage($dourl,$noteid,$nhtml,$step);
}
}
//-----------------------
//获取特定区域的HTML
//-----------------------
function GetHtmlArea($sptag,&$areaRule,&$html){
//用正则表达式的模式匹配
if($this->Item["matchtype"]=="regex"){
$areaRule = str_replace("/","\\/",$areaRule);
$areaRules = explode($sptag,$areaRule);
$arr = array();
if($html==""||$areaRules[0]==""){ return ""; }
preg_match("/".$areaRules[0]."(.*)".$areaRules[1]."/isU",$html,$arr);
if(!empty($arr[1])){ return trim($arr[1]); }
else{ return ""; }
//用字符串模式匹配
}else{
$areaRules = explode($sptag,$areaRule);
if($html==""||$areaRules[0]==""){ return ""; }
$posstart = @strpos($html,$areaRules[0]);
if($posstart===false){ return ""; }
$posend = strpos($html,$areaRules[1],$posstart);
if($posend > $posstart && $posend!==false){
return substr($html,$posstart+strlen($areaRules[0]),$posend-$posstart-strlen($areaRules[0]));
}else{
return "";
}
}
}
//--------------------------
//下载指定网址
//--------------------------
function DownOnePage($dourl){
$this->CHttpDown->OpenUrl($dourl);
$html = $this->CHttpDown->GetHtml();
$this->CHttpDown->Close();
$this->ChangeCode($html);
return $html;
}
//---------------------
//下载特定资源,并保存为指定文件
//---------------------
function DownMedia($dourl,$mtype='img'){
//检测是否已经下载此文件
$isError = false;
$errfile = $GLOBALS['cfg_phpurl'].'/img/etag.gif';
$row = $this->dsql->GetOne("Select nurl from #@__co_mediaurl where rurl like '$dourl'");
$wi = false;
if(!empty($row['nurl'])){
$filename = $row['nurl'];
return $filename;
}else{
//如果不存在,下载该文件
$filename = $this->GetRndName($dourl,$mtype);
if(!ereg("^/",$filename)) $filename = "/".$filename;
//反盗链模式
if($this->Item["isref"]=='yes' && $this->Item["refurl"]!=''){
if($this->Item["exptime"]=='') $this->Item["exptime"] = 10;
$rs = DownImageKeep($dourl,$this->Item["refurl"],$GLOBALS['cfg_basedir'].$filename,"",0,$this->Item["exptime"]);
if($rs){
$inquery = "INSERT INTO #@__co_mediaurl(nid,rurl,nurl) VALUES ('".$this->NoteId."', '".addslashes($dourl)."', '".addslashes($filename)."');";
$this->dsql->ExecuteNoneQuery($inquery);
}else{
$inquery = "INSERT INTO #@__co_mediaurl(nid,rurl,nurl) VALUES ('".$this->NoteId."', '".addslashes($dourl)."', '".addslashes($errfile)."');";
$this->dsql->ExecuteNoneQuery($inquery);
$isError = true;
}
if($mtype=='img'){ $wi = true; }
//常规模式
}else{
$this->CHttpDown->OpenUrl($dourl);
$this->CHttpDown->SaveToBin($GLOBALS['cfg_basedir'].$filename);
$inquery = "INSERT INTO #@__co_mediaurl(nid,rurl,nurl) VALUES ('".$this->NoteId."', '".addslashes($dourl)."', '".addslashes($filename)."');";
$this->dsql->ExecuteNoneQuery($inquery);
if($mtype=='img'){ $wi = true; }
$this->CHttpDown->Close();
}
}
//生成缩略图
if($mtype=='img' && $this->breImage=='' && !$isError){
$this->breImage = $filename;
if(!eregi("^http://",$this->breImage) && file_exists($GLOBALS['cfg_basedir'].$filename)){
$filenames = explode('/',$filename);
$filenamed = $filenames[count($filenames)-1];
$nfilename = "lit_".$filenamed;
$nfilename = str_replace($filenamed,$nfilename,$filename);
if(file_exists($GLOBALS['cfg_basedir'].$nfilename)){
$this->breImage = $nfilename;
}else if(copy($GLOBALS['cfg_basedir'].$filename,$GLOBALS['cfg_basedir'].$nfilename)){
ImageResize($GLOBALS['cfg_basedir'].$nfilename,$GLOBALS['cfg_ddimg_width'],$GLOBALS['cfg_ddimg_height']);
$this->breImage = $nfilename;
}
}
}
if($wi && !$isError) @WaterImg($GLOBALS['cfg_basedir'].$filename,'up');
if(!$isError) return $filename;
else return $errfile;
}
//------------------------------
//获得下载媒体的随机名称
//------------------------------
function GetRndName($url,$v)
{
global $threadnum;
$this->MediaCount++;
$mnum = $this->MediaCount;
$timedir = strftime("%y%m%d",time());
//存放路径
$fullurl = preg_replace("/\/{1,}/","/",$this->Item["imgurl"]."/");
if(!is_dir($GLOBALS['cfg_basedir']."/$fullurl")) MkdirAll($GLOBALS['cfg_basedir']."/$fullurl",$GLOBALS['cfg_dir_purview']);
$fullurl = $fullurl.$timedir."/";
if(!is_dir($GLOBALS['cfg_basedir']."/$fullurl")) MkdirAll($GLOBALS['cfg_basedir']."/$fullurl",$GLOBALS['cfg_dir_purview']);
//文件名称
$timename = str_replace(".","",ExecTime());
$nthreadnum =(!empty($threadnum) ? $threadnum : 0);
$filename = $timename.$nthreadnum.$mnum.mt_rand(1000,9999);
//把适合的数字转为字母
$filename = dd2char($filename);
//分配扩展名
$urls = explode(".",$url);
if($v=="img"){
$shortname = ".jpg";
if(eregi("\.gif\?(.*)$",$url) || eregi("\.gif$",$url)) $shortname = ".gif";
else if(eregi("\.png\?(.*)$",$url) || eregi("\.png$",$url)) $shortname = ".png";
}
else if($v=="embed") $shortname = ".swf";
else $shortname = "";
//-----------------------------------------
$fullname = $fullurl.$filename.$shortname;
return preg_replace("/\/{1,}/","/",$fullname);
}
//------------------------------------------------
//按载入的网页内容获取规则,从一个HTML文件中获取内容
//-------------------------------------------------
function GetPageFields($dourl,$needDown)
{
if($this->tmpHtml == "") return "";
$artitem = "";
$isPutUnit = false;
$tmpLtKeys = array();
foreach($this->ArtNote as $k=>$sarr)
{
//可能出现意外的情况
if($k=="sppage"||$k=="sptype") continue;
if(!is_array($sarr)) continue;
//特殊的规则或没匹配选项
if($sarr['match']==''||trim($sarr['match'])=='[var:内容]'
||$sarr['value']!='[var:内容]'){
if($sarr['value']!='[var:内容]') $v = $sarr['value'];
else $v = "";
}
else //需匹配的情况
{
//分多页的内容
if($this->tmpUnitValue!="" && !$isPutUnit && $sarr["isunit"]==1){
$v = $this->tmpUnitValue;
$isPutUnit = true;
//其它内容
}else{
$v = $this->GetHtmlArea("[var:内容]",$sarr["match"],$this->tmpHtml);
}
//过滤内容规则
if(isset($sarr["trim"]) && $v!=""){
foreach($sarr["trim"] as $nv){
if($nv=="") continue;
$nv = str_replace("/","\\/",$nv);
$v = preg_replace("/$nv/isU","",$v);
}
}
//是否下载远程资源
if($needDown){
if($sarr["isdown"] == '1'){ $v = $this->DownMedias($v,$dourl); }
}
else{
if($sarr["isdown"] == '1') $v = $this->MediasReplace($v,$dourl);
}
}
//用户自行对内容进行处理的接口
if($sarr["function"]!=""){
if(!eregi('@litpic',$sarr["function"])){
$v = $this->RunPHP($v,$sarr["function"]);
$artitem .= "{dede:field name='$k'}$v{/dede:field}\r\n";
}else{
$tmpLtKeys[$k]['v'] = $v;
$tmpLtKeys[$k]['f'] = $sarr["function"];
}
}else{
$artitem .= "{dede:field name='$k'}$v{/dede:field}\r\n";
}
}//End Foreach
//处理带缩略图变量的项目
foreach($tmpLtKeys as $k=>$sarr){
$v = $this->RunPHP($sarr['v'],$sarr['f']);
$artitem .= "{dede:field name='$k'}$v{/dede:field}\r\n";
}
return $artitem;
}
//----------------------------------
//下载内容里的资源
//----------------------------------
function DownMedias(&$html,$url)
{
$this->CDedeHtml->GetLinkType = "media";
$this->CDedeHtml->SetSource($html,$url,false);
//下载img标记里的图片
foreach($this->CDedeHtml->Medias as $k=>$v){
$furl = $this->CDedeHtml->FillUrl($k);
if($v=="embed" && !eregi("\.(swf)\?(.*)$",$k)&& !eregi("\.(swf)$",$k)){ continue; }
$okurl = $this->DownMedia($furl,$v);
$html = str_replace($k,$okurl,$html);
}
//下载超链接里的图片
foreach($this->CDedeHtml->Links as $v=>$k){
if(eregi("\.(jpg|gif|png)\?(.*)$",$v) || eregi("\.(jpg|gif|png)$",$v)){ $m = "img"; }
else if(eregi("\.(swf)\?(.*)$",$v) || eregi("\.(swf)$",$v)){ $m = "embed"; }
else continue;
$furl = $this->CDedeHtml->FillUrl($v);
$okurl = $this->DownMedia($furl,$m);
$html = str_replace($v,$okurl,$html);
}
return $html;
}
//---------------------------------
//仅替换内容里的资源为绝对网址
//----------------------------------
function MediasReplace(&$html,$dourl)
{
$this->CDedeHtml->GetLinkType = "media";
$this->CDedeHtml->SetSource($html,$dourl,false);
foreach($this->CDedeHtml->Medias as $k=>$v)
{
$k = trim($k);
if(!eregi("^http://",$k)){
$okurl = $this->CDedeHtml->FillUrl($k);
$html = str_replace($k,$okurl,$html);
}
}
return $html;
}
//---------------------
//测试列表
//---------------------
function TestList()
{
if(isset($this->List["url"][0])) $dourl = $this->List["url"][0];
else{
echo "配置中指定列表的网址错误!\r\n";
return ;
}
if($this->List["sourcetype"]=="archives")
{
echo "配置中指定的源参数为文档的原始URL:\r\n";
$i=0;
$v = "";
foreach($this->List["url"] as $v){
echo $v."\r\n"; $i++; if($i>9) break;
}
return $v;
}
$dhtml = new DedeHtml2();
$html = $this->DownOnePage($dourl);
//$html = str_replace('" class="tool comments">','?999" class="tool comments">',$html);
if($html==""){
echo "读取其中的一个网址: $dourl 时失败!\r\n";
return ;
}
if(trim($this->List["linkarea"])!=""&&trim($this->List["linkarea"])!="[var:区域]"){
$html = $this->GetHtmlArea("[var:区域]",$this->List["linkarea"],$html);
}
$dhtml->GetLinkType = "link";
$dhtml->SetSource($html,$dourl,false);
$testpage = "";
$TestPage = "";
if(is_array($dhtml->Links))
{
echo "按指定规则在 $dourl 发现的网址:\r\n";
echo $this->List["need"];
foreach($dhtml->Links as $k=>$v)
{
$k = $dhtml->FillUrl($k);
if($this->List["need"]!="")
{
if(eregi($this->List["need"],$k))
{
if($this->List["cannot"]==""
||!eregi($this->List["cannot"],$k)){
echo "$k - ".$v."\r\n";
$TestPage = $k;
}
}//eg1
}else{
echo "$k - ".$v."\r\n";
$TestPage = $k;
}
}//foreach
}else{
echo "分析网页的HTML时失败!\r\n";
return ;
}
return $TestPage;
}
//测试文章规则
function TestArt($dourl)
{
if($dourl==""){
echo "没有递交测试的网址!";
exit();
}
$this->tmpHtml = $this->DownOnePage($dourl);
echo $this->GetPageFields($dourl,false);
}
//--------------------------------
//采集种子网址
//--------------------------------
function GetSourceUrl($downall=0,$glstart=0,$pagesize=10)
{
if($downall==1 && $glstart==0){
$this->dsql->ExecuteNoneQuery("Delete From #@__courl where nid='".$this->NoteId."'");
$this->dsql->ExecuteNoneQuery("Delete From #@__co_listenurl where nid='".$this->NoteId."'");
}
if($this->List["sourcetype"]=="archives")
{
echo "配置中指定的源参数为文档的原始URL:<br/>处理中...<br/>\r\n";
foreach($this->List["url"] as $v)
{
if($downall==0){
$lrow = $this->dsql->GetOne("Select * From #@__co_listenurl where url like '".addslashes($v)."'");
if(is_array($lrow)) continue;
}
$inquery = "INSERT INTO #@__courl(nid,title,url,dtime,isdown,result)
VALUES ('".$this->NoteId."','用户手工指定的网址','$v','".time()."','0','');";
$this->dsql->ExecuteNoneQuery($inquery);
}
echo "完成种子网址的处理!<br/>\r\n";
return 0;
}
$tmplink = array();
$arrStart = 0;
$moviePostion = 0;
$endpos = $glstart + $pagesize;
$totallen = count($this->List["url"]);
foreach($this->List["url"] as $k=>$v)
{
$moviePostion++;
if($moviePostion > $endpos) break;
if($moviePostion > $glstart)
{
$html = $this->DownOnePage($v);
//$html = str_replace('" class="tool comments">','?999" class="tool comments">',$html);
if(trim($this->List["linkarea"])!=""&&trim($this->List["linkarea"])!="[var:区域]"){
$html = $this->GetHtmlArea("[var:区域]",$this->List["linkarea"],$html);
}
$this->CDedeHtml->GetLinkType = "link";
$this->CDedeHtml->SetSource($html,$v,false);
foreach($this->CDedeHtml->Links as $k=>$v)
{
$k = $this->CDedeHtml->FillUrl($k);
if($this->List["need"]!=""){
if(eregi($this->List["need"],$k)){
if($this->List["cannot"]==""){
$tmplink[$arrStart][0] = $this->CDedeHtml->FillUrl($k);
$tmplink[$arrStart][1] = $v;
$arrStart++;
}
else if(!eregi($this->List["cannot"],$k)){
$tmplink[$arrStart][0] = $this->CDedeHtml->FillUrl($k);
$tmplink[$arrStart][1] = $v;
$arrStart++;
}
}
}else{
$tmplink[$arrStart][0] = $this->CDedeHtml->FillUrl($k);
$tmplink[$arrStart][1] = $v;
$arrStart++;
}
}
$this->CDedeHtml->Clear();
}//在位置内
}//foreach
krsort($tmplink);
$unum = count($tmplink);
if($unum>0){
//echo "完成本次种子网址抓取,共找到:{$unum} 个记录!<br/>\r\n";
$this->dsql->ExecuteNoneQuery();
foreach($tmplink as $v)
{
$k = addslashes($v[0]);
$v = addslashes($v[1]);
if($downall==0){
$lrow = $this->dsql->GetOne("Select * From #@__co_listenurl where url like '$v' ");
if(is_array($lrow)) continue;
}
if($v=="") $v="无标题,可能是图片链接";
$inquery = "
INSERT INTO #@__courl(nid,title,url,dtime,isdown,result)
VALUES ('".$this->NoteId."','$v','$k','".time()."','0','');
";
$this->dsql->ExecuteNoneQuery($inquery);
}
if($endpos >= $totallen) return 0;
else return ($totallen-$endpos);
}
else{
echo "按指定规则没找到任何链接!";
return -1;
}
return -1;
}
//---------------------------------
//用扩展函数处理采集到的原始数据
//-------------------------------
function RunPHP($fvalue,$phpcode)
{
$DedeMeValue = $fvalue;
$phpcode = preg_replace("/'@me'|\"@me\"|@me/isU",'$DedeMeValue',$phpcode);
$DedeLitPicValue = $this->breImage;
$phpcode = preg_replace("/'@litpic'|\"@litpic\"|@litpic/isU",'$DedeLitPicValue',$phpcode);
if(eregi('@body',$phpcode)){
$DedeBodyValue = $this->tmpHtml;
$phpcode = preg_replace("/'@body'|\"@body\"|@body/isU",'$DedeBodyValue',$phpcode);
}
eval($phpcode.";");// or die($phpcode."[$DedeMeValue]");
return $DedeMeValue;
}
//-----------------------
//编码转换
//-----------------------
function ChangeCode(&$str)
{
if($GLOBALS['cfg_ver_lang']=='utf-8'){
if($this->Item["language"]=="gb2312") $str = gb2utf8($str);
if($this->Item["language"]=="big5") $str = gb2utf8(big52gb($str));
}else{
if($this->Item["language"]=="utf-8") $str = utf82gb($str);
if($this->Item["language"]=="big5") $str = big52gb($str);
}
}
}
?> | zyyhong | trunk/jiaju001/news/include/pub_collection.php | PHP | asf20 | 25,735 |
<?php
if(!defined('DEDEINC'))
{
exit("Request Error!");
}
require_once(dirname(__FILE__)."/inc_arcpart_view.php");
require_once(dirname(__FILE__)."/inc_downclass.php");
require_once(dirname(__FILE__)."/inc_channel_unit.php");
require_once(dirname(__FILE__)."/inc_pubtag_make.php");
/******************************************************
//Copyright 2004-2008 by DedeCms.com itprato
//本类的用途是用于浏览文档或对文档生成HTML
******************************************************/
@set_time_limit(0);
class Archives
{
var $TypeLink;
var $ChannelUnit;
var $dsql;
var $Fields;
var $dtp;
var $ArcID;
var $SplitPageField;
var $SplitFields;
var $NowPage;
var $TotalPage;
var $NameFirst;
var $ShortName;
var $FixedValues;
var $PartView;
var $TempSource;
var $IsError;
var $SplitTitles;
var $MemberInfos;
var $MainTable;
var $AddTable;
var $PreNext;
var $TempletsFile;
var $fullurl;
//-------------------------------
//php5构造函数
//-------------------------------
function __construct($aid)
{
global $PubFields;
$t1 = ExecTime();
$this->IsError = false;
$this->dsql = new DedeSql(false);
$this->ArcID = $aid;
$this->MemberInfos = array();
$this->PreNext = array();
$this->TempletsFile = '';
$this->MainTable = '';
$this->fullurl = '';
//获取文档表信息
$fullsearchs = $this->dsql->GetOne("select c.ID as channelid,c.maintable,c.addtable,a.keywords,a.url from `#@__full_search` a left join #@__channeltype c on c.ID = a.channelid where a.aid='$aid'",MYSQL_ASSOC);
if($fullsearchs['channelid']==-1)
{
$this->MainTable = '#@__archivesspec';
$this->AddTable = '#@__addonspec';
}else
{
if($fullsearchs['maintable']=='') $fullsearchs['maintable']='#@__archives';
$this->MainTable = $fullsearchs['maintable'];
$this->AddTable = $fullsearchs['addtable'];
}
$query = "Select arc.*,sm.name as smalltypename,tp.reID,tp.typedir,tp.typename,am.uname from `{$this->MainTable}` arc
left join #@__arctype tp on tp.ID=arc.typeid
left join #@__smalltypes sm on sm.id=arc.smalltypeid
left join #@__admin am on arc.adminID = am.ID
where arc.ID='$aid'";
$row = $this->dsql->GetOne($query,MYSQL_ASSOC);
//无法获取记录
if(!is_array($row)){
$this->IsError = true;
return;
}
//把主表记录转换为Field
foreach($row as $k=>$v) $this->Fields[$k] = $v;
$this->Fields['keywords'] = $fullsearchs['keywords'];
$this->fullurl = $fullsearchs['url'];
unset($row);
unset($fullsearchs);
if($this->Fields['redirecturl']!="") return;
//模板引擎与页面环境初始化
$this->ChannelUnit = new ChannelUnit($this->Fields['channel'],$aid);
$this->TypeLink = new TypeLink($this->Fields['typeid']);
$this->dtp = new DedeTagParse();
$this->SplitPageField = $this->ChannelUnit->SplitPageField;
$this->SplitFields = "";
$this->TotalPage = 1;
$this->NameFirst = "";
$this->ShortName = "html";
$this->FixedValues = "";
$this->TempSource = "";
$this->PartView = new PartView($this->Fields['typeid']);
if(empty($GLOBALS["pageno"])) $this->NowPage = 1;
else $this->NowPage = intval($GLOBALS["pageno"]);
//特殊的字段Field数据处理
$this->Fields['aid'] = $aid;
$this->Fields['id'] = $aid;
$this->Fields['position'] = $this->TypeLink->GetPositionLink(true);
//设置一些全局参数的值
foreach($PubFields as $k=>$v) $this->Fields[$k] = $v;
if($this->Fields['litpic']=="") $this->Fields['litpic'] = $this->Fields["phpurl"]."/img/dfpic.gif";
//读取附加表信息,并把附加表的资料经过编译处理后导入到$this->Fields中,以方便在
//模板中用 {dede:field name='fieldname' /} 标记统一调用
if($this->AddTable!="")
{
$row = $this->dsql->GetOne("select * from ".trim($this->ChannelUnit->ChannelInfos["addtable"])." where aid=$aid ");
if(is_array($row)) foreach($row as $k=>$v){ if(ereg("[A-Z]",$k)) $row[strtolower($k)] = $v; }
foreach($this->ChannelUnit->ChannelFields as $k=>$arr)
{
if(isset($row[$k]))
{
if($arr["rename"]!="") $nk = $arr["rename"];
else $nk = $k;
$this->Fields[$nk] = $this->ChannelUnit->MakeField($k,$row[$k]);
if($arr['type']=='htmltext' && $GLOBALS['cfg_keyword_replace']=='Y'){
$this->Fields[$nk] = $this->ReplaceKeyword($this->Fields['keywords'],$this->Fields[$nk]);
}
}
}//End foreach
}
unset($row);
//处理要分页显示的字段
//---------------------------
$this->SplitTitles = Array();
if($this->SplitPageField!="" && $GLOBALS['cfg_arcsptitle']='Y' &&
isset($this->Fields[$this->SplitPageField]))
{
$this->SplitFields = explode("#p#",$this->Fields[$this->SplitPageField]);
$i = 1;
foreach($this->SplitFields as $k=>$v)
{
$tmpv = cn_substr($v,50);
$pos = strpos($tmpv,'#e#');
if($pos>0)
{
$st = trim(cn_substr($tmpv,$pos));
if($st==""||$st=="副标题"||$st=="分页标题"){
$this->SplitFields[$k] = preg_replace("/^(.*)#e#/is","",$v);
continue;
}else{
$this->SplitFields[$k] = preg_replace("/^(.*)#e#/is","",$v);
$this->SplitTitles[$k] = $st;
}
}else{
continue;
}
$i++;
}
$this->TotalPage = count($this->SplitFields);
}
$this->Fields['totalpage'] = $this->TotalPage;
}
//php4构造函数
//---------------------------
function Archives($aid){
$this->__construct($aid);
}
//----------------------------
//生成静态HTML
//----------------------------
function MakeHtml()
{
//读取模型信息错误
if($this->IsError) return '';
$this->Fields["displaytype"] = "st";
//分析要创建的文件名称
//------------------------------------------------------
if(!is_object($this->TypeLink)) $this->TypeLink = new TypeLink($this->Fields["typeid"]);
$filename = $this->TypeLink->GetFileNewName(
$this->ArcID,$this->Fields["typeid"],$this->Fields["senddate"],
$this->Fields["title"],$this->Fields["ismake"],
$this->Fields["arcrank"],$this->TypeLink->TypeInfos['namerule'],$this->TypeLink->TypeInfos['typedir'],$this->Fields["money"],
$this->TypeLink->TypeInfos['siterefer'],
$this->TypeLink->TypeInfos['sitepath']
);
$filenames = explode(".",$filename);
$this->ShortName = $filenames[count($filenames)-1];
if($this->ShortName=="") $this->ShortName = "html";
$fileFirst = eregi_replace("\.".$this->ShortName."$","",$filename);
//对于已设置不生成HTML的文章直接返回网址
//------------------------------------------------
if($this->Fields['ismake']==-1||$this->Fields['arcrank']!=0||
$this->Fields['typeid']==0||$this->Fields['money']>0)
{
return $this->GetTrueUrl($filename);
}
//跳转网址
else if($this->Fields['redirecturl']!='')
{
$truefilename = $this->GetTruePath().$fileFirst.".".$this->ShortName;
$tffp = fopen(dirname(__FILE__)."/../include/jump.html","r");
$tmpfile = fread($tffp,filesize(dirname(__FILE__)."/../include/jump.html"));
fclose($tffp);
$tmpfile = str_replace('[title]',$this->Fields['title'],$tmpfile);
$tmpfile = str_replace('[aid]',$this->Fields['ID'],$tmpfile);
$tmpfile = str_replace('[description]',$this->Fields['description'],$tmpfile);
$tmpfile = str_replace('[redirecturl]',$this->Fields['redirecturl'],$tmpfile);
$fp = @fopen($truefilename,"w") or die("Create File False:$filename");
fwrite($fp,$tmpfile);
fclose($fp);
return $this->GetTrueUrl($filename);
}
$filenames = explode("/",$filename);
$this->NameFirst = eregi_replace("\.".$this->ShortName."$","",$filenames[count($filenames)-1]);
if($this->NameFirst=="") $this->NameFirst = $this->arcID;
//获得当前文档的全名
$filenameFull = $filename;
if(!eregi('http://',$filenameFull)) $filenameFull = $GLOBALS['cfg_basehost'].$filenameFull;
$this->Fields['arcurl'] = $filenameFull;
$this->Fields['fullname'] = $this->Fields['arcurl'];
//载入模板
$this->LoadTemplet();
//循环生成HTML文件
for($i=1;$i<=$this->TotalPage;$i++){
if($i>1){ $truefilename = $this->GetTruePath().$fileFirst."_".$i.".".$this->ShortName; }
else{ $truefilename = $this->GetTruePath().$filename; }
$this->Fields['namehand'] = $fileFirst;
$this->ParseDMFields($i,1);
$this->dtp->SaveTo($truefilename);
}
$this->dsql->SetQuery("Update `{$this->MainTable}` set ismake=1 where ID='".$this->ArcID."'");
$this->dsql->ExecuteNoneQuery();
return $this->GetTrueUrl($filename);
}
//----------------------------
//获得真实连接路径
//----------------------------
function GetTrueUrl($nurl)
{
if($GLOBALS['cfg_multi_site']=='Y' && !eregi('php\?',$nurl)){
if($this->TypeLink->TypeInfos['siteurl']=="") $nsite = $GLOBALS["cfg_mainsite"];
else $nsite = $this->TypeLink->TypeInfos['siteurl'];
$nurl = ereg_replace("/$","",$nsite).$nurl;
}
if($nurl != $this->fullurl){
$this->dsql->SetQuery("update #@__full_search set url='$nurl' where aid='$this->ArcID'");
$this->dsql->ExecuteNoneQuery();
}
return $nurl;
}
//----------------------------
//获得站点的真实根路径
//----------------------------
function GetTruePath()
{
if($GLOBALS['cfg_multi_site']=='Y'){
if($this->TypeLink->TypeInfos['siterefer']==1) $truepath = ereg_replace("/{1,}","/",$GLOBALS["cfg_basedir"]."/".$this->TypeLink->TypeInfos['sitepath']);
else if($this->TypeLink->TypeInfos['siterefer']==2) $truepath = $this->TypeLink->TypeInfos['sitepath'];
else $truepath = $GLOBALS["cfg_basedir"];
}else{
$truepath = $GLOBALS["cfg_basedir"];
}
return $truepath;
}
//----------------------------
//获得指定键值的字段
//----------------------------
function GetField($fname)
{
if(isset($this->Fields[$fname])) return $this->Fields[$fname];
else return "";
}
//-----------------------------
//获得模板文件位置
//-----------------------------
function GetTempletFile()
{
global $cfg_basedir,$cfg_templets_dir,$cfg_df_style;
$cid = $this->ChannelUnit->ChannelInfos["nid"];
if($this->Fields['templet']!=''){ $filetag = MfTemplet($this->Fields['templet']); }
else{ $filetag = MfTemplet($this->TypeLink->TypeInfos["temparticle"]); }
$tid = $this->Fields["typeid"];
$filetag = str_replace("{cid}",$cid,$filetag);
$filetag = str_replace("{tid}",$tid,$filetag);
$tmpfile = $cfg_basedir.$cfg_templets_dir."/".$filetag;
if($cid=='spec'){
if($this->Fields['templet']!=''){ $tmpfile = $cfg_basedir.$cfg_templets_dir."/".MfTemplet($this->Fields['templet']); }
else $tmpfile = $cfg_basedir.$cfg_templets_dir."/{$cfg_df_style}/article_spec.htm";
}
if(!file_exists($tmpfile)) $tmpfile = $cfg_basedir.$cfg_templets_dir."/{$cfg_df_style}/article_default.htm";
return $tmpfile;
}
//----------------------------
//动态输出结果
//----------------------------
function display()
{
//读取模型信息错误
if($this->IsError) return '';
$this->LoadTemplet();
//跳转网址
if($this->Fields['redirecturl']!='')
{
$tffp = fopen(dirname(__FILE__)."/../include/jump.html","r");
$tmpfile = fread($tffp,filesize(dirname(__FILE__)."/../include/jump.html"));
fclose($tffp);
$tmpfile = str_replace('[title]',$this->Fields['title'],$tmpfile);
$tmpfile = str_replace('[aid]',$this->Fields['ID'],$tmpfile);
$tmpfile = str_replace('[description]',$this->Fields['description'],$tmpfile);
$tmpfile = str_replace('[redirecturl]',$this->Fields['redirecturl'],$tmpfile);
echo $tmpfile;
return '';
}
$this->Fields["displaytype"] = "dm";
$this->Fields['arcurl'] = $GLOBALS['cfg_phpurl']."/plus.php?aid=".$this->Fields['ID'];
$pageCount = $this->NowPage;
$this->ParseDMFields($pageCount,0);
$this->dtp->display();
}
//--------------
//载入模板
//--------------
function LoadTemplet()
{
global $cfg_basedir;
if($this->TempSource=='')
{
$tempfile = $this->GetTempletFile();
if(!file_exists($tempfile)||!is_file($tempfile)){
return false;
}
$this->dtp->LoadTemplate($tempfile);
$this->TempSource = $this->dtp->SourceString;
$this->ParseTempletsFirst();
}else{
$this->dtp->LoadSource($this->TempSource);
$this->ParseTempletsFirst();
}
$this->TempletsFile = ereg_replace("^".$cfg_basedir,'',$tempfile);
return true;
}
//--------------------------------
//解析模板,对固定的标记进行初始给值
//--------------------------------
function ParseTempletsFirst()
{
//对公用标记的解析,这里对对象的调用均是用引用调用的,因此运算后会自动改变传递的对象的值
MakePublicTag($this,$this->dtp,$this->PartView,$this->TypeLink,
$this->TypeLink->TypeInfos['ID'],$this->Fields['id'],$this->Fields['channel']);
}
//--------------------------------
//解析模板,对内容里的变动进行赋值
//--------------------------------
function ParseDMFields($pageNo,$ismake=1)
{
$this->NowPage = $pageNo;
$this->Fields['nowpage'] = $this->NowPage;
if($this->SplitPageField!="" &&
isset($this->Fields[$this->SplitPageField]))
{
$this->Fields[$this->SplitPageField] = $this->SplitFields[$pageNo - 1];
}
//-------------------------
//解析模板
//-------------------------
if(is_array($this->dtp->CTags))
{
foreach($this->dtp->CTags as $tagid=>$ctag){
$tagname = $ctag->GetName();
if($tagname=="field")
{
$this->dtp->Assign($tagid,$this->GetField($ctag->GetAtt("name")));
}
else if($tagname=="pagebreak")
{
if($ismake==0)
{ $this->dtp->Assign($tagid,$this->GetPagebreakDM($this->TotalPage,$this->NowPage,$this->ArcID)); }
else
{ $this->dtp->Assign($tagid,$this->GetPagebreak($this->TotalPage,$this->NowPage,$this->ArcID)); }
}
else if($tagname=='prenext')
{
$this->dtp->Assign($tagid,$this->GetPreNext($ctag->GetAtt("get")));
}
else if($ctag->GetName()=="pagetitle")
{
if($ismake==0)
{ $this->dtp->Assign($tagid,$this->GetPageTitlesDM($ctag->GetAtt("style"),$pageNo)); }
else
{ $this->dtp->Assign($tagid,$this->GetPageTitlesST($ctag->GetAtt("style"),$pageNo)); }
}
else if($ctag->GetName()=="memberinfo")
{
$this->dtp->Assign($tagid,$this->GetMemberInfo());
}
else if($ctag->GetName()=="fieldlist")
{
$tagidnnertext = trim($ctag->GetInnerText());
if($tagidnnertext=="") $tagidnnertext = GetSysTemplets("tag_fieldlist.htm");
$dtp2 = new DedeTagParse();
$dtp2->SetNameSpace("field","[","]");
$dtp2->LoadSource($tagidnnertext);
$oldSource = $dtp2->SourceString;
$oldCtags = $dtp2->CTags;
$res = "";
if(is_array($this->ChannelUnit->ChannelFields) && is_array($dtp2->CTags))
{
foreach($this->ChannelUnit->ChannelFields as $k=>$v)
{
$dtp2->SourceString = $oldSource;
$dtp2->CTags = $oldCtags;
$fname = $v['itemname'];
if($v['type']=="datetime"){
@$this->Fields[$k] = GetDateTimeMk($this->Fields[$k]);
}
foreach($dtp2->CTags as $tid=>$ctag){
if($ctag->GetName()=='name') $dtp2->Assign($tid,$fname);
else if($ctag->GetName()=='value') @$dtp2->Assign($tid,$this->Fields[$k]);
}
$res .= $dtp2->GetResult();
}
}
$this->dtp->Assign($tagid,$res);
}//end if
}//结束模板循环
}
}
//---------------------------
//关闭所占用的资源
//---------------------------
function Close()
{
$this->FixedValues = "";
$this->Fields = "";
if(is_object($this->dsql)) $this->dsql->Close();
if(is_object($this->ChannelUnit)) $this->ChannelUnit->Close();
if(is_object($this->TypeLink)) $this->TypeLink->Close();
if(is_object($this->PartView)) $this->PartView->Close();
}
//----------------------
//获得本文的投稿作者信息
//----------------------
function GetMemberInfo()
{
if(!isset($this->MemberInfos['ID'])){
if($this->Fields['memberID']==0) return '';
else{
$this->MemberInfos = $this->dsql->GetOne("Select ID,userid,uname,spacename,spaceimage From #@__member where ID='{$this->Fields['memberID']}' ");
}
}
if(!isset($this->MemberInfos['ID'])) return "";
else{
$minfo = "<a href='".$cfg_memberurl."/index.php?uid=".$this->MemberInfos['userid']."'>浏览 <font color='red'><b>";
$minfo .= $this->MemberInfos['uname']."</font></b> 的个人空间</a>\r\n";
return $minfo;
}
}
//--------------------------
//获取上一篇,下一篇链接
//--------------------------
function GetPreNext($gtype='')
{
$rs = "";
if(count($this->PreNext)<2)
{
$aid = $this->ArcID;
$idmax = $this->ArcID+1000;
$idmin = $this->ArcID-1000;
$next = " arc.ID>'$aid' And arc.ID<'$idmax' And arc.arcrank>-1 And typeid='{$this->Fields['typeid']}' order by arc.ID asc ";
$pre = " arc.ID<'$aid' And arc.ID>'$idmin' And arc.arcrank>-1 And typeid='{$this->Fields['typeid']}' order by arc.ID desc ";
$query = "Select arc.ID,arc.title,arc.shorttitle,
arc.typeid,arc.ismake,arc.senddate,arc.arcrank,arc.money,
t.typedir,t.typename,t.namerule,t.namerule2,t.ispart,
t.moresite,t.siteurl
from `{$this->MainTable}` arc left join #@__arctype t on arc.typeid=t.ID
where ";
$nextRow = $this->dsql->GetOne($query.$next);
$preRow = $this->dsql->GetOne($query.$pre);
if(is_array($preRow))
{
$mlink = GetFileUrl($preRow['ID'],$preRow['typeid'],$preRow['senddate'],$preRow['title'],$preRow['ismake'],$preRow['arcrank'],$preRow['namerule'],$preRow['typedir'],$preRow['money'],true,$preRow['siteurl']);
$this->PreNext['pre'] = "上一篇:<a href='$mlink'>{$preRow['title']}</a> ";
}
else{
$this->PreNext['pre'] = "上一篇:没有了 ";
}
if(is_array($nextRow))
{
$mlink = GetFileUrl($nextRow['ID'],$nextRow['typeid'],$nextRow['senddate'],$nextRow['title'],$nextRow['ismake'],$nextRow['arcrank'],$nextRow['namerule'],$nextRow['typedir'],$nextRow['money'],true,$nextRow['siteurl']);
$this->PreNext['next'] = "下一篇:<a href='$mlink'>{$nextRow['title']}</a> ";
}
else{
$this->PreNext['next'] = "下一篇:没有了 ";
}
}
if($gtype=='pre'){
$rs = $this->PreNext['pre'];
}
else if($gtype=='next'){
$rs = $this->PreNext['next'];
}
else{
$rs = $this->PreNext['pre']." ".$this->PreNext['next'];
}
return $rs;
}
//------------------------
//获得动态页面分页列表
//------------------------
function GetPagebreakDM($totalPage,$nowPage,$aid)
{
if($totalPage==1){ return ""; }
$PageList = ''; // "共".$totalPage."页: ";
$nPage = $nowPage-1;
$lPage = $nowPage+1;
if($nowPage==1) $PageList.="<a href='#'>上一页</a> ";
else{
if($nPage==1) $PageList.="<a href='view.php?aid=$aid'>上一页</a> ";
else $PageList.="<a href='view.php?aid=$aid&pageno=$nPage'>上一页</a> ";
}
for($i=1;$i<=$totalPage;$i++)
{
if($i==1){
if($nowPage!=1) $PageList.="<a href='view.php?aid=$aid'>1</a> ";
else $PageList.="<strong>1</strong> ";
}else{
$n = $i;
if($nowPage!=$i) $PageList.="<a href='view.php?aid=$aid&pageno=$i'>".$n."</a> ";
else $PageList.="<strong>$n</strong> ";
}
}
if($lPage <= $totalPage) $PageList.="<a href='view.php?aid=$aid&pageno=$lPage'>下一页</a> ";
else $PageList.= "<a href='#'>下一页</a>";
return $PageList;
}
//-------------------------
//获得静态页面分页列表
//-------------------------
function GetPagebreak($totalPage,$nowPage,$aid)
{
if($totalPage==1){ return ""; }
$PageList = ''; // "共".$totalPage."页: ";
$nPage = $nowPage-1;
$lPage = $nowPage+1;
if($nowPage==1) $PageList.="<a href='#'>上一页</a>";
else{
if($nPage==1) $PageList.="<a href='".$this->NameFirst.".".$this->ShortName."'>上一页</a> ";
else $PageList.="<a href='".$this->NameFirst."_".$nPage.".".$this->ShortName."'>上一页</a> ";
}
for($i=1;$i<=$totalPage;$i++)
{
if($i==1){
if($nowPage!=1) $PageList.="<a href='".$this->NameFirst.".".$this->ShortName."'>1</a> ";
else $PageList.="<strong>1</strong>";
}else{
$n = $i;
if($nowPage!=$i) $PageList.="<a href='".$this->NameFirst."_".$i.".".$this->ShortName."'>".$n."</a> ";
else $PageList.="<strong>$n</strong>";
}
}
if($lPage <= $totalPage) $PageList.="<a href='".$this->NameFirst."_".$lPage.".".$this->ShortName."'>下一页</a> ";
else $PageList.= "<a href='#'>下一页</a>";
return $PageList;
}
//-------------------------
//获得动态页面小标题
//-------------------------
function GetPageTitlesDM($styleName,$pageNo)
{
if($this->TotalPage==1){ return ""; }
if(count($this->SplitTitles)==0){ return ""; }
$i=1;
$aid = $this->ArcID;
if($styleName=='link')
{
$revalue = "";
foreach($this->SplitTitles as $k=>$v){
if($i==1) $revalue .= "<a href='view.php?aid=$aid&pageno=$i'>$v</a> \r\n";
else{
if($pageNo==$i) $revalue .= " $v \r\n";
else $revalue .= "<a href='view.php?aid=$aid&pageno=$i'>$v</a> \r\n";
}
$i++;
}
}else
{
$revalue = "<select id='dedepagetitles' onchange='location.href=this.options[this.selectedIndex].value;'>\r\n";
foreach($this->SplitTitles as $k=>$v){
if($i==1) $revalue .= "<option value='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$i'>{$i}、{$v}</option>\r\n";
else{
if($pageNo==$i) $revalue .= "<option value='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$i' selected>{$i}、{$v}</option>\r\n";
else $revalue .= "<option value='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$i'>{$i}、{$v}</option>\r\n";
}
$i++;
}
$revalue .= "</select>\r\n";
}
return $revalue;
}
//-------------------------
//获得静态页面小标题
//-------------------------
function GetPageTitlesST($styleName,$pageNo)
{
if($this->TotalPage==1){ return ""; }
if(count($this->SplitTitles)==0){ return ""; }
$i=1;
if($styleName=='link')
{
$revalue = "";
foreach($this->SplitTitles as $k=>$v){
if($i==1) $revalue .= "<a href='".$this->NameFirst.".".$this->ShortName."'>$v</a> \r\n";
else{
if($pageNo==$i) $revalue .= " $v \r\n";
else $revalue .= "<a href='".$this->NameFirst."_".$i.".".$this->ShortName."'>$v</a> \r\n";
}
$i++;
}
}else
{
$revalue = "<select id='dedepagetitles' onchange='location.href=this.options[this.selectedIndex].value;'>\r\n";
foreach($this->SplitTitles as $k=>$v){
if($i==1) $revalue .= "<option value='".$this->NameFirst.".".$this->ShortName."'>{$i}、{$v}</option>\r\n";
else{
if($pageNo==$i) $revalue .= "<option value='".$this->NameFirst."_".$i.".".$this->ShortName."' selected>{$i}、{$v}</option>\r\n";
else $revalue .= "<option value='".$this->NameFirst."_".$i.".".$this->ShortName."'>{$i}、{$v}</option>\r\n";
}
$i++;
}
$revalue .= "</select>\r\n";
}
return $revalue;
}
//----------------------------
//把指定关键字替换成链接
//----------------------------
function ReplaceKeyword($kw,&$body)
{
global $cfg_cmspath;
$maxkey = 5;
$kws = explode(" ",trim($kw));
$i=0;
$words = array();
$hrefs = array();
foreach($kws as $k){
$k = trim($k);
if($k!=""){
if($i > $maxkey) break;
$myrow = $this->dsql->GetOne("select * from #@__keywords where keyword='".addslashes($k)."' And rpurl<>'' ");
if(is_array($myrow)){
//$ka = "<a href='{$myrow['rpurl']}'>$k</a>";
//$body = str_replace($k,$ka,$body);
$words[] = $k;
$hrefs[] = $myrow['rpurl'];
}
$i++;
}
}
$body = highlight($body, $words, $hrefs);
return $body;
}
}//End Archives
?> | zyyhong | trunk/jiaju001/news/include/inc_archives_view.php | PHP | asf20 | 25,215 |
<?php
if(!defined('DEDEINC'))
{
exit("Request Error!");
}
require_once(dirname(__FILE__)."/inc_arcpart_view.php");
require_once(dirname(__FILE__)."/inc_pubtag_make.php");
/******************************************************
//Copyright 2004-2006 by DedeCms.com itprato
//本类的用途是用于浏览频道列表或对内容列表生成HTML
******************************************************/
@set_time_limit(0);
class ListView
{
var $dsql;
var $dtp;
var $dtp2;
var $TypeID;
var $TypeLink;
var $pageno;
var $TotalPage;
var $totalresult;
var $PageSize;
var $ChannelUnit;
var $ListType;
var $Fields;
var $PartView;
var $StartTime;
var $maintable;
var $addtable;
var $areas;
var $areaid;
var $areaid2;
var $sectors;
var $sectorid;
var $sectorid2;
var $smalltypes;
var $smalltypeid;
var $topareas;
var $subareas;
var $mysmalltypes;
var $TempletsFile;
var $addSql;
var $hasDmCache;
//-------------------------------
//php5构造函数
//-------------------------------
function __construct($typeid,$starttime=0,$areaid=0,$areaid2=0,$sectorid=0,$sectorid2=0,$smalltypeid=0)
{
$this->areaid = $areaid;
$this->areaid2 = $areaid2;
$this->sectorid = $sectorid;
$this->sectorid2 = $sectorid2;
$this->smalltypeid = $smalltypeid;
$this->TypeID = $typeid;
$this->dsql = new DedeSql(false);
$this->dtp = new DedeTagParse();
$this->dtp->SetNameSpace("dede","{","}");
$this->dtp2 = new DedeTagParse();
$this->dtp2->SetNameSpace("field","[","]");
$this->TypeLink = new TypeLink($typeid);
$this->ChannelUnit = new ChannelUnit($this->TypeLink->TypeInfos['channeltype']);
$this->maintable = $this->ChannelUnit->ChannelInfos['maintable'];
$this->topareas = $this->subareas = $this->areas = $this->sectors = $this->smalltypes = array();
$this->areas[0] = $this->sectors[0] = $this->smalltypes[0] = '不限';
$this->topareas[0] = array("id"=>0 , "name"=>'不限');
$this->addtable = $this->ChannelUnit->ChannelInfos['addtable'];
$this->Fields = $this->TypeLink->TypeInfos;
$this->hasDmCache = false;
$this->Fields['id'] = $typeid;
$this->Fields['position'] = $this->TypeLink->GetPositionLink(true);
$this->Fields['title'] = ereg_replace("[<>]"," / ",$this->TypeLink->GetPositionLink(false));
//设置一些全局参数的值
foreach($GLOBALS['PubFields'] as $k=>$v) $this->Fields[$k] = $v;
$this->Fields['rsslink'] = $GLOBALS['cfg_mainsite'].$GLOBALS['cfg_plus_dir']."/rss/".$this->TypeID.".xml";
if($starttime==0) $this->StartTime = 0;
else $this->StartTime = GetMkTime($starttime);
if($this->TypeLink->TypeInfos['ispart']<=2)
{
$this->PartView = new PartView($typeid);
$this->CountRecord();
}
}
//php4构造函数
//---------------------------
function ListView($typeid,$starttime=0,$areaid=0,$areaid2=0,$sectorid=0,$sectorid2=0,$smalltypeid=0){
$this->__construct($typeid,$starttime,$areaid,$areaid2,$sectorid,$sectorid2,$smalltypeid);
}
//
function LoadDmCatCache()
{
//载入地区、行业、小分类数据表
$this->dsql->Execute('ar',"select * from #@__area ");
while($row=$this->dsql->GetArray('ar'))
{
if(!empty($this->areaid2) && $row['id'] == $this->areaid2){
$this->areaid = $row['reid'];
}
if($row['reid'] == 0){
$this->topareas[] = $row;
}else{
$this->subareas[$row['reid']][] = $row;
}
$this->areas[$row['id']] = $row['name'];
}
$this->dsql->Execute('ar',"select * from #@__sectors");
while($row=$this->dsql->GetArray('ar')){
$this->sectors[$row['id']] = $row['name'];
}
$this->dsql->Execute('ar',"select * from #@__smalltypes");
$this->mysmalltypes = array();
$mysmalltypesarray = explode(',',$this->Fields['smalltypes']);
$this->mysmalltypes[0] = array("id"=>0, "name"=>'不限');
while($row=$this->dsql->GetArray('ar'))
{
if(@in_array($row['id'], $mysmalltypesarray)){
$this->mysmalltypes[] = $row;
}
$this->smalltypes[$row['id']] = $row['name'];
}
$this->hasDmCache = true;
}
//---------------------------
//关闭相关资源
//---------------------------
function Close()
{
$this->dsql->Close();
$this->TypeLink->Close();
$this->ChannelUnit->Close();
if(is_object($this->PartView)) $this->PartView->Close();
}
//------------------
//统计列表里的记录
//------------------
function CountRecord()
{
global $cfg_list_son;
//统计数据库记录
$this->totalresult = -1;
if(isset($GLOBALS['totalresult'])) $this->totalresult = intval($GLOBALS['totalresult']);
if(isset($GLOBALS['pageno'])) $this->pageno = intval($GLOBALS['pageno']);
else $this->pageno = 1;
//分析条件
$this->addSql = " arc.arcrank > -1 ";
if($cfg_list_son=='N'){
$this->addSql .= " And (arc.typeid='".$this->TypeID."' or arc.typeid2='".$this->TypeID."') ";
}else{
$idlist = $this->TypeLink->GetSunID($this->TypeID,'',$this->Fields['channeltype'],true);
if(ereg(',',$idlist)){
$this->addSql .= " And (arc.typeid in ($idlist) Or arc.typeid2='{$this->TypeID}') ";
}else{
$this->addSql .= " And (arc.typeid='{$this->TypeID}' Or arc.typeid2='{$this->TypeID}') ";
}
}
if($this->areaid2 != 0){
$this->addSql .= "and arc.areaid2=$this->areaid2 ";
}else if($this->areaid != 0){
$this->addSql .= "and arc.areaid=$this->areaid ";
}
if($this->sectorid2 != 0){
$this->addSql .= "and arc.sectorid2=$this->sectorid2 ";
}else if($this->sectorid != 0){
$this->addSql .= "and arc.sectorid=$this->sectorid ";
}
if($this->smalltypeid != 0){
$this->addSql .= "and arc.smalltypeid=$this->smalltypeid ";
}
if($this->StartTime>0){
$this->addSql .= " And arc.senddate>'".$this->StartTime."'";
}
if($this->totalresult==-1)
{
$cquery = "Select count(*) as dd From `{$this->maintable}` arc where ".$this->addSql;
$row = $this->dsql->GetOne($cquery);
$this->totalresult = $row['dd'];
}
//初始化列表模板,并统计页面总数
$tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$this->TypeLink->TypeInfos['templist'];
$tempfile = str_replace("{tid}",$this->TypeID,$tempfile);
$tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile);
if(!file_exists($tempfile)){
$tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$GLOBALS['cfg_df_style']."/list_article.htm";
}
if(!file_exists($tempfile)||!is_file($tempfile)){
echo "模板文件不存在,无法解析文档!";
exit();
}
$this->dtp->LoadTemplate($tempfile);
$this->TempletsFile = ereg_replace("^".$GLOBALS['cfg_basedir'],'',$tempfile);
$ctag = $this->dtp->GetTag('page');
if(!is_object($ctag)){ $ctag = $this->dtp->GetTag('list'); }
if(!is_object($ctag)) $this->PageSize = 20;
else{
if($ctag->GetAtt("pagesize")!='') $this->PageSize = $ctag->GetAtt('pagesize');
else $this->PageSize = 20;
}
$this->TotalPage = ceil($this->totalresult/$this->PageSize);
}
//------------------
//列表创建HTML
//------------------
function MakeHtml($startpage=1,$makepagesize=0)
{
if(empty($startpage)) $startpage = 1;
//创建封面模板文件
if($this->TypeLink->TypeInfos['isdefault']==-1){
echo '这个类目是动态类目!';
return '';
}
//单独页面
else if($this->TypeLink->TypeInfos['ispart']>0)
{
$reurl = $this->MakePartTemplets();
return $reurl;
}
//跳转网址
else if($this->TypeLink->TypeInfos['ispart']>2){
echo "这个类目是跳转网址!";
return $this->TypeLink->TypeInfos['typedir'];
}
//$this->CountRecord();
//初步给固定值的标记赋值
$this->ParseTempletsFirst();
$totalpage = ceil($this->totalresult/$this->PageSize);
if($totalpage==0) $totalpage = 1;
if($endpage==1) $endpage = 2;
CreateDir($this->Fields['typedir'],$this->Fields['siterefer'],$this->Fields['sitepath']);
$murl = "";
if($makepagesize>0) $endpage = $startpage+$makepagesize;
else $endpage = ($totalpage+1);
if($endpage>($totalpage+1)) $endpage = $totalpage+1;
$ttmk = 0;
$rs = '';
for($this->pageno=$startpage;$this->pageno<$endpage;$this->pageno++)
{
$ttmk++;
$this->ParseDMFields($this->pageno,1);
$makeFile = $this->GetMakeFileRule($this->Fields['ID'],"list",$this->Fields['typedir'],"",$this->Fields['namerule2']);
$makeFile = str_replace("{page}",$this->pageno,$makeFile);
$murl = $makeFile;
if(!ereg("^/",$makeFile)) $makeFile = "/".$makeFile;
$makeFile = $this->GetTruePath().$makeFile;
$makeFile = ereg_replace("/{1,}","/",$makeFile);
$murl = $this->GetTrueUrl($murl);
$this->dtp->SaveTo($makeFile);
$rs .= "<br/><a href='$murl' target='_blank'>$murl</a>";
}
echo "共创建:($ttmk) 文件 $rs";
if($startpage==1)
{
//如果列表启用封面文件,复制这个文件第一页
if($this->TypeLink->TypeInfos['isdefault']==1
&& $this->TypeLink->TypeInfos['ispart']==0)
{
$onlyrule = $this->GetMakeFileRule($this->Fields['ID'],"list",$this->Fields['typedir'],"",$this->Fields['namerule2']);
$onlyrule = str_replace("{page}","1",$onlyrule);
$list_1 = $this->GetTruePath().$onlyrule;
$murl = $this->Fields['typedir']."/".$this->Fields['defaultname'];
$indexname = $this->GetTruePath().$murl;
copy($list_1,$indexname);
echo "<br>复制:$onlyrule 为 ".$this->Fields['defaultname'];
}
}
$this->Close();
return $murl;
}
//------------------
//显示列表
//------------------
function Display()
{
//ispart = 3 跳转网址
if($this->TypeLink->TypeInfos['ispart']>2)
{
$this->Close();
header("location:".$this->TypeLink->TypeInfos['typedir']);
exit();
}
//ispart = 1 板块或 2 单独页面
else if($this->TypeLink->TypeInfos['ispart']>0)
{
$this->DisplayPartTemplets();
return '';
}
//ispart = 0 正常列表
if((empty($this->pageno) || $this->pageno==1)
&& $this->TypeLink->TypeInfos['ispart']==1)
{
$tmpdir = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir'];
$tempfile = str_replace("{tid}",$this->TypeID,$this->Fields['tempindex']);
$tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile);
$tempfile = $tmpdir."/".$tempfile;
if(!file_exists($tempfile)){
$tempfile = $tmpdir."/".$GLOBALS['cfg_df_style']."/index_article.htm";
}
$this->dtp->LoadTemplate($tempfile);
$this->TempletsFile = ereg_replace("^".$GLOBALS['cfg_basedir'],'',$tempfile);
}
$this->LoadDmCatCache();
$this->ParseTempletsFirst();
$this->ParseDMFields($this->pageno,0);
$this->Close();
$this->dtp->Display();
}
//------------------
//创建单独模板页面
//------------------
function MakePartTemplets()
{
$nmfa = 0;
$tmpdir = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir'];
if($this->Fields['ispart']==1){
$tempfile = str_replace("{tid}",$this->TypeID,$this->Fields['tempindex']);
$tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile);
$tempfile = $tmpdir."/".$tempfile;
if(!file_exists($tempfile)){
$tempfile = $tmpdir."/".$GLOBALS['cfg_df_style']."/index_article.htm";
}
$this->PartView->SetTemplet($tempfile);
}else if($this->Fields['ispart']==2){
$tempfile = str_replace("{tid}",$this->TypeID,$this->Fields['tempone']);
$tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile);
if(is_file($tmpdir."/".$tempfile)) $this->PartView->SetTemplet($tmpdir."/".$tempfile);
else{ $this->PartView->SetTemplet("这是没有使用模板的单独页!","string"); $nmfa = "1";}
}else if($this->Fields['ispart']==3){
return '';
}
CreateDir($this->Fields['typedir']);
$makeUrl = $this->GetMakeFileRule($this->Fields['ID'],"index",$this->Fields['typedir'],$this->Fields['defaultname'],$this->Fields['namerule2']);
$makeUrl = ereg_replace("/{1,}","/",$makeUrl);
$makeFile = $this->GetTruePath().$makeUrl;
if($nmfa==0) $this->PartView->SaveToHtml($makeFile);
else{
if(!file_exists($makeFile)) $this->PartView->SaveToHtml($makeFile);
}
//$this->Close();
return $this->GetTrueUrl($makeUrl);
}
//------------------
//显示单独模板页面
//------------------
function DisplayPartTemplets()
{
$nmfa = 0;
$tmpdir = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir'];
if($this->Fields['ispart']==1){
$tempfile = str_replace("{tid}",$this->TypeID,$this->Fields['tempindex']);
$tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile);
$tempfile = $tmpdir."/".$tempfile;
if(!file_exists($tempfile)){
$tempfile = $tmpdir."/".$GLOBALS['cfg_df_style']."/index_article.htm";
}
$this->PartView->SetTemplet($tempfile);
}else if($this->Fields['ispart']==2){
$tempfile = str_replace("{tid}",$this->TypeID,$this->Fields['tempone']);
$tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile);
if(is_file($tmpdir."/".$tempfile)) $this->PartView->SetTemplet($tmpdir."/".$tempfile);
else{ $this->PartView->SetTemplet("这是没有使用模板的单独页!","string"); $nmfa = 1; }
}
CreateDir($this->Fields['typedir']);
$makeUrl = $this->GetMakeFileRule($this->Fields['ID'],"index",$this->Fields['typedir'],$this->Fields['defaultname'],$this->Fields['namerule2']);
$makeFile = $this->GetTruePath().$makeUrl;
if($nmfa==0) $this->PartView->Display();
else{
if(!file_exists($makeFile)) $this->PartView->Display();
else include($makeFile);
}
$this->Close();
}
//----------------------------
//获得站点的真实根路径
//----------------------------
function GetTruePath(){
if($this->Fields['siterefer']==1) $truepath = ereg_replace("/{1,}","/",$GLOBALS["cfg_basedir"]."/".$this->Fields['sitepath']);
else if($this->Fields['siterefer']==2) $truepath = $this->Fields['sitepath'];
else $truepath = $GLOBALS["cfg_basedir"];
return $truepath;
}
//----------------------------
//获得真实连接路径
//----------------------------
function GetTrueUrl($nurl){
if($this->Fields['moresite']==1){ $nurl = ereg_replace("/$","",$this->Fields['siteurl']).$nurl; }
return $nurl;
}
//--------------------------------
//解析模板,对固定的标记进行初始给值
//--------------------------------
function ParseTempletsFirst()
{
//对公用标记的解析,这里对对象的调用均是用引用调用的,因此运算后会自动改变传递的对象的值
MakePublicTag($this,$this->dtp,$this->PartView,$this->TypeLink,$this->TypeID,0,0);
}
//--------------------------------
//解析模板,对内容里的变动进行赋值
//--------------------------------
function ParseDMFields($pageno,$ismake=1)
{
foreach($this->dtp->CTags as $tagid=>$ctag){
if($ctag->GetName()=="list"){
$limitstart = ($this->pageno-1) * $this->PageSize;
$row = $this->PageSize;
if(trim($ctag->GetInnerText())==""){ $InnerText = GetSysTemplets("list_fulllist.htm"); }
else{ $InnerText = trim($ctag->GetInnerText()); }
$this->dtp->Assign($tagid,
$this->GetArcList(
$limitstart,
$row,
$ctag->GetAtt("col"),
$ctag->GetAtt("titlelen"),
$ctag->GetAtt("infolen"),
$ctag->GetAtt("imgwidth"),
$ctag->GetAtt("imgheight"),
$ctag->GetAtt("listtype"),
$ctag->GetAtt("orderby"),
$InnerText,
$ctag->GetAtt("tablewidth"),
$ismake,
$ctag->GetAtt("orderway")
)
);
}
else if($ctag->GetName()=="pagelist"){
$list_len = trim($ctag->GetAtt("listsize"));
$ctag->GetAtt("listitem")=="" ? $listitem="info,index,pre,pageno,next,end,option" : $listitem=$ctag->GetAtt("listitem");
if($list_len=="") $list_len = 3;
if($ismake==0) $this->dtp->Assign($tagid,$this->GetPageListDM($list_len,$listitem));
else $this->dtp->Assign($tagid,$this->GetPageListST($list_len,$listitem));
}
else if($ctag->GetName()=="area"){
$areaid = trim($ctag->GetAtt('areaid'));
if(empty($areaid)){
$areaid = $this->areaid;
}
$areaid2 = trim($ctag->GetAtt('areaid2'));
if(empty($areaid2)){
$areaid2 = $this->areaid2;
}
$sub = trim($ctag->GetAtt('sub'));
if(empty($sub)){
$sub = 0;
}else{
$sub = 1;
}
$this->dtp->Assign($tagid, $this->getarea($areaid, $areaid2,$sub));
}
else if($ctag->GetName()=="smalltype"){
$this->dtp->Assign($tagid, $this->getsmalltype());
}
}
}
//----------------
//获得要创建的文件名称规则
//----------------
function GetMakeFileRule($typeid,$wname,$typedir,$defaultname,$namerule2)
{
$typedir = eregi_replace("{cmspath}",$GLOBALS['cfg_cmspath'],$typedir);
$typedir = ereg_replace("/{1,}","/",$typedir);
if($wname=="index")
{ return $typedir."/".$defaultname; }
else
{
$namerule2 = str_replace("{tid}",$typeid,$namerule2);
$namerule2 = str_replace("{typedir}",$typedir,$namerule2);
return $namerule2;
}
}
//获取小分类数据
function getsmalltype()
{
$str = '';
if($this->mysmalltypes){
//print_r($this->mysmalltypes);
$str = '<div class="c1"><strong>分类:</strong>';
foreach($this->mysmalltypes as $mysmalltype){
if($mysmalltype['id'] == $this->smalltypeid){
$str .= '<strong style="color:green">'.$mysmalltype['name'].'</strong> ';
continue;
}
$str .= '<a href="list.php?tid='.$this->TypeID;
if($this->areaid2){
$str .= '&areaid2='.$this->areaid2;
}elseif($this->areaid){
$str .= '&areaid='.$this->areaid;
}
$str .= '&smalltypeid='.$mysmalltype['id'].'">'.$mysmalltype['name']."</a>\n";
}
$str .= '</div>';
}
return $str;
}
//获得地区数据
function getarea($areaid, $areaid2,$sub=0)
{
$str = '';
$topareadata = '';
foreach($this->topareas as $toparea){
if($sub){
$topareadata .= '<option value="'.$toparea['id'].'">'.$toparea['name']."</option>\n";
continue;
}
if($toparea['id'] == $this->areaid){
$str .= '<strong style="color:green">'.$toparea['name'].'</strong> ';
continue;
}
$str .= '<a href="list.php?tid='.$this->TypeID;
if($this->smalltypeid){
$str .= '&smalltypeid='.$this->smalltypeid;
}
$str .= '&areaid='.$toparea['id'].'">'.$toparea['name'].'</a> ';
}
$str1 = '';
if($areaid && is_array($this->subareas[$areaid])){
foreach($this->subareas[$areaid] as $subarea){
if($subarea['id'] == $this->areaid2){
$str1 .= '<strong style="color:green">'.$subarea['name'].'</strong> ';
continue;
}
$str1 .= '<a href="list.php?tid='.$this->TypeID;
if($this->smalltypeid){
$str1 .= '&smalltypeid='.$this->smalltypeid;
}
$str1 .= '&areaid2='.$subarea['id'].'">'.$subarea['name'].'</a> ';
}
}
if($sub)
{
return $topareadata;
}else{
return '<div class="c1"><strong>地区:</strong>'.$str.'</div><div class="c2">'.$str1.'</div>';
}
}
//----------------------------------
//获得一个单列的文档列表
//---------------------------------
function GetArcList($limitstart=0,$row=10,$col=1,$titlelen=30,$infolen=250,
$imgwidth=120,$imgheight=90,$listtype="all",$orderby="default",$innertext="",$tablewidth="100",$ismake=1,$orderWay='desc')
{
global $cfg_list_son;
$t1 = ExecTime();
$typeid=$this->TypeID;
if($row=="") $row = 10;
if($limitstart=="") $limitstart = 0;
if($titlelen=="") $titlelen = 100;
if($infolen=="") $infolen = 250;
if($imgwidth=="") $imgwidth = 120;
if($imgheight=="") $imgheight = 120;
if($listtype=="") $listtype = "all";
if($orderby=="") $orderby="default";
else $orderby=strtolower($orderby);
if($orderWay=='') $orderWay = 'desc';
$tablewidth = str_replace("%","",$tablewidth);
if($tablewidth=="") $tablewidth=100;
if($col=="") $col=1;
$colWidth = ceil(100/$col);
$tablewidth = $tablewidth."%";
$colWidth = $colWidth."%";
$innertext = trim($innertext);
if($innertext=="") $innertext = GetSysTemplets("list_fulllist.htm");
//按不同情况设定SQL条件
$orwhere = $this->addSql;
//排序方式
if($orderby=="senddate") $ordersql=" order by arc.senddate $orderWay";
elseif($orderby=="pubdate") $ordersql=" order by arc.pubdate $orderWay";
elseif($orderby=="id") $ordersql=" order by arc.ID $orderWay";
elseif($orderby=="hot"||$orderby=="click") $ordersql = " order by arc.click $orderWay";
elseif($orderby=="lastpost") $ordersql = " order by arc.lastpost $orderWay";
elseif($orderby=="postnum") $ordersql = " order by arc.postnum $orderWay";
elseif($orderby=="digg") $ordersql = " order by arc.digg $orderWay";
elseif($orderby=="diggtime") $ordersql = " order by arc.diggtime $orderWay";
else $ordersql=" order by arc.sortrank $orderWay";
//获得附加表的相关信息
//-----------------------------
$addtable = $this->ChannelUnit->ChannelInfos['addtable'];
$addfields = trim($this->ChannelUnit->ChannelInfos['listadd']);
if($addtable!="" && $addfields!="")
{
$addJoin = " left join `$addtable` addt on addt.aid = arc.ID ";
$addField = "";
$fields = explode(",",$addfields);
foreach($fields as $k=>$v){
$addField .= ",addt.{$v}";
}
}else
{
$addField = "";
$addJoin = "";
}
$query = "Select arc.*,
tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl
$addField
from `{$this->maintable}` arc
left join #@__arctype tp on arc.typeid=tp.ID
$addJoin
where $orwhere $ordersql limit $limitstart,$row";
$this->dtp2->LoadSource($innertext);
if(!is_array($this->dtp2->CTags)) return '';
$this->dsql->Execute("al",$query);
$t2 = ExecTime();
$artlist = "";
if($col>1) $artlist = "<table width='$tablewidth' border='0' cellspacing='0' cellpadding='0'>\r\n";
$GLOBALS['autoindex'] = 0;
for($i=0;$i<$row;$i++)
{
if($col>1) $artlist .= "<tr>\r\n";
for($j=0;$j<$col;$j++)
{
if($col>1) $artlist .= "<td width='$colWidth'>\r\n";
if($row = $this->dsql->GetArray("al",MYSQL_ASSOC))
{
$GLOBALS['autoindex']++;
//处理一些特殊字段
//if()
$row['id'] = $row['ID'];
$row['arcurl'] = $this->GetArcUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'],$row['arcrank'],$row['namerule'],$row['typedir'],$row['money']);
$row['typeurl'] = $this->GetListUrl($row['typeid'],$row['typedir'],$row['isdefault'],$row['defaultname'],$row['ispart'],$row['namerule2'],"abc");
if($ismake==0 && $GLOBALS['cfg_multi_site']=='Y')
{
if($row["siteurl"]=="") $row["siteurl"] = $GLOBALS['cfg_mainsite'];
if(!eregi("^http://",$row['picname'])){
$row['litpic'] = $row['siteurl'].$row['litpic'];
$row['picname'] = $row['litpic'];
}
}
$row['description'] = cn_substr($row['description'],$infolen);
if($row['litpic']=="") $row['litpic'] = $GLOBALS['cfg_plus_dir']."/img/dfpic.gif";
$row['picname'] = $row['litpic'];
$row['info'] = $row['description'];
$row['filename'] = $row['arcurl'];
$row['stime'] = GetDateMK($row['pubdate']);
if($this->hasDmCache){
$row['areaidname'] = $row['areaid2name'] = $row['sectoridname'] = $row['sectorid2name'] =$row['smalltypeidname'] = '';
$row['areaidname'] = $this->areas[$row['areaid']];
$row['areaid2name'] = $this->areas[$row['areaid2']];
$row['sectoridname'] = $this->sectors[$row['sectorid']];
$row['sectorid2name'] = $this->sectors[$row['sectorid2']];
$row['smalltypeidname'] = $this->smalltypes[$row['smalltypeid']];
}
$row['textlink'] = "<a href='".$row['filename']."' title='".str_replace("'","",$row['title'])."'>".$row['title']."</a>";
if($row['typeid'] != $this->Fields['ID']){
$row['typelink'] = "<a href='".$row['typeurl']."'>[".$row['typename']."]</a>";
}else{
$row['typelink']= '';
}
$row['imglink'] = "<a href='".$row['filename']."'><img src='".$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".str_replace("'","",$row['title'])."'></a>";
$row['image'] = "<img src='".$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".str_replace("'","",$row['title'])."'>";
$row['phpurl'] = $GLOBALS['cfg_plus_dir'];
$row['plusurl'] = $GLOBALS['cfg_plus_dir'];
$row['templeturl'] = $GLOBALS['cfg_templets_dir'];
$row['memberurl'] = $GLOBALS['cfg_member_dir'];
$row['title'] = cn_substr($row['title'],$titlelen);
if($row['color']!="") $row['title'] = "<font color='".$row['color']."'>".$row['title']."</font>";
if($row['iscommend']==5||$row['iscommend']==16) $row['title'] = "<b>".$row['title']."</b>";
//编译附加表里的数据
foreach($row as $k=>$v){ $row[strtolower($k)] = $v; }
foreach($this->ChannelUnit->ChannelFields as $k=>$arr){
if(isset($row[$k])) $row[$k] = $this->ChannelUnit->MakeField($k,$row[$k]);
}
foreach($this->dtp2->CTags as $k=>$ctag){
@$this->dtp2->Assign($k,$row[$ctag->GetName()]);
}
$artlist .= $this->dtp2->GetResult();
}//if hasRow
if($col>1) $artlist .= " </td>\r\n";
}//Loop Col
if($col>1) $i += $col - 1;
if($col>1) $artlist .= " </tr>\r\n";
}//Loop Line
if($col>1) $artlist .= "</table>\r\n";
$this->dsql->FreeResult("al");
//$t3 = ExecTime();
//echo ($t3-$t2)."<br>";
return $artlist;
}
//---------------------------------
//获取静态的分页列表
//---------------------------------
function GetPageListST($list_len,$listitem="info,index,end,pre,next,pageno")
{
$prepage="";
$nextpage="";
$prepagenum = $this->pageno-1;
$nextpagenum = $this->pageno+1;
if($list_len==""||ereg("[^0-9]",$list_len)) $list_len=3;
$totalpage = ceil($this->totalresult/$this->PageSize);
if($totalpage<=1 && $this->totalresult>0) return "共1页/".$this->totalresult."条";
if($this->totalresult == 0) return "共0页/".$this->totalresult."条";
$maininfo = " 共{$totalpage}页/".$this->totalresult."条 ";
$purl = $this->GetCurUrl();
$tnamerule = $this->GetMakeFileRule($this->Fields['ID'],"list",$this->Fields['typedir'],$this->Fields['defaultname'],$this->Fields['namerule2']);
$tnamerule = ereg_replace('^(.*)/','',$tnamerule);
//获得上一页和主页的链接
if($this->pageno != 1){
$prepage.="<a href='".str_replace("{page}",$prepagenum,$tnamerule)."'>上一页</a>\r\n";
$indexpage="<a href='".str_replace("{page}",1,$tnamerule)."'>首页</a>\r\n";
}else{ $indexpage="<a href='#'>首页</a>\r\n"; }
//下一页,未页的链接
if($this->pageno!=$totalpage && $totalpage>1){
$nextpage.="<a href='".str_replace("{page}",$nextpagenum,$tnamerule)."'>下一页</a>\r\n";
$endpage="<a href='".str_replace("{page}",$totalpage,$tnamerule)."'>末页</a>\r\n";
}else{
$endpage="<a href='#'>末页</a>\r\n";
}
//option链接
$optionlen = strlen($totalpage);
$optionlen = $optionlen*20+18;
$optionlist = "<select name='sldd' style='width:{$optionlen}px' onchange='location.href=this.options[this.selectedIndex].value;'>\r\n";
for($mjj=1;$mjj<=$totalpage;$mjj++){
if($mjj==$this->pageno) $optionlist .= "<option value='".str_replace("{page}",$mjj,$tnamerule)."' selected>$mjj</option>\r\n";
else $optionlist .= "<option value='".str_replace("{page}",$mjj,$tnamerule)."'>$mjj</option>\r\n";
}
$optionlist .= "</select>";
//获得数字链接
$listdd="";
$total_list = $list_len * 2 + 1;
if($this->pageno >= $total_list) {
$j = $this->pageno-$list_len;
$total_list = $this->pageno+$list_len;
if($total_list>$totalpage) $total_list=$totalpage;
}
else{
$j=1;
if($total_list>$totalpage) $total_list=$totalpage;
}
for($j;$j<=$total_list;$j++){
if($j==$this->pageno) $listdd.= "<strong>$j</strong>";
else $listdd.="<a href='".str_replace("{page}",$j,$tnamerule)."'>".$j."</a>\r\n";
}
$plist = "";
if(eregi('info',$listitem)) $plist .= $maininfo.' ';
if(eregi('index',$listitem)) $plist .= $indexpage.' ';
if(eregi('pre',$listitem)) $plist .= $prepage.' ';
if(eregi('pageno',$listitem)) $plist .= $listdd.' ';
if(eregi('next',$listitem)) $plist .= $nextpage.' ';
if(eregi('end',$listitem)) $plist .= $endpage.' ';
if(eregi('option',$listitem)) $plist .= $optionlist;
return $plist;
}
//---------------------------------
//获取动态的分页列表
//---------------------------------
function GetPageListDM($list_len,$listitem="index,end,pre,next,pageno")
{
$prepage="";
$nextpage="";
$prepagenum = $this->pageno-1;
$nextpagenum = $this->pageno+1;
if($list_len==""||ereg("[^0-9]",$list_len)) $list_len=3;
$totalpage = ceil($this->totalresult/$this->PageSize);
if($totalpage<=1 && $this->totalresult>0) return "<span>共1页/".$this->totalresult."条</span>";
if($this->totalresult == 0) return "<span>共0页/".$this->totalresult."条</span>";
$maininfo = "<span>共{$totalpage}页/".$this->totalresult."条</span>";
$purl = $this->GetCurUrl();
$geturl = "typeid=".$this->TypeID."&totalresult=".$this->totalresult."&";
$hidenform = "<input type='hidden' name='typeid' value='".$this->TypeID."'>\r\n";
$hidenform .= "<input type='hidden' name='totalresult' value='".$this->totalresult."'>\r\n";
$purl .= "?".$geturl;
//获得上一页和下一页的链接
if($this->pageno != 1){
$prepage.="<a href='".$purl."pageno=$prepagenum'>上一页</a>\r\n";
$indexpage="<a href='".$purl."pageno=1'>首页</a>\r\n";
}
else{
$indexpage="<a href='#'>首页</a>\r\n";
}
if($this->pageno!=$totalpage && $totalpage>1){
$nextpage.="<a href='".$purl."pageno=$nextpagenum'>下一页</a>\r\n";
$endpage="<a href='".$purl."pageno=$totalpage'>末页</a>\r\n";
}
else{
$endpage="末页\r\n";
}
//获得数字链接
$listdd="";
$total_list = $list_len * 2 + 1;
if($this->pageno >= $total_list) {
$j = $this->pageno-$list_len;
$total_list = $this->pageno+$list_len;
if($total_list>$totalpage) $total_list=$totalpage;
}else{
$j=1;
if($total_list>$totalpage) $total_list=$totalpage;
}
for($j;$j<=$total_list;$j++){
if($j==$this->pageno) $listdd.= "<strong>$j</strong>\r\n";
else $listdd.="<a href='".$purl."pageno=$j'>".$j."</a>\n";
}
$plist = " ";
$plist .= "<form name='pagelist' action='".$this->GetCurUrl()."'>$hidenform";
$plist .= $maininfo.$indexpage.$prepage.$listdd.$nextpage.$endpage;
if($totalpage>$total_list){
$plist.="<input type='text' name='pageno' ' value='".$this->pageno."'>\r\n";
$plist.="<input type='submit' id='button' name='plistgo' value='GO' >\r\n";
}
$plist .= "</form>\r\n";
return $plist;
}
//--------------------------
//获得一个指定的频道的链接
//--------------------------
function GetListUrl($typeid,$typedir,$isdefault,$defaultname,$ispart,$namerule2,$siteurl=""){
return GetTypeUrl($typeid,MfTypedir($typedir),$isdefault,$defaultname,$ispart,$namerule2,$siteurl);
}
//--------------------------
//获得一个指定档案的链接
//--------------------------
function GetArcUrl($aid,$typeid,$timetag,$title,$ismake=0,$rank=0,$namerule="",$artdir="",$money=0){
return GetFileUrl($aid,$typeid,$timetag,$title,$ismake,$rank,$namerule,$artdir,$money);
}
//---------------
//获得当前的页面文件的url
//----------------
function GetCurUrl()
{
if(!empty($_SERVER["REQUEST_URI"])){
$nowurl = $_SERVER["REQUEST_URI"];
$nowurls = explode("?",$nowurl);
$nowurl = $nowurls[0];
}else{ $nowurl = $_SERVER["PHP_SELF"]; }
return $nowurl;
}
}//End Class
?> | zyyhong | trunk/jiaju001/news/include/inc_arclist_view.php | PHP | asf20 | 33,074 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>系统提示</title>
<link href="<?php echo $cfg_cmspath; ?>/templets/style/css_body.css" rel="stylesheet" type="text/css" />
<style>
.bodytitle{
width:96%;
height:33px;
background:url(<?php echo $cfg_cmspath; ?>/plus/img/body_title_bg.gif) top left repeat-x;
margin-left:auto;
margin-right:auto;
margin-top:8px;
clear:both;
}
.bodytitleleft{
width:30px;
height:33px;
float:left;
background:url(<?php echo $cfg_cmspath; ?>/plus/img/body_title_left.gif) right bottom no-repeat;
}
.bodytitletxt{
height:27px;
float:left;
margin-top:6px;
line-height:27px;
font-size:14px;
font-weight:bold;
letter-spacing:2px;
padding-left:8px;
padding-right:8px;
background:#FFF url(<?php echo $cfg_cmspath; ?>/plus/img/body_title_right.gif) right bottom no-repeat;
}
.np { border:0px }
</style>
</head>
<body>
<div class='bodytitle'>
<div class='bodytitleleft'></div>
<div class='bodytitletxt'>通用对话框</div>
</div>
<table width="96%" border="0" cellpadding="1" cellspacing="1" align="center" class="tbtitle" style="background:#E2F5BC;">
<tr>
<td class="tbtitletxt"><font color='#666600'><b>系统提示:</b></font></td>
</tr>
</table>
<table width="96%" border="0" cellpadding="1" cellspacing="1" align="center" style="margin:0px auto" class="tblist">
<tr align="center">
<td align="left" class="tbsname"><table width='100%' border='0' cellpadding='1' cellspacing='1' align='center' class='tbtitle' style='background:#E2F5BC;'>
<tr>
<td colspan='2' ><strong>站点互动模块暂时关闭通知</strong></td>
</tr>
<tr>
<td colspan='2' height='100'>
由于管理员正在对网站进行维护,因此暂时关闭前台一些互动程序,如有不便请谅解!</td>
</tr>
<tr>
<td align="center">Power by <a href="http://www.dedecms.com" target="_blank">DedeCms</a> </td>
</tr></table>
</td>
</tr>
</table>
<div align="center">
</div>
</body>
</html>
| zyyhong | trunk/jiaju001/news/include/alert.htm | HTML | asf20 | 2,218 |
<?php
if(!defined('DEDEINC'))
{
exit("Request Error!");
}
require_once(dirname(__FILE__)."/inc_typelink.php");
require_once(dirname(__FILE__)."/pub_dedetag.php");
require_once(dirname(__FILE__)."/pub_splitword_www.php");
/******************************************************
//Copyright 2004-2006 by DedeCms.com itprato
//本类的用途是用于文档搜索
******************************************************/
@set_time_limit(0);
//-----------------------
//搜索类
//-----------------------
class SearchView
{
var $dsql;
var $dtp;
var $dtp2;
var $TypeID;
var $TypeLink;
var $PageNo;
var $TotalPage;
var $TotalResult;
var $PageSize;
var $ChannelType;
var $TempInfos;
var $Fields;
var $PartView;
var $StartTime;
var $Keywords;
var $OrderBy;
var $SearchType;
var $KType;
var $Keyword;
var $TempletsFile;
var $result;
var $cacheid;
//-------------------------------
//php5构造函数
//-------------------------------
function __construct($typeid, $keyword, $achanneltype=0, $searchtype="title",$kwtype=0, $cacheid=0)
{
$this->TypeID = $typeid;
$this->Keyword = $keyword;
$this->OrderBy = '#@__full_search.aid desc';
$this->KType = $kwtype;
$this->PageSize = 20;
$this->ChannelType = $achanneltype;
$this->TempletsFile = '';
$this->SearchType = $searchtype;
$this->result = '';
$this->cacheid = $cacheid;
$this->dsql = new DedeSql(false);
$this->dtp = new DedeTagParse();
$this->dtp->SetNameSpace("dede","{","}");
$this->dtp2 = new DedeTagParse();
$this->dtp2->SetNameSpace("field","[","]");
$this->TypeLink = new TypeLink($typeid);
$this->Keywords = $this->GetKeywords($keyword);
//设置一些全局参数的值
foreach($GLOBALS['PubFields'] as $k=>$v) $this->Fields[$k] = $v;
if(isset($GLOBALS['PageNo'])) $this->PageNo = $GLOBALS['PageNo'];
else $this->PageNo = 1;
$this->CountRecord();
$tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$GLOBALS['cfg_df_style']."/search.htm";
if(!file_exists($tempfile)||!is_file($tempfile)){
$this->Close();
echo "模板文件不存在,无法解析!";
exit();
}
$this->dtp->LoadTemplate($tempfile);
$this->TempletsFile = ereg_replace("^".$GLOBALS['cfg_basedir'],'',$tempfile);
$this->TempInfos['tags'] = $this->dtp->CTags;
$this->TempInfos['source'] = $this->dtp->SourceString;
if($this->PageSize=="") $this->PageSize = 20;
$this->TotalPage = ceil($this->TotalResult/$this->PageSize);
if($this->PageNo==1){
$this->dsql->ExecuteNoneQuery("Update #@__search_keywords set result='".$this->TotalResult."' where keyword='".addslashes($keyword)."'; ");
}
}
//php4构造函数
//---------------------------
function SearchView($typeid,$keyword,$achanneltype=0,$searchtype="title",$kwtype=0, $cacheid=0)
{
$this->__construct($typeid,$keyword,$achanneltype,$searchtype,$kwtype, $cacheid=0);
}
//---------------------------
//关闭相关资源
//---------------------------
function Close()
{
$this->dsql->Close();
$this->TypeLink->Close();
}
//获得关键字的分词结果,并保存到数据库
//--------------------------------
function GetKeywords($keyword){
$keyword = cn_substr($keyword,50);
$row = $this->dsql->GetOne("Select spwords From #@__search_keywords where keyword='".addslashes($keyword)."'; ");
if(!is_array($row)){
if(strlen($keyword) > 16){
$sp = new SplitWord();
$keywords = $sp->SplitRMM($keyword);
$sp->Clear();
$keywords = ereg_replace("[ ]{1,}"," ",trim($keywords));
}else{
$keywords = $keyword;
}
$inquery = "INSERT INTO `#@__search_keywords`(`keyword`,`spwords`,`count`,`result`,`lasttime`)
VALUES ('".addslashes($keyword)."', '".addslashes($keywords)."', '1', '0', '".time()."');
";
$this->dsql->ExecuteNoneQuery($inquery);
}else{
$this->dsql->ExecuteNoneQuery("Update #@__search_keywords set count=count+1,lasttime='".time()."' where keyword='".addslashes($keyword)."'; ");
$keywords = $row['spwords'];
}
return $keywords;
}
//----------------
//获得关键字SQL
//----------------
function GetKeywordSql()
{
$where = $where1 = array();
if($this->TypeID > 0){
$where[] = "#@__full_search.typeid={$this->TypeID}";
}
if(!empty($this->ChannelType)){
$where[] = "#@__full_search.channelid={$this->ChannelType}";
}
$ks = explode(' ',$this->Keywords);
sort($ks);
reset ($ks);
$wherearr = array();
foreach($ks as $k)
{
$kwsqlarr = array();
$k = trim($k);
if(strlen($k) < 3){
continue;
//echo '关键词过短,搜索程序终止程序执行';
//exit;
}
$k = addslashes($k);
if($this->SearchType != "titlekeyword"){
$kwsqlarr[] = " #@__full_search.title like '%$k%' ";
}else{
$kwsqlarr[] = " #@__full_search.title like '%$k%' ";
$kwsqlarr[] = " #@__full_search.addinfos like '%$k%' ";
$kwsqlarr[] = " #@__full_search.keywords like '%$k%' ";
}
$wherearr[] = '('.implode(' OR ',$kwsqlarr).')';
}
if($this->KType==1){
$where[] = '('.implode(' AND ',$wherearr).')';
}else{
$where[] = '('.implode(' OR ',$wherearr).')';
}
$wheresql = implode(' AND ',$where);
$wheresql = 'arcrank > -1 and '.$wheresql;
return $wheresql;
}
//-------------------
//获得相关的关键字
//-------------------
function GetLikeWords($num=8){
$ks = explode(" ",$this->Keywords);
$lsql = "";
foreach($ks as $k){
$k = trim($k);
if(strlen($k)<2) continue;
if(ord($k[0])>0x80 && strlen($k)<3) continue;
$k = addslashes($k);
if($lsql=="") $lsql = $lsql." CONCAT(spwords,' ') like '%$k %' ";
else $lsql = $lsql." Or CONCAT(spwords,' ') like '%$k %' ";
}
if($lsql=="") return "";
else{
$likeword = "";
$lsql = "(".$lsql.") And Not(keyword like '".addslashes($this->Keyword)."') ";
$this->dsql->SetQuery("Select keyword,count From #@__search_keywords where $lsql order by lasttime desc limit 0,$num; ");
$this->dsql->Execute('l');
while($row=$this->dsql->GetArray('l')){
if($row['count']>1000) $fstyle=" style='font-size:11pt;color:red'";
else if($row['count']>300) $fstyle=" style='font-size:10pt;color:green'";
else $style = "";
$likeword .= ' <a href="search.php?keyword='.urlencode($row['keyword']).'"'.$style."><u>".$row['keyword']."</u></a> ";
}
return $likeword;
}
}
//----------------
//加粗关键字
//----------------
function GetRedKeyWord($fstr)
{
$ks = explode(" ",$this->Keywords);
$kwsql = "";
$words = array();
foreach($ks as $k){
$k = trim($k);
if($k=="") continue;
if(ord($k[0])>0x80 && strlen($k)<3) continue;
//$fstr = str_replace($k,"<font color='red'>$k</font>",$fstr);
$words[] = $k;
}
$fstr = highlight($fstr, $words);
return $fstr;
}
//------------------
//统计列表里的记录
//------------------
function CountRecord()
{
global $cfg_search_maxlimit, $cfg_search_cachetime;
$cfg_search_cachetime = max(1,intval($cfg_search_cachetime));
$expiredtime = time() - $cfg_search_cachetime * 3600;
if(empty($cfg_search_maxlimit)) $cfg_search_maxlimit = 500;
if(empty($this->cacheid)){
$where = $this->GetKeywordSql();
$query = "Select aid from #@__full_search where $where limit $cfg_search_maxlimit";
$md5 = md5($query);
$timestamp = time();
$cachequery = $this->dsql->getone("select * from #@__search_cache where md5='$md5' And addtime > $expiredtime limit 1");
if(is_array($cachequery))
{
$nums = $cachequery['nums'];
$result = $cachequery['result'];
$this->result = $result;
$this->TotalResult = $nums;
$this->cacheid = $cachequery['cacheid'];
}else{
$this->dsql->SetQuery($query);
$this->dsql->execute();
$aidarr = array();
$aidarr[] = 0;
while($row = $this->dsql->getarray()){
$aidarr[] = $row['aid'];
}
$nums = count($aidarr)-1;
$aids = implode(',', $aidarr);
$delete = "delete from #@__search_cache where addtime < $expiredtime;";
$this->dsql->SetQuery($delete);
$this->dsql->executenonequery();
$insert = "insert into #@__search_cache(`nums`, `md5`, `result`, `usetime`, `addtime`)
values('$nums', '$md5', '$aids','$timestamp', '$timestamp')";
$this->dsql->SetQuery($insert);
$this->dsql->executenonequery();
$this->result = $aids;
$this->TotalResult = $nums;
$this->cacheid = $this->dsql->GetLastID();
}
}else{
$cachequery = $this->dsql->getone("select * from #@__search_cache where cacheid=".$this->cacheid." limit 1");
if(is_array($cachequery)){
$nums = $cachequery['nums'];
$result = $cachequery['result'];
$this->dsql->setquery($update);
$this->dsql->executenonequery();
$this->result = $result;
$this->TotalResult = $nums;
}else
{
ShowMsg("系统出错,请与管理员联系!","javascript:;");
$this->Close();
exit();
}
}
}
//------------------
//显示列表
//------------------
function Display()
{
foreach($this->dtp->CTags as $tagid=>$ctag){
$tagname = $ctag->GetName();
if($tagname=="list"){
$limitstart = ($this->PageNo-1) * $this->PageSize;
$row = $this->PageSize;
if(trim($ctag->GetInnerText())==""){ $InnerText = GetSysTemplets("list_fulllist.htm"); }
else{ $InnerText = trim($ctag->GetInnerText()); }
$this->dtp->Assign($tagid,
$this->GetArcList($limitstart,
$row,
$ctag->GetAtt("col"),
$ctag->GetAtt("titlelen"),
$ctag->GetAtt("infolen"),
$ctag->GetAtt("imgwidth"),
$ctag->GetAtt("imgheight"),
$this->ChannelType,
$this->OrderBy,
$InnerText,
$ctag->GetAtt("tablewidth"))
);
}
else if($tagname=="pagelist"){
$list_len = trim($ctag->GetAtt("listsize"));
if($list_len=="") $list_len = 3;
$this->dtp->Assign($tagid,$this->GetPageListDM($list_len));
}
else if($tagname=="likewords"){
$this->dtp->Assign($tagid,$this->GetLikeWords($ctag->GetAtt('num')));
}
else if($tagname=="hotwords"){
$this->dtp->Assign($tagid,
GetHotKeywords($this->dsql,$ctag->GetAtt('num'),$ctag->GetAtt('subday'),$ctag->GetAtt('maxlength')));
}
else if($tagname=="field") //类别的指定字段
{
if(isset($this->Fields[$ctag->GetAtt('name')]))
$this->dtp->Assign($tagid,$this->Fields[$ctag->GetAtt('name')]);
else
$this->dtp->Assign($tagid,"");
}
else if($tagname=="channel")//下级频道列表
{
if($this->TypeID>0){
$typeid = $this->TypeID; $reid = $this->TypeLink->TypeInfos['reID'];
}
else{ $typeid = 0; $reid=0; }
$this->dtp->Assign($tagid,
$this->TypeLink->GetChannelList($typeid,
$reid,
$ctag->GetAtt("row"),
$ctag->GetAtt("type"),
$ctag->GetInnerText()
)
);
}//End if
}
$this->Close();
$this->dtp->Display();
}
//----------------------------------
//获得文档列表
//---------------------------------
function GetArcList($limitstart=0,$perpage=10,$col=1,$titlelen=30,$infolen=250,
$imgwidth=120,$imgheight=90,$achanneltype="all",$orderby=" aid desc ",$innertext="",$tablewidth="100")
{
$typeid=$this->TypeID;
if($perpage=="") $perpage = 10;
if($limitstart=="") $limitstart = 0;
if($titlelen=="") $titlelen = 30;
if($infolen=="") $infolen = 250;
if($achanneltype=="") $achanneltype = "0";
$innertext = trim($innertext);
if($innertext=="") $innertext = GetSysTemplets("search_list.htm");
$ordersql = "order by ".$this->OrderBy;
$query = "select * from #@__full_search left join #@__arctype on #@__arctype.ID=#@__full_search.typeid
where aid in ($this->result) $ordersql limit $limitstart,$perpage ";
$this->dsql->SetQuery($query);
$this->dsql->Execute("al");
$artlist = "";
$this->dtp2->LoadSource($innertext);
$tt = 0;
for($i=0;$i<$perpage;$i++)
{
if($row = $this->dsql->GetArray("al"))
{
//处理一些特殊字段
$row["arcurl"] = $row["url"];
$row["description"] = $this->GetRedKeyWord(cn_substr($row["addinfos"],$infolen));
$row["title"] = $this->GetRedKeyWord(cn_substr($row["title"],$titlelen));
$row["id"] = $row["aid"];
if($row["litpic"]=="") $row["litpic"] = $GLOBALS["cfg_plus_dir"]."/img/dfpic.gif";
$row["picname"] = $row["litpic"];
$row["typeurl"] = $this->GetListUrl($row["typeid"],$row["typedir"],$row["isdefault"],$row["defaultname"],$row["ispart"],$row["namerule2"],$row["siteurl"]);
$row["info"] = $row["description"];
$row["filename"] = $row["arcurl"];
$row["stime"] = GetDateMK($row["uptime"]);
$row["textlink"] = "<a href='".$row["filename"]."'>".$row["title"]."</a>";
$row["typelink"] = "[<a href='".$row["typeurl"]."'>".$row["typename"]."</a>]";
$row["imglink"] = "<a href='".$row["filename"]."'><img src='".$row["picname"]."' border='0' width='$imgwidth' height='$imgheight'></a>";
$row["image"] = "<img src='".$row["picname"]."' border='0' width='$imgwidth' height='$imgheight'>";
$row["phpurl"] = $GLOBALS["cfg_plus_dir"];
$row["templeturl"] = $GLOBALS["cfg_templets_dir"];
$row["memberurl"] = $GLOBALS["cfg_member_dir"];
//---------------------------
if(is_array($this->dtp2->CTags)){
foreach($this->dtp2->CTags as $k=>$ctag){
if(isset($row[$ctag->GetName()])) $this->dtp2->Assign($k,$row[$ctag->GetName()]);
else $this->dtp2->Assign($k,"");
}
}
$artlist .= $this->dtp2->GetResult();
$tt = 1;
}//if hasRow
else{
if($tt == 0 && $this->KType == 1){
$sp1 = new SearchView($this->TypeID,$this->Keyword,$this->ChannelType,$this->SearchType,0,$this->cacheid);
$sp1->Display();
$sp1->Close();
exit;
}else{
$artlist .= '';
}
}
}//Loop Line
$this->dsql->FreeResult("al");
return $artlist;
}
//---------------------------------
//获取动态的分页列表
//---------------------------------
function GetPageListDM($list_len)
{
global $id;
$prepage="";
$nextpage="";
$prepagenum = $this->PageNo-1;
$nextpagenum = $this->PageNo+1;
if($list_len==""||ereg("[^0-9]",$list_len)) $list_len=3;
$totalpage = ceil($this->TotalResult/$this->PageSize);
if($totalpage<=1 && $this->TotalResult>0) return "共1页/".$this->TotalResult."条";
if($this->TotalResult == 0) return "共0页/".$this->TotalResult."条";
$purl = $this->GetCurUrl();
$geturl = "keyword=".urlencode($this->Keyword)."&searchtype=".$this->SearchType;
$geturl .= "&channeltype=".$this->ChannelType;
$geturl .= "&kwtype=".$this->KType."&pagesize=".$this->PageSize;
$geturl .= "&typeid=".$this->TypeID."&cacheid=".$this->cacheid."&";
$hidenform = "<input type='hidden' name='typeid' value='".$this->TypeID."'>\r\n";
$hidenform .= "<input type='hidden' name='TotalResult' value='".$this->TotalResult."'>\r\n";
$purl .= "?".$geturl;
//获得上一页和下一页的链接
if($this->PageNo != 1){
$prepage.="<a href='".$purl."PageNo=$prepagenum'>上一页</a>\r\n";
$indexpage="<a href='".$purl."PageNo=1'>首页</a>\r\n";
}
else{
$indexpage="<a>首页</a>\r\n";
}
if($this->PageNo!=$totalpage && $totalpage>1){
$nextpage.="<a href='".$purl."PageNo=$nextpagenum'>下一页</a>\r\n";
$endpage="<a href='".$purl."PageNo=$totalpage'>末页</a>\r\n";
}
else{
$endpage="<a>末页</a>\r\n";
}
//获得数字链接
$listdd="";
$total_list = $list_len * 2 + 1;
if($this->PageNo >= $total_list) {
$j = $this->PageNo-$list_len;
$total_list = $this->PageNo+$list_len;
if($total_list>$totalpage) $total_list=$totalpage;
}
else{
$j=1;
if($total_list>$totalpage) $total_list=$totalpage;
}
for($j;$j<=$total_list;$j++)
{
if($j==$this->PageNo) $listdd.= "<strong>$j</strong>\r\n";
else $listdd.="<a href='".$purl."PageNo=$j'>".$j."</a>\r\n";
}
$plist = "";
$plist .= "<form name='pagelist' action='".$this->GetCurUrl()."'>$hidenform";
$plist .= $indexpage;
$plist .= $prepage;
$plist .= $listdd;
$plist .= $nextpage;
$plist .= $endpage;
if($totalpage>$total_list){
$plist.="<input type='text' name='PageNo' style='width:30px;height:18px' value='".$this->PageNo."'>\r\n";
$plist.="<input type='submit' name='plistgo' value='GO' style='width:24px;height:18px;font-size:9pt'>\r\n";
}
$plist .= "</form>\r\n";
return $plist;
}
//--------------------------
//获得一个指定的频道的链接
//--------------------------
function GetListUrl($typeid,$typedir,$isdefault,$defaultname,$ispart,$namerule2)
{
return GetTypeUrl($typeid,MfTypedir($typedir),$isdefault,$defaultname,$ispart,$namerule2);
}
//---------------
//获得当前的页面文件的url
//----------------
function GetCurUrl()
{
if(!empty($_SERVER["REQUEST_URI"])){
$nowurl = $_SERVER["REQUEST_URI"];
$nowurls = explode("?",$nowurl);
$nowurl = $nowurls[0];
}
else
{ $nowurl = $_SERVER["PHP_SELF"]; }
return $nowurl;
}
}//End Class
?> | zyyhong | trunk/jiaju001/news/include/inc_arcsearch_view.php | PHP | asf20 | 18,011 |
<?php
if(!defined('DEDEINC'))
{
exit("Request Error!");
}
require_once(dirname(__FILE__)."/inc_channel_unit_functions.php");
//-------------------------------------
//class TypeLink
//获得文章的位置和文章的类目位置等
//凡以Logic开头的成员,一般在内调用,不在外调用(相当于保护级成员)
//-------------------------------------
class TypeLink
{
var $typeDir;
var $dsql;
var $TypeID;
var $baseDir;
var $modDir;
var $indexUrl;
var $indexName;
var $TypeInfos;
var $SplitSymbol;
var $valuePosition;
var $valuePositionName;
var $OptionArrayList;
//构造函数///////
//-------------
//php5构造函数
//-------------
function __construct($typeid)
{
$this->indexUrl = $GLOBALS['cfg_basehost'].$GLOBALS['cfg_indexurl'];
$this->indexName = $GLOBALS['cfg_indexname'];
$this->baseDir = $GLOBALS['cfg_basedir'];
$this->modDir = $GLOBALS['cfg_templets_dir'];
$this->SplitSymbol = $GLOBALS['cfg_list_symbol'];
$this->dsql = new DedeSql(false);
$this->TypeID = $typeid;
$this->valuePosition = "";
$this->valuePositionName = "";
$this->typeDir = "";
$this->OptionArrayList = "";
//载入类目信息
$query = "
Select #@__arctype.*,#@__channeltype.typename as ctypename
From #@__arctype left join #@__channeltype
on #@__channeltype.ID=#@__arctype.channeltype
where #@__arctype.ID='$typeid'
";
if($typeid > 0){
$this->TypeInfos = $this->dsql->GetOne($query,MYSQL_ASSOC);
//模板和路径变量处理
if($this->TypeInfos['ispart']<=2) $this->TypeInfos['typedir'] = MfTypedir($this->TypeInfos['typedir']);
$this->TypeInfos['tempindex'] = MfTemplet($this->TypeInfos['tempindex']);
$this->TypeInfos['templist'] = MfTemplet($this->TypeInfos['templist']);
$this->TypeInfos['temparticle'] = MfTemplet($this->TypeInfos['temparticle']);
$this->TypeInfos['tempone'] = MfTemplet($this->TypeInfos['tempone']);
}
}
//对于使用默认构造函数的情况
//GetPositionLink()将不可用
function TypeLink($typeid){
$this->__construct($typeid);
}
//关闭数据库连接,析放资源
//-----------------------
function Close(){
$this->dsql->Close();
}
//------------------------
//重设类目ID
//------------------------
function SetTypeID($typeid){
$this->TypeID = $typeid;
$this->valuePosition = "";
$this->valuePositionName = "";
$this->typeDir = "";
$this->OptionArrayList = "";
//载入类目信息
$query = "
Select #@__arctype.*,#@__channeltype.typename as ctypename
From #@__arctype left join #@__channeltype
on #@__channeltype.ID=#@__arctype.channeltype where #@__arctype.ID='$typeid' ";
$this->dsql->SetQuery($query);
$this->TypeInfos = $this->dsql->GetOne();
}
//-----------------------
//获得这个类目的路径
//-----------------------
function GetTypeDir(){
if(empty($this->TypeInfos['typedir'])) return $GLOBALS['cfg_cmspath'].$GLOBALS['cfg_arcdir'];
else return $this->TypeInfos['typedir'];
}
//-----------------------------
//获得文章网址
//----------------------------
function GetFileUrl($aid,$typeid,$timetag,$title,$ismake=0,$rank=0,$namerule="",$artdir="",$money=0,$siterefer="",$sitepath=""){
$articleRule = "";
$articleDir = "";
if($namerule!="") $articleRule = $namerule;
else if(is_array($this->TypeInfos)) $articleRule = $this->TypeInfos['namerule'];
if($artdir!="") $articleDir = $artdir;
else if(is_array($this->TypeInfos)) $articleDir = $this->GetTypeDir();
return GetFileUrl($aid,$typeid,$timetag,$title,$ismake,$rank,$articleRule,$articleDir,$money,$siterefer,$sitepath);
}
//获得新文件网址
//本函数会自动创建目录
function GetFileNewName($aid,$typeid,$timetag,$title,$ismake=0,$rank=0,$namerule="",$artdir="",$money=0,$siterefer="",$sitepath=""){
$articleRule = "";
$articleDir = "";
if($namerule!="") $articleRule = $namerule;
else if(is_array($this->TypeInfos)) $articleRule = $this->TypeInfos['namerule'];
if($artdir!="") $articleDir = $artdir;
else if(is_array($this->TypeInfos)) $articleDir = $this->GetTypeDir();
return GetFileNewName($aid,$typeid,$timetag,$title,$ismake,$rank,$articleRule,$articleDir,$money,$siterefer,$sitepath);
}
//----------------------------------------------
//获得某类目的链接列表 如:类目一>>类目二>> 这样的形式
//islink 表示返回的列表是否带连接
//----------------------------------------------
function GetPositionLink($islink=true)
{
$indexpage = "<a href='".$this->indexUrl."'>".$this->indexName."</a>";
if($this->valuePosition!="" && $islink){
return $this->valuePosition;
}
else if($this->valuePositionName!="" && !$islink){
return $this->valuePositionName;
}
else if($this->TypeID==0){
if($islink) return $indexpage;
else return "没指定分类!";
}
else
{
if($islink)
{
$this->valuePosition = $this->GetOneTypeLink($this->TypeInfos);
if($this->TypeInfos['reID']!=0){ //调用递归逻辑
$this->LogicGetPosition($this->TypeInfos['reID'],true);
}
$this->valuePosition = $indexpage.$this->SplitSymbol.$this->valuePosition;
return $this->valuePosition.$this->SplitSymbol;
}else{
$this->valuePositionName = $this->TypeInfos['typename'];
if($this->TypeInfos['reID']!=0){ //调用递归逻辑
$this->LogicGetPosition($this->TypeInfos['reID'],false);
}
return $this->valuePositionName;
}
}
}
//获得名字列表
function GetPositionName(){
return $this->GetPositionLink(false);
}
//获得某类目的链接列表,递归逻辑部分
function LogicGetPosition($ID,$islink)
{
$this->dsql->SetQuery("Select ID,reID,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl From #@__arctype where ID='".$ID."'");
$tinfos = $this->dsql->GetOne();
if($islink) $this->valuePosition = $this->GetOneTypeLink($tinfos).$this->SplitSymbol.$this->valuePosition;
else $this->valuePositionName = $tinfos['typename'].$this->SplitSymbol.$this->valuePositionName;
if($tinfos['reID']>0) $this->LogicGetPosition($tinfos['reID'],$islink);
else return 0;
}
//获得某个类目的超链接信息
//-----------------------
function GetOneTypeLink($typeinfos){
$typepage = $this->GetOneTypeUrl($typeinfos);
$typelink = "<a href='".$typepage."'>".$typeinfos['typename']."</a>";
return $typelink;
}
//获得某分类连接的URL
//---------------------
function GetOneTypeUrl($typeinfos){
return GetTypeUrl($typeinfos['ID'],MfTypedir($typeinfos['typedir']),$typeinfos['isdefault'],
$typeinfos['defaultname'],$typeinfos['ispart'],$typeinfos['namerule2'],$typeinfos['siteurl']);
}
//获得某ID的下级ID(包括本身)的SQL语句“($tb.typeid=id1 or $tb.typeid=id2...)”
//-------------------------------------------
function GetSunID($typeid=-1,$tb="#@__archives",$channel=0,$idlist=false){
$ids = TypeGetSunID($typeid,$this->dsql,$tb,$channel,$idlist);
return $ids;
}
//------------------------------
//获得类别列表
//hid 是指默认选中类目,0 表示“请选择类目”或“不限类目”
//oper 是用户允许管理的类目,0 表示所有类目
//channeltype 是指类目的内容类型,0 表示不限频道
//--------------------------------
function GetOptionArray($hid=0,$oper=0,$channeltype=0,$usersg=0){
return $this->GetOptionList($hid,$oper,$channeltype,$usersg);
}
function GetOptionList($hid=0,$oper=0,$channeltype=0,$usersg=0)
{
if(!$this->dsql) $this->dsql = new DedeSql();
$this->OptionArrayList = "";
if($hid>0){
$row = $this->dsql->GetOne("Select ID,typename,ispart From #@__arctype where ID='$hid'");
if($row['ispart']==1) $this->OptionArrayList .= "<option value='".$row['ID']."' style='background-color:#DFDFDB;color:#888888' selected>".$row['typename']."</option>\r\n";
else $this->OptionArrayList .= "<option value='".$row['ID']."' selected>".$row['typename']."</option>\r\n";
}
if($channeltype==0) $ctsql="";
else $ctsql=" And channeltype='$channeltype' ";
if($oper!=0){ $query = "Select ID,typename,ispart From #@__arctype where ispart<2 And ID='$oper' $ctsql"; }
else{ $query = "Select ID,typename,ispart From #@__arctype where ispart<2 And reID=0 $ctsql order by sortrank asc"; }
$this->dsql->SetQuery($query);
$this->dsql->Execute();
while($row=$this->dsql->GetObject()){
if($row->ID!=$hid){
if($row->ispart==1) $this->OptionArrayList .= "<option value='".$row->ID."' style='background-color:#EFEFEF;color:#666666'>".$row->typename."</option>\r\n";
else $this->OptionArrayList .= "<option value='".$row->ID."'>".$row->typename."</option>\r\n";
}
$this->LogicGetOptionArray($row->ID,"─");
}
return $this->OptionArrayList;
}
function LogicGetOptionArray($ID,$step){
$this->dsql->SetQuery("Select ID,typename,ispart From #@__arctype where reID='".$ID."' And ispart<2 order by sortrank asc");
$this->dsql->Execute($ID);
while($row=$this->dsql->GetObject($ID)){
if($row->ispart==1) $this->OptionArrayList .= "<option value='".$row->ID."' style='background-color:#EFEFEF;color:#666666'>$step".$row->typename."</option>\r\n";
else $this->OptionArrayList .= "<option value='".$row->ID."'>$step".$row->typename."</option>\r\n";
$this->LogicGetOptionArray($row->ID,$step."─");
}
}
//----------------------------
//获得与该类相关的类目,本函数应用于模板标记{dede:channel}{/dede:channel}中
//$typetype 的值为: sun 下级分类 self 同级分类 top 顶级分类
//-----------------------------
function GetChannelList($typeid=0,$reID=0,$row=8,$typetype='sun',$innertext='',
$col=1,$tablewidth=100,$myinnertext='')
{
if($typeid==0) $typeid = $this->TypeID;
if($row=="") $row = 8;
if($reID=="") $reID = 0;
if($col=="") $col = 1;
$tablewidth = str_replace("%","",$tablewidth);
if($tablewidth=="") $tablewidth=100;
if($col=="") $col = 1;
$colWidth = ceil(100/$col);
$tablewidth = $tablewidth."%";
$colWidth = $colWidth."%";
if($typetype=="") $typetype="sun";
if($innertext=="") $innertext = GetSysTemplets("channel_list.htm");
if($reID==0 && $typeid>0){
$dbrow = $this->dsql->GetOne("Select reID From #@__arctype where ID='$typeid' ");
if(is_array($dbrow)) $reID = $dbrow['reID'];
}
$likeType = "";
if($typetype=="top"){
$sql = "Select ID,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl
From #@__arctype where reID=0 And ishidden<>1 order by sortrank asc limit 0,$row";
}
else if($typetype=="sun"||$typetype=="son"){
$sql = "Select ID,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl
From #@__arctype where reID='$typeid' And ishidden<>1 order by sortrank asc limit 0,$row";
}
else if($typetype=="self"){
$sql = "Select ID,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl
From #@__arctype where reID='$reID' And ishidden<>1 order by sortrank asc limit 0,$row";
}
//And ID<>'$typeid'
$dtp2 = new DedeTagParse();
$dtp2->SetNameSpace("field","[","]");
$dtp2->LoadSource($innertext);
$this->dsql->SetQuery($sql);
$this->dsql->Execute();
$line = $row;
$GLOBALS['autoindex'] = 0;
if($col>1) $likeType = "<table width='$tablewidth' border='0' cellspacing='0' cellpadding='0'>\r\n";
for($i=0;$i<$line;$i++)
{
if($col>1) $likeType .= "<tr>\r\n";
for($j=0;$j<$col;$j++)
{
if($col>1) $likeType .= " <td width='$colWidth'>\r\n";
if($row=$this->dsql->GetArray())
{
$row['id'] = $row['ID'];
//处理当前栏目的样式
if($row['ID']=="$typeid" && $myinnertext != ''){
$linkOkstr = $myinnertext;
$row['typelink'] = $this->GetOneTypeUrl($row);
$linkOkstr = str_replace("~typelink~",$row['typelink'],$linkOkstr);
$linkOkstr = str_replace("~typename~",$row['typename'],$linkOkstr);
$likeType .= $linkOkstr;
}else{//非当前栏目
$row['typelink'] = $this->GetOneTypeUrl($row);
if(is_array($dtp2->CTags)){
foreach($dtp2->CTags as $tagid=>$ctag)
{ if(isset($row[$ctag->GetName()])) $dtp2->Assign($tagid,$row[$ctag->GetName()]); }
}
$likeType .= $dtp2->GetResult();
}
}
if($col>1) $likeType .= " </td>\r\n";
$GLOBALS['autoindex']++;
}//Loop Col
if($col>1) $i += $col - 1;
if($col>1) $likeType .= " </tr>\r\n";
}//Loop for $i
if($col>1) $likeType .= " </table>\r\n";
$this->dsql->FreeResult();
return $likeType;
}//GetChannel
}//End Class
?> | zyyhong | trunk/jiaju001/news/include/inc_typelink.php | PHP | asf20 | 13,031 |
<?php
if(!empty($_GET['gurl'])){
echo "<script>location=\"{$_GET['gurl']}\";</script>";
}
?> | zyyhong | trunk/jiaju001/news/include/jump.php | PHP | asf20 | 98 |
<?php
//本文件用于扩展采集结果
//下载居于http 1.1协议的防盗链图片
//------------------------------------
function DownImageKeep($gurl,$rfurl,$filename,$gcookie="",$JumpCount=0,$maxtime=30){
$urlinfos = GetHostInfo($gurl);
$ghost = trim($urlinfos['host']);
if($ghost=='') return false;
$gquery = $urlinfos['query'];
if($gcookie=="" && !empty($rfurl)) $gcookie = RefurlCookie($rfurl);
$sessionQuery = "GET $gquery HTTP/1.1\r\n";
$sessionQuery .= "Host: $ghost\r\n";
$sessionQuery .= "Referer: $rfurl\r\n";
$sessionQuery .= "Accept: */*\r\n";
$sessionQuery .= "User-Agent: Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)\r\n";
if($gcookie!=""&&!ereg("[\r\n]",$gcookie)) $sessionQuery .= $gcookie."\r\n";
$sessionQuery .= "Connection: Keep-Alive\r\n\r\n";
$errno = "";
$errstr = "";
$m_fp = fsockopen($ghost, 80, $errno, $errstr,10);
fwrite($m_fp,$sessionQuery);
$lnum = 0;
//获取详细应答头
$m_httphead = Array();
$httpstas = explode(" ",fgets($m_fp,256));
$m_httphead["http-edition"] = trim($httpstas[0]);
$m_httphead["http-state"] = trim($httpstas[1]);
while(!feof($m_fp)){
$line = trim(fgets($m_fp,256));
if($line == "" || $lnum>100) break;
$hkey = "";
$hvalue = "";
$v = 0;
for($i=0;$i<strlen($line);$i++){
if($v==1) $hvalue .= $line[$i];
if($line[$i]==":") $v = 1;
if($v==0) $hkey .= $line[$i];
}
$hkey = trim($hkey);
if($hkey!="") $m_httphead[strtolower($hkey)] = trim($hvalue);
}
//分析返回记录
if(ereg("^3",$m_httphead["http-state"])){
if(isset($m_httphead["location"]) && $JumpCount<3){
$JumpCount++;
DownImageKeep($gurl,$rfurl,$filename,$gcookie,$JumpCount);
}
else{ return false; }
}
if(!ereg("^2",$m_httphead["http-state"])){
return false;
}
if(!isset($m_httphead)) return false;
$contentLength = $m_httphead['content-length'];
//保存文件
$fp = fopen($filename,"w") or die("写入文件:{$filename} 失败!");
$i=0;
$okdata = "";
$starttime = time();
while(!feof($m_fp)){
$okdata .= fgetc($m_fp);
$i++;
//超时结束
if(time()-$starttime>$maxtime) break;
//到达指定大小结束
if($i >= $contentLength) break;
}
if($okdata!="") fwrite($fp,$okdata);
fclose($fp);
if($okdata==""){
@unlink($filename);
fclose($m_fp);
return false;
}
fclose($m_fp);
return true;
}
//获得某页面返回的Cookie信息
//----------------------------
function RefurlCookie($gurl){
global $gcookie,$lastRfurl;
$gurl = trim($gurl);
if(!empty($gcookie) && $lastRfurl==$gurl) return $gcookie;
else $lastRfurl=$gurl;
if(trim($gurl)=='') return '';
$urlinfos = GetHostInfo($gurl);
$ghost = $urlinfos['host'];
$gquery = $urlinfos['query'];
$sessionQuery = "GET $gquery HTTP/1.1\r\n";
$sessionQuery .= "Host: $ghost\r\n";
$sessionQuery .= "Accept: */*\r\n";
$sessionQuery .= "User-Agent: Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)\r\n";
$sessionQuery .= "Connection: Close\r\n\r\n";
$errno = "";
$errstr = "";
$m_fp = fsockopen($ghost, 80, $errno, $errstr,10) or die($ghost.'<br />');
fwrite($m_fp,$sessionQuery);
$lnum = 0;
//获取详细应答头
$gcookie = "";
while(!feof($m_fp)){
$line = trim(fgets($m_fp,256));
if($line == "" || $lnum>100) break;
else{
if(eregi("^cookie",$line)){
$gcookie = $line;
break;
}
}
}
fclose($m_fp);
return $gcookie;
}
//获得网址的host和query部份
//-------------------------------------
function GetHostInfo($gurl){
$gurl = eregi_replace("^http://","",trim($gurl));
$garr['host'] = eregi_replace("/(.*)$","",$gurl);
$garr['query'] = "/".eregi_replace("^([^/]*)/","",$gurl);
return $garr;
}
//HTML里的图片转DEDE格式
//-----------------------------------
function TurnImageTag(&$body){
global $cfg_album_width,$cfg_ddimg_width;
if(empty($cfg_album_width)) $cfg_album_width = 800;
if(empty($cfg_ddimg_width)) $cfg_ddimg_width = 150;
preg_match_all('/src=[\'"](.+?)[\'"]/is',$body,$match);
$ttx = '';
if(is_array($match[1]) && count($match[1])>0){
for($i=0;isset($match[1][$i]);$i++){
$ttx .= "{dede:img text='' }".$match[1][$i]." {/dede:img}"."\r\n";
}
}
$ttx = "{dede:pagestyle maxwidth='{$cfg_album_width}' ddmaxwidth='{$cfg_ddimg_width}' row='3' col='3' value='2'/}\r\n".$ttx;
return $ttx;
}
//HTML里的网址格式转换
//-----------------------------------
function TurnLinkTag(&$body){
$ttx = '';
$handid = '服务器';
preg_match_all("/<a href=['\"](.+?)['\"]([^>]+?)>(.+?)<\/a>/is",$body,$match);
if(is_array($match[1]) && count($match[1])>0)
{
for($i=0;isset($match[1][$i]);$i++)
{
$servername = (isset($match[3][$i]) ? str_replace("'","`",$match[3][$i]) : $handid.($i+1));
if(ereg("[<>]",$servername) || strlen($servername)>40) $servername = $handid.($i+1);
$ttx .= "{dede:link text='$servername'} {$match[1][$i]} {/dede:link}\r\n";
}
}
return $ttx;
}
?> | zyyhong | trunk/jiaju001/news/include/pub_collection_functions.php | PHP | asf20 | 5,197 |
<?php
//检测用户系统支持的图片格式
$cfg_photo_type['gif'] = false;
$cfg_photo_type['jpeg'] = false;
$cfg_photo_type['png'] = false;
$cfg_photo_type['wbmp'] = false;
$cfg_photo_typenames = Array();
$cfg_photo_support = "";
if(function_exists("imagecreatefromgif") && function_exists("imagegif")){
$cfg_photo_type["gif"] = true;
$cfg_photo_typenames[] = "image/gif";
$cfg_photo_support .= "GIF ";
}
if(function_exists("imagecreatefromjpeg") && function_exists("imagejpeg")){
$cfg_photo_type["jpeg"] = true;
$cfg_photo_typenames[] = "image/pjpeg";
$cfg_photo_typenames[] = "image/jpeg";
$cfg_photo_support .= "JPEG ";
}
if(function_exists("imagecreatefrompng") && function_exists("imagepng")){
$cfg_photo_type["png"] = true;
$cfg_photo_typenames[] = "image/png";
$cfg_photo_typenames[] = "image/x-png";
$cfg_photo_support .= "PNG ";
}
if(function_exists("imagecreatefromwbmp") && function_exists("imagewbmp")){
$cfg_photo_type["wbmp"] = true;
$cfg_photo_typenames[] = "image/wbmp";
$cfg_photo_support .= "WBMP ";
}
//--------------------------------
//缩图片自动生成函数,来源支持bmp、gif、jpg、png
//但生成的小图只用jpg或png格式
//--------------------------------
function ImageResize($srcFile,$toW,$toH,$toFile="")
{
global $cfg_photo_type,$cfg_jpeg_query;
if(empty($cfg_jpeg_query)) $cfg_jpeg_query = 85;
if($toFile==""){ $toFile = $srcFile; }
$info = "";
$srcInfo = GetImageSize($srcFile,$info);
switch ($srcInfo[2])
{
case 1:
if(!$cfg_photo_type['gif']) return false;
$im = imagecreatefromgif($srcFile);
break;
case 2:
if(!$cfg_photo_type['jpeg']) return false;
$im = imagecreatefromjpeg($srcFile);
break;
case 3:
if(!$cfg_photo_type['png']) return false;
$im = imagecreatefrompng($srcFile);
break;
case 6:
if(!$cfg_photo_type['bmp']) return false;
$im = imagecreatefromwbmp($srcFile);
break;
}
$srcW=ImageSX($im);
$srcH=ImageSY($im);
$toWH=$toW/$toH;
$srcWH=$srcW/$srcH;
if($toWH<=$srcWH){
$ftoW=$toW;
$ftoH=$ftoW*($srcH/$srcW);
}
else{
$ftoH=$toH;
$ftoW=$ftoH*($srcW/$srcH);
}
if($srcW>$toW||$srcH>$toH)
{
if(function_exists("imagecreatetruecolor")){
$ni = imagecreatetruecolor($ftoW,$ftoH);
if($ni) imagecopyresampled($ni,$im,0,0,0,0,$ftoW,$ftoH,$srcW,$srcH);
else{
$ni=imagecreate($ftoW,$ftoH);
imagecopyresized($ni,$im,0,0,0,0,$ftoW,$ftoH,$srcW,$srcH);
}
}else{
$ni=imagecreate($ftoW,$ftoH);
imagecopyresized($ni,$im,0,0,0,0,$ftoW,$ftoH,$srcW,$srcH);
}
switch ($srcInfo[2])
{
case 1:
imagegif($ni,$toFile);
break;
case 2:
imagejpeg($ni,$toFile,$cfg_jpeg_query);
break;
case 3:
imagepng($ni,$toFile);
break;
case 6:
imagebmp($ni,$toFile);
break;
default:
return false;
}
imagedestroy($ni);
}else{
copy($srcFile,$toFile);
}
imagedestroy($im);
return true;
}
//--------------------------------
//获得GD的版本
//--------------------------------
function gdversion()
{
static $gd_version_number = null;
if ($gd_version_number === null)
{
ob_start();
phpinfo(8);
$module_info = ob_get_contents();
ob_end_clean();
if(preg_match("/\bgd\s+version\b[^\d\n\r]+?([\d\.]+)/i", $module_info,$matches))
{ $gdversion_h = $matches[1]; }
else
{ $gdversion_h = 0; }
}
return $gdversion_h;
}
//-------------------------------------
//图片自动加水印函数
//-------------------------------------
function WaterImg($srcFile,$fromGo='up')
{
include(dirname(__FILE__)."/inc_photowatermark_config.php");
if($photo_markup!='1') return;
$info = "";
$srcInfo = GetImageSize($srcFile,$info);
$srcFile_w = $srcInfo[0];
$srcFile_h = $srcInfo[1];
if($srcFile_w < $photo_wwidth || $srcFile_h < $photo_wheight) return;
if($fromGo=='up' && $photo_markup=='0') return;
if($fromGo=='down' && $photo_markdown=='0') return;
$trueMarkimg = dirname(__FILE__).'/data/'.$photo_markimg;
if(!file_exists($trueMarkimg) || empty($photo_markimg)) $trueMarkimg = "";
ImgWaterMark($srcFile,$photo_waterpos,$trueMarkimg,$photo_watertext,$photo_fontsize,$photo_fontcolor,$photo_diaphaneity);
}
//图片自动加水印函数原始函数
//------------------------------------------------
function ImgWaterMark($srcFile,$w_pos=0,$w_img="",$w_text="",$w_font=5,$w_color="#FF0000",$w_pct)
{
$font_type = dirname(__FILE__).'/data/ant1.ttf';
if(empty($srcFile) || !file_exists($srcFile)) return ;
$info = '';
$srcInfo = getimagesize($srcFile,$info);
$srcFile_w = $srcInfo[0];
$srcFile_h = $srcInfo[1];
switch($srcInfo[2]){
case 1 :
if(!function_exists("imagecreatefromgif")) return;
$srcFile_img = imagecreatefromgif($srcFile);
break;
case 2 :
if(!function_exists("imagecreatefromjpeg")) return;
$srcFile_img = imagecreatefromjpeg($srcFile);
break;
case 3 :
if(!function_exists("imagecreatefrompng")) return;
$srcFile_img = imagecreatefrompng($srcFile);
break;
case 6:
if(!function_exists("imagewbmp")) return;
$srcFile_img = imagecreatefromwbmp($srcFile);
break;
default :
return;
}
//读取水印图片
if(!empty($w_img) && file_exists($w_img)){
$ifWaterImage = 1;
$info = '';
$water_info = getimagesize($w_img,$info);
$width = $water_info[0];
$height = $water_info[1];
switch($water_info[2]){
case 1 :
if(!function_exists("imagecreatefromgif")) return;
$water_img = imagecreatefromgif($w_img);
break;
case 2 :
if(!function_exists("imagecreatefromjpeg")) return;
$water_img = imagecreatefromjpeg($w_img);
break;
case 3 :
if(!function_exists("imagecreatefrompng")) return;
$water_img = imagecreatefrompng($w_img);
break;
case 6 :
if(!function_exists("imagecreatefromwbmp")) return;
$srcFile_img = imagecreatefromwbmp($w_img);
break;
default :
return;
}
}else{
$ifWaterImage = 0;
$ifttf = 1;
@$temp = imagettfbbox($w_font,0,$font_type,$w_text);
$width = $temp[2] - $temp[6];
$height = $temp[3] - $temp[7];
unset($temp);
if(empty($width)&&empty($height)){
$width = strlen($w_text) * 10;
$height = 20;
$ifttf = 0;
}
}
//水印位置
if($w_pos==0){ //随机位置
$wX = rand(0,($srcFile_w - $width));
$wY = rand(0,($srcFile_h - $height));
}else if($w_pos==1){ //左上角
$wX = 5;
if($ifttf==1) $wY = $height + 5;
else $wY = 5;
}else if($w_pos==2){ //左中
$wX = 5;
$wY = ($srcFile_h - $height) / 2;
}else if($w_pos==3){ //左下
$wX = 5;
$wY = $srcFile_h - $height - 5;
}else if($w_pos==4){ //上中
$wX = ($srcFile_w - $width) / 2;
if($ifttf==1) $wY = $height + 5;
else $wY = 5;
}else if($w_pos==5){ //正中
$wX = ($srcFile_w - $width) / 2;
$wY = ($srcFile_h - $height) / 2;
}else if($w_pos==6){ //下中
$wX = ($srcFile_w - $width) / 2;
$wY = $srcFile_h - $height - 5;
}else if($w_pos==7){ //右上
$wX = $srcFile_w - $width - 5;
if($ifttf==1) $wY = $height + 5;
else $wY = 5;
}else if($w_pos==8){ //右中
$wX = $srcFile_w - $width - 5;
$wY = ($srcFile_h - $height) / 2;
}else if($w_pos==9){ //右下
$wX = $srcFile_w - $width - 5;
$wY = $srcFile_h - $height - 5;
}else{ //中
$wX = ($srcFile_w - $width) / 2;
$wY = ($srcFile_h - $height) / 2;
}
//写入水印
imagealphablending($srcFile_img, true);
if($ifWaterImage){
imagecopymerge($srcFile_img, $water_img, $wX, $wY, 0, 0, $width,$height,$w_pct);
}else{
if(!empty($w_color) && (strlen($w_color)==7)){
$R = hexdec(substr($w_color,1,2));
$G = hexdec(substr($w_color,3,2));
$B = hexdec(substr($w_color,5));
}else{
return;
}
if($ifttf==1) imagettftext($srcFile_img, $w_font, 0, $wX, $wY, imagecolorallocate($srcFile_img,$R,$G,$B), $font_type, $w_text);
else imagestring($srcFile_img,$w_font,$wX,$wY,$w_text,imagecolorallocate($srcFile_img,$R,$G,$B));
}
//保存结果
switch($srcInfo[2]){
case 1 :
if(function_exists("imagegif")) imagegif($srcFile_img,$srcFile);
break;
case 2 :
if(function_exists("imagejpeg")) imagejpeg($srcFile_img,$srcFile);
break;
case 3 :
if(function_exists("imagepng")) imagepng($srcFile_img,$srcFile);
break;
case 6 :
if(function_exists("imagewbmp")) imagewbmp($srcFile_img,$srcFile);
break;
default :
return;
}
if(isset($water_info)) unset($water_info);
if(isset($water_img)) imagedestroy($water_img);
unset($srcInfo);
imagedestroy($srcFile_img);
}
?>
| zyyhong | trunk/jiaju001/news/include/inc_photograph.php | PHP | asf20 | 9,522 |
<?php
/*************************************************
本文件的信息不建议用户自行更改,否则发生意外自行负责
**************************************************/
error_reporting(E_ALL || ~E_NOTICE);
define('DEDEINC',dirname(__FILE__));
//全局安全检测
foreach($_REQUEST AS $_k => $_v) {
if(eregi("^(globals|cfg_)",$_k)) exit('Request var not allow!');
}
//载入用户配置的系统变量
require_once(DEDEINC.'/config_hand.php');
//设置站点维护状态开启后,程序文件最上方有 $cfg_IsCanView=true; 则该程序仍访问
if(!isset($cfg_IsCanView)) $cfg_IsCanView = false;
if(isset($cfg_websafe_open) && $cfg_websafe_open=='Y' && !$cfg_IsCanView)
{
include(DEDEINC.'/alert.htm');
exit();
}
//php5.1版本以上时区设置
if(PHP_VERSION > '5.1') {
$time51 = 'Etc/GMT'.($cfg_cli_time > 0 ? '-' : '+').abs($cfg_cli_time);
function_exists('date_default_timezone_set') ? @date_default_timezone_set($time51) : '';
}
if(!isset($cfg_needFilter)) $cfg_needFilter = false;
//安全模式检测
$cfg_isUrlOpen = @ini_get('allow_url_fopen');
$cfg_isSafeMode = @ini_get('safe_mode');
if($cfg_isSafeMode)
{
$cfg_os = strtolower(isset($_ENV['OS']) ? $_ENV['OS'] : @getenv('OS'));
if($cfg_os=='windows_nt') $cfg_isSafeMode = false;
}
//注册请求变量以及进行安全性检测
require_once(DEDEINC.'/inc_request_vars.php');
//Session保存路径
$sessSavePath = DEDEINC."/../data/sessions/";
if(is_writeable($sessSavePath) && is_readable($sessSavePath)){ session_save_path($sessSavePath); }
//对于仅需要简单SQL操作的页面,引入本文件前把此$__ONLYDB设为true,可避免引入不必要的文件
if(!isset($__ONLYDB)) $__ONLYDB = false;
if(!isset($__ONLYCONFIG)) $__ONLYCONFIG = false;
//站点根目录
$ndir = str_replace("\\","/",dirname(__FILE__));
$cfg_basedir = eregi_replace($cfg_cmspath."/include[/]{0,1}$","",$ndir);
if($cfg_multi_site == 'Y') $cfg_mainsite = $cfg_basehost;
else $cfg_mainsite = '';
//数据库连接信息
$cfg_dbhost = 'localhost';
$cfg_dbname = 'news';
$cfg_dbuser = 'news';
$cfg_dbpwd = '18946981';
$cfg_dbprefix = 'dede_';
$cfg_db_language = 'utf8';
//模板的存放目录
$cfg_templets_dir = $cfg_cmspath.'/templets';
$cfg_templeturl = $cfg_mainsite.$cfg_templets_dir;
//插件目录,这个目录是用于存放计数器、投票、评论等程序的必要动态程序
$cfg_plus_dir = $cfg_cmspath.'/plus';
$cfg_phpurl = $cfg_mainsite.$cfg_plus_dir;
//会员目录
$cfg_member_dir = $cfg_cmspath.'/member';
$cfg_memberurl = $cfg_mainsite.$cfg_member_dir;
//会员个人空间目录#new
$cfg_space_dir = $cfg_cmspath.'/space';
$cfg_spaceurl = $cfg_basehost.$cfg_space_dir;
$cfg_medias_dir = $cfg_cmspath.$cfg_medias_dir;
//上传的普通图片的路径,建议按默认
$cfg_image_dir = $cfg_medias_dir.'/allimg';
//上传的缩略图
$ddcfg_image_dir = $cfg_medias_dir.'/litimg';
//专题列表的存放路径
$cfg_special = $cfg_cmspath.'/special';
//用户投稿图片存放目录
$cfg_user_dir = $cfg_medias_dir.'/userup';
//上传的软件目录
$cfg_soft_dir = $cfg_medias_dir.'/soft';
//上传的多媒体文件目录
$cfg_other_medias = $cfg_medias_dir.'/media';
//圈子目录
$cfg_group_path = $cfg_cmspath.'/group';
//书库目录
$cfg_book_path = $cfg_cmspath.'/book';
//问答模块目录
$cfg_ask_path = $cfg_cmspath.'/ask';
//圈子网址
$cfg_group_url = $cfg_mainsite.$cfg_group_path;
//书库网址
$cfg_book_url = $cfg_mainsite.$cfg_book_path;
//问答模块网址
$cfg_ask_url = $cfg_mainsite.$cfg_ask_path;
//软件摘要信息,****请不要删除本项**** 否则系统无法正确接收系统漏洞或升级信息
//-----------------------------
$cfg_softname = "织梦内容管理系统";
$cfg_soft_enname = "DedeCms V5.1 UTF8版 SP1";
$cfg_soft_devteam = "织梦团队";
$cfg_version = 'V51UTF8_SP1_B88';
$cfg_ver_lang = 'utf-8'; //严禁手工修改此项
//默认扩展名,仅在命名规则不含扩展名的时候调用
$art_shortname = '.shtml';
//文档的默认命名规则
$cfg_df_namerule = '{typedir}/{Y}{M}/{aid}.shtml';
$cfg_df_listnamerule = '{typedir}/{tid}-{page}.shtml';
//新建目录的权限,如果你使用别的属性,本程不保证程序能顺利在Linux或Unix系统运行
$cfg_dir_purview = 0755;
//引入数据库类和常用函数
require_once(DEDEINC.'/config_passport.php');
if($cfg_pp_isopen) include_once(DEDEINC.'/../member/passport/pw.passport.class.php');
if(!$__ONLYCONFIG) include_once(DEDEINC.'/pub_db_mysql.php');
if(!$__ONLYDB) include_once(DEDEINC.'/inc_functions.php');
?>
| zyyhong | trunk/jiaju001/news/include/config_base.php | PHP | asf20 | 4,705 |
<?php
//拼音的缓冲数组
$pinyins = Array();
$g_ftpLink = false;
//判断软件语言
if( !isset($cfg_ver_lang) ){
if(eregi('utf',$cfg_version)) $cfg_ver_lang = 'utf-8';
else $cfg_ver_lang = 'gb2312';
}
if($cfg_ver_lang=='utf-8') include_once(dirname(__FILE__).'/pub_charset.php');
//客户端与服务时间差校正
function mytime()
{
return time();
}
//获得当前的脚本网址
function GetCurUrl(){
if(!empty($_SERVER["REQUEST_URI"])){
$scriptName = $_SERVER["REQUEST_URI"];
$nowurl = $scriptName;
}else{
$scriptName = $_SERVER["PHP_SELF"];
if(empty($_SERVER["QUERY_STRING"])) $nowurl = $scriptName;
else $nowurl = $scriptName."?".$_SERVER["QUERY_STRING"];
}
return $nowurl;
}
//把全角数字转为半角数字
function GetAlabNum($fnum){
if($GLOBALS['cfg_ver_lang']=='utf-8') $fnum = utf82gb($fnum);
$nums = array('0','1','2','3','4','5','6','7','8','9','.','-','+',':');
$fnums = array('0','1', '2','3', '4','5', '6', '7','8', '9','.', '-', '+',':');
$fnlen = count($fnums);
for($i=0;$i<$fnlen;$i++) $fnum = str_replace($nums[$i],$fnums[$i],$fnum);
$slen = strlen($fnum);
$oknum = '';
for($i=0;$i<$slen;$i++){
if(ord($fnum[$i]) > 0x80) $i++;
else $oknum .= $fnum[$i];
}
if($oknum=="") $oknum=0;
return $oknum;
}
//文本转HTML
function Text2Html($txt){
$txt = str_replace(" "," ",$txt);
$txt = str_replace("<","<",$txt);
$txt = str_replace(">",">",$txt);
$txt = preg_replace("/[\r\n]{1,}/isU","<br/>\r\n",$txt);
return $txt;
}
//获得HTML里的文本
function Html2Text($str){
$str = preg_replace("/<sty(.*)\\/style>|<scr(.*)\\/script>|<!--(.*)-->/isU",'',$str);
$str = str_replace(array('<br />','<br>','<br/>'), "\n", $str);
$str = strip_tags($str);
return $str;
}
//清除HTML标记
function ClearHtml($str){
$str = Html2Text($str);
$str = str_replace('<','<',$str);
$str = str_replace('>','>',$str);
return $str;
}
//中文截取把双字节字符也看作一个字符
function cnw_left($str,$len){
if($GLOBALS['cfg_ver_lang']=='utf-8'){
$str = utf82gb($str);
return gb2utf8(cn_substrGb($str,$slen,$startdd));
}else{
return cnw_mid($str,0,$len);
}
}
function cnw_mid($str,$start,$slen){
if(!isset($GLOBALS['__funString'])) include_once(dirname(__FILE__)."/inc/inc_fun_funString.php");
return Spcnw_mid($str,$start,$slen);
}
//此函数在UTF8版中不能直接调用
function cn_substrGb($str,$slen,$startdd=0){
$restr = "";
$c = "";
$str_len = strlen($str);
if($str_len < $startdd+1) return "";
if($str_len < $startdd + $slen || $slen==0) $slen = $str_len - $startdd;
$enddd = $startdd + $slen - 1;
for($i=0;$i<$str_len;$i++)
{
if($startdd==0) $restr .= $c;
else if($i > $startdd) $restr .= $c;
if(ord($str[$i])>127){
if($str_len>$i+1) $c = $str[$i].$str[$i+1];
$i++;
}
else{ $c = $str[$i]; }
if($i >= $enddd){
if(strlen($restr)+strlen($c)>$slen) break;
else{ $restr .= $c; break; }
}
}
return $restr;
}
//中文截取2,单字节截取模式
//如果是request的内容,必须使用这个函数
function cn_substrR($str,$slen,$startdd=0)
{
$str = cn_substr(stripslashes($str),$slen,$startdd);
return addslashes($str);
}
//中文截取2,单字节截取模式
function cn_substr($str,$slen,$startdd=0){
if($GLOBALS['cfg_ver_lang']=='utf-8'){
$str = utf82gb($str);
return gb2utf8(cn_substrGb($str,$slen,$startdd));
}else{
return cn_substrGb($str,$slen,$startdd);
}
}
function cn_midstr($str,$start,$len){
if($GLOBALS['cfg_ver_lang']=='utf-8'){
$str = utf82gb($str);
return gb2utf8(cn_substrGb($str,$slen,$startdd));
}else{
return cn_substrGb($str,$slen,$startdd);
}
}
function GetMkTime($dtime)
{
if(!ereg("[^0-9]",$dtime)) return $dtime;
$dt = Array(1970,1,1,0,0,0);
$dtime = ereg_replace("[\r\n\t]|日|秒"," ",$dtime);
$dtime = str_replace("年","-",$dtime);
$dtime = str_replace("月","-",$dtime);
$dtime = str_replace("时",":",$dtime);
$dtime = str_replace("分",":",$dtime);
$dtime = trim(ereg_replace("[ ]{1,}"," ",$dtime));
$ds = explode(" ",$dtime);
$ymd = explode("-",$ds[0]);
if(isset($ymd[0])) $dt[0] = $ymd[0];
if(isset($ymd[1])) $dt[1] = $ymd[1];
if(isset($ymd[2])) $dt[2] = $ymd[2];
if(strlen($dt[0])==2) $dt[0] = '20'.$dt[0];
if(isset($ds[1])){
$hms = explode(":",$ds[1]);
if(isset($hms[0])) $dt[3] = $hms[0];
if(isset($hms[1])) $dt[4] = $hms[1];
if(isset($hms[2])) $dt[5] = $hms[2];
}
foreach($dt as $k=>$v){
$v = ereg_replace("^0{1,}","",trim($v));
if($v=="") $dt[$k] = 0;
}
$mt = @mktime($dt[3],$dt[4],$dt[5],$dt[1],$dt[2],$dt[0]);
if($mt>0) return $mt;
else return time();
}
function SubDay($ntime,$ctime){
$dayst = 3600 * 24;
$cday = ceil(($ntime-$ctime)/$dayst);
return $cday;
}
function AddDay($ntime,$aday){
$dayst = 3600 * 24;
$oktime = $ntime + ($aday * $dayst);
return $oktime;
}
function GetDateTimeMk($mktime){
global $cfg_cli_time;
if($mktime==""||ereg("[^0-9]",$mktime)) return "";
return gmdate("Y-m-d H:i:s",$mktime + 3600 * $cfg_cli_time);
}
function GetDateMk($mktime){
global $cfg_cli_time;
if($mktime==""||ereg("[^0-9]",$mktime)) return "";
return gmdate("Y-m-d",$mktime + 3600 * $cfg_cli_time);
}
function GetIP(){
if(!empty($_SERVER["HTTP_CLIENT_IP"])) $cip = $_SERVER["HTTP_CLIENT_IP"];
else if(!empty($_SERVER["HTTP_X_FORWARDED_FOR"])) $cip = $_SERVER["HTTP_X_FORWARDED_FOR"];
else if(!empty($_SERVER["REMOTE_ADDR"])) $cip = $_SERVER["REMOTE_ADDR"];
else $cip = "";
preg_match("/[\d\.]{7,15}/", $cip, $cips);
$cip = $cips[0] ? $cips[0] : 'unknown';
unset($cips);
return $cip;
}
//获取一串中文字符的拼音 ishead=0 时,输出全拼音 ishead=1时,输出拼音首字母
function GetPinyin($str,$ishead=0,$isclose=1){
if($GLOBALS['cfg_ver_lang']=='utf-8') $str = utf82gb($str);
if(!isset($GLOBALS['__funAdmin'])) include_once(dirname(__FILE__)."/inc/inc_fun_funAdmin.php");
return SpGetPinyin($str,$ishead,$isclose);
}
function GetNewInfo(){
if(!isset($GLOBALS['__funAdmin'])) include_once(dirname(__FILE__)."/inc/inc_fun_funAdmin.php");
return SpGetNewInfo();
}
function UpdateStat(){
include_once(dirname(__FILE__)."/inc/inc_stat.php");
return SpUpdateStat();
}
function ShowMsg($msg,$gourl,$onlymsg=0,$limittime=0)
{
global $dsql,$cfg_ver_lang;
if( eregi("^gb",$cfg_ver_lang) ) $cfg_ver_lang = 'gb2312';
$htmlhead = "<html>\r\n<head>\r\n<title>DedeCms 系统提示</title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset={$cfg_ver_lang}\" />\r\n";
$htmlhead .= "<base target='_self'/>\r\n</head>\r\n<body leftmargin='0' topmargin='0'>\r\n<center>\r\n<script>\r\n";
$htmlfoot = "</script>\r\n</center>\r\n</body>\r\n</html>\r\n";
if($limittime==0) $litime = 5000;
else $litime = $limittime;
if($gourl=="-1"){
if($limittime==0) $litime = 5000;
$gourl = "javascript:history.go(-1);";
}
if($gourl==""||$onlymsg==1){
$msg = "<script>alert(\"".str_replace("\"","“",$msg)."\");</script>";
}else{
$func = " var pgo=0;
function JumpUrl(){
if(pgo==0){ location='$gourl'; pgo=1; }
}\r\n";
$rmsg = $func;
$rmsg .= "document.write(\"<br/><div style='width:400px;padding-top:4px;height:24;font-size:10pt;border-left:1px solid #b9df92;border-top:1px solid #b9df92;border-right:1px solid #b9df92;background-color:#def5c2;'>DedeCms 提示信息:</div>\");\r\n";
$rmsg .= "document.write(\"<div style='width:400px;height:100;font-size:10pt;border:1px solid #b9df92;background-color:#f9fcf3'><br/><br/>\");\r\n";
$rmsg .= "document.write(\"".str_replace("\"","“",$msg)."\");\r\n";
$rmsg .= "document.write(\"";
if($onlymsg==0){
if($gourl!="javascript:;" && $gourl!=""){ $rmsg .= "<br/><br/><a href='".$gourl."'>如果你的浏览器没反应,请点击这里...</a>"; }
$rmsg .= "<br/><br/></div>\");\r\n";
if($gourl!="javascript:;" && $gourl!=""){ $rmsg .= "setTimeout('JumpUrl()',$litime);"; }
}else{ $rmsg .= "<br/><br/></div>\");\r\n"; }
$msg = $htmlhead.$rmsg.$htmlfoot;
}
if(isset($dsql) && is_object($dsql)) @$dsql->Close();
echo $msg;
}
function ExecTime(){
$time = explode(" ", microtime());
$usec = (double)$time[0];
$sec = (double)$time[1];
return $sec + $usec;
}
function GetEditor($fname,$fvalue,$nheight="350",$etype="Basic",$gtype="print",$isfullpage="false"){
if(!isset($GLOBALS['__funAdmin'])) include_once(dirname(__FILE__)."/inc/inc_fun_funAdmin.php");
return SpGetEditor($fname,$fvalue,$nheight,$etype,$gtype,$isfullpage);
}
//获得指定位置模板字符串
function GetTemplets($filename){
if(file_exists($filename)){
$fp = fopen($filename,"r");
$rstr = fread($fp,filesize($filename));
fclose($fp);
return $rstr;
}else{ return ""; }
}
function GetSysTemplets($filename){
return GetTemplets($GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir'].'/system/'.$filename);
}
//给变量赋默认值
function AttDef($oldvar,$nv){
if(empty($oldvar)) return $nv;
else return $oldvar;
}
//把符合规则的数字转为字符
function dd2char($dd){
if($GLOBALS['cfg_ver_lang']=='utf-8') $dd = utf82gb($dd);
$slen = strlen($dd);
$okdd = "";
for($i=0;$i<$slen;$i++){
if(isset($dd[$i+1]))
{
$n = $dd[$i].$dd[$i+1];
if(($n>96 && $n<123)||($n>64 && $n<91)){
$okdd .= chr($n); $i++;
}
else $okdd .= $dd[$i];
}else $okdd .= $dd[$i];
}
return $okdd;
}
//按默认参数设置一个Cookie
function PutCookie($key,$value,$kptime,$pa="/"){
global $cfg_cookie_encode,$cfg_pp_isopen,$cfg_basehost;
if(empty($cfg_pp_isopen)
||!ereg("\.",$cfg_basehost)||!ereg("[a-zA-Z]",$cfg_basehost))
{
setcookie($key,$value,time()+$kptime,$pa);
setcookie($key.'ckMd5',substr(md5($cfg_cookie_encode.$value),0,16),time()+$kptime,$pa);
}else{
$dm = eregi_replace("http://([^\.]*)\.","",$cfg_basehost);
$dm = ereg_replace("/(.*)","",$dm);
setcookie($key,$value,time()+$kptime,$pa,$dm);
setcookie($key.'ckMd5',substr(md5($cfg_cookie_encode.$value),0,16),time()+$kptime,$pa,$dm);
}
}
//使Cookie失效
function DropCookie($key){
global $cfg_cookie_encode,$cfg_pp_isopen,$cfg_basehost;
if(empty($cfg_pp_isopen)
||!ereg("\.",$cfg_basehost)||!ereg("[a-zA-Z]",$cfg_basehost))
{
setcookie($key,"",time()-3600000,"/");
setcookie($key.'ckMd5',"",time()-3600000,"/");
}else
{
$dm = eregi_replace("http://([^\.]*)\.","",$cfg_basehost);
$dm = ereg_replace("/(.*)","",$dm);
setcookie($key,"",time(),"/",$dm);
setcookie($key.'ckMd5',"",time(),"/",$dm);
}
}
//获得一个cookie值
function GetCookie($key){
global $cfg_cookie_encode;
if( !isset($_COOKIE[$key]) || !isset($_COOKIE[$key.'ckMd5']) ) return '';
else{
if($_COOKIE[$key.'ckMd5']!=substr(md5($cfg_cookie_encode.$_COOKIE[$key]),0,16)) return '';
else return $_COOKIE[$key];
}
}
//获得验证码的值
function GetCkVdValue(){
@session_start();
if(isset($_SESSION["dd_ckstr"])) $ckvalue = $_SESSION["dd_ckstr"];
else $ckvalue = '';
return $ckvalue;
}
//用FTP创建一个目录
function FtpMkdir($truepath,$mmode,$isMkdir=true){
global $cfg_basedir,$cfg_ftp_root,$g_ftpLink;
OpenFtp();
$ftproot = ereg_replace($cfg_ftp_root.'$','',$cfg_basedir);
$mdir = ereg_replace('^'.$ftproot,'',$truepath);
if($isMkdir) ftp_mkdir($g_ftpLink,$mdir);
return ftp_site($g_ftpLink,"chmod $mmode $mdir");
}
//用FTP改变一个目录的权限
function FtpChmod($truepath,$mmode){
return FtpMkdir($truepath,$mmode,false);
}
//打开FTP连接
function OpenFtp(){
global $cfg_basedir,$cfg_ftp_host,$cfg_ftp_port;
global $cfg_ftp_user,$cfg_ftp_pwd,$cfg_ftp_root,$g_ftpLink;
if(!$g_ftpLink){
if($cfg_ftp_host==""){
echo "由于你的站点的PHP配置存在限制,程序尝试用FTP进行目录操作,你必须在后台指定FTP相关的变量!";
exit();
}
$g_ftpLink = ftp_connect($cfg_ftp_host,$cfg_ftp_port);
if(!$g_ftpLink){ echo "连接FTP失败!"; exit(); }
if(!ftp_login($g_ftpLink,$cfg_ftp_user,$cfg_ftp_pwd)){ echo "登陆FTP失败!"; exit(); }
}
}
//关闭FTP连接
function CloseFtp(){
global $g_ftpLink;
if($g_ftpLink) @ftp_quit($g_ftpLink);
}
//通用的创建目录的函数
function MkdirAll($truepath,$mmode){
global $cfg_ftp_mkdir,$cfg_isSafeMode;
if($cfg_isSafeMode||$cfg_ftp_mkdir=='Y'){ return FtpMkdir($truepath,$mmode); }
else{
if(!file_exists($truepath)){
mkdir($truepath,$GLOBALS['cfg_dir_purview']);
chmod($truepath,$GLOBALS['cfg_dir_purview']);
return true;
}else{
return true;
}
}
}
//通用的更改目录或文件权限的函数
function ChmodAll($truepath,$mmode){
global $cfg_ftp_mkdir,$cfg_isSafeMode;
if($cfg_isSafeMode||$cfg_ftp_mkdir=='Y'){ return FtpChmod($truepath,$mmode); }
else{ return chmod($truepath,'0'.$mmode); }
}
//创建多层次的目录
function CreateDir($spath,$siterefer="",$sitepath=""){
if(!isset($GLOBALS['__funAdmin'])) include_once(dirname(__FILE__)."/inc/inc_fun_funAdmin.php");
return SpCreateDir($spath,$siterefer,$sitepath);
}
//过滤用户输入用于查询的字符串
function StringFilterSearch($str,$isint=0){
return $str;
}
//会员校对密码
//把用户的密码经过此函数后与数据库的密码对比
function GetEncodePwd($pwd){
global $cfg_pwdtype,$cfg_md5len,$cfg_ddsign;
$cfg_pwdtype = strtolower($cfg_pwdtype);
if($cfg_pwdtype=='md5'){
if(empty($cfg_md5len)) $cfg_md5len = 32;
if($cfg_md5len>=32) return md5($pwd);
else return substr(md5($pwd),0,$cfg_md5len);
}else if($cfg_pwdtype=='dd'){
return DdPwdEncode($pwd,$cfg_ddsign);
}else if($cfg_pwdtype=='md5m16'){
return substr(md5($pwd),8,16);
}else{
return $pwd;
}
}
//用户ID和密码或其它字符串安全性测试
function TestStringSafe($uid){
if($uid!=addslashes($uid)) return false;
if(ereg("[><\$\r\n\t '\"`\\]",$uid)) return false;
return true;
}
//Dede密码加密算法
//加密程序
function DdPwdEncode($pwd,$sign=''){
global $cfg_ddsign;
if($sign=='') $sign = $cfg_ddsign;
$rtstr = '';
$plen = strlen($pwd);
if($plen<10) $plenstr = '0'.$plen;
else $plenstr = "$plen";
$sign = substr(md5($sign),0,$plen);
$poshandle = mt_rand(65,90);
$rtstr .= chr($poshandle);
$pwd = base64_encode($pwd);
if($poshandle%2==0){
$rtstr .= chr(ord($plenstr[0])+18);
$rtstr .= chr(ord($plenstr[1])+36);
}
for($i=0;$i<strlen($pwd);$i++){
if($i < $plen){
if($poshandle%2==0) $rtstr .= $pwd[$i].$sign[$i];
else $rtstr .= $sign[$i].$pwd[$i];
}else{ $rtstr .= $pwd[$i]; }
}
if($poshandle%2!=0){
$rtstr .= chr(ord($plenstr[0])+20);
$rtstr .= chr(ord($plenstr[1])+25);
}
return $rtstr;
}
//解密程序
function DdPwdDecode($epwd,$sign=''){
global $cfg_ddsign;
$n1=0;
$n2=0;
$pwstr='';
$restr='';
if($sign=='') $sign = $cfg_ddsign;
$rtstr = '';
$poshandle = ord($epwd[0]);
if($poshandle%2==0)
{
$n1 = chr(ord($epwd[1])-18);
$n2 = chr(ord($epwd[2])-36);
$pwstr = substr($epwd,3,strlen($epwd)-3);
}else{
$n1 = chr(ord($epwd[strlen($epwd)-2])-20);
$n2 = chr(ord($epwd[strlen($epwd)-1])-25);
$pwstr = substr($epwd,1,strlen($epwd)-3);
}
$pwdlen = ($n1.$n2)*2;
$pwstrlen = strlen($pwstr);
for($i=0;$i < $pwstrlen;$i++)
{
if($i < $pwdlen){
if($poshandle%2==0){
$restr .= $pwstr[$i]; $i++;
}else{
$i++;
$restr .= $pwstr[$i];
}
}else{ $restr .= $pwstr[$i]; }
}
$restr = base64_decode($restr);
return $restr;
}
/*----------------------
过滤HTML代码的函数
-----------------------*/
function htmlEncode($string) {
$string=trim($string);
$string=str_replace("&","&",$string);
$string=str_replace("'","'",$string);
$string=str_replace("&amp;","&",$string);
$string=str_replace("&quot;",""",$string);
$string=str_replace("\"",""",$string);
$string=str_replace("&lt;","<",$string);
$string=str_replace("<","<",$string);
$string=str_replace("&gt;",">",$string);
$string=str_replace(">",">",$string);
$string=str_replace("&nbsp;"," ",$string);
$string=nl2br($string);
return $string;
}
function filterscript($str) {
$str = eregi_replace("iframe","iframe",$str);
$str = eregi_replace("script","script",$str);
return $str;
}
function AjaxHead()
{
global $cfg_ver_lang;
@header("Pragma:no-cache\r\n");
@header("Cache-Control:no-cache\r\n");
@header("Expires:0\r\n");
@header("Content-Type: text/html; charset={$cfg_ver_lang}");
}
function getarea($areaid)
{
global $dsql;
if($areaid==0) return '';
if(!is_object($dsql)) $dsql = new dedesql(false);
$areaname = $dsql->GetOne("select name from #@__area where id=$areaid");
return $areaname['name'];
}
//用户自行扩展function
if(file_exists( dirname(__FILE__).'/inc_extend_functions.php' )){
include_once(dirname(__FILE__).'/inc_extend_functions.php');
}
//--------------------
// 获得附加表和主表名称
//----------------------
function GetChannelTable($dsql,$id,$formtype='channel')
{
global $cfg_dbprefix;
$retables = array();
$oldarrays = array(1=>'addonarticle',2=>'addonimages',3=>'addonsoft',4=>'addonflash',5=>'addonproduct',-2=>'addoninfos',-1=>'addonspec');
if(isset($oldarrays[$id]) && $formtype!='arc')
{
$retables['addtable'] = $cfg_dbprefix.$oldarrays[$id];
$retables['maintable'] = $cfg_dbprefix.'archives';
if($id==-1) $retables['maintable'] = $cfg_dbprefix.'archivesspec';
else if($id==-2) $retables['maintable'] = $cfg_dbprefix.'infos';
$retables['channelid'] = $id;
}else
{
if($formtype=='arc'){
$retables = $dsql->GetOne(" select c.ID as channelid,c.maintable,c.addtable from `#@__full_search` a left join #@__channeltype c on c.ID = a.channelid where a.aid='$id' ",MYSQL_ASSOC);
}
else{
$retables = $dsql->GetOne(" Select ID as channelid,maintable,addtable From #@__channeltype where ID='$id' ",MYSQL_ASSOC);
}
if(!isset($retables['maintable'])) $retables['maintable'] = $cfg_dbprefix.'archives';
if(!isset($retables['addtable'])) $retables['addtable'] = '';
}
return $retables;
}
//-----------------------
//获取一条索引ID
//-----------------------
function GetIndexKey($dsql,$typeid=0,$channelid=0)
{
global $typeid,$channelid,$arcrank,$title,$cfg_plus_dir;
$typeid = (empty($typeid) ? 0 : $typeid);
$channelid = (empty($channelid) ? 0 : $channelid);
$arcrank = (empty($arcrank) ? 0 : $arcrank);
$iquery = "INSERT INTO `#@__full_search` (`typeid` , `channelid` , `adminid` , `mid` , `att` , `arcrank` ,
`uptime` , `title` , `url` , `litpic` , `keywords` , `addinfos` , `digg` , `diggtime` )
VALUES ('$typeid', '$channelid', '0', '0', '0', '$arcrank',
'0', '$title', '', '', '', '', '0', '0');
";
$dsql->ExecuteNoneQuery($iquery);
return $dsql->GetLastID();
}
//-----------------------
//更新一条整站搜索的索引记录
//-----------------------
function WriteSearchIndex($dsql,&$datas)
{
UpSearchIndex($dsql,$datas);
}
function UpSearchIndex($dsql,&$datas)
{
$addf = '';
foreach($datas as $k=>$v){
if($k!='aid') $addf .= ($addf=='' ? "`$k`='$v'" : ",`$k`='$v'");
}
$uquery = "update `#@__full_search` set $addf where aid = '".$datas['aid']."';";
$rs = $dsql->ExecuteNoneQuery($uquery);
if(!$rs){
$gerr = $dsql->GetError();
//$tbs = GetChannelTable($dsql,$datas['channelid'],'channel');
//$dsql->ExecuteNoneQuery("Delete From `{$tbs['maintable']}` where ID='{$datas['aid']}'");
//$dsql->ExecuteNoneQuery("Delete From `{$tbs['addtable']}` where aid='{$datas['aid']}'");
//$dsql->ExecuteNoneQuery("Delete From `#@__full_search` where aid='{$datas['aid']}'");
echo "更新整站索引时失败,错误原因: [".$gerr."]";
echo "<br /> SQL语句:<font color='red'>{$uquery}</font>";
$dsql->Close();
exit();
}
return $rs;
}
//
//检查某栏目下级是否包含特定频道的内容
//
function TestHasChannel($cid,$channelid,$issend=-1,$carr='')
{
global $_Cs;
if(!is_array($_Cs) && !is_array($carr)){ include_once(dirname(__FILE__)."/../data/cache/inc_catalog_base.php"); }
if($channelid==0) return 1;
if(!isset($_Cs[$cid])) return 0;
if($issend==-1){
if($_Cs[$cid][1]==$channelid||$channelid==0) return 1;
else{
foreach($_Cs as $k=>$vs){
if($vs[0]==$cid) return TestHasChannel($k,$channelid,$issend,$_Cs);
}
}
}else
{
if($_Cs[$cid][2]==$issend && ($_Cs[$cid][1]==$channelid||$channelid==0)) return 1;
else{
foreach($_Cs as $k=>$vs){
if($vs[0]==$cid) return TestHasChannel($k,$channelid,$issend,$_Cs);
}
}
}
return 0;
}
//更新栏目索引缓存
function UpDateCatCache($dsql)
{
$cache1 = dirname(__FILE__)."/../data/cache/inc_catalog_base.php";
$dsql->SetQuery("Select ID,reID,channeltype,issend From #@__arctype");
$dsql->Execute();
$fp1 = fopen($cache1,'w');
$phph = '?';
$fp1Header = "<{$phph}php\r\nglobal \$_Cs;\r\n\$_Cs=array();\r\n";
fwrite($fp1,$fp1Header);
while($row=$dsql->GetObject()){
fwrite($fp1,"\$_Cs[{$row->ID}]=array({$row->reID},{$row->channeltype},{$row->issend});\r\n");
}
fwrite($fp1,"{$phph}>");
fclose($fp1);
}
//邮件发送函数
function sendmail($email, $mailtitle, $mailbody, $headers)
{
global $cfg_sendmail_bysmtp, $cfg_smtp_server, $cfg_smtp_port, $cfg_smtp_usermail, $cfg_smtp_user, $cfg_smtp_password, $cfg_adminemail;
if($cfg_sendmail_bysmtp == 'Y'){
$mailtype = 'TXT';
include_once(dirname(__FILE__).'/mail.class.php');
$smtp = new smtp($cfg_smtp_server,$cfg_smtp_port,true,$cfg_smtp_usermail,$cfg_smtp_password);
$smtp->debug = false;
$smtp->sendmail($email, $cfg_smtp_usermail, $mailtitle, $mailbody, $mailtype);
}else{
@mail($email, $mailtitle, $mailbody, $headers);
}
}
function highlight($string, $words, $hrefs='',$pretext='', $step='')
{
//后两个变量为系统继承变量,不可指定
if($step != 'me'){
return preg_replace('/(^|>)([^<]+)(?=<|$)/sUe', "highlight('\\2',\$words, \$hrefs, '\\1', 'me')", $string);
}
if(is_array($words)){
$string = str_replace('\"', '"', $string);
foreach($words as $k => $word){
if(empty($hrefs[$k])){
$string = preg_replace('/(^|>)([^<]+)(?=<|$)/sUe', "highlight('\\2',\$word, '', '\\1', 'me')", $string);
}else{
$string = preg_replace('/(^|>)([^<]+)(?=<|$)/sUe', "highlight('\\2',\$word, \$hrefs[\$k], '\\1', 'me')", $string);
}
}
return $pretext.$string;
}else{
if($hrefs == ''){
$string = str_replace($words,'<strong><font color="#ff0000">'.$words.'</font></strong>',$string);
}else{
if(strpos($string, $words) !== false){
$string = str_replace($words, '<a href="'.$hrefs.'" style="color:#ff0000;font-weight:bold;">'.$words.'</a>', $string);
}
}
return $pretext.$string;
}
}
$startRunMe = ExecTime();
?>
| zyyhong | trunk/jiaju001/news/include/inc_functions.php | PHP | asf20 | 23,374 |
<?php
if(!defined('DEDEINC'))
{
exit("Request Error!");
}
//------------------------------------------------
//该文件是所有涉及文档或列表读取必须引入的文件
//------------------------------------------------
global $PubFields,$cfg_mainsite,$cfg_plus_dir,$cfg_powerby,$cfg_indexname,$cfg_indexurl;
global $cfg_webname,$cfg_templets_dir,$cfg_df_style,$cfg_special,$cfg_member_dir;
//设置一些公用变量
$PubFields['phpurl'] = $cfg_mainsite.$cfg_plus_dir;
$PubFields['indexurl'] = $cfg_mainsite.$cfg_indexurl;
$PubFields['templeturl'] = $cfg_mainsite.$cfg_templets_dir;
$PubFields['memberurl'] = $cfg_mainsite.$cfg_member_dir;
$PubFields['specurl'] = $cfg_mainsite.$cfg_special;
$PubFields['indexname'] = $cfg_indexname;
$PubFields['powerby'] = $cfg_powerby;
$PubFields['webname'] = $cfg_webname;
$PubFields['templetdef'] = $cfg_templets_dir.'/'.$cfg_df_style;
$GLOBALS['pTypeArrays'] = Array();
$GLOBALS['idArrary'] = '';
//----------------------------------
//用星表示软件或Flash的等级
//----------------------------------
function GetRankStar($rank)
{
$nstar = "";
for($i=1;$i<=$rank;$i++) $nstar .= "★";
for($i;$i<=5;$i++) $nstar .= "☆";
return $nstar;
}
//-------------------------
//产品模块中供应方式的处理
//-----------------------
function SelSpType($stype){
$tps = array('厂家直销','厂家批发','商家批发','商家零售','其它渠道');
$rstr = "<select name='ssstype' style='width:80px'>\r\n";
foreach($tps as $tp){
$rstr .= ($stype==$tp ? "<option selected>$tp</option>\r\n" : "<option>$tp</option>\r\n");
}
$rstr .= "</select>\r\n";
return $rstr;
}
//-----------------------------
//获得文章网址
//----------------------------
function GetFileUrl(
$aid,$typeid,$timetag,$title,$ismake=0,$rank=0,
$namerule="",$artdir="",$money=0,$aburl=false,$siteurl="")
{
if($rank!=0||$ismake==-1||$typeid==0||$money>0) //动态文章
{
if($GLOBALS['cfg_multi_site']=='Y')
{
$siteurl = $GLOBALS['cfg_basehost'];
}
return $siteurl.$GLOBALS['cfg_plus_dir']."/view.php?aid=$aid";
}
else
{
$articleRule = $namerule;
$articleDir = MfTypedir($artdir);
if($namerule=="") $articleRule = $GLOBALS['cfg_df_namerule'];
if($artdir=="") $articleDir = $GLOBALS['cfg_cmspath'].$GLOBALS['cfg_arcdir'];
$dtime = GetDateMk($timetag);
$articleRule = strtolower($articleRule);
list($y,$m,$d) = explode("-",$dtime);
$articleRule = str_replace("{typedir}",$articleDir,$articleRule);
$articleRule = str_replace("{y}",$y,$articleRule);
$articleRule = str_replace("{m}",$m,$articleRule);
$articleRule = str_replace("{d}",$d,$articleRule);
$articleRule = str_replace("{timestamp}",$timetag,$articleRule);
$articleRule = str_replace("{aid}",$aid,$articleRule);
$articleRule = str_replace("{cc}",dd2char($m.$d.$aid.$y),$articleRule);
if(ereg('{p',$articleRule)){
$articleRule = str_replace("{pinyin}",GetPinyin($title)."_".$aid,$articleRule);
$articleRule = str_replace("{py}",GetPinyin($title,1)."_".$aid,$articleRule);
}
$articleUrl = "/".ereg_replace("^/","",$articleRule);
//是否强制使用绝对网址
if($aburl && $GLOBALS['cfg_multi_site']=='Y'){
if($siteurl=="") $siteurl = $GLOBALS["cfg_basehost"];
$articleUrl = $siteurl.$articleUrl;
}
return $articleUrl;
}
}
//获得新文件网址
//本函数会自动创建目录
function GetFileNewName(
$aid,$typeid,$timetag,$title,$ismake=0,$rank=0,
$namerule="",$artdir="",$money=0,$siterefer="",
$sitepath="",$moresite="",$siteurl="")
{
if($rank!=0||$ismake==-1||$typeid==0||$money>0){ //动态文章
return $GLOBALS['cfg_plus_dir']."/view.php?aid=$aid";
}
else
{
$articleUrl = GetFileUrl(
$aid,$typeid,$timetag,$title,$ismake,$rank,
$namerule,$artdir,$money);
$slen = strlen($articleUrl)-1;
for($i=$slen;$i>=0;$i--){
if($articleUrl[$i]=="/"){ $subpos = $i; break; }
}
$okdir = substr($articleUrl,0,$subpos);
CreateDir($okdir,$siterefer,$sitepath);
}
return $articleUrl;
}
//--------------------------
//获得指定类目的URL链接
//对于使用封面文件和单独页面的情况,强制使用默认页名称
//-------------------------
function GetTypeUrl($typeid,$typedir,$isdefault,$defaultname,$ispart,$namerule2,$siteurl="")
{
//跳转网址
if($ispart>2){
return $typedir;
}
if($defaultname == 'index.html'){
$defaultname = '';
}
if($isdefault==-1)
{
$reurl = $GLOBALS["cfg_plus_dir"]."/list.php?tid=".$typeid;
}else if($ispart>0)
{
$reurl = "$typedir/".$defaultname;
}else
{
if($isdefault==0)
{
$reurl = str_replace("{page}","1",$namerule2);
$reurl = str_replace("{tid}",$typeid,$reurl);
$reurl = str_replace("{typedir}",$typedir,$reurl);
}else
{
$reurl = "$typedir/".$defaultname;
}
}
$reurl = ereg_replace("/{1,}","/",$reurl);
if($GLOBALS['cfg_multi_site']=='Y'){
if($siteurl=="" || $isdefault==-1) $siteurl = $GLOBALS['cfg_basehost'];
if($siteurl!="abc") $reurl = $siteurl.$reurl;
}
$reurl = eregi_replace("{cmspath}",$GLOBALS['cfg_cmspath'],$reurl);
return $reurl;
}
//魔法变量,用于获取两个可变的值
//------------------------
function MagicVar($v1,$v2)
{
if($GLOBALS['autoindex']%2==0) return $v1;
else return $v2;
}
//获取上级ID列表
function GetParentIDS($tid,&$dsql)
{
global $_Cs;
$GLOBALS['pTypeArrays'][] = $tid;
if(!is_array($_Cs)){ require_once(dirname(__FILE__)."/../data/cache/inc_catalog_base.php"); }
if(!isset($_Cs[$tid]) || $_Cs[$tid][0]==0){
return $GLOBALS['pTypeArrays'];
}
else{
return GetParentIDS($_Cs[$tid][0],$dsql);
}
}
//----------------------
//获取一个类目的顶级类目ID
//----------------------
function SpGetTopID($tid){
global $_Cs;
if(!is_array($_Cs)){ require_once(dirname(__FILE__)."/../data/cache/inc_catalog_base.php"); }
if($v[$tid][0]==0) return $tid;
else return SpGetTopID($tid);
}
//----------------------
//获取一个类目的所有顶级栏目ID
//----------------------
global $TopIDS;
function SpGetTopIDS($tid){
global $_Cs,$TopIDS;
if(!is_array($_Cs)){ require_once(dirname(__FILE__)."/../data/cache/inc_catalog_base.php"); }
$TopIDS[] = $tid;
if($_Cs[$tid][0]==0) return $TopIDS;
else return SpGetTopIDS($tid);
}
//-----------------------------
// 返回与某个目相关的下级目录的类目ID列表(删除类目或文章时调用)
//由于PHP有些版本存在Bug,不能直接使用同一数组在递归逻辑,只能复制副本传递给函数
//-----------------------------
function TypeGetSunTypes($ID,&$dsql,$channel=0)
{
global $_Cs;
$GLOBALS['idArray'] = array();
if( !is_array($_Cs) ){ require_once(dirname(__FILE__)."/../data/cache/inc_catalog_base.php"); }
TypeGetSunTypesLogic($ID,$_Cs,$channel);
return $GLOBALS['idArray'];
}
function TypeGetSunTypesLogic($ID,$sArr,$channel=0)
{
if($ID!=0) $GLOBALS['idArray'][$ID] = $ID;
foreach($sArr as $k=>$v)
{
if( $v[0]==$ID && ($channel==0 || $v[1]==$channel ))
{
TypeGetSunTypesLogic($k,$sArr,$channel);
}
}
}
//--------------------------------
//获得某ID的下级ID(包括本身)的SQL语句“($tb.typeid=id1 or $tb.typeid=id2...)”
//-----------------------------
function TypeGetSunID($ID,&$dsql,$tb="#@__archives",$channel=0,$onlydd=false)
{
$GLOBALS['idArray'] = array();
TypeGetSunTypes($ID,$dsql,$channel);
$rquery = "";
foreach($GLOBALS['idArray'] as $k=>$v)
{
if($onlydd){
$rquery .= ($rquery=='' ? $k : ",{$k}");
}else{
if($tb!="")
$rquery .= ($rquery!='' ? " Or {$tb}.typeid='$k' " : " {$tb}.typeid='$k' ");
else
$rquery .= ($rquery!='' ? " Or typeid='$k' " : " typeid='$k' ");
}
}
if($onlydd) return $rquery;
else return " (".$rquery.") ";
}
//栏目目录规则
function MfTypedir($typedir)
{
global $cfg_cmspath;
if(eregi("^http://",$typedir)) return $typedir;
$typedir = eregi_replace("{cmspath}",$cfg_cmspath,$typedir);
$typedir = ereg_replace("/{1,}","/",$typedir);
return $typedir;
}
//模板目录规则
function MfTemplet($tmpdir)
{
global $cfg_df_style;
$tmpdir = eregi_replace("{style}",$cfg_df_style,$tmpdir);
$tmpdir = ereg_replace("/{1,}","/",$tmpdir);
return $tmpdir;
}
//获取网站搜索的热门关键字
function GetHotKeywords(&$dsql,$num=8,$nday=365,$klen=16,$orderby='count'){
global $cfg_phpurl,$cfg_cmspath;
$nowtime = time();
$num = @intval($num);
$nday = @intval($nday);
$klen = @intval($klen);
if(empty($nday)) $nday = 365;
if(empty($num)) $num = 6;
if(empty($klen)) $klen = 16;
$klen = $klen+1;
$mintime = $nowtime - ($nday * 24 * 3600);
if(empty($orderby)) $orderby = 'count';
$dsql->SetQuery("Select keyword,istag From #@__search_keywords where lasttime>$mintime And length(keyword)<$klen order by $orderby desc limit 0,$num");
$dsql->Execute('hw');
$hotword = "";
while($row=$dsql->GetArray('hw')){
if($row['istag']==1) $hotword .= " <a href='".$cfg_cmspath."/tag.php?/{$row['keyword']}/'>".$row['keyword']."</a> ";
else $hotword .= " <a href='".$cfg_phpurl."/search.php?keyword=".urlencode($row['keyword'])."&searchtype=titlekeyword'>".$row['keyword']."</a> ";
}
return $hotword;
}
//
function FormatScript($atme){
if($atme==" ") return "";
else return trim(html2text($atme));
}
//------------------------------
//获得自由列表的网址
//------------------------------
function GetFreeListUrl($lid,$namerule,$listdir,$defaultpage,$nodefault){
$listdir = str_replace('{cmspath}',$GLOBALS['cfg_cmspath'],$listdir);
if($nodefault==1){
$okfile = str_replace('{page}','1',$namerule);
$okfile = str_replace('{listid}',$lid,$okfile);
$okfile = str_replace('{listdir}',$listdir,$okfile);
}else{
$okfile = $listdir.'/'.$defaultpage;
}
$okfile = str_replace("\\","/",$okfile);
$trueFile = $GLOBALS['cfg_basedir'].$okfile;
if(!file_exists($trueFile)){
$okfile = $GLOBALS['cfg_phpurl']."/freelist.php?lid=$lid";
}
return $okfile;
}
//----------
//判断图片可用性
function CkLitImageView($imgsrc,$imgwidth){
$imgsrc = trim($imgsrc);
if(!empty($imgsrc) && eregi('^http',$imgsrc)){
$imgsrc = $cfg_mainsite.$imgsrc;
}
if(!empty($imgsrc) && !eregi("img/dfpic\.gif",$imgsrc)){
return "<img src='".$imgsrc."' width=80 align=left>";
}
return "";
}
//----------
//使用绝对网址
function Gmapurl($gurl){
if(!eregi("http://",$gurl)) return $GLOBALS['cfg_basehost'].$gurl;
else return $gurl;
}
//----------------
//获得图书的URL
//----------------
function GetBookUrl($bid,$title,$gdir=0)
{
global $cfg_cmspath;
if($gdir==1) $bookurl = "{$cfg_cmspath}/book/".DedeID2Dir($bid);
else $bookurl = "{$cfg_cmspath}/book/".DedeID2Dir($bid).'/'.GetPinyin($title).'-'.$bid.'.html';
return $bookurl;
}
//-----------------
//根据ID生成目录
//-----------------
function DedeID2Dir($aid)
{
$n = ceil($aid / 1000);
return $n;
}
?> | zyyhong | trunk/jiaju001/news/include/inc_channel_unit_functions.php | PHP | asf20 | 11,281 |
<?php
//class TypeUnit
//这个类主要是封装频道管理时的一些复杂操作
//--------------------------------
if(!defined('DEDEINC'))
{
exit("Request Error!");
}
require_once(dirname(__FILE__)."/../data/cache/inc_catalog_base.php");
class TypeUnit
{
var $dsql;
var $artDir;
var $baseDir;
var $idCounter;
var $idArrary;
var $shortName;
var $aChannels;
var $isAdminAll;
//-------------
//php5构造函数
//-------------
function __construct($catlogs='')
{
global $_Cs;
$this->idCounter = 0;
$this->artDir = $GLOBALS['cfg_cmspath'].$GLOBALS['cfg_arcdir'];
$this->baseDir = $GLOBALS['cfg_basedir'];
$this->shortName = $GLOBALS['art_shortname'];
$this->idArrary = "";
$this->dsql = new DedeSql(false);
$this->aChannels = Array();
$this->isAdminAll = false;
if(!empty($catlogs) && $catlogs!='-1')
{
$this->aChannels = explode(',',$catlogs);
foreach($this->aChannels as $cid)
{
if($_Cs[$cid][0]==0)
{
$this->dsql->SetQuery("Select ID,ispart From `#@__arctype` where reID=$cid");
$this->dsql->Execute();
while($row = $this->dsql->GetObject()){
if($row->ispart!=2) $this->aChannels[] = $row->ID;
}
}
}
}else{
$this->isAdminAll = true;
}
}
function TypeUnit($catlogs='')
{
$this->__construct($catlogs);
}
//------------------
//清理类
//------------------
function Close()
{
if($this->dsql){
@$this->dsql->Close();
@$this->dsql=0;
}
$this->idArrary = "";
$this->idCounter = 0;
}
//
//----读出所有分类,在类目管理页(list_type)中使用----------
//
function ListAllType($channel=0,$nowdir=0)
{
$this->dsql->SetQuery("Select ID,typedir,typename,ispart,channeltype From #@__arctype where reID=0 And ispart<>3 order by sortrank");
$this->dsql->Execute(0);
$lastID = GetCookie('lastCidMenu');
while($row=$this->dsql->GetObject(0))
{
$typeDir = $row->typedir;
$typeName = $row->typename;
$ispart = $row->ispart;
$ID = $row->ID;
$channeltype = $row->channeltype;
if($ispart==2){
continue;
}
//有权限栏目
if($this->isAdminAll===true || in_array($ID,$this->aChannels))
{
//互动栏目
if($channeltype<-1) $smenu = " oncontextmenu=\"CommonMenuWd(this,$ID,'".urlencode($typeName)."')\"";
//普通列表
else if($ispart==0) $smenu = " oncontextmenu=\"CommonMenu(this,$ID,'".urlencode($typeName)."')\"";
//带封面的频道
else if($ispart==1) $smenu = " oncontextmenu=\"CommonMenuPart(this,$ID,'".urlencode($typeName)."')\"";
//独立页面
else if($ispart==2) $smenu = " oncontextmenu=\"SingleMenu(this,$ID,'".urlencode($typeName)."')\"";
//跳转
else if($ispart==3) $smenu = " ";
echo "<dl class='topcc'>\r\n";
echo " <dd class='dlf'><img style='cursor:hand' onClick=\"LoadSuns('suns{$ID}',{$ID});\" src='img/tree_explode.gif' width='11' height='11'></dd>\r\n";
echo " <dd class='dlr'><a href='catalog_do.php?cid=".$ID."&dopost=listArchives'{$smenu}>".$typeName."</a></dd>\r\n";
echo "</dl>\r\n";
echo "<div id='suns".$ID."' class='sunct'>";
if($lastID==$ID){
$this->LogicListAllSunType($ID," ");
}
echo "</div>\r\n";
}//没权限栏目
else{
$sonNeedShow = false;
$this->dsql->SetQuery("Select ID From #@__arctype where reID={$ID}");
$this->dsql->Execute('ss');
while($srow=$this->dsql->GetArray('ss')){
if( in_array($srow['ID'],$this->aChannels) ){ $sonNeedShow = true; break; }
}
//如果二级栏目中有的所属归类文档
if($sonNeedShow===true){
echo "<dl class='topcc'>\r\n";
echo " <dd class='dlf'><img style='cursor:hand' onClick=\"LoadSuns('suns{$ID}',{$ID});\" src='img/tree_explode.gif' width='11' height='11'></dd>\r\n";
echo " <dd class='dlr'>{$typeName}</dd>\r\n";
echo "</dl>\r\n";
echo "<div id='suns".$ID."' class='sunct'>";
$this->LogicListAllSunType($ID," ",true);
echo "</div>\r\n";
}
}
}
}
//获得子类目的递归调用
function LogicListAllSunType($ID,$step,$needcheck=true)
{
$fid = $ID;
$this->dsql->SetQuery("Select ID,reID,typedir,typename,ispart,channeltype From #@__arctype where reID='".$ID."' And ispart<>3 order by sortrank");
$this->dsql->Execute($fid);
if($this->dsql->GetTotalRow($fid)>0)
{
while($row=$this->dsql->GetObject($fid))
{
$typeDir = $row->typedir;
$typeName = $row->typename;
$reID = $row->reID;
$ID = $row->ID;
$ispart = $row->ispart;
$channeltype = $row->channeltype;
if($step==" ") $stepdd = 2;
else $stepdd = 3;
//有权限栏目
if(in_array($ID,$this->aChannels) || $needcheck===false || $this->isAdminAll===true)
{
//互动栏目
if($channeltype<-1){
$smenu = " oncontextmenu=\"CommonMenuWd(this,$ID,'".urlencode($typeName)."')\"";
$timg = " <img src='img/tree_list.gif'> ";
}
//普通列表
else if($ispart==0){
$smenu = " oncontextmenu=\"CommonMenu(this,$ID,'".urlencode($typeName)."')\"";
$timg = " <img src='img/tree_list.gif'> ";
}
//带封面的频道
else if($ispart==1)
{
$timg = " <img src='img/tree_part.gif'> ";
$smenu = " oncontextmenu=\"CommonMenuPart(this,$ID,'".urlencode($typeName)."')\"";
}
//独立页面
else if($ispart==2){
$timg = " <img src='img/tree_page.gif'> ";
$smenu = " oncontextmenu=\"SingleMenu(this,$ID,'".urlencode($typeName)."')\"";
}
//跳转
else if($ispart==3){
$timg = " <img src='img/tree_page.gif'> ";
$smenu = " ";
}
echo " <table class='sunlist'>\r\n";
echo " <tr>\r\n";
echo " <td>".$step.$timg."<a href='catalog_do.php?cid=".$ID."&dopost=listArchives'{$smenu}>".$typeName."</a></td>\r\n";
echo " </tr>\r\n";
echo " </table>\r\n";
$this->LogicListAllSunType($ID,$step." ",false);
}
}
}
}
//------------------------------------------------------
//-----返回与某个目相关的下级目录的类目ID列表(删除类目或文章时调用)
//------------------------------------------------------
function GetSunTypes($ID,$channel=0)
{
$this->idArray[$this->idCounter]=$ID;
$this->idCounter++;
$fid = $ID;
if($channel!=0) $csql = " And channeltype=$channel ";
else $csql = "";
$this->dsql->SetQuery("Select ID From #@__arctype where reID=$ID $csql");
$this->dsql->Execute("gs".$fid);
//if($this->dsql->GetTotalRow("gs".$fid)!=0)
//{
while($row=$this->dsql->GetObject("gs".$fid)){
$nid = $row->ID;
$this->GetSunTypes($nid,$channel);
}
//}
return $this->idArray;
}
//----------------------------------------------------------------------------
//获得某ID的下级ID(包括本身)的SQL语句“($tb.typeid=id1 or $tb.typeid=id2...)”
//----------------------------------------------------------------------------
function GetSunID($ID,$tb="#@__archives",$channel=0)
{
$this->sunID = "";
$this->idCounter = 0;
$this->idArray = "";
$this->GetSunTypes($ID,$channel);
$this->dsql->Close();
$this->dsql = 0;
$rquery = "";
for($i=0;$i<$this->idCounter;$i++)
{
if($i!=0) $rquery .= " Or ".$tb.".typeid='".$this->idArray[$i]."' ";
else $rquery .= " ".$tb.".typeid='".$this->idArray[$i]."' ";
}
reset($this->idArray);
$this->idCounter = 0;
return " (".$rquery.") ";
}
}
?> | zyyhong | trunk/jiaju001/news/include/inc_typeunit_menu.php | PHP | asf20 | 7,874 |
<?php
if(!defined('DEDEINC'))
{
exit("Request Error!");
}
//检测用户上传空间
function GetUserSpace($uid,$dsql){
$row = $dsql->GetOne("select sum(filesize) as fs From #@__uploads where memberID='$uid'; ");
return $row['fs'];
}
function CheckUserSpace($uid){
global $cfg_mb_max,$dsql;
if(!is_object($dsql)) $dsql = new DedeSql(false);
$hasuse = GetUserSpace($uid,$dsql);
$maxSize = $cfg_mb_max * 1024 * 1024;
if($hasuse >= $maxSize){
$dsql->Close();
ShowMsg('你的空间已满,不允许上传新文件!','-1');
exit();
}
}
//检测用户的附件类型
function CheckAddonType($aname){
global $cfg_mb_mediatype;
if(empty($cfg_mb_mediatype)){
$cfg_mb_mediatype = "jpg|gif|png|bmp|swf|mpg|mp3|rm|rmvb|wmv|asf|wma|zip|rar|doc|xsl|ppt|wps";
}
$anames = explode('.',$aname);
$atype = $anames[count($anames)-1];
if(count($anames)==1) return false;
else{
$atype = strtolower($atype);
$cfg_mb_mediatypes = explode('|',trim($cfg_mb_mediatype));
if(in_array($atype,$cfg_mb_mediatypes)) return true;
else return false;
}
}
$GLOBALS['MemberAreas'] = Array();
//获取省份信息
function GetProvince($pid,$dsql){
global $dsql,$MemberAreas;
if($pid<=0) return "未知";
else{
if(isset($MemberAreas[$pid])) return $MemberAreas[$pid];
$dsql->SetQuery("Select `id`,`name` From #@__area ");
$dsql->Execute('eee');
while($row = $dsql->GetObject('eee')){
$MemberAreas[$row->id] = $row->name;
}
if(isset($MemberAreas[$pid])) return $MemberAreas[$pid];
else return "未知";
}
}
//获取用户的会话信息
function GetUserInfos($uid)
{
$tpath = ceil($uid/5000);
$userfile = dirname(__FILE__)."/../data/cache/user/$tpath/{$uid}.php";
if(!file_exists($userfile)) return '';
else{
require_once($userfile);
return $cfg_userinfos;
}
}
//写入用户的会话信息
function WriteUserInfos($uid,$row)
{
$tpath = ceil($uid/5000);
$ndir = dirname(__FILE__)."/../data/cache/user/$tpath/";
if(!is_dir($ndir)){
mkdir($ndir,$GLOBALS['cfg_dir_purview']);
chmod($ndir,$GLOBALS['cfg_dir_purview']);
}
$userfile = $ndir.$uid.'.php';
$infos = "<"."?php\r\n";
$infos .= "\$cfg_userinfos['wtime'] = '".time()."';\r\n";
foreach($row as $k=>$v){
if(ereg('[^0-9]',$k)){
$v = str_replace("'","\\'",$v);
$v = ereg_replace("(<\?|\?>)","",$v);
if(in_array($k, array('userid','uname','pwd'))){
$infos .= "\$cfg_userinfos['{$k}'] = ".'base64_decode("'.base64_encode($v)."\");\r\n";
}else{
$infos .= "\$cfg_userinfos['{$k}'] = '{$v}';\r\n";
}
}
}
$infos .= "\r\n?".">";
@$fp = fopen($userfile,'w');
@flock($fp);
@fwrite($fp,$infos);
@fclose($fp);
return $infos;
}
//删除用户的会话信息
function DelUserInfos($uid)
{
$tpath = ceil($uid/5000);
$userfile = dirname(__FILE__)."/../data/cache/user/$tpath/".$uid.'.php';
if(file_exists($userfile)) @unlink($userfile);
}
//------------------------
//网站会员登录类
//------------------------
class MemberLogin
{
var $M_ID;
var $M_LoginID;
var $M_Type;
var $M_utype;
var $M_Money;
var $M_UserName;
var $M_MySafeID;
var $M_LoginTime;
var $M_KeepTime;
var $M_UserPwd;
var $M_UpTime;
var $M_ExpTime;
var $M_HasDay;
var $M_Scores;
var $M_Honor;
var $M_Newpm;
var $M_UserIcon;
//php5构造函数
function __construct($kptime = 0)
{
if(empty($kptime)) $this->M_KeepTime = 3600 * 24 * 15;
else $this->M_KeepTime = $kptime;
$this->M_ID = $this->GetNum(GetCookie("DedeUserID"));
$this->M_LoginTime = GetCookie("DedeLoginTime");
if(empty($this->M_LoginTime)) $this->M_LoginTime = time();
if(empty($this->M_ID))
{
$this->ResetUser();
}else
{
$this->M_ID = ereg_replace("[^0-9]","",$this->M_ID);
//读取用户缓存信息
$row = GetUserInfos($this->M_ID);
//如果不存在就更新缓存
if(!is_array($row) && $this->M_ID>0) $row = $this->FushCache();
//存在用户信息
if(is_array($row))
{
$this->M_LoginID = $row['userid'];
$this->M_UserPwd = $row['pwd'];
$this->M_Type = $row['membertype'];
$this->M_utype = $row['type'];
$this->M_Money = $row['money'];
$this->M_UserName = $row['uname'];
$this->M_UpTime = $row['uptime'];
$this->M_ExpTime = $row['exptime'];
$this->M_Scores = $row['scores'];
$this->M_Honor = $row['honor'];
$this->M_Newpm = $row['newpm'];
$this->M_UserIcon = $row['spaceimage'];
$this->M_HasDay = 0;
if($this->M_UpTime>0)
{
$nowtime = time();
$mhasDay = $this->M_ExpTime - ceil(($nowtime - $this->M_UpTime)/3600/24) + 1;
$this->M_HasDay = $mhasDay;
}
}else
{
$this->ResetUser();
}
}
}
function MemberLogin($kptime = 0){
$this->__construct($kptime);
}
//更新缓存
function FushCache($mid=0)
{
if(empty($mid)) $mid = $this->M_ID;
$dsql = new DedeSql(false);
$row = $dsql->GetOne("Select ID,userid,pwd,type,uname,membertype,money,uptime,exptime,scores,newpm,spaceimage From #@__member where ID='{$mid}' ");
if(is_array($row))
{
$scrow = $dsql->GetOne("Select titles From #@__scores where integral<={$row['scores']} order by integral desc");
$row['honor'] = $scrow['titles'];
}
if(is_array($row)) return WriteUserInfos($mid,$row);
else return '';
}
//退出cookie的会话
function ExitCookie(){
DelUserInfos($this->M_ID);
$this->ResetUser();
}
//验证用户是否已经登录
function IsLogin(){
if($this->M_ID > 0) return true;
else return false;
}
//重置用户信息
function ResetUser(){
$this->M_ID = 0;
$this->M_LoginID = "";
$this->M_Type = -1;
$this->M_utype = 0;
$this->M_Money = 0;
$this->M_UserName = "";
$this->M_LoginTime = 0;
$this->M_UpTime = 0;
$this->M_ExpTime = 0;
$this->M_HasDay = 0;
$this->M_Scores = 0;
$this->M_Newpm = 0;
$this->M_UserIcon = "";
DropCookie("DedeUserID");
DropCookie("DedeLoginTime");
}
//获取整数值
function GetNum($fnum){
$fnum = ereg_replace("[^0-9\.]","",$fnum);
return $fnum;
}
//用户登录
function CheckUser($loginuser,$loginpwd)
{
if(!TestStringSafe($loginuser)||!TestStringSafe($loginpwd))
{
ShowMsg("用户名或密码不合法!","-1");
exit();
}
$loginuser = ereg_replace("[;%'\\\?\*\$]","",$loginuser);
$dsql = new DedeSql(false);
$row = $dsql->GetOne("Select ID,pwd From #@__member where userid='$loginuser' ");
if(is_array($row)) //用户存在
{
//密码错误
if($row['pwd'] != $loginpwd){ return -1; }
else{ //成功登录
$dsql->ExecuteNoneQuery("update #@__member set logintime='".time()."',loginip='".GetIP()."' where ID='{$row['ID']}';");
$dsql->Close();
$this->PutLoginInfo($row['ID']);
$this->FushCache();
return 1;
}
}else{ //用户不存在
return 0;
}
}
//保存用户cookie
function PutLoginInfo($uid){
$this->M_ID = $uid;
$this->M_LoginTime = time();
PutCookie("DedeUserID",$uid,$this->M_KeepTime);
PutCookie("DedeLoginTime",$this->M_LoginTime,$this->M_KeepTime);
}
//获得会员目前的状态
function GetSta($dsql)
{
$sta = "";
if($this->M_Type==0) $sta .= "你目前的身份是:未审核会员 ";
else{
$row = $dsql->GetOne("Select membername From #@__arcrank where rank='".$this->M_Type."'");
$sta .= "你目前的身份是:".$row['membername'];
if($this->M_Type>10){
$sta .= " 剩余天数: ".$this->M_HasDay." 天 ";
}
}
$sta .= " 你目前拥有金币:".$this->M_Money." 个。";
return $sta;
}
}
?> | zyyhong | trunk/jiaju001/news/include/inc_memberlogin.php | PHP | asf20 | 8,006 |
<?php
if(!defined('DEDEINC'))
{
exit("Request Error!");
}
require_once(dirname(__FILE__)."/inc_channel_unit.php");
require_once(dirname(__FILE__)."/inc_typelink.php");
/******************************************************
//Copyright 2004-2006 by DedeCms.com itprato
//本类的用途是用于解析和创建全局性质的模板,如频道封面,主页,单个页面等
******************************************************/
class PartView
{
var $dsql;
var $dtp;
var $dtp2;
var $TypeID;
var $Fields;
var $TypeLink;
var $pvCopy;
var $TempletsFile;
var $OldCacheTime;
//-------------------------------
//php5构造函数
//-------------------------------
function __construct($typeid=0)
{
global $PubFields;
$this->TypeID = $typeid;
$this->dsql = new DedeSql(false);
$this->dtp = new DedeTagParse();
$this->dtp->SetNameSpace("dede","{","}");
$this->dtp2 = new DedeTagParse();
$this->dtp2->SetNameSpace("field","[","]");
$this->TypeLink = new TypeLink($typeid);
$this->TempletsFile = '';
$this->OldCacheTime = -100;
if(is_array($this->TypeLink->TypeInfos))
{
foreach($this->TypeLink->TypeInfos as $k=>$v)
{
if(ereg("[^0-9]",$k)) $this->Fields[$k] = $v;
}
}
//设置一些全局参数的值
foreach($PubFields as $k=>$v) $this->Fields[$k] = $v;
}
//php4构造函数
//---------------------------
function PartView($typeid=0){
$this->__construct($typeid);
}
//设置要解析的模板
//------------------------
function SetTemplet($temp,$stype="file")
{
$this->OldCacheTime = $GLOBALS['cfg_al_cachetime'];
$GLOBALS['cfg_al_cachetime'] = 0;
if($stype=="string") $this->dtp->LoadSource($temp);
else{
$this->dtp->LoadTemplet($temp);
$this->TempletsFile = ereg_replace("^".$GLOBALS['cfg_basedir'],'',$temp);
}
if($this->TypeID > 0){
$this->Fields['position'] = $this->TypeLink->GetPositionLink(true);
$this->Fields['title'] = $this->TypeLink->GetPositionLink(false);
}
$this->ParseTemplet();
}
//显示内容
//-----------------------
function Display(){
$this->dtp->Display();
if($this->OldCacheTime!=-100) $GLOBALS['cfg_al_cachetime'] = $this->OldCacheTime;
}
//获取内容
//-----------------------
function GetResult(){
$rs = $this->dtp->GetResult();
if($this->OldCacheTime!=-100) $GLOBALS['cfg_al_cachetime'] = $this->OldCacheTime;
return $rs;
}
//保存结果为文件
//------------------------
function SaveToHtml($filename){
$this->dtp->SaveTo($filename);
if($this->OldCacheTime!=-100) $GLOBALS['cfg_al_cachetime'] = $this->OldCacheTime;
}
//解析的模板
/*
function __ParseTemplet();
*/
//------------------------
function ParseTemplet()
{
//global $envTypeid;
//if(!isset($envTypeid)) $envTypeid = 0;
if(!is_array($this->dtp->CTags)) return "";
foreach($this->dtp->CTags as $tagid=>$ctag)
{
$tagname = $ctag->GetName();
if($tagname=="field"){
//获得 field 标记值
@$this->dtp->Assign($tagid,$this->Fields[$ctag->GetAtt('name')]);
}else if($tagname=="onetype"||$tagname=="type"){
//获得单个栏目属性
$this->dtp->Assign($tagid,$this->GetOneType($ctag->GetAtt('typeid'),$ctag->GetInnerText()));
}else if($tagname=="autochannel"){
//获得自动栏目内容
$this->dtp->Assign($tagid,
$this->GetAutoChannel($ctag->GetAtt('partsort'),$ctag->GetInnerText(),$ctag->GetAtt('typeid'))
);
}else if($tagname=="arclist"||$tagname=="artlist"||$tagname=="likeart"||$tagname=="hotart"||
$tagname=="imglist"||$tagname=="imginfolist"||$tagname=="coolart"||$tagname=="specart"||$tagname=="autolist")
{ //特定的文章列表
$autopartid = 0;
$channelid = $ctag->GetAtt("channelid");
if($tagname=="imglist"||$tagname=="imginfolist"){ $listtype = "image"; }
else if($tagname=="specart"){ $channelid = -1; $listtype=""; }
else if($tagname=="coolart"){ $listtype = "commend"; }
else if($tagname=="autolist"){ $autopartid = $ctag->GetAtt('partsort'); }
else{ $listtype = $ctag->GetAtt('type'); }
//排序
if($ctag->GetAtt('sort')!="") $orderby = $ctag->GetAtt('sort');
else if($tagname=="hotart") $orderby = "click";
else $orderby = $ctag->GetAtt('orderby');
//对相应的标记使用不同的默认innertext
if(trim($ctag->GetInnerText())!="") $innertext = $ctag->GetInnerText();
else if($tagname=="imglist") $innertext = GetSysTemplets("part_imglist.htm");
else if($tagname=="imginfolist") $innertext = GetSysTemplets("part_imginfolist.htm");
else $innertext = GetSysTemplets("part_arclist.htm");
$typeid = trim($ctag->GetAtt("typeid"));
if(empty($typeid)) $typeid = $this->TypeID;
if(!isset($titlelen)) $titlelen = '';
if(!isset($infolen)) $infolen = '';
$this->dtp->Assign($tagid,
$this->GetArcList(
$this->TempletsFile,
$typeid,$ctag->GetAtt("row"),$ctag->GetAtt("col"),
$ctag->GetAtt("titlelen"),$ctag->GetAtt("infolen"),$ctag->GetAtt("imgwidth"),$ctag->GetAtt("imgheight"),
$ctag->GetAtt("type"),$orderby,$ctag->GetAtt("keyword"),$innertext,
$ctag->GetAtt("tablewidth"),0,"",$channelid,$ctag->GetAtt("limit"),$ctag->GetAtt("att"),
$ctag->GetAtt("orderway"),$ctag->GetAtt("subday"),$autopartid,$ctag->GetAtt("ismember")
)
);
}else if($tagname=="channelartlist"){
//获得频道的下级栏目列表及文档列表
$this->dtp->Assign($tagid,
$this->GetChannelList(trim($ctag->GetAtt('typeid')),$ctag->GetAtt('col'),$ctag->GetAtt('tablewidth'),$ctag->GetInnerText())
);
}else if($tagname=="hotwords"){
//热门关键字
$this->dtp->Assign($tagid,
GetHotKeywords($this->dsql,$ctag->GetAtt('num'),$ctag->GetAtt('subday'),$ctag->GetAtt('maxlength'),$ctag->GetAtt('orderby')));
}
else if($tagname=="channel"){
//获得栏目连接列表
$typeid = trim($ctag->GetAtt('typeid'));
if( empty($typeid) ){
$typeid = $this->TypeID;
$reid = $this->TypeLink->TypeInfos['reID'];
}else{
$reid=0;
}
$this->dtp->Assign($tagid,
$this->TypeLink->GetChannelList($typeid,$reid,$ctag->GetAtt("row"),
$ctag->GetAtt("type"),$ctag->GetInnerText(),
$ctag->GetAtt("col"),$ctag->GetAtt("tablewidth"),
$ctag->GetAtt("currentstyle"))
);
}else if($tagname=="mytag"){
//自定义标记
$this->dtp->Assign($tagid,
$this->GetMyTag($ctag->GetAtt("typeid"),$ctag->GetAtt("name"),$ctag->GetAtt("ismake"))
);
}else if($tagname=="myad"){
//广告代码
$this->dtp->Assign($tagid,
$this->GetMyAd($ctag->GetAtt("typeid"),$ctag->GetAtt("name"))
);
}else if($tagname=="vote"){
//投票
$this->dtp->Assign($tagid,
$this->GetVote(
$ctag->GetAtt("id"),$ctag->GetAtt("lineheight"),
$ctag->GetAtt("tablewidth"),$ctag->GetAtt("titlebgcolor"),
$ctag->GetAtt("titlebackground"),$ctag->GetAtt("tablebgcolor")
)
);
}else if($tagname=="friendlink"||$tagname=="flink"){
//友情链接
$this->dtp->Assign($tagid,
$this->GetFriendLink($ctag->GetAtt("type"),
$ctag->GetAtt("row"),$ctag->GetAtt("col"),
$ctag->GetAtt("titlelen"),$ctag->GetAtt("tablestyle"),
$ctag->GetAtt("linktype"),
$ctag->GetInnerText()
)
);
}else if($tagname=="mynews"){
//站内新闻
$this->dtp->Assign($tagid,
$this->GetMyNews($ctag->GetAtt("row"),$ctag->GetAtt("titlelen"),$ctag->GetInnerText())
);
}else if($tagname=="toparea"){
$this->dtp->Assign($tagid,
$this->GetTopArea($ctag->GetInnerText())
);
}else if($tagname=="loop"){
//数据表操作
$this->dtp->Assign($tagid,
$this->GetTable($ctag->GetAtt("table"),
$ctag->GetAtt("row"),$ctag->GetAtt("sort"),
$ctag->GetAtt("if"),$ctag->GetInnerText()
)
);
}else if($tagname=="sql"){
//数据表操作
$this->dtp->Assign($tagid,
$this->GetSql($ctag->GetAtt("sql"),$ctag->GetInnerText())
);
}else if($tagname=="tag"){
//自定义宏标签
$this->dtp->Assign($tagid,
$this->GetTags($ctag->GetAtt("row"),$ctag->GetAtt("sort"),$ctag->GetInnerText())
);
}
else if($tagname=="groupthread")
{
//圈子主题
$this->dtp->Assign($tagid,
$this->GetThreads($ctag->GetAtt("gid"),$ctag->GetAtt("row"),
$ctag->GetAtt("orderby"),$ctag->GetAtt("orderway"),$ctag->GetInnerText())
);
}
else if($tagname=="group")
{
//圈子
$this->dtp->Assign($tagid,
$this->GetGroups($ctag->GetAtt("row"),$ctag->GetAtt("orderby"),$ctag->GetInnerText())
);
}
else if($tagname=="ask")
{
//问答
$this->dtp->Assign($tagid,
$this->GetAsk($ctag->GetAtt("row"),$ctag->GetAtt("qtype"),$ctag->GetInnerText()),$ctag->GetAtt("typeid")
);
}
//特定条件的文档调用
else if($tagname=="arcfulllist"||$tagname=="fulllist"||$tagname=="likeart"||$tagname=="specart")
{
$channelid = $ctag->GetAtt("channelid");
if($tagname=="specart"){ $channelid = -1; }
$typeid = trim($ctag->GetAtt("typeid"));
if(empty($typeid)) $typeid = $this->TypeID;
$this->dtp->Assign($tagid,
$this->GetFullList(
$typeid,$channelid,$ctag->GetAtt("row"),$ctag->GetAtt("titlelen"),$ctag->GetAtt("infolen"),
$ctag->GetAtt("keyword"),$ctag->GetInnerText(),$ctag->GetAtt("idlist"),$ctag->GetAtt("limitv"),$ctag->GetAtt("ismember"),
$ctag->GetAtt("orderby"),$ctag->GetAtt("imgwidth"),$ctag->GetAtt("imgheight")
)
);
}
}//End Foreach
}
//------------------------------------
//获得限定模型或栏目的一个指定文档列表
//这个标记由于使用了缓存,并且处理数据是支持分表模式的,因此速度更快,但不能进行整站的数据调用
//---------------------------------
function GetArcList($templets='',$typeid=0,$row=10,$col=1,$titlelen=30,$infolen=160,
$imgwidth=120,$imgheight=90,$listtype="all",$orderby="default",$keyword="",$innertext="",
$tablewidth="100",$arcid=0,$idlist="",$channelid=0,$limit="",$att=0,$order='desc',$subday=0,
$autopartid=-1,$ismember=0)
{
if(empty($autopartid)) $autopartid = -1;
if(empty($typeid)) $typeid=$this->TypeID;
if($autopartid!=-1){
$typeid = $this->GetAutoChannelID($autopartid,$typeid);
if($typeid==0) return "";
}
if(!isset($GLOBALS['__SpGetArcList'])) require_once(dirname(__FILE__)."/inc/inc_fun_SpGetArcList.php");
return SpGetArcList($this->dsql,$templets,$typeid,$row,$col,$titlelen,$infolen,$imgwidth,$imgheight,$listtype,
$orderby,$keyword,$innertext,$tablewidth,$arcid,$idlist,$channelid,$limit,$att,$order,$subday,$ismember);
}
//获得整站一个指定的文档列表
//---------------------------------
function GetFullList($typeid=0,$channelid=0,$row=10,$titlelen=30,$infolen=160,
$keyword='',$innertext='',$idlist='',$limitv='',$ismember=0,$orderby='',$imgwidth=120,
$imgheight=120,$autopartid=-1)
{
if(empty($autopartid)) $autopartid = -1;
if(empty($typeid)) $typeid=$this->TypeID;
if($autopartid!=-1){
$typeid = $this->GetAutoChannelID($autopartid,$typeid);
if($typeid==0) return "";
}
if(!isset($GLOBALS['__SpGetFullList'])) require_once(dirname(__FILE__)."/inc/inc_fun_SpFullList.php");
return SpGetFullList($this->dsql,$typeid,$channelid,$row,$titlelen,$infolen,$keyword,$innertext,
$idlist,$limitv,$ismember,$orderby,$imgwidth,$imgheight);
}
//GetChannelList($typeid=0,$col=2,$tablewidth=100,$innertext="")
//获得一个包含下级类目文档列表信息列表
//---------------------------------
function GetChannelList($typeid=0,$col=2,$tablewidth=100,$innertext="")
{
if($typeid=="") $typeid=0;
if($typeid==0 && !empty($this->TypeID)) $typeid = $this->TypeID;
if($col=="") $col=2;
$tablewidth = str_replace("%","",$tablewidth);
if($tablewidth=="") $tablewidth=100;
if($col=="") $col = 1;
$colWidth = ceil(100/$col);
$tablewidth = $tablewidth."%";
$colWidth = $colWidth."%";
if($innertext=="") $innertext = GetSysTemplets("part_channelartlist.htm");
//获得类别ID总数的信息
//----------------------------
$typeids = "";
if($typeid==0){
$this->dsql->SetQuery("Select ID from #@__arctype where reID='0' And ispart<2 And ishidden<>'1' order by sortrank asc");
$this->dsql->Execute();
while($row = $this->dsql->GetObject()){ $typeids[] = $row->ID; }
}else{
if(!ereg(",",$typeid)){
$this->dsql->SetQuery("Select ID from #@__arctype where reID='".$typeid."' And ispart<2 And ishidden<>'1' order by sortrank asc");
$this->dsql->Execute();
while($row = $this->dsql->GetObject()){ $typeids[] = $row->ID; }
}else{
$ids = explode(",",$typeid);
foreach($ids as $id){
$id = trim($id); if($id!=""){ $typeids[] = $id; }
}
}
}
if(!is_array($typeids)) return "";
if(count($typeids)<1) return "";
$nrow = count($typeids);
$artlist = "";
$dtp = new DedeTagParse();
$dtp->LoadSource($innertext);
if($col>1){ $artlist = "<table width='$tablewidth' border='0' cellspacing='0' cellpadding='0'>\r\n"; }
for($i=0;$i < $nrow;)
{
if($col>1) $artlist .= "<tr>\r\n";
for($j=0;$j<$col;$j++)
{
if($col>1) $artlist .= " <td width='$colWidth' valign='top'>\r\n";
if(isset($typeids[$i]))
{
foreach($dtp->CTags as $tid=>$ctag)
{
$sql = "select reid from #@__arctype where ID={$typeids[$i]}";
$trow = $this->dsql->GetOne($sql);
$tagname = $ctag->GetName();
if($tagname=="type"){
$dtp->Assign($tid,$this->GetOneType($typeids[$i],$ctag->GetInnerText()));
}
else if($tagname=="arclist")
{
$dtp->Assign($tid,$this->GetArcList($this->TempletsFile,$typeids[$i],$ctag->GetAtt('row'),
$ctag->GetAtt('col'),$ctag->GetAtt('titlelen'),$ctag->GetAtt('infolen'),
$ctag->GetAtt('imgwidth'),$ctag->GetAtt('imgheight'),$ctag->GetAtt('type'),
$ctag->GetAtt('orderby'),$ctag->GetAtt('keyword'),$ctag->GetInnerText(),
$ctag->GetAtt('tablewidth'),$ctag->GetAtt('arcid'),$ctag->GetAtt('idlist'),
$ctag->GetAtt('channel'),$ctag->GetAtt('limit'),$ctag->GetAtt('att'),
$ctag->GetAtt('order'),$ctag->GetAtt('subday')
-1,0,0
)
);
}
else if($tagname=="channel"){
$dtp->Assign($tid,
$this->TypeLink->GetChannelList(
$typeids[$i],$trow['reid'],$ctag->GetAtt("row"),
$ctag->GetAtt("type"),$ctag->GetInnerText(),
$ctag->GetAtt("col"),$ctag->GetAtt("tablewidth"),
$ctag->GetAtt("currentstyle")
)
);
}
}
$artlist .= $dtp->GetResult();
}
if($col>1) $artlist .= " </td>\r\n";
$i++;
}//Loop Col
if($col>1){ $artlist .= " </tr>\r\n";}
}//Loop Line
if($col>1) $artlist .= " </table>\r\n";
return $artlist;
}
//获取自定义标记的值
//---------------------------
function GetMyTag($typeid=0,$tagname="",$ismake="no")
{
if(trim($ismake)=="") $ismake = "no";
$body = $this->GetMyTagT($typeid,$tagname,"#@__mytag");
//编译
if($ismake=="yes"){
$this->pvCopy = new PartView($typeid);
$this->pvCopy->SetTemplet($body,"string");
$body = $this->pvCopy->GetResult();
}
return $body;
}
//获取广告值
//---------------------------
function GetMyAd($typeid=0,$tagname=""){
return $this->GetMyTagT($typeid,$tagname,"#@__myad");
}
function GetMyTagT($typeid,$tagname,$tablename){
if($tagname=="") return "";
if(trim($typeid)=="") $typeid=0;
if($this->TypeID > 0 && $typeid==0) $typeid = $this->TypeID;
$row = "";
$pids = Array();
if($typeid > 0) $pids = GetParentIDS($typeid,$this->dsql);
$idsql = " typeid='0' ";
foreach($pids as $v){ $idsql .= " Or typeid='$v' "; }
$row = $this->dsql->GetOne(" Select * From $tablename where tagname like '$tagname' And ($idsql) order by typeid desc ");
if(!is_array($row)){ return ""; }
else{
$nowtime = time();
if($row['timeset']==1 && ($nowtime<$row['starttime'] || $nowtime>$row['endtime']) )
{ $body = $row['expbody']; }
else{ $body = $row['normbody']; }
}
return $body;
}
function GetTopArea($innertext)
{
$str = '<option value="0">-不限-</option>';
$this->dsql->SetQuery("select * from #@__area where reid=0 order by disorder asc, id asc");
$this->dsql->Execute();
if(!$innertext){
$innertext = '<option value="[field:id/]">[field:name/]</option>';
}
while($row = $this->dsql->getarray())
{
$str .= str_replace(array('[field:id/]','[field:name/]'),array($row['id'],$row['name']),$innertext);
//'<option value="'.$row['id'].'">'.$row['name']."</option>\n";
}
return $str;
}
//获取站内新闻消息
//--------------------------
function GetMyNews($row=1,$titlelen=30,$innertext=""){
if($row=="") $row=1;
if($titlelen=="") $titlelen=30;
if($innertext=="") $innertext = GetSysTemplets("mynews.htm");
if($this->TypeID > 0){
$topid = SpGetTopID($this->TypeID);
$idsql = " where typeid='$topid' ";
}else{
$idsql = "";
}
$this->dsql->SetQuery("Select * from #@__mynews $idsql order by senddate desc limit 0,$row");
$this->dsql->Execute();
$ctp = new DedeTagParse();
$ctp->SetNameSpace("field","[","]");
$ctp->LoadSource($innertext);
$revalue = "";
while($row = $this->dsql->GetArray())
{
foreach($ctp->CTags as $tagid=>$ctag){
@$ctp->Assign($tagid,$row[$ctag->GetName()]);
}
$revalue .= $ctp->GetResult();
}
return $revalue;
}
//获得一个类目的链接信息
//------------------------------
function GetOneType($typeid,$innertext=""){
$row = $this->dsql->GetOne("Select ID,typedir,isdefault,defaultname,ispart,namerule2,typename,moresite,siterefer,siteurl,sitepath From #@__arctype where ID='$typeid'");
if(!is_array($row)) return "";
if(trim($innertext)=="") $innertext = GetSysTemplets("part_type_list.htm");
$dtp = new DedeTagParse();
$dtp->SetNameSpace("field","[","]");
$dtp->LoadSource($innertext);
if(!is_array($dtp->CTags)){ unset($dtp); return ""; }
else{
$row['typelink'] = GetTypeUrl($row['ID'],MfTypedir($row['typedir']),$row['isdefault'],
$row['defaultname'],$row['ispart'],$row['namerule2'],$row['siteurl']);
foreach($dtp->CTags as $tagid=>$ctag){
if(isset($row[$ctag->GetName()])){ $dtp->Assign($tagid,$row[$ctag->GetName()]); }
}
$revalue = $dtp->GetResult();
unset($dtp);
return $revalue;
}
}
//----------------------------------------
//获得任意表的内容
//----------------------------------------
function GetTable($tablename="",$row=6,$sort="",$ifcase="",$InnerText=""){
$InnerText = trim($InnerText);
if($tablename==""||$InnerText=="") return "";
$row = AttDef($row,6);
if($sort!="") $sort = " order by $sort desc ";
if($ifcase!="") $ifcase=" where $ifcase ";
$revalue="";
$this->dsql->SetQuery("Select * From $tablename $ifcase $sort limit 0,$row");
$this->dsql->Execute();
$ctp = new DedeTagParse();
$ctp->SetNameSpace("field","[","]");
$ctp->LoadSource($InnerText);
while($row = $this->dsql->GetArray())
{
foreach($ctp->CTags as $tagid=>$ctag){
if(!empty($row[$ctag->GetName()]))
{ $ctp->Assign($tagid,$row[$ctag->GetName()]); }
}
$revalue .= $ctp->GetResult();
}
return $revalue;
}
//----------------------------------------
//通过任意SQL查询获得内容
//----------------------------------------
function GetSql($sql="",$InnerText=""){
$InnerText = trim($InnerText);
if($sql==""||$InnerText=="") return "";
$revalue = "";
$this->dsql->SetQuery($sql);
$this->dsql->Execute();
$ctp = new DedeTagParse();
$ctp->SetNameSpace("field","[","]");
$ctp->LoadSource($InnerText);
while($row = $this->dsql->GetArray())
{
foreach($ctp->CTags as $tagid=>$ctag){
if(isset($row[$ctag->GetName()]))
{ $ctp->Assign($tagid,$row[$ctag->GetName()]); }
}
$revalue .= $ctp->GetResult();
}
return $revalue;
}
//----------------------------------------
//获得标签
//----------------------------------------
function GetTags($num,$ltype='new',$InnerText=""){
global $cfg_cmspath;
$InnerText = trim($InnerText);
if($InnerText=="") $InnerText = GetSysTemplets("tag_one.htm");
$revalue = "";
if($ltype=='rand') $orderby = ' rand() ';
else if($ltype=='week') $orderby=' weekcc desc ';
else if($ltype=='month') $orderby=' monthcc desc ';
else if($ltype=='hot') $orderby=' count desc ';
else $orderby = ' id desc ';
if(empty($num)) $num = 10;
$this->dsql->SetQuery("Select tagname,count,monthcc,result From #@__tag_index order by $orderby limit 0,$num");
$this->dsql->Execute();
$ctp = new DedeTagParse();
$ctp->SetNameSpace("field","[","]");
$ctp->LoadSource($InnerText);
while($row = $this->dsql->GetArray())
{
$row['keyword'] = $row['tagname'];
$row['link'] = $cfg_cmspath."/tag.php?/".urlencode($row['keyword'])."/";
$row['highlight'] = $row['keyword'];
$row['result'] = trim($row['result']);
if(empty($row['result'])) $row['result'] = 0;
if($ltype=='view'||$ltype=='rand'||$ltype=='new'){
if($row['monthcc']>1000 || $row['weekcc']>300 ){
$row['highlight'] = "<span style='font-size:".mt_rand(12,16)."px;color:red'><b>{$row['highlight']}</b></span>";
}
else if($row['result']>150){
$row['highlight'] = "<span style='font-size:".mt_rand(12,16)."px;color:blue'>{$row['highlight']}</span>";
}
else if($row['count']>1000){
$row['highlight'] = "<span style='font-size:".mt_rand(12,16)."px;color:red'>{$row['highlight']}</span>";
}
}else{
$row['highlight'] = "<span style='font-size:".mt_rand(12,16)."px;'>{$row['highlight']}</span>";
}
foreach($ctp->CTags as $tagid=>$ctag){
if(isset($row[$ctag->GetName()])) $ctp->Assign($tagid,$row[$ctag->GetName()]);
}
$revalue .= $ctp->GetResult();
}
return $revalue;
}
/*调用圈子模块相关方法*/
//最新主题调用 $num:贴子数,$gid:圈子ID,$dsql数据连接,$h:依照什么排序,$orders:排序方法
function GetThreads($gid=0,$num=0,$orderby="dateline",$orderway="DESC",$innertext='')
{
global $cfg_group_url,$cfg_dbprefix;
if( !$this->dsql->IsTable("{$cfg_dbprefix}group_threads") ) return '没安装问答模块';
$num = AttDef($num,12);
$gid = AttDef($gid,0);
$orderway = AttDef($orderway,'desc');
$orderby = AttDef($orderby,'dateline');
if(trim($innertext)=="") $innertext = GetSysTemplets("groupthreads.htm");
$WhereSql = " WHERE t.closed=0 ";
$orderby = 't.'.$orderby;
if($gid > 0) $WhereSql .= " AND t.gid='$gid' ";
$this->dsql->SetQuery("SELECT t.subject,t.gid,t.tid,t.lastpost,g.groupname FROM #@__group_threads t left join #@__groups g on g.groupid=t.gid $WhereSql ORDER BY $orderby $orderway LIMIT 0,{$num}");
$this->dsql->Execute();
$ctp = new DedeTagParse();
$ctp->SetNameSpace("field","[","]");
if(!isset($list)) $list = '';
while($rs = $this->dsql->GetArray())
{
$ctp->LoadSource($innertext);
$rs['url'] = $cfg_group_url."/viewthread.php?id={$rs['gid']}&tid={$rs['tid']}";
$rs['groupurl'] = $cfg_group_url."/group.php?id={$rs['gid']}";
foreach($ctp->CTags as $tagid=>$ctag){
if(!empty($rs[strtolower($ctag->GetName())])){ $ctp->Assign($tagid,$rs[$ctag->GetName()]); }
}
$list .= $ctp->GetResult();
}
return $list;
}
function GetGroups($nums=0,$orderby='threads',$innertext='')
{
global $cfg_group_url,$cfg_dbprefix;
if( !$this->dsql->IsTable("{$cfg_dbprefix}groups") ) return '没安装圈子模块';
$list = '';
$nums = AttDef($nums,6);
$orderby = AttDef($orderby,'threads');
if(trim($innertext)=='') $innertext = GetSysTemplets("groups.htm");
$this->dsql->SetQuery("SELECT groupimg,groupid,groupname FROM #@__groups WHERE ishidden=0 ORDER BY $orderby DESC LIMIT 0,{$nums}");
$this->dsql->Execute();
$ctp = new DedeTagParse();
$ctp->SetNameSpace("field","[","]");
while($rs = $this->dsql->GetArray())
{
$ctp->LoadSource($innertext);
$rs['url'] = $cfg_group_url."/group.php?id={$rs['groupid']}";
$rs['icon'] = $rs['groupimg'];
foreach($ctp->CTags as $tagid=>$ctag){
if(!empty($rs[strtolower($ctag->GetName())])){ $ctp->Assign($tagid,$rs[$ctag->GetName()]); }
}
$list .= $ctp->GetResult();
}
return $list;
}
//调用问答最新主题
//--------------------------------
function GetAsk($nums=8,$qtype='new',$innertext='',$tid=0)
{
global $cfg_ask_url,$cfg_dbprefix;
if( !$this->dsql->IsTable("{$cfg_dbprefix}ask") ) return '没安装问答模块';
$nums = AttDef($nums,6);
$qtype = AttDef($qtype,'new');
$tid = AttDef($tid,0);
if(trim($innertext)=='') $innertext = GetSysTemplets("asks.htm");
$qtypeQuery = '';
if($tid>0) $tid = " (tid=$tid Or $tid2='$tid') And ";
else $tid = '';
//推荐问题
if($qtype=='commend') $qtypeQuery = " $tid digest=1 order by dateline desc ";
//新解决问题
else if($qtype=='ok') $qtypeQuery = " $tid status=1 order by solvetime desc ";
//高分问题
else if($qtype=='high') $qtypeQuery = " $tid status=0 order by reward desc ";
//新问题
else $qtypeQuery = " $tid status=0 order by disorder desc, dateline desc ";
$ctp = new DedeTagParse();
$ctp->SetNameSpace("field","[","]");
$query = "select id, tid, tidname, tid2, tid2name, title from #@__ask where $qtypeQuery limit $nums";
$this->dsql->Execute('me',$query);
$solvingask = '';
while($rs = $this->dsql->GetArray('me'))
{
$ctp->LoadSource($innertext);
if($rs['tid2name']!='')
{
$rs['tid'] = $rs['tid2'];
$rs['tidname'] = $rs['tid2name'];
}
$rs['url'] = $cfg_ask_url."/question.php?id={$rs['id']}";
$rs['typeurl'] = $cfg_ask_url."/browser.php?tid={$rs['tid']}";
foreach($ctp->CTags as $tagid=>$ctag){
if(!empty($rs[strtolower($ctag->GetName())])){ $ctp->Assign($tagid,$rs[$ctag->GetName()]); }
}
$solvingask .= $ctp->GetResult();
}
return $solvingask;
}
//获得一组投票
//-------------------------
function GetVote($id=0,$lineheight=24,$tablewidth="100%",$titlebgcolor="#EDEDE2",$titlebackgroup="",$tablebg="#FFFFFF"){
if($id=="") $id=0;
if($id==0){
$row = $this->dsql->GetOne("select aid From #@__vote order by aid desc limit 0,1");
if(!isset($row['aid'])) return "";
else $id=$row['aid'];
}
include_once(dirname(__FILE__)."/inc_vote.php");
$vt = new DedeVote($id);
//$vt->Close();
return $vt->GetVoteForm($lineheight,$tablewidth,$titlebgcolor,$titlebackgroup,$tablebg);
}
//获取友情链接列表
//------------------------
function GetFriendLink($type="",$row="",$col="",$titlelen="",$tablestyle="",$linktype=1,$innertext=''){
$type = AttDef($type,"textall");
$row = AttDef($row,4);
$col = AttDef($col,6);
if($linktype=="") $linktype = 1;
$titlelen = AttDef($titlelen,24);
$tablestyle = AttDef($tablestyle," width='100%' border='0' cellspacing='1' cellpadding='1' ");
$tdwidth = round(100/$col)."%";
$totalrow = $row*$col;
if($innertext=='') $innertext = " [field:link/] ";
$wsql = " where ischeck >= '$linktype' ";
if($type=="image") $wsql .= " And logo<>'' ";
else if($type=="text") $wsql .= " And logo='' ";
else $wsql .= "";
$equery = "Select * from #@__flink $wsql order by sortrank asc limit 0,$totalrow";
$this->dsql->SetQuery($equery);
$this->dsql->Execute();
$revalue = "";
while($row = $this->dsql->GetArray())
{
if($type=="text"||$type=="textall")
$row['link'] = "<a href='".$row['url']."' target='_blank'>".cn_substr($row['webname'],$titlelen)."</a>";
else if($type=="image")
$row['link'] = "<a href='".$row['url']."' target='_blank'><img alt='".str_replace("'","`",$row['webname'])."' src='".$row['logo']."' border='0'></a>";
else{
if($row['logo']=="")
$row['link'] = " <a href='".$row['url']."' target='_blank'>".cn_substr($row['webname'],$titlelen)."</a>";
else
$row['link'] = " <a href='".$row['url']."' target='_blank'><img alt='".str_replace("'","`",$row['webname'])."' src='".$row['logo']."' border='0'></a>";
}
$rbtext = preg_replace("/\[field:url([\s]{0,})\/\]/isU",$row['url'],$innertext);
$rbtext = preg_replace("/\[field:webname([\s]{0,})\/\]/isU",$row['ID'],$rbtext);
$rbtext = preg_replace("/\[field:logo([\s]{0,})\/\]/isU",$row['logo'],$rbtext);
$rbtext = preg_replace("/\[field:link([\s]{0,})\/\]/isU",$row['link'],$rbtext);
$revalue .= $rbtext;
}
return $revalue;
}
//按排列顺序获得一个下级分类信息
function GetAutoChannel($sortid,$innertext,$topid="-1"){
if($topid=="-1" || $topid=="") $topid = $this->TypeID;
$typeid = $this->GetAutoChannelID($sortid,$topid);
if($typeid==0) return "";
if(trim($innertext)=="") $innertext = GetSysTemplets("part_autochannel.htm");
return $this->GetOneType($typeid,$innertext);
}
function GetAutoChannelID($sortid,$topid){
if(empty($sortid)) $sortid = 1;
$getstart = $sortid - 1;
$row = $this->dsql->GetOne("Select ID,typename From #@__arctype where reid='{$topid}' And ispart<2 And ishidden<>'1' order by sortrank asc limit $getstart,1");
if(!is_array($row)) return 0;
else return $row['ID'];
}
//---------------------------
//关闭所占用的资源
//---------------------------
function Close(){
$this->dsql->Close();
if(is_object($this->TypeLink)) $this->TypeLink->Close();
}
}//End Class
?> | zyyhong | trunk/jiaju001/news/include/inc_arcpart_view.php | PHP | asf20 | 31,222 |
<?php
require_once './../../site/cache/ad_index.php'; $ad= unserialize(stripslashes($ad));
?>
<div class="note"><div style="text-align:right"><div style="float:left"><strong>活动与公告</strong></div><a href='http://www.homebjjj.com/huodong/'>更多>></a></div>
<?php
if($ad['event']){
foreach($ad['event'] as $a){
echo '<a href="http://www.jiaju001.com',$a['url'],'">',$a['title'],'</a><br />';
}
}
?></div>
| zyyhong | trunk/jiaju001/news/include/index.right.php | PHP | asf20 | 425 |
<?php
if(!defined('DEDEINC'))
{
exit("Request Error!");
}
require_once(dirname(__FILE__)."/pub_dedetag.php");
$lang_pre_page = "上页";
$lang_next_page = "下页";
$lang_index_page = "首页";
$lang_end_page = "末页";
//////////////////////////////////////////////
class DataList
{
var $sourceSql;
var $nowPage;
var $totalResult;
var $pageSize;
var $queryTime;
var $inTagS;
var $inTagE;
var $getValues;
var $dtp;
var $dsql;
//构造函数///////
//-------------
function __construct()
{
global $nowpage,$totalresult;
if($nowpage==""||ereg("[^0-9]",$nowpage)) $nowpage=1;
if($totalresult==""||ereg("[^0-9]",$totalresult)) $totalresult=0;
$this->sourceSql="";
$this->pageSize=20;
$this->queryTime=0;
$this->inTagS = "[";
$this->inTagE = "]";
$this->getValues=Array();
$this->dtp;
$this->dsql = new DedeSql(false);
$this->nowPage = $nowpage;
$this->totalResult = $totalresult;
}
function DataList()
{
$this->__construct();
}
function Init()
{
return "";
}
//设置要解析的模板
function SetTemplet($modpage)
{
if(!file_exists($modpage))
{
$this->dsql->DisplayError("Load templet <font color='red'>".$modpage."</font> false");
exit();
}
$this->dtp = new DedeTagParse();
$this->dtp->LoadTemplate($modpage);
$pid = $this->dtp->GetTagID("page");
if($pid!=-1) $this->pageSize = $this->dtp->CTags[$pid]->GetAtt("pagesize");
}
//设置网址的Get参数键值
function SetParameter($key,$value)
{
$this->getValues[$key] = $value;
}
function SetSource($sql)
{
$this->sourceSql = trim($sql);
}
//显示模板
function Display()
{
$dlistid = $this->dtp->GetTagID("datalist");
if($this->sourceSql!="")
{
$this->dtp->Assign(
$dlistid,
$this->GetDataList($this->dtp->CTags[$dlistid]->InnerText)
);
}
for($i=0;$i<=$this->dtp->Count;$i++)
{
if($this->dtp->CTags[$i]->TagName=="datalist")
continue;
else if($this->dtp->CTags[$i]->TagName=="pagelist")
$this->dtp->Assign($i,$this->GetPageList($this->dtp->CTags[$i]->GetAtt("listsize")));
else
$this->dtp->Assign($i,"");
}
$this->dtp->Display();
}
//保存结果为文件
function SaveTo($filename)
{
$dlistid = $this->dtp->GetTagID("datalist");
$this->dtp->Assign(
$dlistid,
$this->GetDataList($this->dtp->CTags[$dlistid]->InnerText)
);
for($i=0;$i<=$this->dtp->Count;$i++)
{
if($this->dtp->CTags[$i]->TagName=="datalist")
continue;
else if($this->dtp->CTags[$i]->TagName=="pagelist")
$this->dtp->Assign($i,$this->GetPageList($this->dtp->CTags[$i]->GetAtt("listsize")));
else
$this->dtp->Assign($i,"");
}
$this->dtp->SaveTo($filename);
}
//获得解析后的模板结果字符串
function GetResult()
{
$dlistid = $this->dtp->GetTagID("datalist");
$this->dtp->Assign(
$dlistid,
$this->GetDataList($this->dtp->CTags[$dlistid]->InnerText)
);
for($i=0;$i<=$this->dtp->Count;$i++)
{
if($this->dtp->CTags[$i]->TagName=="datalist")
continue;
else if($this->dtp->CTags[$i]->TagName=="pagelist")
$this->dtp->Assign($i,$this->GetPageList($this->dtp->CTags[$i]->GetAtt("listsize")));
}
return $this->dtp->GetResult();
}
//获得列表内容
function GetDataList($innertext)
{
$timedd = "未知";
$starttime = ExecTime();
$DataListValue = "";
if($this->totalResult==0){
$query = preg_replace("/^(.*)[\s]from[\s]/is",'Select count(*) as dd From ',$this->sourceSql);
$rowdm = $this->dsql->GetOne($query);
$this->totalResult = $rowdm['dd'];
}
$this->sourceSql .= " limit ".(($this->nowPage-1)*$this->pageSize).",".$this->pageSize;
$this->dsql->Query('dms',$this->sourceSql);
//计算执行时间
$endtime = $this->ExecTime();
if($starttime!=""&&$endtime!=""){
$timedd=$endtime-$starttime;
if($timedd<0) $timedd=$timedd*(-1.0);
$timedd=substr($timedd,0,5);
}
$this->queryTime = $timedd;
$GLOBALS["limittime"] = $timedd;
$GLOBALS["totalrecord"] = $this->totalResult;
////////////////////////////////////////
$dtp2 = new DedeTagParse();
$dtp2->TagStartWord="[";
$dtp2->TagEndWord="]";
$dtp2->NameSpace="field";
$dtp2->CharToLow=FALSE;
$dtp2->LoadSource($innertext);
$fnum = 0;
while($GLOBALS["row"] = $this->dsql->GetArray('dms'))
{
$fnum++;
for($i=0;$i<=$dtp2->Count;$i++)
{
if(isset($GLOBALS["row"][$dtp2->CTags[$i]->TagName]))
$dtp2->Assign($i,$GLOBALS["row"][$dtp2->CTags[$i]->TagName]);
else
$dtp2->Assign($i,"");
}
$DataListValue .= $dtp2->GetResult();
}
$GLOBALS["row"] = "";
return $DataListValue;
}
//获取分页列表
function GetPageList($list_len)
{
global $lang_pre_page;
global $lang_next_page;
global $lang_index_page;
global $lang_end_page;
$prepage="";
$nextpage="";
$prepagenum = $this->nowPage-1;
$nextpagenum = $this->nowPage+1;
if($list_len==""||ereg("[^0-9]",$list_len)) $list_len=3;
$totalpage = ceil($this->totalResult/$this->pageSize);
if($totalpage<=1&&$this->totalResult>0) return "共1页/".$this->totalResult."条记录";
if($this->totalResult == 0) return "共0页/".$this->totalResult."条记录";
$purl = $this->GetCurUrl();
$geturl="";
$hidenform="";
if($this->totalResult!=0) $this->SetParameter("totalresult",$this->totalResult);
if(count($this->getValues)>0)
{
foreach($this->getValues as $key=>$value)
{
$value = urlencode($value);
$geturl.="$key=$value"."&";
$hidenform.="<input type='hidden' name='$key' value='$value'>\r\n";
}
}
$purl .= "?".$geturl;
//获得上一页和下一页的链接
if($this->nowPage!=1)
{
$prepage.="<td width='50'><a href='".$purl."nowpage=$prepagenum'>$lang_pre_page</a></td>\r\n";
$indexpage="<td width='40'><a href='".$purl."nowpage=1'>$lang_index_page</a></td>\r\n";
}
else
{
$indexpage="<td width='30'>$lang_index_page</td>\r\n";
}
if($this->nowPage!=$totalpage&&$totalpage>1)
{
$nextpage.="<td width='50'><a href='".$purl."nowpage=$nextpagenum'>$lang_next_page</a></td>\r\n";
$endpage="<td width='40'><a href='".$purl."nowpage=$totalpage'>$lang_end_page</a></td>\r\n";
}
else
{
$endpage="<td width='30'>$lang_end_page</td>\r\n";
}
//获得数字链接
$listdd="";
$total_list = $list_len * 2 + 1;
if($this->nowPage>=$total_list)
{
$j=$this->nowPage-$list_len;
$total_list=$this->nowPage+$list_len;
if($total_list>$totalpage) $total_list=$totalpage;
}
else
{
$j=1;
if($total_list>$totalpage) $total_list=$totalpage;
}
for($j;$j<=$total_list;$j++)
{
if($j==$this->nowPage) $listdd.= "<td width='20'>$j</td>\r\n";
else $listdd.="<td width='20'><a href='".$purl."nowpage=$j'>[".$j."]</a></td>\r\n";
}
$plist = "<table border='0' cellpadding='0' cellspacing='0' class='dedePagelist'>\r\n";
$plist.="<tr align='center' style='font-size:10pt'>\r\n";
$plist.="<form name='pagelist' action='".$this->GetCurUrl()."'>$hidenform";
$plist.=$indexpage;
$plist.=$prepage;
$plist.=$listdd;
$plist.=$nextpage;
$plist.=$endpage;
if($totalpage>$total_list)
{
$plist.="<td width='36'><input type='text' name='nowpage' style='width:30px;height:24px'></td>\r\n";
$plist.="<td width='30'><input type='submit' name='plistgo' value='GO' style='width:36px;height:24px;font-size:9pt'></td>\r\n";
}
$plist.="</form>\r\n</tr>\r\n</table>\r\n";
return $plist;
}
//清除系统所占用资源
function ClearList()
{
$this->dsql->Close();
$dtp="";
}
function Clear()
{
$this->ClearList();
}
function Close()
{
$this->ClearList();
}
function ExecTime(){
$time = explode(" ", microtime());
$usec = (double)$time[0];
$sec = (double)$time[1];
return $sec + $usec;
}
function GetCurUrl()
{
if(!empty($_SERVER["REQUEST_URI"])){
$nowurl = $_SERVER["REQUEST_URI"];
$nowurls = explode("?",$nowurl);
$nowurl = $nowurls[0];
}
else
{ $nowurl = $_SERVER["PHP_SELF"]; }
return $nowurl;
}
}
/*
//使用示范
$dlist = new DataList();
$dlist->Init();
$dlist->SetTemplet("dlist.htm");
$dlist->SetSource("select * from #@__admin");
$dlist->Display();//结果等同于 echo $dlist->GetResult();但前者并非是一次性输出的
$dlist->Close();
//dlist.htm
//===============================
//<br/>
//{dede:page pagesize="10"/}
//{dede:datalist}
//[field:ID/] -
//[field:uname/]
//<br/>
//{/dede:datalist}
//{dede:pagelist listsize=1/}
<br/>
*/
?> | zyyhong | trunk/jiaju001/news/include/pub_datalist.php | PHP | asf20 | 8,738 |
<?php
//class TypeUnit
//这个类主要是封装频道管理时的一些复杂操作
//--------------------------------
if(!defined('DEDEINC'))
{
exit("Request Error!");
}
require_once(dirname(__FILE__)."/inc_channel_unit_functions.php");
require_once(dirname(__FILE__)."/../data/cache/inc_catalog_base.php");
class TypeUnit
{
var $dsql;
var $artDir;
var $baseDir;
var $idCounter;
var $idArrary;
var $shortName;
var $aChannels;
var $isAdminAll;
var $CatalogNums;
//-------------
//php5构造函数
//-------------
function __construct($catlogs=''){
$this->idCounter = 0;
$this->artDir = $GLOBALS['cfg_cmspath'].$GLOBALS['cfg_arcdir'];
$this->baseDir = $GLOBALS['cfg_basedir'];
$this->shortName = $GLOBALS['art_shortname'];
$this->idArrary = "";
$this->dsql = new DedeSql(false);
$this->aChannels = Array();
$this->isAdminAll = false;
if(!empty($catlogs) && $catlogs!='-1'){
$this->aChannels = explode(',',$catlogs);
foreach($this->aChannels as $cid)
{
if($_Cs[$cid][0]==0)
{
$this->dsql->SetQuery("Select ID,ispart From `#@__arctype` where reID=$cid");
$this->dsql->Execute();
while($row = $this->dsql->GetObject()){
if($row->ispart!=2) $this->aChannels[] = $row->ID;
}
}
}
}else{
$this->isAdminAll = true;
}
}
function TypeUnit($catlogs='')
{
$this->__construct($catlogs);
}
//------------------
//清理类
//------------------
function Close(){
if(is_object($this->dsql)){
@$this->dsql->Close();
unset($this->dsql);
}
$this->idArrary = "";
$this->idCounter = 0;
}
//------------------------------
function GetTotalArc($tid){
return $this->GetCatalogNum($tid);
}
//
//获取所有栏目的文档ID数
//
function UpdateCatalogNum()
{
$this->dsql->SetQuery("SELECT typeid,count(typeid) as dd FROM `#@__full_search` group by typeid");
$this->dsql->Execute();
while($row = $this->dsql->GetArray()){
$this->CatalogNums[$row['typeid']] = $row['dd'];
}
}
function GetCatalogNum($tid)
{
if(!is_array($this->CatalogNums)){ $this->UpdateCatalogNum(); }
if(!isset($this->CatalogNums[$tid])) return 0;
else
{
$totalnum = 0;
$GLOBALS['idArray'] = array();
$ids = TypeGetSunTypes($tid,$this->dsql,0);
foreach($ids as $tid){
if(isset($this->CatalogNums[$tid])) $totalnum += $this->CatalogNums[$tid];
}
return $totalnum;
}
}
//
//----读出所有分类,在类目管理页(list_type)中使用----------
//
function ListAllType($channel=0,$nowdir=0)
{
$this->dsql->SetQuery("Select ID,typedir,typename,ispart,sortrank,ishidden,channeltype From #@__arctype where reID=0 order by sortrank");
$this->dsql->Execute('pn0');
$lastID = GetCookie('lastCid');
while($row=$this->dsql->GetObject('pn0'))
{
$typeDir = $row->typedir;
$typeName = $row->typename;
$ispart = $row->ispart;
$ID = $row->ID;
$rank = $row->sortrank;
$channeltype = $row->channeltype;
if($row->ishidden=='1') $nss = "<font color='red'>[隐]</font>";
else $nss = "";
//有权限栏目
if($this->isAdminAll===true || in_array($ID,$this->aChannels))
{
//print_r($this->aChannels);
//互动栏目
if($channeltype<-1)
{
echo "<table width='96%' border='0' cellpadding='1' cellspacing='0' align='center' style='margin:0px auto' class='tblist2'>\r\n";
echo "<tr align='center' oncontextmenu=\"CommonMenuWd(this,$ID,'".urlencode($typeName)."')\">\r\n";
echo "<td width='7%'><input class='np' type='checkbox' name='tids[]' value='{$ID}'></td>\r\n";
echo "<td width='6%'>[ID:".$ID."]</td>\r\n";
echo "<td width='27%' align='left'>\r\n<img onClick=\"LoadSuns('suns".$ID."',$ID);\" src='images/class_sopen.gif' width='11' height='15' border='0' align='absmiddle' /> <a href='catalog_do.php?cid=".$ID."&dopost=listArchives' style='font-size:14px; text-decoration:none;'>{$nss}".$typeName."</a><font color='red'>[互]</font> </td>\r\n";
echo "<td width='10%'>(文档:".$this->GetTotalArc($ID).")</td>\r\n";
echo "<td width='8%'>$channeltype</td>\r\n";
echo "<td width='34%' align='right' style='letter-spacing:1px;'>\r\n";
echo "<a href='{$GLOBALS['cfg_plus_dir']}/list.php?tid={$ID}' target='_blank'>预览</a>\r\n";
echo "| <a href='catalog_do.php?cid={$ID}&dopost=listArchives'>内容</a>\r\n";
echo "| <a href='catalog_add.php?ID={$ID}'>添加</a>\r\n";
echo "| <a href='catalog_edit.php?ID={$ID}'>修改</a>\r\n";
echo "| <a href='catalog_move.php?job=movelist&typeid={$ID}'>移动</a>\r\n";
echo "| <a href='catalog_del.php?ID={$ID}&typeoldname=".urlencode($typeName)."'>删除</a>\r\n";
echo "</td><td width='8%'><label>";
echo "<input name='sortrank{$ID}' type='text' id='textfield2' value='{$rank}' size='2' maxlength='4' style='text-align:center;' />";
echo "</label></td>\r\n</tr>\r\n";
echo "</table>\r\n <div id='suns".$ID."'>\r\n";
}
//普通列表
else if($ispart==0)
{
echo "<table width='96%' border='0' cellpadding='1' cellspacing='0' align='center' style='margin:0px auto' class='tblist2'>\r\n";
echo "<tr align='center' oncontextmenu=\"CommonMenu(this,$ID,'".urlencode($typeName)."')\">\r\n";
echo "<td width='7%'><input class='np' type='checkbox' name='tids[]' value='{$ID}'></td>\r\n";
echo "<td width='6%'>[ID:".$ID."]</td>\r\n";
echo "<td width='27%' align='left'><img style='cursor:hand' onClick=\"LoadSuns('suns".$ID."',$ID);\" src='images/class_sopen.gif' width='11' height='15' border='0' align='absmiddle' /> <a href='catalog_do.php?cid=".$ID."&dopost=listArchives' style='font-size:14px; text-decoration:none;'>{$nss}".$typeName."</a></td>\r\n";
echo "<td width='10%'>(文档:".$this->GetTotalArc($ID).")</td>\r\n";
echo "<td width='8%'>$channeltype</td>\r\n";
echo "<td width='34%' align='right' style='letter-spacing:1px;'>\r\n";
echo "<a href='{$GLOBALS['cfg_plus_dir']}/list.php?tid={$ID}' target='_blank'>预览</a>\r\n";
echo "| <a href='catalog_do.php?cid={$ID}&dopost=listArchives'>内容</a>\r\n";
echo "| <a href='catalog_add.php?ID={$ID}'>添加</a>\r\n";
echo "| <a href='catalog_edit.php?ID={$ID}'>修改</a>\r\n";
echo "| <a href='catalog_move.php?job=movelist&typeid={$ID}'>移动</a>\r\n";
echo "| <a href='catalog_del.php?ID={$ID}&typeoldname=".urlencode($typeName)."'>删除</a>\r\n";
echo "</td>\r\n<td width='8%'><label>";
echo "<input name='sortrank{$ID}' type='text' id='textfield2' value='{$rank}' size='2' maxlength='4' style='text-align:center;' />";
echo "</label></td>\r\n</tr>\r\n";
echo "</table>\r\n <div id='suns".$ID."'>\r\n";
}
//带封面的频道
else if($ispart==1)
{
echo "<table width='96%' border='0' cellpadding='1' cellspacing='0' align='center' style='margin:0px auto' class='tblist2'>\r\n";
echo "<tr align='center' oncontextmenu=\"CommonMenuPart(this,$ID,'".urlencode($typeName)."')\">\r\n";
echo "<td width='7%'><input class='np' type='checkbox' name='tids[]' value='{$ID}'></td>\r\n";
echo "<td width='6%'>[ID:".$ID."]</td>\r\n";
echo "<td width='27%' align='left'><img style='cursor:hand' onClick=\"LoadSuns('suns".$ID."',$ID);\" src='images/class_sopen.gif' width='11' height='15' border='0' align='absmiddle' /> <a href='catalog_do.php?cid=".$ID."&dopost=listArchives' style='font-size:14px; text-decoration:none;'>{$nss}".$typeName."</a></td>\r\n";
echo "<td width='10%'>(文档:".$this->GetTotalArc($ID).")</td>\r\n";
echo "<td width='8%'>$channeltype</td>\r\n";
echo "<td width='34%' align='right' style='letter-spacing:1px;'>\r\n";
echo "<a href='{$GLOBALS['cfg_plus_dir']}/list.php?tid={$ID}' target='_blank'>预览</a>\r\n";
echo "| <a href='catalog_do.php?cid={$ID}&dopost=listArchives'>内容</a>\r\n";
echo "| <a href='catalog_add.php?ID={$ID}'>添加</a>\r\n";
echo "| <a href='catalog_edit.php?ID={$ID}'>修改</a>\r\n";
echo "| <a href='catalog_move.php?job=movelist&typeid={$ID}'>移动</a>\r\n";
echo "| <a href='catalog_del.php?ID={$ID}&typeoldname=".urlencode($typeName)."'>删除</a>\r\n";
echo "</td>\r\n<td width='8%'><label>";
echo "<input name='sortrank{$ID}' type='text' id='textfield2' value='{$rank}' size='2' maxlength='4' style='text-align:center;' />";
echo "</label></td>\r\n</tr>\r\n";
echo "</table>\r\n <div id='suns".$ID."'>\r\n";
}
//独立页面
else if($ispart==2)
{
echo "<table width='96%' border='0' cellpadding='1' cellspacing='0' align='center' style='margin:0px auto' class='tblist2'>\r\n";
echo "<tr align='center' oncontextmenu=\"CommonMenuPart(this,$ID,'".urlencode($typeName)."')\">\r\n";
echo "<td width='7%'><input class='np' type='checkbox' name='tids[]' value='{$ID}'></td>\r\n";
echo "<td width='6%'>[ID:".$ID."]</td>\r\n";
echo "<td width='27%' align='left'><img style='cursor:hand' onClick=\"LoadSuns('suns".$ID."',$ID);\" src='images/class_sopen.gif' width='11' height='15' border='0' align='absmiddle' /> <a href='catalog_do.php?cid=".$ID."&dopost=listArchives' style='font-size:14px; text-decoration:none;'>{$nss}".$typeName."</a></td>\r\n";
echo "<td width='10%'>(文档:".$this->GetTotalArc($ID).")</td>\r\n";
echo "<td width='8%'>独立页</td>\r\n";
echo "<td width='34%' align='right' style='letter-spacing:1px;'>\r\n";
echo "<a href='{$GLOBALS['cfg_plus_dir']}/list.php?tid={$ID}' target='_blank'>预览</a>\r\n";
echo "| <a href='catalog_do.php?cid={$ID}&dopost=listArchives'>内容</a>\r\n";
echo "| <a href='catalog_add.php?ID={$ID}'>添加</a>\r\n";
echo "| <a href='catalog_edit.php?ID={$ID}'>修改</a>\r\n";
echo "| <a href='catalog_move.php?job=movelist&typeid={$ID}'>移动</a>\r\n";
echo "| <a href='catalog_del.php?ID={$ID}&typeoldname=".urlencode($typeName)."'>删除</a>\r\n";
echo "</td><td width='8%'><label>";
echo "<input name='sortrank{$ID}' type='text' id='textfield2' value='{$rank}' size='2' maxlength='4' style='text-align:center;' />";
echo "</label></td>\r\n</tr>\r\n";
echo "</table>\r\n <div id='suns".$ID."'>\r\n";
}
//跳转网址
else if($ispart==3)
{
echo "<table width='96%' border='0' cellpadding='1' cellspacing='0' align='center' style='margin:0px auto' class='tblist2'>\r\n";
echo "<tr align='center'>\r\n";
echo "<td width='7%'><input class='np' type='checkbox' name='tids[]' value='{$ID}'></td>\r\n";
echo "<td width='6%'>[ID:".$ID."]</td>\r\n";
echo "<td width='27%' align='left'><img style='cursor:hand' onClick=\"LoadSuns('suns".$ID."',$ID);\" src='images/class_sopen.gif' width='11' height='15' border='0' align='absmiddle' /> <a href='{$GLOBALS['cfg_plus_dir']}/list.php?tid={$ID}' target='_blank' style='font-size:14px; text-decoration:none;'>{$nss}".$typeName."<font color='red'>[跳转]</font></a></td>\r\n";
echo "<td width='10%'>(文档:0)</td>\r\n";
echo "<td width='8%'>跳转</td>\r\n";
echo "<td width='34%' align='right' style='letter-spacing:1px;'>\r\n";
echo "<a href='{$GLOBALS['cfg_plus_dir']}/list.php?tid={$ID}' target='_blank'>预览</a>\r\n";
echo "| <a href='catalog_edit.php?ID={$ID}'>修改</a>\r\n";
echo "| <a href='catalog_del.php?ID={$ID}&typeoldname=".urlencode($typeName)."'>删除</a>\r\n";
echo "</td><td width='8%'><label>";
echo "<input name='sortrank{$ID}' type='text' id='textfield2' value='{$rank}' size='2' maxlength='4' style='text-align:center;' />";
echo "</label></td>\r\n</tr>\r\n";
echo "</table>\r\n <div id='suns".$ID."'>\r\n";
}
if($lastID==$ID){
$this->LogicListAllSunType($ID," ",false);
}
}
//没权限栏目
else{
$sonNeedShow = false;
$this->dsql->SetQuery("Select ID From #@__arctype where reID={$ID}");
$this->dsql->Execute('ss');
while($srow=$this->dsql->GetArray('ss')){
if( in_array($srow['ID'],$this->aChannels) ){ $sonNeedShow = true; break; }
}
//如果二级栏目中有的所属归类文档
if($sonNeedShow===true)
{
//互动栏目
if($channeltype<-1)
{
echo "<table width='96%' border='0' cellpadding='1' cellspacing='0' align='center' style='margin:0px auto' class='tblist2'>\r\n";
echo "<tr align='center'>";
echo "<td width='7%'></td>";
echo "<td width='6%'>[ID:".$ID."]</td>";
echo "<td width='27%' align='left'><img style='cursor:hand' onClick=\"LoadSuns('suns".$ID."',$ID);\" src='images/class_sopen.gif' width='11' height='15' border='0' align='absmiddle' /> <a href='catalog_do.php?cid=".$ID."&dopost=listArchives' style='font-size:14px; text-decoration:none;'>{$nss}".$typeName."</a></td>";
echo "<td width='10%'>(文档:".$this->GetTotalArc($ID).")</td>";
echo "<td width='8%'>$channeltype</td>\r\n";
echo "<td width='34%' align='right' style='letter-spacing:1px;'>";
echo "</td><td width='8%'><label>";
echo "<input name='sortrank{$ID}' type='text' id='sortrank{$ID}' value='{$rank}' size='2' maxlength='4' style='text-align:center;' />";
echo "</label></td></tr>";
echo "</table>\r\n <div id='suns".$ID."'>";
}
//普通列表
else if($ispart==0)
{
echo "<table width='96%' border='0' cellpadding='1' cellspacing='0' align='center' style='margin:0px auto' class='tblist2'>\r\n";
echo "<tr align='center'>";
echo "<td width='7%'></td>";
echo "<td width='6%'>[ID:".$ID."]</td>";
echo "<td width='27%' align='left'><img style='cursor:hand' onClick=\"LoadSuns('suns".$ID."',$ID);\" src='images/class_sopen.gif' width='11' height='15' border='0' align='absmiddle' /> <a href='catalog_do.php?cid=".$ID."&dopost=listArchives' style='font-size:14px; text-decoration:none;'>{$nss}".$typeName."</a></td>";
echo "<td width='10%'>(文档:".$this->GetTotalArc($ID).")</td>";
echo "<td width='10%'>$channeltype</td>\r\n";
echo "<td width='34%' align='right' style='letter-spacing:1px;'>";
echo "</td><td width='10%'><label>";
echo "<input name='sortrank{$ID}' type='text' id='sortrank{$ID}' value='{$rank}' size='2' maxlength='4' style='text-align:center;' />";
echo "</label></td></tr>";
echo "</table>\r\n <div id='suns".$ID."'>";
}
//带封面的频道
else if($ispart==1)
{
echo "<table width='96%' border='0' cellpadding='1' cellspacing='0' align='center' style='margin:0px auto' class='tblist2'>\r\n";
echo "<tr align='center'>";
echo "<td width='7%'></td>";
echo "<td width='6%'>[ID:".$ID."]</td>";
echo "<td width='27%' align='left'><img style='cursor:hand' onClick=\"LoadSuns('suns".$ID."',$ID);\" src='images/class_sopen.gif' width='11' height='15' border='0' align='absmiddle' /> <a href='catalog_do.php?cid=".$ID."&dopost=listArchives' style='font-size:14px; text-decoration:none;'>{$nss}".$typeName."</a></td>";
echo "<td width='10%'>(文档:".$this->GetTotalArc($ID).")</td>";
echo "<td width='10%'>$channeltype</td>\r\n";
echo "<td width='34%' align='right' style='letter-spacing:1px;'>";
echo "</td><td width='10%'><label>";
echo "<input name='sortrank{$ID}' type='text' id='sortrank{$ID}' value='{$rank}' size='2' maxlength='4' style='text-align:center;' />";
echo "</label></td></tr>";
echo "</table>\r\n <div id='suns".$ID."'>";
}
//独立页面
else if($ispart==2)
{
echo "<table width='96%' border='0' cellpadding='1' cellspacing='0' align='center' style='margin:0px auto' class='tblist2'>\r\n";
echo "<tr align='center'>";
echo "<td width='7%'></td>";
echo "<td width='6%'>[ID:".$ID."]</td>";
echo "<td width='27%' align='left'><img style='cursor:hand' onClick=\"LoadSuns('suns".$ID."',$ID);\" src='images/class_sopen.gif' width='11' height='15' border='0' align='absmiddle' /> <a href='catalog_do.php?cid=".$ID."&dopost=listArchives' style='font-size:14px; text-decoration:none;'>{$nss}".$typeName."</a></td>";
echo "<td width='10%'>(文档:".$this->GetTotalArc($ID).")</td>";
echo "<td width='10%'>独立页</td>\r\n";
echo "<td width='34%' align='right' style='letter-spacing:1px;'>";
echo "</td><td width='10%'><label>";
echo "<input name='sortrank{$ID}' type='text' id='textfield2' value='{$rank}' size='2' maxlength='4' style='text-align:center;' />";
echo "</label></td></tr>";
echo "</table>\r\n <div id='suns".$ID."'>";
}
$this->LogicListAllSunType($ID," ",true);
}
}
echo "</div>\r\n";
}
}
//获得子类目的递归调用
function LogicListAllSunType($ID,$step,$needcheck=true)
{
$fid = $ID;
$this->dsql->SetQuery("Select ID,reID,typedir,typename,ispart,sortrank,ishidden,channeltype From #@__arctype where reID='".$ID."' order by sortrank");
$this->dsql->Execute('s'.$fid);
while($row=$this->dsql->GetObject('s'.$fid))
{
$typeDir = $row->typedir;
$typeName = $row->typename;
$reID = $row->reID;
$ID = $row->ID;
$ispart = $row->ispart;
$channeltype = $row->channeltype;
if($step==" ") $stepdd = 2;
else $stepdd = 3;
$rank = $row->sortrank;
if($row->ishidden=='1') $nss = "<font color='red'>[隐]</font>";
else $nss = "";
//有权限栏目
if(in_array($ID,$this->aChannels) || $needcheck===false || $this->isAdminAll===true)
{
//互动栏目
if($channeltype<-1)
{
echo "<table width='96%' border='0' cellspacing='1' cellpadding='0' align='center' style='margin:0px auto' class='tblist2'>\r\n";
echo "<tr align='center' class='trlbg' oncontextmenu=\"CommonMenuWd(this,$ID,'".urlencode($typeName)."')\">\r\n";
echo "<td width='7%'><input class='np' type='checkbox' name='tids[]' value='{$ID}'></td>";
echo "<td width='6%'>[ID:".$ID."]</td>";
echo "<td width='27%' align='left'>$step ├ <a href='catalog_do.php?cid=".$ID."&dopost=listArchives' style='font-size:14px; text-decoration:none;'>{$nss}".$typeName."</a><font color='red'>[互]</font> </td>";
echo "<td width='10%'>(文档:".$this->GetTotalArc($ID).")</td>";
echo "<td width='8%'>$channeltype</td>\r\n";
echo "<td width='34%' align='right' style='letter-spacing:1px;'>";
echo "<a href='{$GLOBALS['cfg_plus_dir']}/list.php?tid={$ID}' target='_blank'>预览</a> ";
echo "| <a href='catalog_do.php?cid={$ID}&dopost=listArchives'>列出</a> ";
echo "| <a href='catalog_add.php?ID={$ID}'>添加</a> ";
echo "| <a href='catalog_edit.php?ID={$ID}'>修改</a> ";
echo "| <a href='catalog_move.php?job=movelist&typeid={$ID}'>移动</a> ";
echo "| <a href='catalog_del.php?ID={$ID}&typeoldname=".urlencode($typeName)."'>删除</a> ";
echo "</td><td width='8%'><label>";
echo "<input name='sortrank{$ID}' type='text' id='textfield2' value='{$rank}' size='2' maxlength='4' style='text-align:center;' />";
echo "</label></td></tr>";
echo " </table>\r\n";
}
//普通列表
else if($ispart==0)
{
echo "<table width='96%' border='0' cellspacing='1' cellpadding='0' align='center' style='margin:0px auto' class='tblist2'>\r\n";
echo "<tr align='center' class='trlbg' oncontextmenu=\"CommonMenu(this,$ID,'".urlencode($typeName)."')\">\r\n";
echo "<td width='7%'><input class='np' type='checkbox' name='tids[]' value='{$ID}'></td>";
echo "<td width='6%'>[ID:".$ID."]</td>";
echo "<td width='27%' align='left'>$step ├ <a href='catalog_do.php?cid=".$ID."&dopost=listArchives' style='font-size:14px; text-decoration:none;'>{$nss}".$typeName."</a> </td>";
echo "<td width='10%'>(文档:".$this->GetTotalArc($ID).")</td>";
echo "<td width='8%'>$channeltype</td>\r\n";
echo "<td width='34%' align='right' style='letter-spacing:1px;'>";
echo "<a href='{$GLOBALS['cfg_plus_dir']}/list.php?tid={$ID}' target='_blank'>预览</a> ";
echo "| <a href='catalog_do.php?cid={$ID}&dopost=listArchives'>内容</a> ";
echo "| <a href='catalog_add.php?ID={$ID}'>添加</a> ";
echo "| <a href='catalog_edit.php?ID={$ID}'>修改</a> ";
echo "| <a href='catalog_move.php?job=movelist&typeid={$ID}'>移动</a> ";
echo "| <a href='catalog_del.php?ID={$ID}&typeoldname=".urlencode($typeName)."'>删除</a> ";
echo "</td><td width='8%'><label>";
echo "<input name='sortrank{$ID}' type='text' id='textfield2' value='{$rank}' size='2' maxlength='4' style='text-align:center;' />";
echo "</label></td></tr>";
echo " </table>\r\n";
}
//封面频道
else if($ispart==1)
{
echo "<table width='96%' border='0' cellspacing='1' cellpadding='0' align='center' style='margin:0px auto' class='tblist2'>\r\n";
echo "<tr align='center' class='trlbg' oncontextmenu=\"CommonMenuPart(this,$ID,'".urlencode($typeName)."')\">\r\n";
echo "<td width='7%'><input class='np' type='checkbox' name='tids[]' value='{$ID}'></td>";
echo "<td width='6%'>[ID:".$ID."]</td>";
echo "<td width='27%' align='left'>$step ├ <a href='catalog_do.php?cid=".$ID."&dopost=listArchives' style='font-size:14px; text-decoration:none;'>{$nss}".$typeName."</a><font color='red'>[封面]</font></td>";
echo "<td width='10%'>(文档:".$this->GetTotalArc($ID).")</td>";
echo "<td width='8%'>$channeltype</td>\r\n";
echo "<td width='34%' align='right' style='letter-spacing:1px;'>";
echo "<a href='{$GLOBALS['cfg_plus_dir']}/list.php?tid={$ID}' target='_blank'>预览</a> ";
echo "| <a href='catalog_do.php?cid={$ID}&dopost=listArchives'>列出</a> ";
echo "| <a href='catalog_add.php?ID={$ID}'>添加</a> ";
echo "| <a href='catalog_edit.php?ID={$ID}'>修改</a> ";
echo "| <a href='catalog_move.php?job=movelist&typeid={$ID}'>移动</a> ";
echo "| <a href='catalog_del.php?ID={$ID}&typeoldname=".urlencode($typeName)."'>删除</a> ";
echo "</td><td width='8%'><label>";
echo "<input name='sortrank{$ID}' type='text' id='textfield2' value='{$rank}' size='2' maxlength='4' style='text-align:center;' />";
echo "</label></td></tr>";
echo " </table>\r\n";
}
//独立页面
else if($ispart==2)
{
echo "<table width='96%' border='0' cellspacing='1' cellpadding='0' align='center' style='margin:0px auto' class='tblist2'>\r\n";
echo "<tr align='center' class='trlbg' oncontextmenu=\"SingleMenu(this,$ID,'".urlencode($typeName)."')\">\r\n";
echo "<td width='7%'><input class='np' type='checkbox' name='tids[]' value='{$ID}'></td>";
echo "<td width='6%'>[ID:".$ID."]</td>";
echo "<td width='27%' align='left'>$step ├ <a href='catalog_do.php?cid=".$ID."&dopost=listArchives' style='font-size:14px; text-decoration:none;'>{$nss}".$typeName."</a><font color='red'>[封面]</font></td>";
echo "<td width='10%'>(文档:".$this->GetTotalArc($ID).")</td>";
echo "<td width='8%'>独立页</td>\r\n";
echo "<td width='34%' align='right' style='letter-spacing:1px;'>";
echo "<a href='{$GLOBALS['cfg_plus_dir']}/list.php?tid={$ID}' target='_blank'>预览</a> ";
echo "| <a href='catalog_do.php?cid={$ID}&dopost=listArchives'>内容</a> ";
echo "| <a href='catalog_add.php?ID={$ID}'>添加</a> ";
echo "| <a href='catalog_edit.php?ID={$ID}'>修改</a> ";
echo "| <a href='catalog_move.php?job=movelist&typeid={$ID}'>移动</a> ";
echo "| <a href='catalog_del.php?ID={$ID}&typeoldname=".urlencode($typeName)."'>删除</a> ";
echo "</td><td width='8%'><label>";
echo "<input name='sortrank{$ID}' type='text' id='textfield2' value='{$rank}' size='2' maxlength='4' style='text-align:center;' />";
echo "</label></td></tr>";
echo " </table>\r\n";
}
//跳转网址
else if($ispart==3)
{
echo "<table width='96%' border='0' cellspacing='1' cellpadding='0' align='center' style='margin:0px auto' class='tblist2'>\r\n";
echo "<tr align='center' class='trlbg'>\r\n";
echo "<td width='7%'><input class='np' type='checkbox' name='tids[]' value='{$ID}'></td>";
echo "<td width='6%'>[ID:".$ID."]</td>";
echo "<td width='27%' align='left'>$step ├ <a href='{$GLOBALS['cfg_plus_dir']}/list.php?tid={$ID}' target='_blank' style='font-size:14px; text-decoration:none;'>{$nss}".$typeName."</a><font color='red'>[跳转]</font></td>";
echo "<td width='10%'>(文档:0)</td>";
echo "<td width='8%'>跳转</td>\r\n";
echo "<td width='34%' align='right' style='letter-spacing:1px;'>";
echo "<a href='{$GLOBALS['cfg_plus_dir']}/list.php?tid={$ID}' target='_blank'>预览</a> ";
echo "| <a href='catalog_edit.php?ID={$ID}'>修改</a> ";
echo "| <a href='catalog_del.php?ID={$ID}&typeoldname=".urlencode($typeName)."'>删除</a> ";
echo "</td><td width='8%'><label>";
echo "<input name='sortrank{$ID}' type='text' id='textfield2' value='{$rank}' size='2' maxlength='4' style='text-align:center;' />";
echo "</label></td></tr>";
echo " </table>\r\n";
}
$this->LogicListAllSunType($ID,$step." ",false);
}//if 有权限
}//End while
}
//------------------------------------------------------
//-----返回与某个目相关的下级目录的类目ID列表(删类目或文章时调用)
//------------------------------------------------------
function GetSunTypes($ID,$channel=0)
{
$this->idArray[$this->idCounter]=$ID;
$this->idCounter++;
$fid = $ID;
if($channel!=0) $csql = " And channeltype=$channel ";
else $csql = "";
$this->dsql->SetQuery("Select ID From #@__arctype where reID=$ID $csql");
$this->dsql->Execute("gs".$fid);
while($row=$this->dsql->GetObject("gs".$fid)){
$nid = $row->ID;
$this->GetSunTypes($nid,$channel);
}
return $this->idArray;
}
//----------------------------------------------------------------------------
//获得某ID的下级ID(包括本身)的SQL语句“($tb.typeid=id1 or $tb.typeid=id2...)”
//----------------------------------------------------------------------------
function GetSunID($ID,$tb="#@__archives",$channel=0)
{
$this->sunID = "";
$this->idCounter = 0;
$this->idArray = "";
$this->GetSunTypes($ID,$channel);
$this->dsql->Close();
$this->dsql = 0;
$rquery = "";
for($i=0;$i<$this->idCounter;$i++)
{
if($i!=0) $rquery .= " Or ".$tb.".typeid='".$this->idArray[$i]."' ";
else $rquery .= " ".$tb.".typeid='".$this->idArray[$i]."' ";
}
reset($this->idArray);
$this->idCounter = 0;
return " (".$rquery.") ";
}
//----------------------------------------
//删类目
//----------------------------------------
function DelType($ID,$isDelFile,$delson=true)
{
$this->idCounter = 0;
$this->idArray = "";
if($delson){
$this->GetSunTypes($ID);
}else{
$this->idArray = array();
$this->idArray[] = $ID;
}
//删数据库里的相关记录
foreach($this->idArray as $id)
{
$myrow = $this->dsql->GetOne("Select c.maintable,c.addtable From #@__arctype t left join #@__channeltype c on c.ID=t.channeltype where t.ID='$id'",MYSQL_ASSOC);
if($myrow['maintable']=='') $myrow['maintable'] = '#@__archives';
//删数据库信息
$this->dsql->ExecuteNoneQuery("Delete From `{$myrow['maintable']}` where typeid='$id'");
if($myrow['addtable']!="") $this->dsql->ExecuteNoneQuery("Delete From `{$myrow['addtable']}` where typeid='$id'");
$this->dsql->ExecuteNoneQuery("update `{$myrow['maintable']}` set typeid2=0 where typeid2='$id'");
$this->dsql->ExecuteNoneQuery("Delete From `#@__spec` where typeid='$id'");
$this->dsql->ExecuteNoneQuery("Delete From `#@__feedback` where typeid='$id'");
$this->dsql->ExecuteNoneQuery("Delete From `#@__arctype` where ID='$id'");
$this->dsql->ExecuteNoneQuery("Delete From `#@__full_search` where typeid='$id'");
}
@reset($this->idArray);
$this->idCounter = 0;
return true;
}
//---------------------------
//---- 删指定目录的所有文件
//---------------------------
function RmDirFile($indir)
{
if(!file_exists($indir)) return;
$dh = dir($indir);
while($file = $dh->read()) {
if($file == "." || $file == "..") continue;
else if(is_file("$indir/$file")) @unlink("$indir/$file");
else{
$this->RmDirFile("$indir/$file");
}
if(is_dir("$indir/$file")){
@rmdir("$indir/$file");
}
}
$dh->close();
return(1);
}
}
?> | zyyhong | trunk/jiaju001/news/include/inc_typeunit_admin.php | PHP | asf20 | 29,148 |
<?php
$cfg_list_son = 'Y';
$cfg_websafe_open = 'N';
$cfg_mb_open = 'N';
$cfg_ftp_mkdir = 'N';
$cfg_dede_log = 'N';
$cfg_webname = '装修家居资讯、室内设计点评';
$cfg_dede_cache = 'Y';
$cfg_ftp_root = '/';
$cfg_basehost = 'http://news.jiaju001.com';
$cfg_al_cachetime = '1';
$cfg_member_regsta = 'N';
$cfg_cmspath = '';
$cfg_arc_all = 'Y';
$cfg_ftp_host = '';
$cfg_pwdtype = 'md5';
$cfg_ftp_port = '21';
$cfg_indexname = '主页';
$cfg_md5len = '32';
$cfg_indexurl = '/';
$cfg_arcsptitle = 'N';
$cfg_cookie_encode = 'TwFJr1383J';
$cfg_fck_xhtml = 'N';
$cfg_keywords = '装修资讯,施工技巧,装修方案,装修经验,装修指南,装修材料,装修效果图,室内装修 ';
$cfg_ddsign = '';
$cfg_ftp_user = '';
$cfg_arcautosp = 'N';
$cfg_ftp_pwd = '';
$cfg_df_score = '1000';
$cfg_auot_description = '255';
$cfg_description = '北京家居网专业装修家居资讯 、 装修设计师点评、装修效果图指导';
$cfg_mb_sendall = 'Y';
$cfg_powerby = '';
$cfg_guest_send = 'N';
$cfg_send_score = '2';
$cfg_cat_seltype = '1';
$cfg_arcautosp_size = '5';
$cfg_keyword_like = 'Y';
$cfg_mb_mediatype = 'jpg|gif|png|bmp|swf|mp3|rmvb|wma|zip|rar|';
$cfg_ct_mode = '1';
$cfg_mb_max = '10';
$cfg_adminemail = 'admin@yourmail.com';
$cfg_beian = '';
$cfg_up_prenext = 'Y';
$cfg_html_editor = 'fck';
$cfg_mb_upload_size = '1024';
$cfg_specnote = '6';
$cfg_backup_dir = 'backup_data';
$cfg_makeindex = 'Y';
$cfg_updateperi = '15';
$cfg_mb_upload = 'N';
$cfg_mb_rmdown = 'N';
$cfg_medias_dir = '/uploads';
$cfg_baidunews_limit = '100';
$cfg_df_style = 'default';
$cfg_allsearch_limit = '1';
$cfg_search_maxlimit = '500';
$cfg_list_symbol = '-- > ';
$cfg_mb_album = 'N';
$cfg_ddimg_width = '280';
$cfg_arcdir = '';
$cfg_ddimg_height = '220';
$cfg_search_cachetime = '1';
$cfg_book_ifcheck = 'N';
$cfg_album_width = '800';
$cfg_locked_day = '7';
$cfg_online_type = 'nps';
$cfg_mb_score2money = 'N';
$cfg_imgtype = 'jpg|gif|png';
$cfg_softtype = 'exe|zip|gz|rar|iso|doc|xsl|ppt|wps';
$cfg_score2money = '3';
$cfg_money2score = '3';
$cfg_mediatype = 'swf|mpg|dat|avi|mp3|rm|rmvb|wmv|asf|vob|wma|wav|mid|mov';
$cfg_mb_exiturl = '/';
$cfg_notallowstr = '#没设定#';
$cfg_replacestr = '她妈|它妈|他妈|你妈|fuck|去死|贱人|老母';
$cfg_feedbackcheck = 'N';
$cfg_keyword_replace = 'Y';
$cfg_multi_site = 'N';
$cfg_feedback_ck = 'N';
$cfg_cli_time = '+8';
$cfg_jpeg_query = '100';
$cfg_use_vdcode = 'N';
$cfg_sitehash = '';
$cfg_siteid = '';
$cfg_siteownerid = '';
$cfg_gif_wartermark = 'N';
$cfg_sendmail_bysmtp = 'Y';
$cfg_smtp_server = 'smtp.xinhuanet.com';
$cfg_smtp_port = '25';
$cfg_smtp_usermail = '';
$cfg_smtp_user = '';
$cfg_smtp_password = '';
$cfg_feedback_make = 'Y';
$cfg_ask = 'Y';
$cfg_ask_ifcheck = 'N';
$cfg_ask_dateformat = 'Y-n-j';
$cfg_ask_timeformat = 'H:i';
$cfg_ask_timeoffset = '8';
$cfg_ask_gzipcompress = '1';
$cfg_ask_authkey = 'AeN896fG';
$cfg_ask_cookiepre = 'deask_';
$cfg_answer_ifcheck = 'N';
$cfg_ask_expiredtime = '20';
$cfg_ask_tpp = '14';
$cfg_ask_sitename = '织梦问答';
$cfg_ask_symbols = '->';
$cfg_ask_answerscore = '2';
$cfg_ask_bestanswer = '20';
$cfg_ask_subtypenum = '10';
$cfg_group_creators = '1000';
$cfg_group_max = '0';
$cfg_group_maxuser = '0';
$cfg_group_click = '1';
$cfg_group_words = '1000';
$cfg_book_freenum = '6';
$cfg_book_pay = '1';
$cfg_book_money = '1';
$cfg_book_freerank = '100';
$cfg_safeurl = 'dedecms.commysite.com';
?> | zyyhong | trunk/jiaju001/news/include/config_hand.php | PHP | asf20 | 3,522 |
<?php
//给变量赋默认值
//--------------------------------
function AttDef($oldvar,$nv){
if(empty($oldvar)) return $nv;
else return $oldvar;
}
//获取一个文档列表
//--------------------------------
function SpGetArcList($dsql,$typeid=0,$row=10,$col=1,$titlelen=30,$infolen=160,
$imgwidth=120,$imgheight=90,$listtype="all",$orderby="default",$keyword="",$innertext="",
$tablewidth="100",$arcid=0,$idlist="",$channelid=0,$limit="",$att=0,$order="desc",$subday=0)
{
global $PubFields;
$row = AttDef($row,10);
$titlelen = AttDef($titlelen,30);
$infolen = AttDef($infolen,160);
$imgwidth = AttDef($imgwidth,120);
$imgheight = AttDef($imgheight,120);
$listtype = AttDef($listtype,"all");
$arcid = AttDef($arcid,0);
$channelid = AttDef($channelid,0);
$orderby = AttDef($orderby,"default");
$orderWay = AttDef($order,"desc");
$subday = AttDef($subday,0);
$line = $row;
$orderby=strtolower($orderby);
$tablewidth = str_replace("%","",$tablewidth);
if($tablewidth=="") $tablewidth=100;
if($col=="") $col = 1;
$colWidth = ceil(100/$col);
$tablewidth = $tablewidth."%";
$colWidth = $colWidth."%";
$keyword = trim($keyword);
$innertext = trim($innertext);
if($innertext=="") $innertext = GetSysTemplets("part_arclist.htm");
//按不同情况设定SQL条件 排序方式
$orwhere = " arc.arcrank > -1 ";
//时间限制(用于调用最近热门文章、热门评论之类)
if($subday>0){
$limitday = time() - ($oneday * 24 * 3600);
$orwhere .= " And arc.senddate > $limitday ";
}
//文档的自定义属性
if($att!="") $orwhere .= "And arcatt='$att' ";
//文档的频道模型
if($channelid>0 && !eregi("spec",$listtype)) $orwhere .= " And arc.channel = '$channelid' ";
//是否为推荐文档
if(eregi("commend",$listtype)) $orwhere .= " And arc.iscommend > 10 ";
//是否为带缩略图图片文档
if(eregi("image",$listtype)) $orwhere .= " And arc.litpic <> '' ";
//是否为专题文档
if(eregi("spec",$listtype) || $channelid==-1) $orwhere .= " And arc.channel = -1 ";
//是否指定相近ID
if($arcid!=0) $orwhere .= " And arc.ID<>'$arcid' ";
//文档排序的方式
$ordersql = "";
if($orderby=="hot"||$orderby=="click") $ordersql = " order by arc.click $orderWay";
else if($orderby=="pubdate") $ordersq = " order by arc.pubdate $orderWay";
else if($orderby=="sortrank") $ordersq = " order by arc.sortrank $orderWay";
else if($orderby=="id") $ordersql = " order by arc.ID $orderWay";
else if($orderby=="near") $ordersql = " order by ABS(arc.ID - ".$arcid.")";
else if($orderby=="lastpost") $ordersql = " order by arc.lastpost $orderWay";
else if($orderby=="postnum") $ordersql = " order by arc.postnum $orderWay";
else $ordersql=" order by arc.senddate $orderWay";
//类别ID的条件,如果用 "," 分开,可以指定特定类目
//------------------------------
if($typeid!=0)
{
$reids = explode(",",$typeid);
$ridnum = count($reids);
if($ridnum>1){
$tpsql = "";
for($i=0;$i<$ridnum;$i++){
if($tpsql=="") $tpsql .= " And (".TypeGetSunID($reids[$i],$dsql,'arc');
else $tpsql .= " Or ".TypeGetSunID($reids[$i],$dsql,'arc');
}
$tpsql .= ") ";
$orwhere .= $tpsql;
unset($tpsql);
}
else{
$orwhere .= " And ".TypeGetSunID($typeid,$dsql,'arc');
}
unset($reids);
}
//指定的文档ID列表
//----------------------------------
if($idlist!="")
{
$reids = explode(",",$idlist);
$ridnum = count($reids);
$idlistSql = "";
for($i=0;$i<$ridnum;$i++){
if($idlistSql=="") $idlistSql .= " And ( arc.ID='".$reids[$i]."' ";
else $idlistSql .= " Or arc.ID='".$reids[$i]."' ";
}
$idlistSql .= ") ";
$orwhere .= $idlistSql;
unset($idlistSql);
unset($reids);
$row = $ridnum;
}
//关键字条件
if($keyword!="")
{
$keywords = explode(",",$keyword);
$ridnum = count($keywords);
$orwhere .= " And (arc.keywords like '%".trim($keywords[0])." %' ";
for($i=1;$i<$ridnum;$i++){
if($keywords[$i]!="") $orwhere .= " Or arc.keywords like '%".trim($keywords[$i])." %' ";
}
$orwhere .= ")";
unset($keywords);
}
$limit = trim(eregi_replace("limit","",$limit));
if($limit!="") $limitsql = " limit $limit ";
else $limitsql = " limit 0,$line ";
//////////////
$query = "Select arc.ID,arc.title,arc.iscommend,arc.color,arc.typeid,arc.ismake,
arc.description,arc.pubdate,arc.senddate,arc.arcrank,arc.click,arc.money,
arc.litpic,tp.typedir,tp.typename,tp.isdefault,
tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl
from #@__archives arc left join #@__arctype tp on arc.typeid=tp.ID
where $orwhere $ordersql $limitsql";
$dsql->SetQuery($query);
$dsql->Execute("al");
$artlist = "";
if($col>1) $artlist = "<table width='$tablewidth' border='0' cellspacing='0' cellpadding='0'>\r\n";
$dtp2 = new DedeTagParse();
$dtp2->SetNameSpace("field","[","]");
$dtp2->LoadString($innertext);
$GLOBALS['autoindex'] = 0;
for($i=0;$i<$line;$i++)
{
if($col>1) $artlist .= "<tr>\r\n";
for($j=0;$j<$col;$j++)
{
if($col>1) $artlist .= " <td width='$colWidth'>\r\n";
if($row = $dsql->GetArray("al"))
{
//处理一些特殊字段
$row['description'] = cn_substr($row['description'],$infolen);
$row['id'] = $row['ID'];
file_put_contents("c:/ttt.txt",$row['id']);
if($row['litpic']=="") $row['litpic'] = $PubFields['templeturl']."/img/default.gif";
$row['picname'] = $row['litpic'];
$row['arcurl'] = GetFileUrl($row['id'],$row['typeid'],$row['senddate'],
$row['title'],$row['ismake'],$row['arcrank'],$row['namerule'],
$row['typedir'],$row['money'],true,$row['siteurl']);
$row['typeurl'] = GetTypeUrl($row['typeid'],MfTypedir($row['typedir']),$row['isdefault'],$row['defaultname'],$row['ispart'],$row['namerule2'],$row['siteurl']);
$row['info'] = $row['description'];
$row['filename'] = $row['arcurl'];
$row['stime'] = GetDateMK($row['pubdate']);
$row['typelink'] = "<a href='".$row['typeurl']."'>".$row['typename']."</a>";
$row['image'] = "<img src='".$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".ereg_replace("['><]","",$row['title'])."'>";
$row['imglink'] = "<a href='".$row['filename']."'>".$row['image']."</a>";
$row['title'] = cn_substr($row['title'],$titlelen);
$row['textlink'] = "<a href='".$row['filename']."'>".$row['title']."</a>";
if($row['color']!="") $row['title'] = "<font color='".$row['color']."'>".$row['title']."</font>";
if($row['iscommend']==5||$row['iscommend']==16) $row['title'] = "<b>".$row['title']."</b>";
$row['phpurl'] = $PubFields['phpurl'];
$row['templeturl'] = $PubFields['templeturl'];
if(is_array($dtp2->CTags)){
foreach($dtp2->CTags as $k=>$ctag){
if(isset($row[$ctag->GetName()])) $dtp2->Assign($k,$row[$ctag->GetName()]);
else $dtp2->Assign($k,"");
}
$GLOBALS['autoindex']++;
}
$artlist .= $dtp2->GetResult()."\r\n";
}//if hasRow
else{
$artlist .= "";
}
if($col>1) $artlist .= " </td>\r\n";
}//Loop Col
if($col>1) $i += $col - 1;
if($col>1) $artlist .= " </tr>\r\n";
}//Loop Line
if($col>1) $artlist .= " </table>\r\n";
$dsql->FreeResult("al");
return $artlist;
}
?>
| zyyhong | trunk/jiaju001/news/include/inc_separate_functions.php | PHP | asf20 | 7,941 |
<?php
require_once(dirname(__FILE__)."/inc_arcpart_view.php");
require_once(dirname(__FILE__)."/inc_pubtag_make.php");
/******************************************************
//Copyright 2004-2006 by DedeCms.com itprato
//本类的用途是用于浏览所有专题列表或对专题列表生成HTML
******************************************************/
@set_time_limit(0);
class SpecView
{
var $dsql;
var $dtp;
var $dtp2;
var $TypeID;
var $TypeLink;
var $PageNo;
var $TotalPage;
var $TotalResult;
var $PageSize;
var $ChannelUnit;
var $ListType;
var $TempInfos;
var $Fields;
var $PartView;
var $StartTime;
var $TempletsFile;
//-------------------------------
//php5构造函数
//-------------------------------
function __construct($starttime=0)
{
$this->TypeID = 0;
$this->dsql = new DedeSql(false);
$this->dtp = new DedeTagParse();
$this->dtp->SetNameSpace("dede","{","}");
$this->dtp2 = new DedeTagParse();
$this->dtp2->SetNameSpace("field","[","]");
$this->TypeLink = new TypeLink(0);
$this->ChannelUnit = new ChannelUnit(-1);
//设置一些全局参数的值
foreach($GLOBALS['PubFields'] as $k=>$v) $this->Fields[$k] = $v;
if($starttime==0) $this->StartTime = 0;
else{
$this->StartTime = GetMkTime($starttime);
}
$this->PartView = new PartView();
$this->CountRecord();
$tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$GLOBALS['cfg_df_style']."/list_spec.htm";
if(!file_exists($tempfile)||!is_file($tempfile)){
echo "模板文件不存在,无法解析文档!";
exit();
}
$this->dtp->LoadTemplate($tempfile);
$this->TempletsFile = ereg_replace("^".$GLOBALS['cfg_basedir'],'',$tempfile);
$this->TempInfos['tags'] = $this->dtp->CTags;
$this->TempInfos['source'] = $this->dtp->SourceString;
$ctag = $this->dtp->GetTag("page");
if(!is_object($ctag)) $this->PageSize = 20;
else{
if($ctag->GetAtt("pagesize")!="") $this->PageSize = $ctag->GetAtt("pagesize");
else $this->PageSize = 20;
}
$this->TotalPage = ceil($this->TotalResult/$this->PageSize);
}
//php4构造函数
//---------------------------
function SpecView($starttime=0){
$this->__construct($starttime);
}
//---------------------------
//关闭相关资源
//---------------------------
function Close()
{
$this->dsql->Close();
$this->TypeLink->Close();
$this->ChannelUnit->Close();
}
//------------------
//统计列表里的记录
//------------------
function CountRecord()
{
$this->TotalResult = -1;
if(isset($GLOBALS['TotalResult'])) $this->TotalResult = $GLOBALS['TotalResult'];
if(isset($GLOBALS['PageNo'])) $this->PageNo = $GLOBALS['PageNo'];
else $this->PageNo = 1;
if($this->TotalResult==-1)
{
if($this->StartTime>0) $timesql = " And senddate>'".$this->StartTime."'";
else $timesql = "";
$row = $this->dsql->GetOne("Select count(*) as dd From `#@__archivesspec` where arcrank > -1 And channel=-1 $timesql");
if(is_array($row)) $this->TotalResult = $row['dd'];
else $this->TotalResult = 0;
}
}
//------------------
//显示列表
//------------------
function Display()
{
if($this->TypeLink->TypeInfos['ispart']==1
||$this->TypeLink->TypeInfos['ispart']==2)
{
$this->DisplayPartTemplets();
}
$this->ParseTempletsFirst();
foreach($this->dtp->CTags as $tagid=>$ctag){
if($ctag->GetName()=="list"){
$limitstart = ($this->PageNo-1) * $this->PageSize;
$row = $this->PageSize;
if(trim($ctag->GetInnerText())==""){ $InnerText = GetSysTemplets("list_fulllist.htm"); }
else{ $InnerText = trim($ctag->GetInnerText()); }
$this->dtp->Assign($tagid,
$this->GetArcList($limitstart,$row,
$ctag->GetAtt("col"),
$ctag->GetAtt("titlelen"),
$ctag->GetAtt("infolen"),
$ctag->GetAtt("imgwidth"),
$ctag->GetAtt("imgheight"),
$ctag->GetAtt("listtype"),
$ctag->GetAtt("orderby"),
$InnerText,
$ctag->GetAtt("tablewidth"))
);
}
else if($ctag->GetName()=="pagelist"){
$list_len = trim($ctag->GetAtt("listsize"));
if($list_len=="") $list_len = 3;
$this->dtp->Assign($tagid,$this->GetPageListDM($list_len));
}
}
$this->Close();
$this->dtp->Display();
}
//------------------
//开始创建列表
//------------------
function MakeHtml()
{
//初步给固定值的标记赋值
$indexfile = '';
$this->ParseTempletsFirst();
$totalpage = ceil($this->TotalResult/$this->PageSize);
if($totalpage==0) $totalpage = 1;
CreateDir($GLOBALS['cfg_special']);
$murl = "";
for($this->PageNo=1;$this->PageNo<=$totalpage;$this->PageNo++)
{
foreach($this->dtp->CTags as $tagid=>$ctag){
if($ctag->GetName()=="list"){
$limitstart = ($this->PageNo-1) * $this->PageSize;
$row = $this->PageSize;
if(trim($ctag->GetInnerText())==""){ $InnerText = GetSysTemplets("spec_list.htm"); }
else{ $InnerText = trim($ctag->GetInnerText()); }
$this->dtp->Assign($tagid,
$this->GetArcList($limitstart,$row,
$ctag->GetAtt("col"),
$ctag->GetAtt("titlelen"),
$ctag->GetAtt("infolen"),
$ctag->GetAtt("imgwidth"),
$ctag->GetAtt("imgheight"),
"spec",
$ctag->GetAtt("orderby"),
$InnerText,
$ctag->GetAtt("tablewidth"))
);
}
else if($ctag->GetName()=="pagelist"){
$list_len = trim($ctag->GetAtt("listsize"));
if($list_len=="") $list_len = 3;
$this->dtp->Assign($tagid,$this->GetPageListST($list_len));
}
}//End foreach
$makeFile = $GLOBALS['cfg_special']."/spec_".$this->PageNo.$GLOBALS['art_shortname'];
$murl = $makeFile;
$makeFile = $GLOBALS['cfg_basedir'].$makeFile;
$this->dtp->SaveTo($makeFile);
if(empty($indexfile)){
$indexfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_special']."/index".$GLOBALS['art_shortname'];
copy($makeFile,$indexfile);
}
echo "成功创建:<a href='$murl' target='_blank'>$murl</a><br/>";
}
$this->Close();
return $murl;
}
//--------------------------------
//解析模板,对固定的标记进行初始给值
//--------------------------------
function ParseTempletsFirst()
{
//对公用标记的解析,这里对对象的调用均是用引用调用的,因此运算后会自动改变传递的对象的值
MakePublicTag($this,$this->dtp,$this->PartView,$this->TypeLink,$this->TypeID,0,0);
}
//----------------------------------
//获取内容列表
//---------------------------------
function GetArcList($limitstart=0,$row=10,$col=1,$titlelen=30,$infolen=250,
$imgwidth=120,$imgheight=90,$listtype="all",$orderby="default",$innertext="",$tablewidth="100")
{
$typeid=$this->TypeID;
if($row=="") $row = 10;
if($limitstart=="") $limitstart = 0;
if($titlelen=="") $titlelen = 30;
if($infolen=="") $infolen = 250;
if($imgwidth=="") $imgwidth = 120;
if($imgheight=="") $imgheight = 120;
if($listtype=="") $listtype = "all";
if($orderby=="") $orderby="default";
else $orderby=strtolower($orderby);
$tablewidth = str_replace("%","",$tablewidth);
if($tablewidth=="") $tablewidth=100;
if($col=="") $col=1;
$colWidth = ceil(100/$col);
$tablewidth = $tablewidth."%";
$colWidth = $colWidth."%";
$innertext = trim($innertext);
if($innertext=="") $innertext = GetSysTemplets("spec_list.htm");
//按不同情况设定SQL条件
$orwhere = " arcs.arcrank > -1 And arcs.channel = -1 ";
if($this->StartTime>0) $orwhere .= " And arcs.senddate>'".$this->StartTime."'";
//排序方式
$ordersql = "";
if($orderby=="senddate") $ordersql=" order by arcs.senddate desc";
else if($orderby=="pubdate") $ordersql=" order by arcs.pubdate desc";
else if($orderby=="id") $ordersql=" order by arcs.ID desc";
else $ordersql=" order by arcs.sortrank desc";
//
//----------------------------
$query = "Select arcs.ID,arcs.title,arcs.typeid,arcs.ismake,
arcs.description,arcs.pubdate,arcs.senddate,arcs.arcrank,
arcs.click,arcs.postnum,arcs.lastpost,arcs.money,arcs.litpic,t.typedir,t.typename,t.isdefault,
t.defaultname,t.namerule,t.namerule2,t.ispart,t.moresite,t.siteurl
from `#@__archivesspec` arcs
left join #@__arctype t on arcs.typeid=t.ID
where $orwhere $ordersql limit $limitstart,$row";
$this->dsql->SetQuery($query);
$this->dsql->Execute("al");
$artlist = "";
if($col>1) $artlist = "<table width='$tablewidth' border='0' cellspacing='0' cellpadding='0'>\r\n";
$this->dtp2->LoadSource($innertext);
for($i=0;$i<$row;$i++)
{
if($col>1) $artlist .= "<tr>\r\n";
for($j=0;$j<$col;$j++)
{
if($col>1) $artlist .= "<td width='$colWidth'>\r\n";
if($row = $this->dsql->GetArray("al"))
{
//处理一些特殊字段
$row["description"] = cnw_left($row["description"],$infolen);
$row["title"] = cnw_left($row["title"],$titlelen);
$row["id"] = $row["ID"];
if($row["litpic"]=="") $row["litpic"] = $GLOBALS["cfg_plus_dir"]."/img/dfpic.gif";
$row["picname"] = $row["litpic"];
$row["arcurl"] = GetFileUrl($row["ID"],$row["typeid"],$row["senddate"],$row["title"],
$row["ismake"],$row["arcrank"],$row["namerule"],$row["typedir"],$row["money"],true,$row["siteurl"]);
$row["typeurl"] = $this->GetListUrl($row["typeid"],$row["typedir"],$row["isdefault"],$row["defaultname"],$row["ispart"],$row["namerule2"],$row["siteurl"]);
$row["info"] = $row["description"];
$row["filename"] = $row["arcurl"];
$row["stime"] = GetDateMK($row["pubdate"]);
$row["textlink"] = "<a href='".$row["filename"]."'>".$row["title"]."</a>";
$row["typelink"] = "[<a href='".$row["typeurl"]."'>".$row["typename"]."</a>]";
$row["imglink"] = "<a href='".$row["filename"]."'><img src='".$row["picname"]."' border='0' width='$imgwidth' height='$imgheight'></a>";
$row["image"] = "<img src='".$row["picname"]."' border='0' width='$imgwidth' height='$imgheight'>";
$row["phpurl"] = $GLOBALS["cfg_plus_dir"];
$row["templeturl"] = $GLOBALS["cfg_templets_dir"];
$row["memberurl"] = $GLOBALS["cfg_member_dir"];
//编译附加表里的数据
foreach($this->ChannelUnit->ChannelFields as $k=>$arr){
if(isset($row[$k])) $row[$k] = $this->ChannelUnit->MakeField($k,$row[$k]);
}
//---------------------------
if(is_array($this->dtp2->CTags)){
foreach($this->dtp2->CTags as $k=>$ctag){
if(isset($row[$ctag->GetName()])) $this->dtp2->Assign($k,$row[$ctag->GetName()]);
else $this->dtp2->Assign($k,"");
}
}
$artlist .= $this->dtp2->GetResult();
}//if hasRow
else{
$artlist .= "";
}
if($col>1) $artlist .= "</td>\r\n";
}//Loop Col
if($col>1) $artlist .= "</tr>\r\n";
}//Loop Line
if($col>1) $artlist .= "</table>\r\n";
$this->dsql->FreeResult("al");
return $artlist;
}
//---------------------------------
//获取静态的分页列表
//---------------------------------
function GetPageListST($list_len)
{
$prepage="";
$nextpage="";
$prepagenum = $this->PageNo-1;
$nextpagenum = $this->PageNo+1;
if($list_len==""||ereg("[^0-9]",$list_len)) $list_len=3;
$totalpage = ceil($this->TotalResult/$this->PageSize);
if($totalpage<=1 && $this->TotalResult>0) return "共1页/".$this->TotalResult."条记录";
if($this->TotalResult == 0) return "共0页/".$this->TotalResult."条记录";
$purl = $this->GetCurUrl();
$tnamerule = "spec_";
//获得上一页和下一页的链接
if($this->PageNo != 1){
$prepage.="<a href='".$tnamerule."$prepagenum".$GLOBALS['art_shortname']."'>上一页</a>\r\n";
$indexpage="<a href='".$tnamerule."1".$GLOBALS['art_shortname']."'>首页</a>\r\n";
}
else{
$indexpage="首页\r\n";
}
//
if($this->PageNo!=$totalpage && $totalpage>1){
$nextpage.="<a href='".$tnamerule."$nextpagenum".$GLOBALS['art_shortname']."'>下一页</a>\r\n";
$endpage="<a href='".$tnamerule."$totalpage".$GLOBALS['art_shortname']."'>末页</a>\r\n";
}
else{
$endpage="末页\r\n";
}
//获得数字链接
$listdd="";
$total_list = $list_len * 2 + 1;
if($this->PageNo >= $total_list) {
$j = $this->PageNo-$list_len;
$total_list = $this->PageNo+$list_len;
if($total_list>$totalpage) $total_list=$totalpage;
}
else{
$j=1;
if($total_list>$totalpage) $total_list=$totalpage;
}
for($j;$j<=$total_list;$j++)
{
if($j==$this->PageNo) $listdd.= "$j\r\n";
else $listdd.="<a href='".$tnamerule."$j".$GLOBALS['art_shortname']."'>[".$j."]</a>\r\n";
}
$plist = $indexpage.$prepage.$listdd.$nextpage.$endpage;
return $plist;
}
//---------------------------------
//获取动态的分页列表
//---------------------------------
function GetPageListDM($list_len)
{
$prepage="";
$nextpage="";
$prepagenum = $this->PageNo-1;
$nextpagenum = $this->PageNo+1;
if($list_len==""||ereg("[^0-9]",$list_len)) $list_len=3;
$totalpage = ceil($this->TotalResult/$this->PageSize);
if($totalpage<=1 && $this->TotalResult>0) return "共1页/".$this->TotalResult."条记录";
if($this->TotalResult == 0) return "共0页/".$this->TotalResult."条记录";
$purl = $this->GetCurUrl();
$geturl = "typeid=".$this->TypeID."&TotalResult=".$this->TotalResult."&";
$hidenform = "<input type='hidden' name='typeid' value='".$this->TypeID."'>\r\n";
$hidenform .= "<input type='hidden' name='TotalResult' value='".$this->TotalResult."'>\r\n";
$purl .= "?".$geturl;
//获得上一页和下一页的链接
if($this->PageNo != 1){
$prepage.="<td width='50'><a href='".$purl."PageNo=$prepagenum'>上一页</a></td>\r\n";
$indexpage="<td width='30'><a href='".$purl."PageNo=1'>首页</a></td>\r\n";
}
else{
$indexpage="<td width='30'>首页</td>\r\n";
}
if($this->PageNo!=$totalpage && $totalpage>1){
$nextpage.="<td width='50'><a href='".$purl."PageNo=$nextpagenum'>下一页</a></td>\r\n";
$endpage="<td width='30'><a href='".$purl."PageNo=$totalpage'>末页</a></td>\r\n";
}
else{
$endpage="<td width='30'>末页</td>\r\n";
}
//获得数字链接
$listdd="";
$total_list = $list_len * 2 + 1;
if($this->PageNo >= $total_list) {
$j = $this->PageNo-$list_len;
$total_list = $this->PageNo+$list_len;
if($total_list>$totalpage) $total_list=$totalpage;
}
else{
$j=1;
if($total_list>$totalpage) $total_list=$totalpage;
}
for($j;$j<=$total_list;$j++)
{
if($j==$this->PageNo) $listdd.= "<td>$j </td>\r\n";
else $listdd.="<td><a href='".$purl."PageNo=$j'>[".$j."]</a> </td>\r\n";
}
$plist = "<table border='0' cellpadding='0' cellspacing='0'>\r\n";
$plist .= "<tr align='center' style='font-size:10pt'>\r\n";
$plist .= "<form name='pagelist' action='".$this->GetCurUrl()."'>$hidenform";
$plist .= $indexpage;
$plist .= $prepage;
$plist .= $listdd;
$plist .= $nextpage;
$plist .= $endpage;
if($totalpage>$total_list){
$plist.="<td width='36'><input type='text' name='PageNo' style='width:30;height:18' value='".$this->PageNo."'></td>\r\n";
$plist.="<td width='30'><input type='submit' name='plistgo' value='GO' style='width:24;height:18;font-size:9pt'></td>\r\n";
}
$plist .= "</form>\r\n</tr>\r\n</table>\r\n";
return $plist;
}
//--------------------------
//获得一个指定的频道的链接
//--------------------------
function GetListUrl($typeid,$typedir,$isdefault,$defaultname,$ispart,$namerule2)
{
return GetTypeUrl($typeid,MfTypedir($typedir),$isdefault,$defaultname,$ispart,$namerule2);
}
//---------------
//获得当前的页面文件的url
//----------------
function GetCurUrl()
{
if(!empty($_SERVER["REQUEST_URI"])){
$nowurl = $_SERVER["REQUEST_URI"];
$nowurls = explode("?",$nowurl);
$nowurl = $nowurls[0];
}
else
{ $nowurl = $_SERVER["PHP_SELF"]; }
return $nowurl;
}
}//End Class
?> | zyyhong | trunk/jiaju001/news/include/inc_arcspec_view.php | PHP | asf20 | 16,843 |
<?php
$cfg_pp_isopen = '0';
$cfg_pp_name = '论坛';
$cfg_pp_indexurl = 'http://www.v5.com/bbs';
?> | zyyhong | trunk/jiaju001/news/include/config_passport.php | PHP | asf20 | 104 |
<?php
if(!defined('DEDEINC'))
{
exit("Request Error!");
}
require_once(dirname(__FILE__)."/inc_arcpart_view.php");
require_once(dirname(__FILE__)."/inc_pubtag_make.php");
/******************************************************
//Copyright 2004-2006 by DedeCms.com itprato
//本类的用途是用于浏览频道列表或对内容列表生成HTML
******************************************************/
@set_time_limit(0);
class DiggList
{
var $dsql;
var $dtp;
var $dtp2;
var $TypeID;
var $TypeLink;
var $PageNo;
var $TotalPage;
var $TotalResult;
var $PageSize;
var $ListType;
var $Fields;
var $PartView;
var $SortType;
var $NameRule;
var $TempletsFile;
//-------------------------------
//php5构造函数
//-------------------------------
function __construct($typeid=0,$sorttype='time')
{
global $dsql;
$this->SortType = $sorttype;
$this->TypeID = $typeid;
$this->TempletsFile = '';
$this->NameRule = $GLOBALS['cfg_cmspath']."/digg/digg-{page}.html";
$this->dsql = new DedeSql(false);
$this->dtp = new DedeTagParse();
$this->dtp->SetNameSpace("dede","{","}");
$this->dtp2 = new DedeTagParse();
$this->dtp2->SetNameSpace("field","[","]");
$this->TypeLink = new TypeLink($typeid);
$this->Fields = $this->TypeLink->TypeInfos;
$this->Fields['id'] = $typeid;
$this->Fields['position'] = ' DIGG顶客 > ';
$this->Fields['title'] = " DIGG顶客 ";
//设置一些全局参数的值
foreach($GLOBALS['PubFields'] as $k=>$v) $this->Fields[$k] = $v;
$this->Fields['rsslink'] = "";
$this->PartView = new PartView($typeid);
}
//php4构造函数
//---------------------------
function DiggList($typeid=0,$sorttype='time'){
$this->__construct($typeid,$sorttype);
}
//---------------------------
//关闭相关资源
//---------------------------
function Close()
{
@$this->dsql->Close();
@$this->dsql = '';
@$this->TypeLink->Close();
@$this->PartView->Close();
}
//------------------
//统计列表里的记录
//------------------
function CountRecord()
{
global $cfg_list_son;
//统计数据库记录
$this->TotalResult = -1;
if(isset($GLOBALS['TotalResult'])) $this->TotalResult = $GLOBALS['TotalResult'];
if(isset($GLOBALS['PageNo'])) $this->PageNo = $GLOBALS['PageNo'];
else $this->PageNo = 1;
if($this->TotalResult==-1)
{
$addSql = " arcrank > -1 ";
$cquery = "Select count(*) as dd From `#@__full_search` where $addSql";
$row = $this->dsql->GetOne($cquery);
if(is_array($row)) $this->TotalResult = $row['dd'];
else $this->TotalResult = 0;
}
//初始化列表模板,并统计页面总数
$tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$GLOBALS['cfg_df_style'].'/digg.htm';
if(!file_exists($tempfile)||!is_file($tempfile)){
echo "模板文件不存在,无法解析文档!";
exit();
}
$this->dtp->LoadTemplate($tempfile);
$this->TempletsFile = ereg_replace("^".$GLOBALS['cfg_basedir'],'',$tempfile);
$ctag = $this->dtp->GetTag("page");
if(!is_object($ctag)){ $ctag = $this->dtp->GetTag("list"); }
if(!is_object($ctag)) $this->PageSize = 25;
else{
if($ctag->GetAtt("pagesize")!="") $this->PageSize = $ctag->GetAtt("pagesize");
else $this->PageSize = 25;
}
$this->TotalPage = ceil($this->TotalResult/$this->PageSize);
}
//------------------
//列表创建HTML
//------------------
function MakeHtml($startpage=1,$makepagesize=0)
{
if(empty($startpage)) $startpage = 1;
$this->CountRecord();
//初步给固定值的标记赋值
$this->ParseTempletsFirst();
CreateDir('/digg','','');
$murl = "";
if($makepagesize>0) $endpage = $startpage+$makepagesize;
else $endpage = ($this->TotalPage+1);
if($endpage>($this->TotalPage+1)) $endpage = $this->TotalPage;
//循环更新HTML
for($this->PageNo=$startpage;$this->PageNo<$endpage;$this->PageNo++)
{
$this->ParseDMFields($this->PageNo,1);
$makeFile = $this->NameRule;
$makeFile = str_replace("{page}",$this->PageNo,$makeFile);
$murl = $makeFile;
$makeFile = $this->GetTruePath().$makeFile;
$makeFile = ereg_replace("/{1,}","/",$makeFile);
$murl = $this->GetTrueUrl($murl);
$this->dtp->SaveTo($makeFile);
echo "成功创建:<a href='$murl' target='_blank'>$murl</a><br/>";
}
$this->Close();
return $murl;
}
//------------------
//显示列表
//------------------
function Display()
{
$this->CountRecord();
$this->ParseTempletsFirst();
$this->ParseDMFields($this->PageNo,0);
$this->Close();
$this->dtp->Display();
}
//----------------------------
//获得站点的真实根路径
//----------------------------
function GetTruePath(){
$truepath = $GLOBALS["cfg_basedir"];
return $truepath;
}
//----------------------------
//获得真实连接路径
//----------------------------
function GetTrueUrl($nurl){
if($this->Fields['moresite']==1){ $nurl = ereg_replace("/$","",$this->Fields['siteurl']).$nurl; }
return $nurl;
}
//--------------------------------
//解析模板,对固定的标记进行初始给值
//--------------------------------
function ParseTempletsFirst()
{
//对公用标记的解析,这里对对象的调用均是用引用调用的,因此运算后会自动改变传递的对象的值
MakePublicTag($this,$this->dtp,$this->PartView,$this->TypeLink,$this->TypeID,0,0);
}
//--------------------------------
//解析模板,对内容里的变动进行赋值
//--------------------------------
function ParseDMFields($PageNo,$ismake=1)
{
foreach($this->dtp->CTags as $tagid=>$ctag){
if($ctag->GetName()=="list"){
$limitstart = ($this->PageNo-1) * $this->PageSize;
$row = $this->PageSize;
if(trim($ctag->GetInnerText())==""){ $InnerText = GetSysTemplets("list_digglist.htm"); }
else{ $InnerText = trim($ctag->GetInnerText()); }
$this->dtp->Assign($tagid,
$this->GetArcList(
$limitstart,
$row,
$ctag->GetAtt("col"),
$ctag->GetAtt("titlelen"),
$ctag->GetAtt("infolen"),
$ctag->GetAtt("imgwidth"),
$ctag->GetAtt("imgheight"),
$ctag->GetAtt("listtype"),
$this->SortType,
$InnerText,
$ctag->GetAtt("tablewidth"),
$ismake,
$ctag->GetAtt("orderway")
)
);
}
else if($ctag->GetName()=="pagelist"){
$list_len = trim($ctag->GetAtt("listsize"));
$ctag->GetAtt("listitem")=="" ? $listitem="info,index,pre,pageno,next,end,option" : $listitem=$ctag->GetAtt("listitem");
if($list_len=="") $list_len = 3;
if($ismake==0) $this->dtp->Assign($tagid,$this->GetPageListDM($list_len,$listitem));
else $this->dtp->Assign($tagid,$this->GetPageListST($list_len,$listitem));
}
}
}
//----------------------------------
//获得一个单列的文档列表
//---------------------------------
function GetArcList($limitstart=0,$row=10,$col=1,$titlelen=30,$infolen=250,
$imgwidth=120,$imgheight=90,$listtype="all",$orderby="default",$innertext="",$tablewidth="100",$ismake=1,$orderWay='desc')
{
global $cfg_list_son;
$t1 = ExecTime();
$typeid=$this->TypeID;
if($row=="") $row = 10;
if($limitstart=="") $limitstart = 0;
if($titlelen=="") $titlelen = 100;
if($infolen=="") $infolen = 250;
if($imgwidth=="") $imgwidth = 120;
if($imgheight=="") $imgheight = 120;
if($listtype=="") $listtype = "all";
if($orderby=="") $orderby="default";
else $orderby=strtolower($orderby);
if($orderWay=='') $orderWay = 'desc';
$tablewidth = str_replace("%","",$tablewidth);
if($tablewidth=="") $tablewidth=100;
if($col=="") $col=1;
$colWidth = ceil(100/$col);
$tablewidth = $tablewidth."%";
$colWidth = $colWidth."%";
$innertext = trim($innertext);
if($innertext=="") $innertext = GetSysTemplets("list_digglist.htm");
//按不同情况设定SQL条件
$orwhere = " arc.arcrank > -1 ";
//排序方式
$ordersql = "";
if($orderby=="digg") $ordersql=" order by arc.digg $orderWay";
else $ordersql=" order by arc.diggtime $orderWay";
$this->dtp2->LoadSource($innertext);
if(!is_array($this->dtp2->CTags)) return '';
$query = "Select arc.*,
tp.typedir,tp.typename,tp.isdefault,tp.defaultname,
tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl
from `#@__full_search` arc
left join #@__arctype tp on arc.typeid=tp.ID
where $orwhere $ordersql limit $limitstart,$row
";
$this->dsql->SetQuery($query);
$this->dsql->Execute("alf");
//$t2 = ExecTime();
//echo $query."|";
//echo ($t2-$t1)."<br>";
$artlist = "";
$GLOBALS['autoindex'] = 0;
while($row = $this->dsql->GetArray("alf"))
{
//处理一些特殊字段
$row['description'] = cn_substr($row['addinfos'],$infolen);
$row['id'] = $row['aid'];
$row['filename'] = $row['arcurl'] = $row['url'];
$row['typeurl'] = GetTypeUrl($row['typeid'],MfTypedir($row['typedir']),$row['isdefault'],$row['defaultname'],$row['ispart'],$row['namerule2'],$row['siteurl']);
if($row['litpic']=="") $row['litpic'] = $GLOBALS['PubFields']['templeturl']."/img/default.gif";
$row['picname'] = $row['litpic'];
if($GLOBALS['cfg_multi_site']=='Y')
{
if($row['siteurl']=="") $row['siteurl'] = $GLOBALS['cfg_mainsite'];
if(!eregi("^http://",$row['picname'])){
$row['litpic'] = $row['siteurl'].$row['litpic'];
$row['picname'] = $row['litpic'];
}
}
$row['stime'] = GetDateMK($row['uptime']);
$row['typelink'] = "<a href='".$row['typeurl']."'>".$row['typename']."</a>";
$row['image'] = "<img src='".$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".ereg_replace("['><]","",$row['title'])."' />";
$row['imglink'] = "<a href='".$row['arcurl']."'>".$row['image']."</a>";
$row['fulltitle'] = $row['title'];
$row['title'] = cn_substr($row['title'],$titlelen);
$row['textlink'] = "<a href='".$row['arcurl']."'>".$row['title']."</a>";
foreach($this->dtp2->CTags as $k=>$ctag)
{
if(isset($row[$ctag->GetName()])) $this->dtp2->Assign($k,$row[$ctag->GetName()]);
else $this->dtp2->Assign($k,'');
}
$GLOBALS['autoindex']++;
$artlist .= $this->dtp2->GetResult();
}//Loop Line
$this->dsql->FreeResult("alf");
//$t3 = ExecTime();
//echo ($t3-$t2)."<br>";
return $artlist;
}
//---------------------------------
//获取静态的分页列表
//---------------------------------
function GetPageListST($list_len,$listitem="info,index,end,pre,next,pageno")
{
$prepage="";
$nextpage="";
$prepagenum = $this->PageNo-1;
$nextpagenum = $this->PageNo+1;
if($list_len==""||ereg("[^0-9]",$list_len)) $list_len=3;
$totalpage = ceil($this->TotalResult/$this->PageSize);
if($totalpage<=1 && $this->TotalResult>0) return "共1页/".$this->TotalResult."条记录";
if($this->TotalResult == 0) return "共0页/".$this->TotalResult."条记录";
$maininfo = " 共{$totalpage}页/".$this->TotalResult."条记录 ";
$purl = $this->GetCurUrl();
$tnamerule = $this->NameRule;
$tnamerule = ereg_replace('^(.*)/','',$tnamerule);
//获得上一页和主页的链接
if($this->PageNo != 1){
$prepage.="<a href='".str_replace("{page}",$prepagenum,$tnamerule)."'>上一页</a>\r\n";
$indexpage="<a href='".str_replace("{page}",1,$tnamerule)."'>首页</a>\r\n";
}else{ $indexpage="首页\r\n"; }
//下一页,未页的链接
if($this->PageNo!=$totalpage && $totalpage>1){
$nextpage.="<a href='".str_replace("{page}",$nextpagenum,$tnamerule)."'>下一页</a>\r\n";
$endpage="<a href='".str_replace("{page}",$totalpage,$tnamerule)."'>末页</a>\r\n";
}else{
$endpage="末页\r\n";
}
//option链接
$optionlen = strlen($totalpage);
$optionlen = $optionlen*20+18;
$optionlist = "<select name='sldd' style='width:$optionlen' onchange='location.href=this.options[this.selectedIndex].value;'>\r\n";
for($mjj=1;$mjj<=$totalpage;$mjj++){
if($mjj==$this->PageNo) $optionlist .= "<option value='".str_replace("{page}",$mjj,$tnamerule)."' selected>$mjj</option>\r\n";
else $optionlist .= "<option value='".str_replace("{page}",$mjj,$tnamerule)."'>$mjj</option>\r\n";
}
$optionlist .= "</select>";
//获得数字链接
$listdd="";
$total_list = $list_len * 2 + 1;
if($this->PageNo >= $total_list) {
$j = $this->PageNo-$list_len;
$total_list = $this->PageNo+$list_len;
if($total_list>$totalpage) $total_list=$totalpage;
}
else{
$j=1;
if($total_list>$totalpage) $total_list=$totalpage;
}
for($j;$j<=$total_list;$j++){
if($j==$this->PageNo) $listdd.= "$j\r\n";
else $listdd.="<a href='".str_replace("{page}",$j,$tnamerule)."'>[".$j."]</a>\r\n";
}
$plist = "";
if(eregi('info',$listitem)) $plist .= $maininfo.' ';
if(eregi('index',$listitem)) $plist .= $indexpage.' ';
if(eregi('pre',$listitem)) $plist .= $prepage.' ';
if(eregi('pageno',$listitem)) $plist .= $listdd.' ';
if(eregi('next',$listitem)) $plist .= $nextpage.' ';
if(eregi('end',$listitem)) $plist .= $endpage.' ';
if(eregi('option',$listitem)) $plist .= $optionlist;
return $plist;
}
//---------------------------------
//获取动态的分页列表
//---------------------------------
function GetPageListDM($list_len,$listitem="index,end,pre,next,pageno")
{
$prepage="";
$nextpage="";
$prepagenum = $this->PageNo-1;
$nextpagenum = $this->PageNo+1;
if($list_len==""||ereg("[^0-9]",$list_len)) $list_len=3;
$totalpage = ceil($this->TotalResult/$this->PageSize);
if($totalpage<=1 && $this->TotalResult>0) return "共1页/".$this->TotalResult."条记录";
if($this->TotalResult == 0) return "共0页/".$this->TotalResult."条记录";
$maininfo = "<td style='padding-right:6px'>共{$totalpage}页/".$this->TotalResult."条记录</td>";
$purl = $this->GetCurUrl();
$geturl = "typeid=".$this->TypeID."&TotalResult=".$this->TotalResult."&";
$hidenform = "<input type='hidden' name='typeid' value='".$this->TypeID."'>\r\n";
$hidenform = "<input type='hidden' name='sorttype' value='".$this->SortType."'>\r\n";
$hidenform .= "<input type='hidden' name='TotalResult' value='".$this->TotalResult."'>\r\n";
$purl .= "?".$geturl;
//获得上一页和下一页的链接
if($this->PageNo != 1){
$prepage.="<td width='50'><a href='".$purl."PageNo=$prepagenum'>上一页</a></td>\r\n";
$indexpage="<td width='30'><a href='".$purl."PageNo=1'>首页</a></td>\r\n";
}
else{
$indexpage="<td width='30'>首页</td>\r\n";
}
if($this->PageNo!=$totalpage && $totalpage>1){
$nextpage.="<td width='50'><a href='".$purl."PageNo=$nextpagenum'>下一页</a></td>\r\n";
$endpage="<td width='30'><a href='".$purl."PageNo=$totalpage'>末页</a></td>\r\n";
}
else{
$endpage="<td width='30'>末页</td>\r\n";
}
//获得数字链接
$listdd="";
$total_list = $list_len * 2 + 1;
if($this->PageNo >= $total_list) {
$j = $this->PageNo-$list_len;
$total_list = $this->PageNo+$list_len;
if($total_list>$totalpage) $total_list=$totalpage;
}else{
$j=1;
if($total_list>$totalpage) $total_list=$totalpage;
}
for($j;$j<=$total_list;$j++){
if($j==$this->PageNo) $listdd.= "<td>$j </td>\r\n";
else $listdd.="<td><a href='".$purl."PageNo=$j'>[".$j."]</a> </td>\r\n";
}
$plist = "<table border='0' cellpadding='0' cellspacing='0'>\r\n";
$plist .= "<tr align='center' style='font-size:10pt'>\r\n";
$plist .= "<form name='pagelist' action='".$this->GetCurUrl()."'>$hidenform";
$plist .= $maininfo.$indexpage.$prepage.$listdd.$nextpage.$endpage;
if($totalpage>$total_list){
$plist.="<td width='36'><input type='text' name='PageNo' style='width:30px;height:18px' value='".$this->PageNo."'></td>\r\n";
$plist.="<td width='30'><input type='submit' name='plistgo' value='GO' style='width:24px;height:18px;font-size:9pt'></td>\r\n";
}
$plist .= "</form>\r\n</tr>\r\n</table>\r\n";
return $plist;
}
//--------------------------
//获得一个指定的频道的链接
//--------------------------
function GetListUrl($typeid,$typedir,$isdefault,$defaultname,$ispart,$namerule2,$siteurl=""){
return GetTypeUrl($typeid,MfTypedir($typedir),$isdefault,$defaultname,$ispart,$namerule2,$siteurl);
}
//--------------------------
//获得一个指定档案的链接
//--------------------------
function GetArcUrl($aid,$typeid,$timetag,$title,$ismake=0,$rank=0,$namerule="",$artdir="",$money=0){
return GetFileUrl($aid,$typeid,$timetag,$title,$ismake,$rank,$namerule,$artdir,$money);
}
//---------------
//获得当前的页面文件的url
//----------------
function GetCurUrl()
{
if(!empty($_SERVER["REQUEST_URI"])){
$nowurl = $_SERVER["REQUEST_URI"];
$nowurls = explode("?",$nowurl);
$nowurl = $nowurls[0];
}else{ $nowurl = $_SERVER["PHP_SELF"]; }
return $nowurl;
}
}//End Class
?> | zyyhong | trunk/jiaju001/news/include/inc_digglist_view.php | PHP | asf20 | 17,675 |
<?php
require_once(dirname(__FILE__)."/config.php");
if(empty($job)) $job = "";
if($job=="newdir")
{
$dirname = trim(ereg_replace("[ \r\n\t\.\*\%\\/\?><\|\":]{1,}","",$dirname));
if($dirname==""){
ShowMsg("目录名非法!","-1");
exit();
}
MkdirAll($cfg_basedir.$activepath."/".$dirname,$GLOBALS['cfg_dir_purview']);
CloseFtp();
ShowMsg("成功创建一个目录!","select_media.php?f=$f&activepath=".urlencode($activepath."/".$dirname));
exit();
}
if($job=="upload")
{
if(empty($uploadfile)) $uploadfile = "";
if(!is_uploaded_file($uploadfile)){
ShowMsg("你没有选择上传的文件!","-1");
exit();
}
if(ereg("^text",$uploadfile_type)){
ShowMsg("不允许文本类型附件!","-1");
exit();
}
$nowtme = time();
if($filename!="") $filename = trim(ereg_replace("[ \r\n\t\*\%\\/\?><\|\":]{1,}","",$filename));
if($filename==""){
$y = substr(strftime("%Y",$nowtme),2,2);
$filename = $cuserLogin->getUserID()."_".$y.strftime("%m%d%H%M%S",$nowtme);
$fs = explode(".",$uploadfile_name);
$filename = $filename.".".$fs[count($fs)-1];
}
$fullfilename = $cfg_basedir.$activepath."/".$filename;
if(file_exists($fullfilename)){
ShowMsg("本目录已经存在同名的文件,请更改!","-1");
exit();
}
@move_uploaded_file($uploadfile,$fullfilename);
if($uploadfile_type == 'application/x-shockwave-flash') $mediatype=2;
else if(eregi('audio|media|video',$uploadfile_type)) $mediatype=3;
else $mediatype=4;
$inquery = "
INSERT INTO #@__uploads(title,url,mediatype,width,height,playtime,filesize,uptime,adminid,memberid)
VALUES ('$filename','".$activepath."/".$filename."','$mediatype','0','0','0','{$uploadfile_size}','{$nowtme}','".$cuserLogin->getUserID()."','0');
";
$dsql = new DedeSql(false);
$dsql->ExecuteNoneQuery($inquery);
$dsql->Close();
ShowMsg("成功上传文件!","select_media.php?comeback=".urlencode($filename)."&f=$f&activepath=".urlencode($activepath)."&d=".time());
exit();
}
?> | zyyhong | trunk/jiaju001/news/include/dialog/select_media_post.php | PHP | asf20 | 2,032 |
<?php
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__)."/../inc_photograph.php");
if(empty($job)) $job = "";
if($job=="newdir")
{
$dirname = trim(ereg_replace("[ \r\n\t\.\*\%\\/\?><\|\":]{1,}","",$dirname));
if($dirname==""){
ShowMsg("目录名非法!","-1");
exit();
}
MkdirAll($cfg_basedir.$activepath."/".$dirname,$GLOBALS['cfg_dir_purview']);
CloseFtp();
ShowMsg("成功创建一个目录!","select_images.php?imgstick=$imgstick&v=$v&f=$f&activepath=".urlencode($activepath."/".$dirname));
exit();
}
if($job=="upload")
{
if(empty($imgfile)) $imgfile="";
if(!is_uploaded_file($imgfile)){
ShowMsg("你没有选择上传的文件!","-1");
exit();
}
if(ereg("^text",$imgfile_type)){
ShowMsg("不允许文本类型附件!","-1");
exit();
}
$nowtme = time();
$sparr = Array("image/pjpeg","image/jpeg","image/gif","image/png","image/x-png","image/wbmp");
$imgfile_type = strtolower(trim($imgfile_type));
if(!in_array($imgfile_type,$sparr)){
ShowMsg("上传的图片格式错误,请使用JPEG、GIF、PNG、WBMP格式的其中一种!","-1");
exit();
}
$mdir = strftime("%y%m%d",$nowtme);
if(!is_dir($cfg_basedir.$activepath."/$mdir")){
MkdirAll($cfg_basedir.$activepath."/$mdir",$GLOBALS['cfg_dir_purview']);
CloseFtp();
}
$sname = '.jpg';
//图片的限定扩展名
if($imgfile_type=='image/pjpeg'||$imgfile_type=='image/jpeg'){
$sname = '.jpg';
}else if($imgfile_type=='image/gif'){
$sname = '.gif';
}else if($imgfile_type=='image/png'){
$sname = '.png';
}else if($imgfile_type=='image/wbmp'){
$sname = '.bmp';
}
$filename_name = $cfg_ml->M_ID."_".dd2char(strftime("%H%M%S",$nowtme).mt_rand(100,999));
$filename = $mdir."/".$filename_name;
$filename = $filename.$sname;
$filename_name = $filename_name.$sname;
$fullfilename = $cfg_basedir.$activepath."/".$filename;
if(file_exists($fullfilename)){
ShowMsg("本目录已经存在同名的文件,请更改!","-1");
exit();
}
if(!eregi("\.(jpg|gif|png|bmp)$",$fullfilename)){
ShowMsg("你所上传的文件类型被禁止,系统只允许上传jpg、gif、png、bmp类型图片!","-1");
exit();
}
@move_uploaded_file($imgfile,$fullfilename);
if(empty($resize)) $resize = 0;
if($resize==1){
if(in_array($imgfile_type,$cfg_photo_typenames)) ImageResize($fullfilename,$iwidth,$iheight);
}
else{
if(in_array($imgfile_type,$cfg_photo_typenames)) WaterImg($fullfilename,'up');
}
$info = "";
$sizes[0] = 0; $sizes[1] = 0;
@$sizes = getimagesize($fullfilename,$info);
$imgwidthValue = $sizes[0];
$imgheightValue = $sizes[1];
$imgsize = filesize($fullfilename);
$inquery = "
INSERT INTO #@__uploads(title,url,mediatype,width,height,playtime,filesize,uptime,adminid,memberid)
VALUES ('$filename','".$activepath."/".$filename."','1','$imgwidthValue','$imgheightValue','0','{$imgsize}','{$nowtme}','".$cuserLogin->getUserID()."','0');
";
$dsql = new DedeSql(false);
$dsql->ExecuteNoneQuery($inquery);
$dsql->Close();
@unlink($imgfile);
ShowMsg("成功上传一幅图片!","select_images.php?imgstick=$imgstick&comeback=".urlencode($filename_name)."&v=$v&f=$f&activepath=".urlencode($activepath)."/$mdir&d=".time());
exit();
}
?> | zyyhong | trunk/jiaju001/news/include/dialog/select_images_post.php | PHP | asf20 | 3,373 |
<?php
//该页仅用于检测用户登录的情况,如要手工更改系统配置,请更改config_base.php
require_once(dirname(__FILE__)."/../config_base.php");
require_once(dirname(__FILE__)."/../inc_userlogin.php");
//获得当前脚本名称,如果你的系统被禁用了$_SERVER变量,请自行更改这个选项
$dedeNowurl = "";
$s_scriptName="";
$dedeNowurl = GetCurUrl();
$dedeNowurls = explode("?",$dedeNowurl);
$s_scriptName = $dedeNowurls[0];
//检验用户登录状态
$cuserLogin = new userLogin();
if($cuserLogin->getUserID()==-1)
{
if($cuserLogin->adminDir=='') exit('Request Error!');
$gurl = "../../{$cuserLogin->adminDir}/login.php?gotopage=".urlencode($dedeNowurl);
echo "<script language='javascript'>location='$gurl';</script>";
exit();
}
?> | zyyhong | trunk/jiaju001/news/include/dialog/config.php | PHP | asf20 | 805 |
<?php
require_once(dirname(__FILE__)."/config.php");
if(empty($job)) $job = "";
if($job=="newdir")
{
$dirname = trim(ereg_replace("[ \r\n\t\.\*\%\\/\?><\|\":]{1,}","",$dirname));
if($dirname==""){
ShowMsg("目录名非法!","-1");
exit();
}
MkdirAll($cfg_basedir.$activepath."/".$dirname,$GLOBALS['cfg_dir_purview']);
CloseFtp();
ShowMsg("成功创建一个目录!","select_soft.php?f=$f&activepath=".urlencode($activepath."/".$dirname));
exit();
}
if($job=="upload")
{
if(empty($uploadfile)) $uploadfile = "";
if(!is_uploaded_file($uploadfile)){
ShowMsg("你没有选择上传的文件!","-1");
exit();
}
if(ereg("^text",$uploadfile_type)){
ShowMsg("不允许文本类型附件!","-1");
exit();
}
if(!eregi("\.".$cfg_softtype,$uploadfile_name))
{
ShowMsg("你所上传的文件类型不能被识别,请更改系统对扩展名限定的配置!","-1");
exit();
}
$nowtme = time();
if($filename!="") $filename = trim(ereg_replace("[ \r\n\t\*\%\\/\?><\|\":]{1,}","",$filename));
if($filename==""){
$y = substr(strftime("%Y",$nowtme),2,2);
$filename = $cuserLogin->getUserID()."_".$y.strftime("%m%d%H%M%S",$nowtme);
$fs = explode(".",$uploadfile_name);
$filename = $filename.".".$fs[count($fs)-1];
}
$fullfilename = $cfg_basedir.$activepath."/".$filename;
if(file_exists($fullfilename)){
ShowMsg("本目录已经存在同名的文件,请更改!","-1");
exit();
}
@move_uploaded_file($uploadfile,$fullfilename);
if($uploadfile_type == 'application/x-shockwave-flash') $mediatype=2;
else if(eregi('audio|media|video',$uploadfile_type)) $mediatype=3;
else $mediatype=4;
$inquery = "
INSERT INTO #@__uploads(title,url,mediatype,width,height,playtime,filesize,uptime,adminid,memberid)
VALUES ('$filename','".$activepath."/".$filename."','$mediatype','0','0','0','{$uploadfile_size}','{$nowtme}','".$cuserLogin->getUserID()."','0');
";
$dsql = new DedeSql(false);
$dsql->ExecuteNoneQuery($inquery);
$dsql->Close();
ShowMsg("成功上传文件!","select_soft.php?comeback=".urlencode($filename)."&f=$f&activepath=".urlencode($activepath)."&d=".time());
exit();
}
?> | zyyhong | trunk/jiaju001/news/include/dialog/select_soft_post.php | PHP | asf20 | 2,207 |
<?php
require_once(dirname(__FILE__)."/config.php");
if(empty($activepath)) $activepath = "";
if(empty($imgstick)) $imgstick = "";
$activepath = str_replace("..","",$activepath);
$activepath = ereg_replace("^/{1,}","/",$activepath);
if(strlen($activepath) < strlen($cfg_medias_dir)){
$activepath = $cfg_medias_dir;
}
$inpath = $cfg_basedir.$activepath;
$activeurl = "..".$activepath;
if(empty($f)) $f="form1.picname";
if(empty($v)) $v="picview";
if(empty($comeback)) $comeback = "";
?>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>图片浏览器</title>
<link href='base.css' rel='stylesheet' type='text/css'>
<style>
.linerow {border-bottom: 1px solid #CBD8AC;}
.napisdiv {left:40;top:3;width:150;height:100;position:absolute;z-index:3}
</style>
<script>
function $DE(eid){ return document.getElementById(eid); }
function nullLink(){ return; }
function ChangeImage(surl){ $DE('picview').src = surl; }
</script>
</head>
<body background='img/allbg.gif' leftmargin='0' topmargin='0'>
<div id="floater" class="napisdiv">
<a href="javascript:nullLink();" onClick="ChangeImage('img/picviewnone.gif');"><img src='img/picviewnone.gif' name='picview' border='0' alt='单击关闭预览'></a>
</div>
<SCRIPT language=JavaScript src="js/float.js"></SCRIPT>
<SCRIPT language=JavaScript>
function $DE(eid){ return document.getElementById(eid); }
function nullLink(){ return; }
function ChangeImage(surl){ $DE('picview').src = surl; }
function ReturnImg(reimg)
{
window.opener.document.<?php echo $f?>.value=reimg;
if(window.opener.document.getElementById('<?php echo $v?>')){
window.opener.document.getElementById('<?php echo $v?>').src = reimg;
}
if(document.all) window.opener=true;
window.close();
}
</SCRIPT>
<table width='100%' border='0' cellspacing='0' cellpadding='0' align="center">
<tr>
<td colspan='4' align='right'>
<table width='100%' border='0' cellpadding='0' cellspacing='1' bgcolor='#CBD8AC'>
<tr bgcolor='#FFFFFF'>
<td colspan='4'>
<table width='100%' border='0' cellspacing='0' cellpadding='2'>
<tr bgcolor="#CCCCCC">
<td width="8%" align="center" class='linerow' bgcolor='#EEF4EA'><strong>预览</strong></td>
<td width="47%" align="center" background="img/wbg.gif" class='linerow'><strong>点击名称选择图片</strong></td>
<td width="15%" align="center" bgcolor='#EEF4EA' class='linerow'><strong>文件大小</strong></td>
<td width="30%" align="center" background="img/wbg.gif" class='linerow'><strong>最后修改时间</strong></td>
</tr>
<tr>
<td class='linerow' colspan='4' bgcolor='#F9FBF0'>
点击“V”预览图片,点击图片名选择图片,显示图片后点击该图片关闭预览。
</td>
</tr>
<?php
$dh = dir($inpath);
$ty1="";
$ty2="";
while($file = $dh->read()) {
//-----计算文件大小和创建时间
if($file!="." && $file!=".." && !is_dir("$inpath/$file")){
$filesize = filesize("$inpath/$file");
$filesize=$filesize/1024;
if($filesize!="")
if($filesize<0.1){
@list($ty1,$ty2)=split("\.",$filesize);
$filesize=$ty1.".".substr($ty2,0,2);
}
else{
@list($ty1,$ty2)=split("\.",$filesize);
$filesize=$ty1.".".substr($ty2,0,1);
}
$filetime = filemtime("$inpath/$file");
$filetime = strftime("%y-%m-%d %H:%M:%S",$filetime);
}
if($file == ".") continue;
else if($file == ".."){
if($activepath == "") continue;
$tmp = eregi_replace("[/][^/]*$","",$activepath);
$line = "\n<tr>
<td class='linerow' colspan='2'>
<a href='select_images.php?imgstick=$imgstick&v=$v&f=$f&activepath=".urlencode($tmp)."'><img src=img/dir2.gif border=0 width=16 height=16 align=absmiddle>上级目录</a></td>
<td colspan='2' class='linerow'> 当前目录:$activepath</td>
</tr>
";
echo $line;
}
else if(is_dir("$inpath/$file")){
if(eregi("^_(.*)$",$file)) continue; #屏蔽FrontPage扩展目录和linux隐蔽目录
if(eregi("^\.(.*)$",$file)) continue;
$line = "\n<tr>
<td bgcolor='#F9FBF0' class='linerow' colspan='2'>
<a href='select_images.php?imgstick=$imgstick&v=$v&f=$f&activepath=".urlencode("$activepath/$file")."'><img src=img/dir.gif border=0 width=16 height=16 align=absmiddle>$file</a></td>
<td class='linerow'> </td>
<td bgcolor='#F9FBF0' class='linerow'> </td>
</tr>";
echo "$line";
}
else if(eregi("\.(gif|png)",$file)){
$reurl = "$activeurl/$file";
$reurl = ereg_replace("^\.\.","",$reurl);
$reurl = $cfg_mainsite.$reurl;
if($file==$comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$line = "\n<tr>
<td align='center' class='linerow' bgcolor='#F9FBF0'>
<a href=\"#\" onClick=\"ChangeImage('$reurl');\"><img src='img/picviewnone.gif' width='16' height='16' border='0' align=absmiddle></a>
</td>
<td class='linerow' bgcolor='#F9FBF0'>
<a href=# onclick=\"ReturnImg('$reurl');\" $lstyle><img src=img/gif.gif border=0 width=16 height=16 align=absmiddle>$file</a></td>
<td class='linerow'>$filesize KB</td>
<td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
</tr>";
echo "$line";
}
else if(eregi("\.(jpg)",$file)){
$reurl = "$activeurl/$file";
$reurl = ereg_replace("^\.\.","",$reurl);
$reurl = $cfg_mainsite.$reurl;
if($file==$comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$line = "\n<tr>
<td align='center' class='linerow' bgcolor='#F9FBF0'>
<a href=\"#\" onClick=\"ChangeImage('$reurl');\"><img src='img/picviewnone.gif' width='16' height='16' border='0' align=absmiddle></a>
</td>
<td class='linerow' bgcolor='#F9FBF0'>
<a href=# onclick=\"ReturnImg('$reurl');\" $lstyle><img src=img/jpg.gif border=0 width=16 height=16 align=absmiddle>$file</a>
</td>
<td class='linerow'>$filesize KB</td>
<td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
</tr>";
echo "$line";
}
}//End Loop
$dh->close();
?>
<tr>
<td colspan='4' bgcolor='#E8F1DE'>
<table width='100%'>
<form action='select_images_post.php' method='POST' enctype="multipart/form-data" name='myform'>
<input type='hidden' name='activepath' value='<?php echo $activepath?>'>
<input type='hidden' name='f' value='<?php echo $f?>'>
<input type='hidden' name='v' value='<?php echo $v?>'>
<input type='hidden' name='imgstick' value='<?php echo $imgstick?>'>
<input type='hidden' name='job' value='upload'>
<tr>
<td background="img/tbg.gif" bgcolor="#99CC00" style="clear:all">
上 传: <input type='file' name='imgfile' style='width:200px' style="clear:all">
<input type='checkbox' name='resize' value='1' class='np' style="clear:all">自动缩小
宽:<input type='text' style='width:30' name='iwidth' value='<?php echo $cfg_ddimg_width?>'>
高:<input type='text' style='width:30' name='iheight' value='<?php echo $cfg_ddimg_height?>'>
<input type='submit' name='sb1' value='确定'>
</td>
</tr>
</form>
<form action='select_images_post.php' method='POST' name='myform2'>
<input type='hidden' name='activepath' value='<?php echo $activepath?>' style='width:200'>
<input type='hidden' name='f' value='<?php echo $f?>'>
<input type='hidden' name='v' value='<?php echo $v?>'>
<input type='hidden' name='imgstick' value='<?php echo $imgstick?>'>
<input type='hidden' name='job' value='newdir'>
<tr>
<td background="img/tbg.gif" bgcolor='#66CC00'> 新目录:
<input type='text' name='dirname' value='' style='width:150'>
<input type='submit' name='sb2' value='创建' style='width:40'>
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html> | zyyhong | trunk/jiaju001/news/include/dialog/select_images.php | PHP | asf20 | 7,775 |
<?php
require_once(dirname(__FILE__)."/config.php");
$cfg_txttype = "htm|html|tpl|txt|dtp";
if(empty($job)) $job = "";
if($job=="newdir")
{
$dirname = trim(ereg_replace("[ \r\n\t\.\*\%\\/\?><\|\":]{1,}","",$dirname));
if($dirname==""){
ShowMsg("目录名非法!","-1");
exit();
}
MkdirAll($cfg_basedir.$activepath."/".$dirname,$GLOBALS['cfg_dir_purview']);
CloseFtp();
ShowMsg("成功创建一个目录!","select_templets.php?f=$f&activepath=".urlencode($activepath."/".$dirname));
exit();
}
if($job=="upload")
{
if(empty($uploadfile)) $uploadfile = "";
if(!is_uploaded_file($uploadfile)){
ShowMsg("你没有选择上传的文件!","-1");
exit();
}
if(!ereg("^text",$uploadfile_type)){
ShowMsg("你上传的不是文本类型附件!","-1");
exit();
}
if(!eregi($cfg_txttype,$uploadfile_name))
{
ShowMsg("你所上传的模板文件类型不能被识别,请使用htm、html、tpl、txt、dtp扩展名!","-1");
exit();
}
if($filename!="") $filename = trim(ereg_replace("[ \r\n\t\*\%\\/\?><\|\":]{1,}","",$filename));
if($filename==""){
$y = substr(strftime("%Y",time()),2,2);
$filename = $cuserLogin->getUserID()."_".$y.strftime("%m%d%H%M%S",time());
$fs = explode(".",$uploadfile_name);
$filename = $filename.".".$fs[count($fs)-1];
}
$fullfilename = $cfg_basedir.$activepath."/".$filename;
if(file_exists($fullfilename))
{
ShowMsg("本目录已经存在同名的文件,请更改!","-1");
exit();
}
@move_uploaded_file($uploadfile,$fullfilename);
@unlink($uploadfile);
ShowMsg("成功上传文件!","select_templets.php?comeback=".urlencode($filename)."&f=$f&activepath=".urlencode($activepath)."&d=".time());
exit();
}
?> | zyyhong | trunk/jiaju001/news/include/dialog/select_templets.php | PHP | asf20 | 1,748 |
td {font-size: 9pt;line-height: 1.5;}
body {
font-size: 9pt;
line-height: 1.5;
scrollbar-base-color:#C0D586;
scrollbar-arrow-color:#FFFFFF;
scrollbar-shadow-color:DEEFC6
}
a:link { font-size: 9pt; color: #000000; text-decoration: none }
a:visited{ font-size: 9pt; color: #000000; text-decoration: none }
a:hover {color: red}
input{border: 1px solid #000000;}
.np{border:none}
.linerow{border-bottom: 1px solid #ACACAC;}
.coolbg {
border-right: 2px solid #ACACAC;
border-bottom: 2px solid #ACACAC;
background-color: #E6E6E6
}
.coolbg2 {
border: 1px solid #000000;
background-color: #DFDDD2;
height:18px
}
.ll {
border-right: 2px solid #ACACAC;
border-bottom: 2px solid #ACACAC;
background-color: #E6E6E6
}
.bline {border-bottom: 1px solid #BCBCBC;background-color: #FFFFFF}
.bline2 {border-bottom: 1px solid #BCBCBC;} | zyyhong | trunk/jiaju001/news/include/dialog/base.css | CSS | asf20 | 874 |
<?php
require_once(dirname(__FILE__)."/config.php");
if(empty($activepath)) $activepath = "";
$activepath = str_replace("..","",$activepath);
$activepath = ereg_replace("^/{1,}","/",$activepath);
if(strlen($activepath)<strlen($cfg_other_medias)){
$activepath = $cfg_other_medias;
}
$inpath = $cfg_basedir.$activepath;
$activeurl = "..".$activepath;
if(empty($f)) $f="form1.enclosure";
if(empty($comeback)) $comeback = "";
?>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>媒体文件管理器</title>
<link href='base.css' rel='stylesheet' type='text/css'>
<style>
.linerow {border-bottom: 1px solid #CBD8AC;}
</style>
</head>
<body background='img/allbg.gif' leftmargin='0' topmargin='0'>
<SCRIPT language='JavaScript'>
function nullLink()
{
return;
}
function ReturnValue(reimg)
{
window.opener.document.<?php echo $f?>.value=reimg;
if(document.all) window.opener=true;
window.close();
}
</SCRIPT>
<table width='100%' border='0' cellpadding='0' cellspacing='1' bgcolor='#CBD8AC' align="center">
<tr bgcolor='#FFFFFF'>
<td colspan='3'>
<!-- 开始文件列表 -->
<table width='100%' border='0' cellspacing='0' cellpadding='2'>
<tr bgcolor="#CCCCCC">
<td width="55%" align="center" background="img/wbg.gif" class='linerow'><strong>点击名称选择文件</strong></td>
<td width="15%" align="center" bgcolor='#EEF4EA' class='linerow'><strong>文件大小</strong></td>
<td width="30%" align="center" background="img/wbg.gif" class='linerow'><strong>最后修改时间</strong></td>
</tr>
<?php
$dh = dir($inpath);
$ty1="";
$ty2="";
while($file = $dh->read()) {
//-----计算文件大小和创建时间
if($file!="." && $file!=".." && !is_dir("$inpath/$file")){
$filesize = filesize("$inpath/$file");
$filesize=$filesize/1024;
if($filesize!="")
if($filesize<0.1){
@list($ty1,$ty2)=split("\.",$filesize);
$filesize=$ty1.".".substr($ty2,0,2);
}
else{
@list($ty1,$ty2)=split("\.",$filesize);
$filesize=$ty1.".".substr($ty2,0,1);
}
$filetime = filemtime("$inpath/$file");
$filetime = strftime("%y-%m-%d %H:%M:%S",$filetime);
}
//------判断文件类型并作处理
if($file == ".") continue;
else if($file == "..")
{
if($activepath == "") continue;
$tmp = eregi_replace("[/][^/]*$","",$activepath);
$line = "\n<tr>
<td class='linerow'> <a href=select_media.php?f=$f&activepath=".urlencode($tmp)."><img src=img/dir2.gif border=0 width=16 height=16 align=absmiddle>上级目录</a></td>
<td colspan='2' class='linerow'> 当前目录:$activepath</td>
</tr>\r\n";
echo $line;
}
else if(is_dir("$inpath/$file"))
{
if(eregi("^_(.*)$",$file)) continue; #屏蔽FrontPage扩展目录和linux隐蔽目录
if(eregi("^\.(.*)$",$file)) continue;
$line = "\n<tr>
<td bgcolor='#F9FBF0' class='linerow'>
<a href=select_media.php?f=$f&activepath=".urlencode("$activepath/$file")."><img src=img/dir.gif border=0 width=16 height=16 align=absmiddle>$file</a>
</td>
<td class='linerow'>-</td>
<td bgcolor='#F9FBF0' class='linerow'>-</td>
</tr>";
echo "$line";
}
else if(eregi("\.(swf|fly|fla)",$file)){
$reurl = "$activeurl/$file";
$reurl = ereg_replace("^\.\.","",$reurl);
$reurl = $cfg_mainsite.$reurl;
if($file==$comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$line = "\n<tr>
<td class='linerow' bgcolor='#F9FBF0'>
<a href=\"javascript:ReturnValue('$reurl');\"><img src=img/flash.gif border=0 width=16 height=16 align=absmiddle>$file</a>
</td>
<td class='linerow'>$filesize KB</td>
<td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
</tr>";
echo "$line";
}
else if(eregi("\.(wmv|api)",$file)){
$reurl = "$activeurl/$file";
$reurl = ereg_replace("^\.\.","",$reurl);
$reurl = $cfg_mainsite.$reurl;
if($file==$comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$line = "\n<tr>
<td class='linerow' bgcolor='#F9FBF0'>
<a href=\"javascript:ReturnValue('$reurl');\"><img src=img/wmv.gif border=0 width=16 height=16 align=absmiddle>$file</a>
</td>
<td class='linerow'>$filesize KB</td>
<td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
</tr>";
echo "$line";
}
else if(eregi("\.(rm|rmvb)",$file)){
$reurl = "$activeurl/$file";
$reurl = ereg_replace("^\.\.","",$reurl);
$reurl = $cfg_mainsite.$reurl;
if($file==$comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$line = "\n<tr>
<td class='linerow' bgcolor='#F9FBF0'>
<a href=\"javascript:ReturnValue('$reurl');\"><img src=img/rm.gif border=0 width=16 height=16 align=absmiddle>$file</a>
</td>
<td class='linerow'>$filesize KB</td>
<td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
</tr>";
echo "$line";
}
else if(eregi("\.(mp3|wma)",$file)){
$reurl = "$activeurl/$file";
$reurl = ereg_replace("^\.\.","",$reurl);
$reurl = $cfg_mainsite.$reurl;
if($file==$comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$line = "\n<tr>
<td class='linerow' bgcolor='#F9FBF0'>
<a href=\"javascript:ReturnValue('$reurl');\"><img src=img/mp3.gif border=0 width=16 height=16 align=absmiddle>$file</a>
</td>
<td class='linerow'>$filesize KB</td>
<td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
</tr>";
echo "$line";
}
else
{
$reurl = "$activeurl/$file";
$reurl = ereg_replace("^\.\.","",$reurl);
$reurl = $cfg_mainsite.$reurl;
if($file==$comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$line = "\n<tr>
<td class='linerow' bgcolor='#F9FBF0'>
<a href=\"javascript:ReturnValue('$reurl');\"><img src=img/exe.gif border=0 width=16 height=16 align=absmiddle>$file</a>
</td>
<td class='linerow'>$filesize KB</td>
<td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
</tr>";
echo "$line";
}
}//End Loop
$dh->close();
?>
<!-- 文件列表完 -->
<tr>
<td colspan='3' bgcolor='#E8F1DE'>
<table width='100%'>
<form action='select_media_post.php' method='POST' enctype="multipart/form-data" name='myform'>
<input type='hidden' name='activepath' value='<?php echo $activepath?>'>
<input type='hidden' name='f' value='<?php echo $f?>'>
<input type='hidden' name='job' value='upload'>
<tr>
<td background="img/tbg.gif" bgcolor="#99CC00">
上 传: <input type='file' name='uploadfile' style='width:200'>
改名:<input type='text' name='filename' value='' style='width:100'>
<input type='submit' name='sb1' value='确定'>
</td>
</tr>
</form>
<form action='select_media_post.php' method='POST' name='myform2'>
<input type='hidden' name='activepath' value='<?php echo $activepath?>' style='width:200'>
<input type='hidden' name='f' value='<?php echo $f?>'>
<input type='hidden' name='job' value='newdir'>
<tr>
<td background="img/tbg.gif" bgcolor='#66CC00'> 新目录:
<input type='text' name='dirname' value='' style='width:150'>
<input type='submit' name='sb2' value='创建' style='width:40'>
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
| zyyhong | trunk/jiaju001/news/include/dialog/select_media.php | PHP | asf20 | 7,425 |
<?php
require_once(dirname(__FILE__)."/config.php");
if(empty($activepath)) $activepath = "";
$activepath = str_replace("..","",$activepath);
$activepath = ereg_replace("^/{1,}","/",$activepath);
if(strlen($activepath)<strlen($cfg_soft_dir)){
$activepath = $cfg_soft_dir;
}
$inpath = $cfg_basedir.$activepath;
$activeurl = "..".$activepath;
if(empty($f)) $f="form1.enclosure";
if(empty($comeback)) $comeback = "";
?>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>软件管理器</title>
<link href='base.css' rel='stylesheet' type='text/css'>
<style>
.linerow {border-bottom: 1px solid #CBD8AC;}
</style>
</head>
<body background='img/allbg.gif' leftmargin='0' topmargin='0'>
<SCRIPT language='JavaScript'>
function nullLink()
{
return;
}
function ReturnValue(reimg)
{
window.opener.document.<?php echo $f?>.value=reimg;
if(document.all) window.opener=true;
window.close();
}
</SCRIPT>
<table width='100%' border='0' cellpadding='0' cellspacing='1' bgcolor='#CBD8AC' align="center">
<tr bgcolor='#FFFFFF'>
<td colspan='3'>
<!-- 开始文件列表 -->
<table width='100%' border='0' cellspacing='0' cellpadding='2'>
<tr bgcolor="#CCCCCC">
<td width="55%" align="center" background="img/wbg.gif" class='linerow'><strong>点击名称选择文件</strong></td>
<td width="15%" align="center" bgcolor='#EEF4EA' class='linerow'><strong>文件大小</strong></td>
<td width="30%" align="center" background="img/wbg.gif" class='linerow'><strong>最后修改时间</strong></td>
</tr>
<?php
$dh = dir($inpath);
$ty1="";
$ty2="";
while($file = $dh->read()) {
//-----计算文件大小和创建时间
if($file!="." && $file!=".." && !is_dir("$inpath/$file")){
$filesize = filesize("$inpath/$file");
$filesize=$filesize/1024;
if($filesize!="")
if($filesize<0.1){
@list($ty1,$ty2)=split("\.",$filesize);
$filesize=$ty1.".".substr($ty2,0,2);
}
else{
@list($ty1,$ty2)=split("\.",$filesize);
$filesize=$ty1.".".substr($ty2,0,1);
}
$filetime = filemtime("$inpath/$file");
$filetime = strftime("%y-%m-%d %H:%M:%S",$filetime);
}
//------判断文件类型并作处理
if($file == ".") continue;
else if($file == "..")
{
if($activepath == "") continue;
$tmp = eregi_replace("[/][^/]*$","",$activepath);
$line = "\n<tr>
<td class='linerow'> <a href='select_soft.php?f=$f&activepath=".urlencode($tmp)."'><img src=img/dir2.gif border=0 width=16 height=16 align=absmiddle>上级目录</a></td>
<td colspan='2' class='linerow'> 当前目录:$activepath</td>
</tr>\r\n";
echo $line;
}
else if(is_dir("$inpath/$file"))
{
if(eregi("^_(.*)$",$file)) continue; #屏蔽FrontPage扩展目录和linux隐蔽目录
if(eregi("^\.(.*)$",$file)) continue;
$line = "\n<tr>
<td bgcolor='#F9FBF0' class='linerow'>
<a href=select_soft.php?f=$f&activepath=".urlencode("$activepath/$file")."><img src=img/dir.gif border=0 width=16 height=16 align=absmiddle>$file</a>
</td>
<td class='linerow'>-</td>
<td bgcolor='#F9FBF0' class='linerow'>-</td>
</tr>";
echo "$line";
}
else if(eregi("\.(zip|rar|tgr.gz)",$file)){
if($file==$comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$reurl = "$activeurl/$file";
$reurl = ereg_replace("^\.\.","",$reurl);
$reurl = $cfg_mainsite.$reurl;
$line = "\n<tr>
<td class='linerow' bgcolor='#F9FBF0'>
<a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src=img/zip.gif border=0 width=16 height=16 align=absmiddle>$file</a>
</td>
<td class='linerow'>$filesize KB</td>
<td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
</tr>";
echo "$line";
}
else{
if($file==$comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$reurl = "$activeurl/$file";
$reurl = ereg_replace("^\.\.","",$reurl);
$reurl = $cfg_mainsite.$reurl;
$line = "\n<tr>
<td class='linerow' bgcolor='#F9FBF0'>
<a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src=img/exe.gif border=0 width=16 height=16 align=absmiddle>$file</a>
</td>
<td class='linerow'>$filesize KB</td>
<td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
</tr>";
echo "$line";
}
}//End Loop
$dh->close();
?>
<!-- 文件列表完 -->
<tr>
<td colspan='3' bgcolor='#E8F1DE'>
<table width='100%'>
<form action='select_soft_post.php' method='POST' enctype="multipart/form-data" name='myform'>
<input type='hidden' name='activepath' value='<?php echo $activepath?>'>
<input type='hidden' name='f' value='<?php echo $f?>'>
<input type='hidden' name='job' value='upload'>
<tr>
<td background="img/tbg.gif" bgcolor="#99CC00">
上 传: <input type='file' name='uploadfile' style='width:200'>
改名:<input type='text' name='filename' value='' style='width:100'>
<input type='submit' name='sb1' value='确定'>
</td>
</tr>
</form>
<form action='select_soft_post.php' method='POST' name='myform2'>
<input type='hidden' name='activepath' value='<?php echo $activepath?>' style='width:200'>
<input type='hidden' name='f' value='<?php echo $f?>'>
<input type='hidden' name='job' value='newdir'>
<tr>
<td background="img/tbg.gif" bgcolor='#66CC00'> 新目录:
<input type='text' name='dirname' value='' style='width:150'>
<input type='submit' name='sb2' value='创建' style='width:40'>
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
| zyyhong | trunk/jiaju001/news/include/dialog/select_soft.php | PHP | asf20 | 5,648 |
<?php
require_once(DEDEINC."/pub_oxwindow.php");
//打开所有标记,开启此项允许你使用封面模板的所有标记,但会对性能造成一定的影响
$cfg_OpenAll = false;
include_once(DEDEINC."/inc_arcpart_view.php");
include_once(DEDEINC."/inc_pubtag_make.php");
/******************************************************
//Copyright 2004-2006 by DedeCms.com itprato
//本类的用途是用于浏览含有某Tag的文档
******************************************************/
@set_time_limit(0);
class TagList
{
var $dsql;
var $dtp;
var $dtp2;
var $TypeLink;
var $PageNo;
var $TotalPage;
var $TotalResult;
var $PageSize;
var $ListType;
var $Fields;
var $PartView;
var $Tag;
var $Templet;
var $TagInfos;
var $TempletsFile;
var $TagID;
//-------------------------------
//php5构造函数
//-------------------------------
function __construct($keyword,$templet)
{
$this->Templet = $templet;
$this->Tag = $keyword;
$this->dsql = new DedeSql(false);
$this->dtp = new DedeTagParse();
$this->dtp->SetNameSpace("dede","{","}");
$this->dtp2 = new DedeTagParse();
$this->dtp2->SetNameSpace("field","[","]");
$this->TypeLink = new TypeLink(0);
$this->Fields['tag'] = $keyword;
$this->Fields['position'] = " ".$keyword;
$this->Fields['title'] = " TAG: {$keyword} ";
$this->TempletsFile = '';
//设置一些全局参数的值
foreach($GLOBALS['PubFields'] as $k=>$v) $this->Fields[$k] = $v;
$this->PartView = new PartView(0);
//读取Tag信息
if(ereg("'",$this->Tag)) {
$this->Tag = '';
echo "Tag Error!";
exit();
}
if($this->Tag!='')
{
$this->TagInfos = $this->dsql->GetOne("Select * From `#@__tag_index` where tagname like '{$this->Tag}' ");
if(!is_array($this->TagInfos))
{
$fullsearch = $GLOBALS['cfg_phpurl']."/search.php?keyword=".$this->Tag."&searchtype=titlekeyword";
$msg = "Not this tag!<a href='$fullsearch'>you can go to search it>></a>";
ShowMsgWin($msg,"<a href='tag.php'>Tag Error</a>");
$this->dsql->Close();
exit();
}
$this->TagID = $this->TagInfos['id'];
}
//初始化模板
$tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$GLOBALS['cfg_df_style'].'/'.$this->Templet;
if(!file_exists($tempfile)||!is_file($tempfile)){
echo "Template file not found!";
exit();
}
$this->dtp->LoadTemplate($tempfile);
$this->TempletsFile = ereg_replace("^".$GLOBALS['cfg_basedir'],'',$tempfile);
}
//php4构造函数
//---------------------------
function TagList($keyword,$templet){
$this->__construct($keyword,$templet);
}
//---------------------------
//关闭相关资源
//---------------------------
function Close()
{
@$this->dsql->Close();
@$this->TypeLink->Close();
@$this->PartView->Close();
}
//------------------
//统计列表里的记录
//------------------
function CountRecord()
{
global $cfg_list_son;
//统计数据库记录
$this->TotalResult = -1;
if(isset($GLOBALS['TotalResult'])) $this->TotalResult = $GLOBALS['TotalResult'];
if(isset($GLOBALS['PageNo'])) $this->PageNo = $GLOBALS['PageNo'];
else $this->PageNo = 1;
if($this->TotalResult==-1)
{
$addSql = " arcrank > -1 ";
$cquery = "Select count(*) as dd From #@__tag_list where tid = '{$this->TagID}' And arcrank>-1 ";
$row = $this->dsql->GetOne($cquery);
$this->TotalResult = $row['dd'];
//更新Tag信息
$ntime = time();
//更新浏览量和记录数
$upquery = "Update #@__tag_index set result='{$row['dd']}',count=count+1,weekcc=weekcc+1,monthcc=monthcc+1 where id='{$this->TagID}' ";
$this->dsql->ExecuteNoneQuery($upquery);
$oneday = 24 * 3600;
//周统计
if(ceil( ($ntime - $this->TagInfos['weekup'])/$oneday )>7){
$this->dsql->ExecuteNoneQuery("Update #@__search_keywords set weekcc=0,weekup='{$ntime}' where id='{$this->TagID}' ");
}
//月统计
if(ceil( ($ntime - $this->TagInfos['monthup'])/$oneday )>30){
$this->dsql->ExecuteNoneQuery("Update #@__search_keywords set monthcc=0,monthup='{$ntime}' where id='{$this->TagID}' ");
}
}
$ctag = $this->dtp->GetTag("page");
if(!is_object($ctag)){ $ctag = $this->dtp->GetTag("list"); }
if(!is_object($ctag)) $this->PageSize = 25;
else{
if($ctag->GetAtt("pagesize")!="") $this->PageSize = $ctag->GetAtt("pagesize");
else $this->PageSize = 25;
}
$this->TotalPage = ceil($this->TotalResult/$this->PageSize);
}
//------------------
//显示列表
//------------------
function Display()
{
if($this->Tag!='') $this->CountRecord();
$this->ParseTempletsFirst();
if($this->Tag!='') $this->ParseDMFields($this->PageNo,0);
$this->Close();
$this->dtp->Display();
}
//--------------------------------
//解析模板,对固定的标记进行初始给值
//--------------------------------
function ParseTempletsFirst()
{
//对公用标记的解析,这里对对象的调用均是用引用调用的,因此运算后会自动改变传递的对象的值
MakePublicTag($this,$this->dtp,$this->PartView,$this->TypeLink,0,0,0);
}
//--------------------------------
//解析模板,对内容里的变动进行赋值
//--------------------------------
function ParseDMFields($PageNo,$ismake=1)
{
foreach($this->dtp->CTags as $tagid=>$ctag){
if($ctag->GetName()=="list"){
$limitstart = ($this->PageNo-1) * $this->PageSize;
$row = $this->PageSize;
if(trim($ctag->GetInnerText())==""){
$InnerText = GetSysTemplets("list_fulllist.htm");
}else{
$InnerText = trim($ctag->GetInnerText());
}
$this->dtp->Assign($tagid,
$this->GetArcList(
$limitstart,
$row,
$ctag->GetAtt("col"),
$ctag->GetAtt("titlelen"),
$ctag->GetAtt("infolen"),
$ctag->GetAtt("imgwidth"),
$ctag->GetAtt("imgheight"),
$ctag->GetAtt("listtype"),
$ctag->GetAtt("orderby"),
$InnerText,
$ctag->GetAtt("tablewidth"),
$ismake,
$ctag->GetAtt("orderway")
)
);
}
else if($ctag->GetName()=="pagelist")
{
$list_len = trim($ctag->GetAtt("listsize"));
$ctag->GetAtt("listitem")=="" ? $listitem="info,index,pre,pageno,next,end,option" : $listitem=$ctag->GetAtt("listitem");
if($list_len=="") $list_len = 3;
if($ismake==0) $this->dtp->Assign($tagid,$this->GetPageListDM($list_len,$listitem));
else $this->dtp->Assign($tagid,$this->GetPageListST($list_len,$listitem));
}
}
}
//----------------------------------
//获得一个单列的文档列表
//---------------------------------
function GetArcList($limitstart=0,$row=10,$col=1,$titlelen=30,$infolen=250,
$imgwidth=120,$imgheight=90,$listtype="all",$orderby="default",$innertext="",$tablewidth="100",$ismake=1,$orderWay='desc')
{
global $cfg_list_son;
$t1 = ExecTime();
$getrow = ($row=="" ? 10 : $row);
if($limitstart=="") $limitstart = 0;
if($titlelen=="") $titlelen = 100;
if($infolen=="") $infolen = 250;
if($imgwidth=="") $imgwidth = 120;
if($imgheight=="") $imgheight = 120;
if($listtype=="") $listtype = "all";
if($orderby=="") $orderby="default";
else $orderby=strtolower($orderby);
if($orderWay=='') $orderWay = 'desc';
$tablewidth = str_replace("%","",$tablewidth);
if($tablewidth=="") $tablewidth=100;
if($col=="") $col=1;
$colWidth = ceil(100/$col);
$tablewidth = $tablewidth."%";
$colWidth = $colWidth."%";
$innertext = trim($innertext);
if($innertext=="") $innertext = GetSysTemplets("list_fulllist.htm");
$idlists = '';
$this->dsql->SetQuery("Select aid From #@__tag_list where tid='{$this->TagID}' And arcrank>-1 limit $limitstart,$getrow");
//echo "Select aid From #@__tag_list where tid='{$this->TagID}' And arcrank>-1 limit $limitstart,$getrow";
$this->dsql->Execute();
while($row=$this->dsql->GetArray()){
$idlists .= ($idlists=='' ? $row['aid'] : ','.$row['aid']);
}
if($idlists=='') return '';
//按不同情况设定SQL条件
$orwhere = " se.aid in($idlists) ";
//排序方式
$ordersql = "";
if($orderby=="uptime") $ordersql = " order by se.uptime $orderWay";
else $ordersql=" order by se.aid $orderWay";
//----------------------------
$query = "Select se.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl
from `#@__full_search` se left join `#@__arctype` tp on se.typeid=tp.ID
where $orwhere $ordersql
";
$this->dsql->SetQuery($query);
$this->dsql->Execute('al');
echo $this->dsql->GetError();
$artlist = "";
if($col>1) $artlist = "<table width='$tablewidth' border='0' cellspacing='0' cellpadding='0'>\r\n";
$this->dtp2->LoadSource($innertext);
if(!is_array($this->dtp2->CTags)) return '';
$GLOBALS['autoindex'] = 0;
for($i=0;$i<$getrow;$i++)
{
if($col>1) $artlist .= "<tr>\r\n";
for($j=0;$j<$col;$j++)
{
if($col>1) $artlist .= "<td width='$colWidth'>\r\n";
if($row = $this->dsql->GetArray('al',MYSQL_ASSOC))
{
$GLOBALS['autoindex']++;
//处理一些特殊字段
$row['id'] = $row['aid'];
$row['arcurl'] = $row['url'];
$row['typeurl'] = $this->GetListUrl($row['typeid'],$row['typedir'],$row['isdefault'],$row['defaultname'],$row['ispart'],$row['namerule2'],"abc");
if($ismake==0 && $GLOBALS['cfg_multi_site']=='Y')
{
if($row['litpic']==''){
$row['litpic'] = $GLOBALS['cfg_mainsite'].$GLOBALS['cfg_plus_dir']."/img/dfpic.gif";
}
else if(!eregi("^http://",$row['picname'])){
$row['litpic'] = $row['siteurl'].$row['litpic'];
}
$row['picname'] = $row['litpic'];
}else
{
if($row['litpic']=='') $row['litpic'] = $GLOBALS['cfg_plus_dir']."/img/dfpic.gif";
}
$row['description'] = cnw_left($row['addinfos'],$infolen);
$row['picname'] = $row['litpic'];
$row['info'] = $row['description'];
$row['filename'] = $row['arcurl'];
$row['uptime'] = GetDateMK($row['uptime']);
$row['typelink'] = "<a href='".$row['typeurl']."'>[".$row['typename']."]</a>";
$row['imglink'] = "<a href='".$row['filename']."'><img src='".$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".str_replace("'","",$row['title'])."'></a>";
$row['image'] = "<img src='".$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".str_replace("'","",$row['title'])."'>";
$row['title'] = cn_substr($row['title'],$titlelen);
$row['textlink'] = "<a href='".$row['filename']."' title='".str_replace("'","",$row['title'])."'>".$row['title']."</a>";
foreach($this->dtp2->CTags as $k=>$ctag)
{
if(isset($row[$ctag->GetName()])) $this->dtp2->Assign($k,$row[$ctag->GetName()]);
else $this->dtp2->Assign($k,"");
}
$artlist .= $this->dtp2->GetResult();
//if hasRow
}else
{
$artlist .= "";
}
if($col>1) $artlist .= " </td>\r\n";
}//Loop Col
if($col>1) $i += $col - 1;
if($col>1) $artlist .= " </tr>\r\n";
}//Loop Line
if($col>1) $artlist .= "</table>\r\n";
$this->dsql->FreeResult("al");
return $artlist;
}
//----------------------------------------
//获得标签
//----------------------------------------
function GetTags($num,$ltype='new',$InnerText=""){
$InnerText = trim($InnerText);
if($InnerText=="") $InnerText = GetSysTemplets("tag_one.htm");
$revalue = "";
if($ltype=='rand') $orderby = ' rand() ';
else if($ltype=='week') $orderby=' weekcc desc ';
else if($ltype=='month') $orderby=' monthcc desc ';
else if($ltype=='hot') $orderby=' count desc ';
else $orderby = ' id desc ';
$this->dsql->SetQuery("Select tagname,count,monthcc,result From #@__tag_index order by $orderby limit 0,$num");
$this->dsql->Execute();
$ctp = new DedeTagParse();
$ctp->SetNameSpace("field","[","]");
$ctp->LoadSource($InnerText);
while($row = $this->dsql->GetArray())
{
$row['keyword'] = $row['tagname'];
$row['tagname'] = htmlspecialchars($row['tagname']);
$row['link'] = $cfg_cmspath."/tag.php?/".urlencode($row['keyword'])."/";
$row['highlight'] = htmlspecialchars($row['keyword']);
$row['result'] = trim($row['result']);
if(empty($row['result'])) $row['result'] = 0;
if($ltype=='view'||$ltype=='rand'||$ltype=='new')
{
if($row['monthcc']>1000 || $row['weekcc']>300 ){
$row['highlight'] = "<span style='font-size:".mt_rand(12,16)."px;color:red'><b>rd{$row['highlight']}</b></span>";
}
else if($row['result']>150){
$row['highlight'] = "<span style='font-size:".mt_rand(12,16)."px;color:blue'>d2{$row['highlight']}</span>";
}
else if($row['count']>1000){
$row['highlight'] = "<span style='font-size:".mt_rand(12,16)."px;color:red'>d3{$row['highlight']}</span>";
}
}else{
$row['highlight'] = "<span style='font-size:".mt_rand(12,16)."px;'>drtrt4{$row['highlight']}</span>";
}
foreach($ctp->CTags as $tagid=>$ctag){
if(isset($row[$ctag->GetName()])) $ctp->Assign($tagid,$row[$ctag->GetName()]);
}
$revalue .= $ctp->GetResult();
}
return $revalue;
}
//---------------------------------
//获取动态的分页列表
//---------------------------------
function GetPageListDM($list_len,$listitem="index,end,pre,next,pageno")
{
$prepage="";
$nextpage="";
$prepagenum = $this->PageNo-1;
$nextpagenum = $this->PageNo+1;
if($list_len==""||ereg("[^0-9]",$list_len)) $list_len=3;
$totalpage = $this->TotalPage;
if($totalpage<=1 && $this->TotalResult>0) return "<a>共1页/".$this->TotalResult."条</a>";
if($this->TotalResult == 0) return "<a>共0页/".$this->TotalResult."条</a>";
$maininfo = "<a>共{$totalpage}页/".$this->TotalResult."条</a>\r\n";
$purl = $this->GetCurUrl();
$purl .= "?/".urlencode($this->Tag);
//获得上一页和下一页的链接
if($this->PageNo != 1){
$prepage.="<a href='".$purl."/$prepagenum/'>上一页</a>\r\n";
$indexpage="<a href='".$purl."/1/'>首页</a>\r\n";
}
else{
$indexpage="<a>首页</a>\r\n";
}
if($this->PageNo!=$totalpage && $totalpage>1){
$nextpage.="<a href='".$purl."/$nextpagenum/'>下一页</a>\r\n";
$endpage="<a href='".$purl."/$totalpage/'>末页</a>\r\n";
}
else{
$endpage="<a>末页</a>\r\n";
}
//获得数字链接
$listdd="";
$total_list = $list_len * 2 + 1;
if($this->PageNo >= $total_list) {
$j = $this->PageNo-$list_len;
$total_list = $this->PageNo+$list_len;
if($total_list>$totalpage) $total_list=$totalpage;
}else{
$j=1;
if($total_list>$totalpage) $total_list=$totalpage;
}
for($j;$j<=$total_list;$j++){
if($j==$this->PageNo) $listdd.= "<strong>$j</strong>\r\n";
else $listdd.="<a href='".$purl."/$j/'>".$j."</a>\r\n";
}
$plist = "";
$plist .= $maininfo.$indexpage.$prepage.$listdd.$nextpage.$endpage;
return $plist;
}
//--------------------------
//获得一个指定的频道的链接
//--------------------------
function GetListUrl($typeid,$typedir,$isdefault,$defaultname,$ispart,$namerule2,$siteurl=""){
return GetTypeUrl($typeid,MfTypedir($typedir),$isdefault,$defaultname,$ispart,$namerule2,$siteurl);
}
//--------------------------
//获得一个指定档案的链接
//--------------------------
function GetArcUrl($aid,$typeid,$timetag,$title,$ismake=0,$rank=0,$namerule="",$artdir="",$money=0){
return GetFileUrl($aid,$typeid,$timetag,$title,$ismake,$rank,$namerule,$artdir,$money);
}
//---------------
//获得当前的页面文件的url
//----------------
function GetCurUrl()
{
if(!empty($_SERVER["REQUEST_URI"])){
$nowurl = $_SERVER["REQUEST_URI"];
$nowurls = explode("?",$nowurl);
$nowurl = $nowurls[0];
}else{ $nowurl = $_SERVER["PHP_SELF"]; }
return $nowurl;
}
}//End Class
?> | zyyhong | trunk/jiaju001/news/include/inc_taglist_view.php | PHP | asf20 | 16,549 |
<?php
require_once './../../site/cache/ad_index.php'; $ad= unserialize(stripslashes($ad));
?>
<div class="l4 ">
<div class="lmr_at"><div class="lmr_atxt">活动公告</div><div class="txt_r">><a href="http://www.jiaju001.com/huodong/">更多</a></div></div>
<div class="lmr_txt lp2">
<?php
if($ad['event'])
{
foreach($ad['event'] as $a)
{
if(!strpos($a['url'], 'jiaju001.com'))
{
$a['url'] = 'http://www.jiaju001.com'.$a['url'];
}
echo '<a href="',$a['url'],'">',$a['title'],'</a><br />';
}
}
?></div></div>
<!--
<div class="l4 lt">
<div class="lmr_at"><div class="lmr_atxt">品牌推荐</div><div class="txt_r">>更多</div></div>
<div class="lmr_txt lp2">
<?php
if($ad['shop'])
{
foreach($ad['shop'] as $a)
{
if(!strpos($a['url'], 'jiaju001.com'))
{
$a['url'] = 'http://www.jiaju001.com'.$a['url'];
}
echo '<a href="',$a['url'],'" title="',$a['title'],'"><img class="b4" src="http://www.jiaju001.com/images/',$a['img'],'" alt="',$a['title'],'"></a> ';
}
}
?>
</div></div>
<div class="l4 lt">
<div class="lmr_at"><div class="lmr_atxt">相关产品</div><div class="txt_r">>更多</div></div>
<div class="lmr_txt lp2">
<?php
if($ad['goods']){
foreach($ad['goods'] as $a)
{
if(!strpos($a['url'], 'jiaju001.com'))
{
$a['url'] = 'http://www.jiaju001.com'.$a['url'];
}
echo '<a href="',$a['url'],'" title="',$a['title'],'"><img class="b4" src="http://www.jiaju001.com/images/p/s.',substr($a['img'],4,40),'" alt="',$a['title'],'"></a> ';
}
}
?></div>
</div>
--> | zyyhong | trunk/jiaju001/news/include/right.php | PHP | asf20 | 1,574 |
<?php
//本文件是从pub_dedetag.php分离出来的属性解析器
/**********************************************
//class DedeAtt Dede模板标记属性集合
function c____DedeAtt();
**********************************************/
//属性的数据描述
class DedeAtt
{
var $Count = -1;
var $Items = ""; //属性元素的集合
//获得某个属性
function GetAtt($str){
if($str=="") return "";
if(isset($this->Items[$str])) return $this->Items[$str];
else return "";
}
//同上
function GetAttribute($str){
return $this->GetAtt($str);
}
//判断属性是否存在
function IsAttribute($str){
if(isset($this->Items[$str])) return true;
else return false;
}
//获得标记名称
function GetTagName(){
return $this->GetAtt("tagname");
}
// 获得属性个数
function GetCount(){
return $this->Count+1;
}
}
/*******************************
//属性解析器
function c____DedeAttParse();
********************************/
class DedeAttParse
{
var $SourceString = "";
var $SourceMaxSize = 1024;
var $CAtt = ""; //属性的数据描述类
var $CharToLow = TRUE;
//////设置属性解析器源字符串////////////////////////
function SetSource($str="")
{
$this->CAtt = new DedeAtt();
//////////////////////
$strLen = 0;
$this->SourceString = trim(preg_replace("/[ \t\r\n]{1,}/"," ",$str));
$strLen = strlen($this->SourceString);
if($strLen>0&&$strLen<=$this->SourceMaxSize){
$this->ParseAtt();
}
}
//////解析属性(私有成员,仅给SetSource调用)/////////////////
function ParseAtt()
{
$d = "";
$tmpatt="";
$tmpvalue="";
$startdd=-1;
$ddtag="";
$notAttribute=true;
$strLen = strlen($this->SourceString);
// 这里是获得Tag的名称,可视情况是否需要
// 如果不在这个里解析,则在解析整个Tag时解析
// 属性中不应该存在tagname这个名称
for($i=0;$i<$strLen;$i++)
{
$d = substr($this->SourceString,$i,1);
if($d==' '){
$this->CAtt->Count++;
if($this->CharToLow) $this->CAtt->Items["tagname"]=strtolower(trim($tmpvalue));
else $this->CAtt->Items["tagname"]=trim($tmpvalue);
$tmpvalue = "";
$notAttribute = false;
break;
}
else
$tmpvalue .= $d;
}
//不存在属性列表的情况
if($notAttribute)
{
$this->CAtt->Count++;
if($this->CharToLow) $this->CAtt->Items["tagname"]=strtolower(trim($tmpvalue));
else $this->CAtt->Items["tagname"]=trim($tmpvalue);
}
//如果字符串含有属性值,遍历源字符串,并获得各属性
if(!$notAttribute){
for($i;$i<$strLen;$i++)
{
$d = substr($this->SourceString,$i,1);
if($startdd==-1){
if($d!="=") $tmpatt .= $d;
else{
if($this->CharToLow) $tmpatt = strtolower(trim($tmpatt));
else $tmpatt = trim($tmpatt);
$startdd=0;
}
}
else if($startdd==0)
{
switch($d){
case ' ':
continue;
break;
case '\'':
$ddtag='\'';
$startdd=1;
break;
case '"':
$ddtag='"';
$startdd=1;
break;
default:
$tmpvalue.=$d;
$ddtag=' ';
$startdd=1;
break;
}
}
else if($startdd==1)
{
if($d==$ddtag){
$this->CAtt->Count++;
$this->CAtt->Items[$tmpatt] = trim($tmpvalue);//strtolower(trim($tmpvalue));
$tmpatt = "";
$tmpvalue = "";
$startdd=-1;
}
else
$tmpvalue.=$d;
}
}
if($tmpatt!=""){
$this->CAtt->Count++;
$this->CAtt->Items[$tmpatt]=trim($tmpvalue);//strtolower(trim($tmpvalue));
}
//完成属性解析
}//for
}//has Attribute
}
?> | zyyhong | trunk/jiaju001/news/include/pub_dedeattribute.php | PHP | asf20 | 3,807 |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language='javascript' src='/plus/count.php?aid=[aid]&mid=0'></script>
<title>转向:[title]</title>
<style>
#ndiv{
width:450px;
padding:8px;
margin-top:8px;
background-color:#FCFFF0;
border:3px solid #B4EF94;
height:100px;
text-align:left;
font-size:14px;
line-height:180%;
}
</style>
<meta http-equiv="refresh" content="1;URL=[redirecturl]">
</head>
<body>
<div align='center'>
<div id='ndiv'>
正在转向:<a href='[redirecturl]'> [redirecturl] </a>,请稍候...
<br/>
内容简介: [description]
</div>
</div>
</body>
</html>
| zyyhong | trunk/jiaju001/news/include/jump.html | HTML | asf20 | 666 |
<?php
//把单个文档的Tag写入索引
function InsertTags(&$dsql,$tagname,$aid,$mid=0,$typeid=0,$arcrank=0)
{
$tagname = trim(ereg_replace("[,;'%><\"\*\?\r\n\t ]{1,}",',',$tagname));
if(strlen($tagname)<2) return false;
$ntime = time();
$tags = explode(',',$tagname);
$hasTags = array();
$hasTagsM = array();
$likequery = '';
foreach($tags as $k){ $likequery .= ($likequery=='' ? "tagname like '$k'" : " or tagname like '$k'" ); }
//获取已经存在的tag的id
$dsql->Execute('0',"Select id,tagname From #@__tag_index where $likequery ");
while($row = $dsql->GetArray('0',MYSQL_ASSOC)) $hasTags[strtolower($row['tagname'])] = $row['id'];
//遍历tag,并依情况是否增加tag,并获得每个tag的索引id
$tids = array();
foreach($tags as $k)
{
$lk = strtolower($k);
if(isset($hasTags[$lk])){
$tid = $hasTags[$lk];
}else{
$dsql->ExecuteNoneQuery("INSERT INTO `#@__tag_index`(`tagname` , `count` , `result` , `weekcc` , `monthcc` , `addtime` ) VALUES('$k', '0', '0', '0', '0', '$ntime');");
$tid = $dsql->GetLastID();
}
//if($mid>0 && !isset($hasTagsM[$lk])) $dsql->ExecuteNoneQuery("INSERT INTO `#@__tags_user`(`mid`,`tid`,`tagname`) VALUES('$mid','$tid', '$k');");
$tids[] = $tid;
}
//检查tag_list是否存在这些Tag,如果不存在则写入
$tidstr = '';
foreach($tids as $tid){
$tidstr .= ($tidstr=='' ? $tid : ",{$tid}");
}
$hastids = array();
if($tidstr!='')
{
$dsql->Execute('0',"Select tid,aid From #@__tag_list where tid in($tidstr) ");
while($row = $dsql->GetArray('0',MYSQL_ASSOC)){
$hastids[$row['tid']][] = $row['aid'];
}
}
foreach($tids as $t)
{
if(!isset($hastids[$t])){
$dsql->ExecuteNoneQuery("INSERT INTO `#@__tag_list`(`tid`,`aid`,`typeid`,`arcrank`) VALUES('$t','$aid','$typeid','$arcrank');");
}else
{
if(!in_array($aid,$hastids[$t])){
$dsql->ExecuteNoneQuery("INSERT INTO `#@__tag_list`(`tid`,`aid`,`typeid`,`arcrank`) VALUES('$t','$aid','$typeid','$arcrank');");
}
}
}
return true;
}
//从索引中获得某文档的所有Tag
function GetTagFormLists(&$dsql,$aid)
{
$tags = '';
$dsql->Execute('t',"Select i.tagname From #@__tag_list t left join #@__tag_index i on i.id=t.tid where t.aid='$aid' ");
while($row = $dsql->GetArray('t',MYSQL_ASSOC)){
$tags .= ($tags=='' ? "{$row['tagname']}" : ",{$row['tagname']}");
}
return $tags;
}
//移除不用的Tag
function UpTags(&$dsql,$tagname,$aid,$mid=0,$typeid=0)
{
$dsql->ExecuteNoneQuery("Delete From `#@__tag_list` where aid='$aid' limit 100");
InsertTags($dsql,$tagname,$aid,$mid,$typeid);
}
?> | zyyhong | trunk/jiaju001/news/include/inc_tag_functions.php | PHP | asf20 | 2,673 |
<?php
//强制检查变量
function FilterNotSafeString(&$str)
{
global $cfg_notallowstr,$cfg_replacestr;
if(strlen($str)>10)
{
//禁止字串
if(!empty($cfg_notallowstr) && eregi($cfg_notallowstr,$str)) {
echo "Messege Error! <a href='javascript:history.go(-1)'>[Go Back]</a>";
exit();
}
//替换字串
if(!empty($cfg_replacestr)) {
$str = eregi_replace($cfg_replacestr,'***',$str);
}
}
}
//注册请求字符串并加转义
function RunMagicQuotes(&$str)
{
global $needFilter,$cfg_notallowstr,$cfg_replacestr;
if(!get_magic_quotes_gpc())
{
if( is_array($str) ) {
foreach($str as $key => $val) $str[$key] = RunMagicQuotes($val);
}else{
if($needFilter) FilterNotSafeString($str);
$str = addslashes($str);
}
}
else
{
if($needFilter) {
$str = stripslashes($str);
FilterNotSafeString($str);
$str = addslashes($str);
}
}
return $str;
}
foreach(Array('_GET','_POST','_COOKIE') as $_request)
{
foreach($$_request as $_k => $_v){
if($_k{0} != '_') ${$_k} = RunMagicQuotes($_v);
}
}
//文件上传安全检查
if(is_array($_FILES))
{
$cfg_not_allowall = "php|pl|cgi|asp|aspx|jsp|php3|shtm|shtml";
$keyarr = array('name','type','tmp_name','size');
foreach($_FILES as $_key=>$_value)
{
foreach($keyarr as $k) {
if(!isset($_FILES[$_key][$k])) exit('Request Error!');
}
$$_key = $_FILES[$_key]['tmp_name'] = str_replace("\\\\","\\",$_FILES[$_key]['tmp_name']);
${$_key.'_name'} = $_FILES[$_key]['name'];
${$_key.'_type'} = $_FILES[$_key]['type'] = eregi_replace('[^0-9a-z\./]','',$_FILES[$_key]['type']);
${$_key.'_size'} = $_FILES[$_key]['size'] = ereg_replace('[^0-9]','',$_FILES[$_key]['size']);
if(!empty(${$_key.'_name'}) && (eregi("\.(".$cfg_not_allowall.")$",${$_key.'_name'}) || !ereg("\.",${$_key.'_name'})) )
{
if(!defined('DEDEADMIN')) exit('Upload filetype not allow !');
}
if(empty(${$_key.'_size'})) ${$_key.'_size'} = @filesize($$_key);
}
}
?> | zyyhong | trunk/jiaju001/news/include/inc_request_vars.php | PHP | asf20 | 2,085 |
<!--
var DedeXHTTP = null;
var DedeXDOM = null;
var DedeContainer = null;
var DedeShowError = false;
var DedeShowWait = false;
var DedeErrCon = "";
var DedeErrDisplay = "Download false!";
var DedeWaitDisplay = "Loading...";
function $DE(id)
{
return document.getElementById(id);
}
function DedeAjax(gcontainer,mShowError,mShowWait,mErrCon,mErrDisplay,mWaitDisplay)
{
DedeContainer = gcontainer;
DedeShowError = mShowError;
DedeShowWait = mShowWait;
if(mErrCon!="") DedeErrCon = mErrCon;
if(mErrDisplay!="") DedeErrDisplay = mErrDisplay;
if(mErrDisplay=="x") DedeErrDisplay = "";
if(mWaitDisplay!="") DedeWaitDisplay = mWaitDisplay;
this.keys = Array();
this.values = Array();
this.keyCount = -1;
this.rkeys = Array();
this.rvalues = Array();
this.rkeyCount = -1;
this.rtype = 'text';
if(window.ActiveXObject)
{
try { DedeXHTTP = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) { }
if (DedeXHTTP == null) try { DedeXHTTP = new ActiveXObject("Microsoft.XMLHTTP");} catch (e) { }
}
else
{
DedeXHTTP = new XMLHttpRequest();
}
this.AddKey = function(skey,svalue)
{
this.keyCount++;
this.keys[this.keyCount] = skey;
svalue = svalue.replace(/\+/g,'$#$');
this.values[this.keyCount] = escape(svalue);
};
this.AddHead = function(skey,svalue)
{
this.rkeyCount++;
this.rkeys[this.rkeyCount] = skey;
this.rvalues[this.rkeyCount] = svalue;
};
this.ClearSet = function()
{
this.keyCount = -1;
this.keys = Array();
this.values = Array();
this.rkeyCount = -1;
this.rkeys = Array();
this.rvalues = Array();
};
DedeXHTTP.onreadystatechange = function()
{
if(DedeXHTTP.readyState == 4){
if(DedeXHTTP.status == 200){
if(DedeXHTTP.responseText!=DedeErrCon){
DedeContainer.innerHTML = DedeXHTTP.responseText;
}else{
if(DedeShowError) DedeContainer.innerHTML = DedeErrDisplay;
}
DedeXHTTP = null;
}else{ if(DedeShowError) DedeContainer.innerHTML = DedeErrDisplay; }
}else{ if(DedeShowWait) DedeContainer.innerHTML = DedeWaitDisplay; }
};
this.BarrageStat = function()
{
if(DedeXHTTP==null) return;
if(typeof(DedeXHTTP.status)!=undefined && DedeXHTTP.status == 200)
{
if(DedeXHTTP.responseText!=DedeErrCon){
DedeContainer.innerHTML = DedeXHTTP.responseText;
}else{
if(DedeShowError) DedeContainer.innerHTML = DedeErrDisplay;
}
}
};
this.SendHead = function()
{
if(this.rkeyCount!=-1){
for(;i<=this.rkeyCount;i++){
DedeXHTTP.setRequestHeader(this.rkeys[i],this.rvalues[i]);
}
}
if(this.rtype=='binary'){
DedeXHTTP.setRequestHeader("Content-Type","multipart/form-data");
}else{
DedeXHTTP.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
}
};
this.SendPost = function(purl)
{
var pdata = "";
var i=0;
this.state = 0;
DedeXHTTP.open("POST", purl, true);
this.SendHead();
if(this.keyCount!=-1){
for(;i<=this.keyCount;i++){
if(pdata=="") pdata = this.keys[i]+'='+this.values[i];
else pdata += "&"+this.keys[i]+'='+this.values[i];
}
}
DedeXHTTP.send(pdata);
};
this.SendGet = function(purl)
{
var gkey = "";
var i=0;
this.state = 0;
if(this.keyCount!=-1){
for(;i<=this.keyCount;i++){
if(gkey=="") gkey = this.keys[i]+'='+this.values[i];
else gkey += "&"+this.keys[i]+'='+this.values[i];
}
if(purl.indexOf('?')==-1) purl = purl + '?' + gkey;
else purl = purl + '&' + gkey;
}
DedeXHTTP.open("GET", purl, true);
this.SendHead();
DedeXHTTP.send(null);
};
this.SendGet2 = function(purl)
{
var gkey = "";
var i=0;
this.state = 0;
if(this.keyCount!=-1){
for(;i<=this.keyCount;i++){
if(gkey=="") gkey = this.keys[i]+'='+this.values[i];
else gkey += "&"+this.keys[i]+'='+this.values[i];
}
if(purl.indexOf('?')==-1) purl = purl + '?' + gkey;
else purl = purl + '&' + gkey;
}
DedeXHTTP.open("GET", purl, false);
this.SendHead();
DedeXHTTP.send(null);
this.BarrageStat();
};
this.SendPost2 = function(purl)
{
var pdata = "";
var i=0;
this.state = 0;
DedeXHTTP.open("POST", purl, false);
this.SendHead();
if(this.keyCount!=-1){
for(;i<=this.keyCount;i++){
if(pdata=="") pdata = this.keys[i]+'='+this.values[i];
else pdata += "&"+this.keys[i]+'='+this.values[i];
}
}
DedeXHTTP.send(pdata);
this.BarrageStat();
};
}
function InitXDom()
{
if(DedeXDOM!=null) return;
var obj = null;
if (typeof(DOMParser) != "undefined") { // Gecko、Mozilla、Firefox
var parser = new DOMParser();
obj = parser.parseFromString(xmlText, "text/xml");
}
else
{
try { obj = new ActiveXObject("MSXML2.DOMDocument");} catch (e) { }
if (obj == null) try { obj = new ActiveXObject("Microsoft.XMLDOM"); } catch (e) { }
}
DedeXDOM = obj;
};
-->
| zyyhong | trunk/jiaju001/news/include/dedeajax2.js | JavaScript | asf20 | 4,916 |
<?php
//class TypeTree
//目录树(用于选择栏目)
//--------------------------------
if(!defined('DEDEINC'))
{
exit("Request Error!");
}
require_once(dirname(__FILE__)."/../data/cache/inc_catalog_base.php");
class TypeTree
{
var $dsql;
var $artDir;
var $baseDir;
var $idCounter;
var $idArrary;
var $shortName;
var $aChannels;
var $isAdminAll;
//-------------
//php5构造函数
//-------------
function __construct($catlogs="")
{
$this->idCounter = 0;
$this->artDir = $GLOBALS['cfg_cmspath'].$GLOBALS['cfg_arcdir'];
$this->baseDir = $GLOBALS['cfg_basedir'];
$this->shortName = $GLOBALS['art_shortname'];
$this->idArrary = "";
$this->dsql = new DedeSql(false);
$this->aChannels = Array();
$this->isAdminAll = false;
if(!empty($catlogs) && $catlogs!='-1'){
$this->aChannels = explode(',',$catlogs);
foreach($this->aChannels as $cid)
{
if($_Cs[$cid][0]==0)
{
$this->dsql->SetQuery("Select ID,ispart From `#@__arctype` where reID=$cid");
$this->dsql->Execute();
while($row = $this->dsql->GetObject()){
if($row->ispart!=2) $this->aChannels[] = $row->ID;
}
}
}
}else{
$this->isAdminAll = true;
}
}
function TypeTree($catlogs="")
{
$this->__construct($catlogs);
}
//------------------
//清理类
//------------------
function Close()
{
if($this->dsql){
@$this->dsql->Close();
@$this->dsql=0;
}
$this->idArrary = "";
$this->idCounter = 0;
}
//
//----读出所有分类,在类目管理页(list_type)中使用----------
//
function ListAllType($nowdir=0,$opall=false,$channelid=0)
{
$this->dsql->SetQuery("Select ID,typedir,typename,ispart,channeltype From #@__arctype where reID=0 order by sortrank");
$this->dsql->Execute(0);
$lastID = GetCookie('lastCidTree');
while($row=$this->dsql->GetObject(0))
{
$typeDir = $row->typedir;
$typeName = $row->typename;
$ispart = $row->ispart;
$ID = $row->ID;
$dcid = $row->channeltype;
if($ispart>=2||TestHasChannel($ID,$channelid)==0) continue;
//有权限栏目
if(in_array($ID,$this->aChannels) || $this->isAdminAll)
{
//普通列表
if($ispart==0 || ($ispart==1 && $opall)){
if($channelid==0 || $channelid==$dcid) $smenu = " <input type='checkbox' name='selid' id='selid$ID' class='np' onClick=\"ReSel($ID,'$typeName')\"> ";
else $smenu = "[×]";
}
//带封面的频道
else if($ispart==1) $smenu = "[封面]";
//单独页面
else if($ispart==2) $smenu = "[单页]";
//跳转
else if($ispart==3) $smenu = "[跳转]";
if($channelid>0) $dcid = $channelid;
else $dcid = 0;
echo "<dl class='topcc'>\r\n";
echo " <dd class='dlf'><img style='cursor:hand' onClick=\"LoadSuns('suns{$ID}',{$ID},{$dcid});\" src='img/tree_explode.gif' width='11' height='11'></dd>\r\n";
echo " <dd class='dlr'>$typeName{$smenu}</dd>\r\n";
echo "</dl>\r\n";
echo "<div id='suns".$ID."' class='sunct'>";
if($lastID==$ID){
$this->LogicListAllSunType($ID," ",$opall,$channelid,true);
}
echo "</div>\r\n";
}//没权限栏目
else{
$sonNeedShow = false;
$this->dsql->SetQuery("Select ID From #@__arctype where reID={$ID}");
$this->dsql->Execute('ss');
while($srow=$this->dsql->GetArray('ss'))
{
if( in_array($srow['ID'],$this->aChannels) ){ $sonNeedShow = true; break; }
}
//如果二级栏目中有的所属归类文档
if($sonNeedShow===true)
{
$smenu = "[×]";
if($channelid>0) $dcid = $channelid;
else $dcid = 0;
echo "<dl class='topcc'>\r\n";
echo " <dd class='dlf'><img style='cursor:hand' onClick=\"LoadSuns('suns{$ID}',{$ID},{$dcid});\" src='img/tree_explode.gif' width='11' height='11'></dd>\r\n";
echo " <dd class='dlr'>$typeName{$smenu}</dd>\r\n";
echo "</dl>\r\n";
echo "<div id='suns".$ID."' class='sunct'>";
$this->LogicListAllSunType($ID," ",$opall,$channelid,true);
echo "</div>\r\n";
}
}//没权限栏目
}
}
//获得子类目的递归调用
function LogicListAllSunType($ID,$step,$opall,$channelid,$needcheck=true)
{
$fid = $ID;
$this->dsql->SetQuery("Select ID,reID,typedir,typename,ispart,channeltype From #@__arctype where reID='".$ID."' order by sortrank");
$this->dsql->Execute($fid);
if($this->dsql->GetTotalRow($fid)>0)
{
while($row=$this->dsql->GetObject($fid))
{
$typeDir = $row->typedir;
$typeName = $row->typename;
$reID = $row->reID;
$ID = $row->ID;
$ispart = $row->ispart;
if($step==" ") $stepdd = 2;
else $stepdd = 3;
$dcid = $row->channeltype;
if(TestHasChannel($ID,$channelid)==0) continue;
//if($ispart==2) continue;
//有权限栏目
if(in_array($ID,$this->aChannels) || $needcheck===false || $this->isAdminAll===true)
{
//普通列表
if($ispart==0||($ispart==1 && $opall))
{
if($channelid==0 || $channelid==$dcid) $smenu = " <input type='checkbox' name='selid' id='selid$ID' class='np' onClick=\"ReSel($ID,'$typeName')\"> ";
else $smenu = "[×]";
$timg = " <img src='img/tree_list.gif'> ";
}
//带封面的频道
else if($ispart==1)
{
$timg = " <img src='img/tree_part.gif'> ";
$smenu = "[封面]";
}
//带封面的频道
else if($ispart==2)
{
$timg = " <img src='img/tree_part.gif'> ";
$smenu = "[单页]";
}
//跳转
else if($ispart==3)
{
$timg = " <img src='img/tree_part.gif'> ";
$smenu = "[跳转]";
}
echo " <table class='sunlist'>\r\n";
echo " <tr>\r\n";
echo " <td>".$step.$timg.$typeName."{$smenu}</td>\r\n";
echo " </tr>\r\n";
echo " </table>\r\n";
$this->LogicListAllSunType($ID,$step." ",$opall,$channelid,false);
}
}//循环结束
}//查询记录大于0
}
}
?> | zyyhong | trunk/jiaju001/news/include/inc_type_tree.php | PHP | asf20 | 6,380 |
<?php
if(!defined('DEDEINC'))
{
exit("Request Error!");
}
/*-------------------------
Dede 模块管理
--------------------------*/
require_once(dirname(__FILE__)."/pub_dedeattribute.php");
class DedeModule
{
var $modulesPath;
var $modules;
var $fileListNames;
function __construct($modulespath='')
{
$this->fileListNames = array();
$this->modulesPath = $modulespath;
}
function DedeModule($modulespath='')
{
$this->__construct($modulespath);
}
//
//枚举系统里已经存在的模块
//
function GetModuleList()
{
if(is_array($this->modules)) return $this->modules;
$dh = dir($this->modulesPath) or die("没找到模块目录:({$this->modulesPath})!");
$fp = @fopen($this->modulesPath.'/modulescache.php','w');
@fwrite($fp,"<"."?php\r\n") or die('读取文件权限出错,目录文件'.$this->modulesPath.'/modulescache.php不可写!');
fwrite($fp,"global \$allmodules;\r\n");
while($filename = $dh->read())
{
if(eregi("\.dev$",$filename))
{
$minfos = $this->GetModuleInfo(str_replace('.dev','',$filename));
if($minfos['hash']!=''){
$this->modules[$minfos['hash']] = $minfos;
fwrite($fp,'$'."GLOBALS['allmodules']['{$minfos['hash']}']='{$filename}';\r\n");
}
}
}
fwrite($fp,'?'.'>');
fclose($fp);
$dh->Close();
return $this->modules;
}
//
//获得指定hash的模块文件
//
function GetHashFile($hash)
{
require_once($this->modulesPath.'/modulescache.php');
if(isset($allmodules[$hash])) return $allmodules[$hash];
else return $hash.'.dev';
}
//
//获得某模块的基本信息
//
function GetModuleInfo($hash,$ftype='hash')
{
if($ftype=='file') $filename = $hash;
else $filename = $this->modulesPath.'/'.$this->GetHashFile($hash);
$start = 0;
$minfos = array();
$minfos['name']='';
$minfos['team']='';
$minfos['time']='';
$minfos['email']='';
$minfos['url']='';
$minfos['hash']='';
$minfos['filename'] = $filename;
$minfos['filesize'] = filesize($filename)/1024;
$minfos['filesize'] = number_format($minfos['filesize'],2,'.','').' Kb';
$fp = fopen($filename,'r') or die("文件 {$filename} 不存在或不可读!");
$n = 0;
while(!feof($fp))
{
$n++;
if($n>15) break;
$line = fgets($fp,256);
if($start==0)
{ if(preg_match("/<baseinfo/is",$line)) $start = 1; }
else
{
if(preg_match("/<\/baseinfo/is",$line)) break;
$line = trim($line);
list($skey,$svalue) = explode('=',$line);
$skey = trim($skey);
$minfos[$skey] = $svalue;
}
}
fclose($fp);
return $minfos;
}
//
//获得系统文件的内容
//指安装、删除、协议文件
//
function GetSystemFile($hashcode,$ntype,$enCode=true)
{
$start = false;
$filename = $this->modulesPath.'/'.$this->GetHashFile($hashcode);
$fp = fopen($filename,'r') or die("文件 {$filename} 不存在或不可读!");
$okdata = '';
while(!feof($fp))
{
$line = fgets($fp,1024);
if(!$start)
{
if(eregi("<{$ntype}",$line)) $start = true;
}
else
{
if(eregi("</{$ntype}",$line)) break;
$okdata .= $line;
unset($line);
}
}
fclose($fp);
$okdata = trim($okdata);
if(!empty($okdata) && $enCode) $okdata = base64_decode($okdata);
return $okdata;
}
//
//把某系统文件转换为文件
//
function WriteSystemFile($hashcode,$ntype)
{
$filename = $hashcode."-{$ntype}.php";
$fname = $this->modulesPath.'/'.$filename;
$filect = $this->GetSystemFile($hashcode,$ntype);
$fp = fopen($fname,'w') or die('生成 {$ntype} 文件失败!');
fwrite($fp,$filect);
fclose($fp);
return $filename;
}
//
//删除系统文件
//
function DelSystemFile($hashcode,$ntype)
{
$filename = $this->modulesPath.'/'.$hashcode."-{$ntype}.php";
unlink($filename);
}
//
//检查是否已经存在指定的模块
//
function HasModule($hashcode)
{
$modulefile = $this->modulesPath.'/'.$this->GetHashFile($hashcode);
if(file_exists($modulefile) && !is_dir($modulefile)) return true;
else return false;
}
//
//读取文件,返回编码后的文件内容
//
function GetEncodeFile($filename,$isremove=false)
{
$fp = fopen($filename,'r') or die("文件 {$filename} 不存在或不可读!");
$str = @fread($fp,filesize($filename));
fclose($fp);
if($isremove) @unlink($filename);
if(!empty($str)) return base64_encode($str);
else return '';
}
//
//获取模块包里的文件名列表
//
function GetFileLists($hashcode)
{
$dap = new DedeAttParse();
$filelists = array();
$modulefile = $this->modulesPath.'/'.$this->GetHashFile($hashcode);
$fp = fopen($modulefile,'r') or die("文件 {$modulefile} 不存在或不可读!");
$i = 0;
while(!feof($fp))
{
$line = fgets($fp,1024);
if(preg_match("/^[\s]{0,}<file/i",$line))
{
$i++;
$line = trim(preg_replace("/[><]/","",$line));
$dap->SetSource($line);
$filelists[$i]['type'] = $dap->CAtt->GetAtt('type');
$filelists[$i]['name'] = $dap->CAtt->GetAtt('name');
}
}
fclose($fp);
return $filelists;
}
//
//删除已安装模块附带的文件
//
function DeleteFiles($hashcode,$isreplace=0)
{
if($isreplace==0) return true;
else
{
$dap = new DedeAttParse();
$modulefile = $this->modulesPath.'/'.$this->GetHashFile($hashcode);
$fp = fopen($modulefile,'r') or die("文件 {$modulefile} 不存在或不可读!");
$i = 0;
$dirs = '';
while(!feof($fp))
{
$line = fgets($fp,1024);
if(preg_match("/^[\s]{0,}<file/i",$line))
{
$i++;
$line = trim(preg_replace("/[><]/","",$line));
$dap->SetSource($line);
$filetype = $dap->CAtt->GetAtt('type');
$filename = $dap->CAtt->GetAtt('name');
$filename = str_replace("\\","/",$filename);
if($filetype=='dir'){ $dirs[] = $filename; }
else{ @unlink($filename); }
}
}
$okdirs = array();
if(is_array($dirs)){
$st = count($dirs) -1;
for($i=$st;$i>=0;$i--){ @rmdir($dirs[$i]); }
}
fclose($fp);
}
return true;
}
//
//把模块包里的文件写入服务器
//
function WriteFiles($hashcode,$isreplace=3)
{
global $AdminBaseDir;
$dap = new DedeAttParse();
$modulefile = $this->modulesPath.'/'.$this->GetHashFile($hashcode);
$fp = fopen($modulefile,'r') or die("文件 {$modulefile} 不存在或不可读!");
$i = 0;
while(!feof($fp))
{
$line = fgets($fp,1024);
if(preg_match("/^[\s]{0,}<file/i",$line))
{
$i++;
$line = trim(preg_replace("/[><]/","",$line));
$dap->SetSource($line);
$filetype = $dap->CAtt->GetAtt('type');
$filename = $dap->CAtt->GetAtt('name');
$filename = str_replace("\\","/",$filename);
if(!empty($AdminBaseDir)) $filename = $AdminBaseDir.$filename;
if($filetype=='dir')
{
if(!is_dir($filename))
{
@mkdir($filename,$GLOBALS['cfg_dir_purview']);
@chmod($filename,$GLOBALS['cfg_dir_purview']);
}
}else{
$this->TestDir($filename);
if($isreplace==0) continue;
if($isreplace==3){
if(is_file($filename)){
$copyname = @preg_replace("/([^\/]{1,}$)/","bak-$1",$filename);
@copy($filename,$copyname);
}
}
if(!empty($filename)){
$fw = fopen($filename,'w') or die("写入文件 {$filename} 失败,请检查相关目录的权限!");
$ct = "";
while(!feof($fp)){
$l = fgets($fp,1024);
if(preg_match("/^[\s]{0,}<\/file/i",trim($l))){ break; }
$ct .= $l;
}
$ct = base64_decode($ct);
fwrite($fw,$ct);
fclose($fw);
}
}
}
}
fclose($fp);
return true;
}
//
//测试某文件的文件夹是否创建
//
function TestDir($filename)
{
$fs = explode('/',$filename);
$fn = count($fs) - 1 ;
$ndir = '';
for($i=0;$i < $fn;$i++)
{
if($ndir!='') $ndir = $ndir."/".$fs[$i];
else $ndir = $fs[$i];
if( !is_dir($ndir) ){ @mkdir($ndir,$GLOBALS['cfg_dir_purview']); @chmod($ndir,$GLOBALS['cfg_dir_purview']); }
}
return true;
}
//
//获取某个目录或文件的打包数据
//
function MakeEncodeFile($basedir,$f,$fp)
{
$this->fileListNames = array();
$this->MakeEncodeFileRun($basedir,$f,$fp);
return true;
}
//
//获取个目录或文件的打包数据,递归
//
function MakeEncodeFileRun($basedir,$f,$fp)
{
$filename = $basedir.'/'.$f;
if(isset($this->fileListNames[$f])) return;
else if(eregi("Thumbs\.db",$f)) return;
else $this->fileListNames[$f] = 1;
$fileList = '';
if(is_dir($filename))
{
$fileList .= "<file type='dir' name='$f'>\r\n";
$fileList .= "</file>\r\n";
fwrite($fp,$fileList);
$dh = dir($filename);
while($filename = $dh->read())
{
if($filename[0]=='.') continue;
$nfilename = $f.'/'.$filename;
$this->MakeEncodeFileRun($basedir,$nfilename,$fp);
}
}
else
{
$fileList .= "<file type='file' name='$f'>\r\n";
$fileList .= $this->GetEncodeFile($filename);
$fileList .= "\r\n</file>\r\n";
fwrite($fp,$fileList);
}
}
//
//清理
//
function Clear()
{
unset($this->modules);
unset($this->fileList);
unset($this->fileListNames);
}
}//End Class
?> | zyyhong | trunk/jiaju001/news/include/inc_modules.php | PHP | asf20 | 9,619 |
<?php
$photo_markup = '0';
$photo_markdown = '0';
$photo_wwidth = '22';
$photo_wheight = '22';
$photo_waterpos = '9';
$photo_watertext = 'www.homebjj.com';
$photo_fontsize = '5';
$photo_fontcolor = '#0000FF';
$photo_diaphaneity = '60';
$photo_markimg = 'mark.jpg';
?>
| zyyhong | trunk/jiaju001/news/include/inc_photowatermark_config.php | PHP | asf20 | 280 |
<?php
//获得一个附加表单
//-----------------------------
function GetFormItem($ctag,$admintype='admin')
{
$fieldname = $ctag->GetName();
$formitem = GetSysTemplets("custom_fields_{$admintype}.htm");
$fieldType = $ctag->GetAtt("type");
$innertext = trim($ctag->GetInnerText());
if($innertext!=""){
if($ctag->GetAtt("type")=='select'){
$myformItem = '';
$items = explode(',',$innertext);
$myformItem = "<select name='$fieldname' style='width:150px'>";
foreach($items as $v){
$v = trim($v);
if($v!=''){ $myformItem.= "<option value='$v'>$v</option>\r\n"; }
}
$myformItem .= "</select>\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$myformItem,$formitem);
return $formitem;
}else if($ctag->GetAtt("type")=='radio'){
$myformItem = '';
$items = explode(',',$innertext);
$i = 0;
foreach($items as $v){
$v = trim($v);
if($v!=''){
$myformItem .= ($i==0 ? "<input type='radio' name='$fieldname' class='np' value='$v' checked>$v\r\n" : "<input type='radio' name='$fieldname' class='np' value='$v'>$v\r\n");
$i++;
}
}
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$myformItem,$formitem);
return $formitem;
}
else if($ctag->GetAtt("type")=='checkbox'){
$myformItem = '';
$items = explode(',',$innertext);
foreach($items as $v){
$v = trim($v);
if($v!=''){ $myformItem .= "<input type='checkbox' name='{$fieldname}[]' class='np' value='$v'>$v\r\n"; }
}
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$myformItem,$formitem);
return $formitem;
}
else{
$formitem = str_replace('~name~',$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace('~form~',$innertext,$formitem);
$formitem = str_replace('@value','',$formitem);
return $formitem;
}
}
if($fieldType=="htmltext"||$fieldType=="textdata")
{
if($admintype=='admin') $innertext = GetEditor($fieldname,'',350,'Basic','string');
else $innertext = GetEditor($fieldname,'',350,'Member','string');
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
return $formitem;
}
else if($fieldType=="multitext")
{
$innertext = "<textarea name='$fieldname' id='$fieldname' style='width:100%;height:80'></textarea>\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
return $formitem;
}
else if($fieldType=="datetime")
{
$nowtime = GetDateTimeMk(time());
$innertext = "<input name=\"$fieldname\" value=\"$nowtime\" type=\"text\" id=\"$fieldname\" style=\"width:250px\">";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
return $formitem;
}
else if($fieldType=="img"||$fieldType=="imgfile")
{
$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:300px'> <input name='".$fieldname."_bt' type='button' class='inputbut' value='浏览...' onClick=\"SelectImage('form1.$fieldname','big')\">\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
return $formitem;
}
else if($fieldType=="media")
{
$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:300px'> <input name='".$fieldname."_bt' type='button' class='inputbut' value='浏览...' onClick=\"SelectMedia('form1.$fieldname')\">\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
return $formitem;
}
else if($fieldType=="addon")
{
$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:300px'> <input name='".$fieldname."_bt' type='button' class='inputbut' value='浏览...' onClick=\"SelectSoft('form1.$fieldname')\">\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
return $formitem;
}
else if($fieldType=="media")
{
$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:300px'> <input name='".$fieldname."_bt' type='button' class='inputbut' value='浏览...' onClick=\"SelectMedia('form1.$fieldname')\">\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
return $formitem;
}
else if($fieldType=="int"||$fieldType=="float")
{
$dfvalue = ($ctag->GetAtt('default')!='' ? $ctag->GetAtt('default') : '');
$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:100px' value='$dfvalue'> (填写数值)\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
return $formitem;
}
else
{
$dfvalue = ($ctag->GetAtt('default')!='' ? $ctag->GetAtt('default') : '');
$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:250px' value='$dfvalue'>\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
return $formitem;
}
}
//---------------------------
//处理不同类型的数据
//---------------------------
function GetFieldValue($dvalue,$dtype,$aid=0,$job='add',$addvar='',$admintype='admin')
{
global $cfg_basedir,$cfg_cmspath,$adminID,$cfg_ml;
if(!empty($adminID)) $adminid = $adminID;
else $adminid = $cfg_ml->M_ID;
if($dtype=="int"){
return GetAlabNum($dvalue);
}
else if($dtype=="float"){
return GetAlabNum($dvalue);
}
else if($dtype=="datetime"){
return GetMkTime($dvalue);
}
else if($dtype=="checkbox"){
$okvalue = '';
if(is_array($dvalue)){
foreach($dvalue as $v){ $okvalue .= ($okvalue=='' ? $v : ",{$v}"); }
}
return $okvalue;
}
else if($dtype=="textdata")
{
if($job=='edit')
{
$addvarDirs = explode('/',$addvar);
$addvarDir = ereg_replace("/".$addvarDirs[count($addvarDirs)-1]."$","",$addvar);
$mdir = $cfg_basedir.$addvarDir;
if(!is_dir($mdir)){ MkdirAll($mdir); }
$fp = fopen($cfg_basedir.$addvar,"w");
fwrite($fp,stripslashes($dvalue));
fclose($fp);
CloseFtp();
return $addvar;
}else{
$ipath = $cfg_cmspath."/data/textdata";
$tpath = ceil($aid/5000);
if(!is_dir($cfg_basedir.$ipath)) MkdirAll($cfg_basedir.$ipath,$GLOBALS['cfg_dir_purview']);
if(!is_dir($cfg_basedir.$ipath.'/'.$tpath)) MkdirAll($cfg_basedir.$ipath.'/'.$tpath,$GLOBALS['cfg_dir_purview']);
$ipath = $ipath.'/'.$tpath;
$filename = "{$ipath}/{$aid}.txt";
$fp = fopen($cfg_basedir.$filename,"w");
fwrite($fp,stripslashes($dvalue));
fclose($fp);
CloseFtp();
return $filename;
}
}
else if($dtype=="img"||$dtype=="imgfile")
{
$iurl = stripslashes($dvalue);
if(trim($iurl)=="") return "";
$iurl = trim(str_replace($GLOBALS['cfg_basehost'],"",$iurl));
$imgurl = "{dede:img text='' width='' height=''} ".$iurl." {/dede:img}";
if(eregi("^http://",$iurl) && $GLOBALS['cfg_isUrlOpen']) //远程图片
{
$reimgs = "";
if($GLOBALS['cfg_isUrlOpen']){
$reimgs = GetRemoteImage($iurl,$adminid);
if(is_array($reimgs)){
if($dtype=="imgfile") $imgurl = $reimgs[1];
else $imgurl = "{dede:img text='' width='".$reimgs[1]."' height='".$reimgs[2]."'} ".$reimgs[0]." {/dede:img}";
}
}else{
if($dtype=="imgfile") $imgurl = $iurl;
else $imgurl = "{dede:img text='' width='' height=''} ".$iurl." {/dede:img}";
}
}
else if($iurl!=""){ //站内图片
$imgfile = $cfg_basedir.$iurl;
if(is_file($imgfile)){
$info = '';
$imginfos = GetImageSize($imgfile,$info);
if($dtype=="imgfile") $imgurl = $iurl;
else $imgurl = "{dede:img text='' width='".$imginfos[0]."' height='".$imginfos[1]."'} $iurl {/dede:img}";
}
}
return addslashes($imgurl);
}else{
return $dvalue;
}
}
//获得带值的表单(编辑时用)
//-----------------------------
function GetFormItemValue($ctag,$fvalue,$admintype='admin')
{
global $cfg_basedir;
$fieldname = $ctag->GetName();
$formitem = $formitem = GetSysTemplets("custom_fields_{$admintype}.htm");
$innertext = trim($ctag->GetInnerText());
$ftype = $ctag->GetAtt("type");
$myformItem = '';
if(eregi("select|radio|checkbox",$ftype)) $items = explode(',',$innertext);
if($ftype=='select')
{
$myformItem = "<select name='$fieldname' style='width:150px'>";
if(is_array($items))
{
foreach($items as $v){
$v = trim($v);
if($v=='') continue;
$myformItem.= ($fvalue==$v ? "<option value='$v' selected>$v</option>\r\n" : "<option value='$v'>$v</option>\r\n");
}
}
$myformItem .= "</select>\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$myformItem,$formitem);
return $formitem;
}else if($ctag->GetAtt("type")=='radio')
{
if(is_array($items))
{
foreach($items as $v)
{
$v = trim($v);
if($v=='') continue;
$myformItem.= ($fvalue==$v ? "<input type='radio' name='$fieldname' class='np' value='$v' checked>$v\r\n" : "<input type='radio' name='$fieldname' class='np' value='$v'>$v\r\n");
}
}
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$myformItem,$formitem);
return $formitem;
}
//checkbox
else if($ctag->GetAtt("type")=='checkbox')
{
$myformItem = '';
$items = explode(',',$innertext);
$fvalues = explode(',',$fvalue);
foreach($items as $v){
$v = trim($v);
if($v=='') continue;
if(in_array($v,$fvalues)){ $myformItem .= "<input type='checkbox' name='{$fieldname}[]' class='np' value='$v' checked='checked' />$v\r\n"; }
else{ $myformItem .= "<input type='checkbox' name='{$fieldname}[]' class='np' value='$v' />$v\r\n"; }
}
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$myformItem,$formitem);
return $formitem;
}
//除了以上类型,如果其它的类型自定义了发布表单,则直接输出发布表单优先
if(!empty($innertext))
{
$formitem = str_replace('~name~',$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace('~form~',$innertext,$formitem);
$formitem = str_replace('@value',$fvalue,$formitem);
return $formitem;
}
//文本数据的特殊处理
if($ftype=="textdata")
{
if(is_file($cfg_basedir.$fvalue)){
$fp = fopen($cfg_basedir.$fvalue,'r');
$okfvalue = "";
while(!feof($fp)){ $okfvalue .= fgets($fp,1024); }
fclose($fp);
}else{
$okfvalue = '';
}
if($admintype=='admin') $myformItem = GetEditor($fieldname,$okfvalue,350,'Basic','string')."\r\n <input type='hidden' name='{$fieldname}_file' value='{$fvalue}'>\r\n ";
else $myformItem = GetEditor($fieldname,$okfvalue,350,'Member','string')."\r\n <input type='hidden' name='{$fieldname}_file' value='{$fvalue}'>\r\n ";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$myformItem,$formitem);
return $formitem;
}
else if($ftype=="htmltext")
{
if($admintype=='admin') $myformItem = GetEditor($fieldname,$fvalue,350,'Basic','string')."\r\n ";
else $myformItem = GetEditor($fieldname,$fvalue,350,'Member','string')."\r\n ";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$myformItem,$formitem);
return $formitem;
}
else if($ftype=="multitext")
{
$innertext = "<textarea name='$fieldname' id='$fieldname' style='width:100%;height:80px'>$fvalue</textarea>\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
return $formitem;
}
else if($ftype=="datetime")
{
$nowtime = GetDateTimeMk($fvalue);
$innertext = "<input name=\"$fieldname\" value=\"$nowtime\" type=\"text\" id=\"$fieldname\" style=\"width:250px\">";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
return $formitem;
}
else if($ftype=="img")
{
$ndtp = new DedeTagParse();
$ndtp->LoadSource($fvalue);
if(!is_array($ndtp->CTags)){
$ndtp->Clear();
$fvalue = "";
}else
{
$ntag = $ndtp->GetTag("img");
//$fvalue = trim($ntag->GetInnerText());
$fvalue = trim($ndtp->InnerText);
}
$innertext = "<input type='text' name='$fieldname' value='$fvalue' id='$fieldname' style='width:300px'> <input name='".$fieldname."_bt' class='inputbut' type='button' value='浏览...' onClick=\"SelectImage('form1.$fieldname','big')\">\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
return $formitem;
}
else if($ftype=="imgfile")
{
$innertext = "<input type='text' name='$fieldname' value='$fvalue' id='$fieldname' style='width:300px'> <input name='".$fieldname."_bt' class='inputbut' type='button' value='浏览...' onClick=\"SelectImage('form1.$fieldname','big')\">\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
return $formitem;
}
else if($ftype=="media")
{
$innertext = "<input type='text' name='$fieldname' value='$fvalue' id='$fieldname' style='width:300px'> <input name='".$fieldname."_bt' class='inputbut' type='button' value='浏览...' onClick=\"SelectMedia('form1.$fieldname')\">\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
return $formitem;
}
else if($ftype=="addon")
{
$innertext = "<input type='text' name='$fieldname' id='$fieldname' value='$fvalue' style='width:300px'> <input name='".$fieldname."_bt' class='inputbut' type='button' value='浏览...' onClick=\"SelectSoft('form1.$fieldname')\">\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
return $formitem;
}
else if($ftype=="int"||$ftype=="float")
{
$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:100px' value='$fvalue'> (填写数值)\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
return $formitem;
}
else
{
$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:250px' value='$fvalue'>\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
return $formitem;
}
}
?> | zyyhong | trunk/jiaju001/news/include/inc_custom_fields.php | PHP | asf20 | 15,595 |
<?php
require_once(dirname(__FILE__)."/fckeditor.php");
$fck = new FCKeditor("test");
$fck->BasePath = '/dedecmsv3/include/fckeditor2/' ;
$fck->Width = '100%' ;
$fck->Height = "500" ;
$fck->ToolbarSet = "Default" ;
$fck->Value = "" ;
$fck->Create();
?> | zyyhong | trunk/jiaju001/news/include/FCKeditor/index.php | PHP | asf20 | 265 |
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fck_editor.css
* Styles used by the editor IFRAME and Toolbar.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
/*
### Basic Editor IFRAME Styles.
*/
body
{
padding: 1px 1px 1px 1px;
margin: 0px 0px 0px 0px;
}
#eWysiwygCell, .Source
{
border: #696969 1px solid;
}
#eSourceField
{
border: none;
padding: 5px;
font-family: Monospace;
}
/*
### Toolbar Styles
*/
.TB_ToolbarSet, .TB_Expand, .TB_Collapse
{
background-color: #efefde;
}
.TB_End
{
display: none;
}
.TB_ExpandImg
{
background-image: url(images/toolbar.expand.gif);
background-repeat: no-repeat;
}
.TB_CollapseImg
{
background-image: url(images/toolbar.collapse.gif);
background-repeat: no-repeat;
}
.TB_ToolbarSet
{
border-top: #efefde 1px outset;
border-bottom: #efefde 1px outset;
}
.TB_SideBorder
{
background-color: #696969;
}
.TB_ToolbarSet, .TB_ToolbarSet *
{
font-size: 11px;
cursor: default;
font-family: 'Microsoft Sans Serif' , Tahoma, Arial, Verdana, Sans-Serif;
}
.TB_Expand, .TB_Collapse
{
padding: 2px 2px 2px 2px;
border: #efefde 1px outset;
}
.TB_Collapse
{
border: #efefde 1px outset;
width: 5px;
}
.TB_Button_On, .TB_Button_Off, .TB_Button_Disabled, .TB_Combo_Off, .TB_Combo_Disabled
{
border: #efefde 1px solid;
height: 21px;
}
.TB_Button_On
{
border-color: #316ac5;
background-color: #c1d2ee;
}
.TB_Button_Off, .TB_Combo_Off
{
opacity: 0.70; /* Safari, Opera and Mozilla */
filter: alpha(opacity=70); /* IE */
/* -moz-opacity: 0.70; Mozilla (Old) */
background-color: #efefde;
}
.TB_Button_Disabled, .TB_Combo_Disabled
{
opacity: 0.30; /* Safari, Opera and Mozilla */
filter: gray() alpha(opacity=30); /* IE */
/* -moz-opacity: 0.30; Mozilla (Old) */
}
.TB_Button_On_Over, .TB_Button_Off_Over
{
background-color: #dff1ff;
}
.TB_Icon DIV
{
width: 21px;
height: 21px;
background-position: 50% 50%;
background-repeat: no-repeat;
}
.TB_Text
{
height: 21px;
padding-right: 5px;
}
.TB_ButtonArrow
{
padding-right: 3px;
}
.TB_Break
{
height: 23px;
} | zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/skins/default/fck_editor.css | CSS | asf20 | 2,559 |
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fck_dialog.css
* Styles used by the dialog boxes.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
body
{
margin: 0px;
padding: 10px;
}
body, td, input, select, textarea
{
font-size: 11px;
font-family: 'Microsoft Sans Serif' , Arial, Helvetica, Verdana;
}
body, .BackColor
{
background-color: #f1f1e3;
}
.PopupBody
{
margin: 0px;
padding: 0px;
}
.PopupTitle
{
font-weight: bold;
font-size: 14pt;
color: #737357;
background-color: #e3e3c7;
padding: 3px 10px 3px 10px;
}
.PopupButtons
{
border-top: #d5d59d 1px solid;
background-color: #e3e3c7;
padding: 7px 10px 7px 10px;
}
.Button
{
border-right: #737357 1px solid;
border-top: #737357 1px solid;
border-left: #737357 1px solid;
color: #3b3b1f;
border-bottom: #737357 1px solid;
background-color: #c7c78f;
}
.DarkBackground
{
background-color: #d7d79f;
}
.LightBackground
{
background-color: #ffffbe;
}
.PopupTitleBorder
{
border-bottom: #d5d59d 1px solid;
}
.PopupTabArea
{
color: #737357;
background-color: #e3e3c7;
}
.PopupTabEmptyArea
{
padding-left: 10px ;
border-bottom: #d5d59d 1px solid;
}
.PopupTab, .PopupTabSelected
{
border-right: #d5d59d 1px solid;
border-top: #d5d59d 1px solid;
border-left: #d5d59d 1px solid;
padding-right: 5px;
padding-left: 5px;
padding-bottom: 3px;
padding-top: 3px;
color: #737357;
}
.PopupTab
{
margin-top: 1px;
border-bottom: #d5d59d 1px solid;
cursor: pointer;
cursor: hand;
}
.PopupTabSelected
{
font-weight:bold;
cursor: default;
padding-top: 4px;
border-bottom: #f1f1e3 1px solid;
background-color: #f1f1e3;
}
.PopupSelectionBox
{
border: #ff9933 1px solid;
background-color: #fffacd;
cursor: pointer;
cursor: hand;
} | zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/skins/default/fck_dialog.css | CSS | asf20 | 2,225 |
<script>
window.onload = function()
{
document.designMode = 'on' ;
// Tell Gecko to use or not the <SPAN> tag for the bold, italic and underline.
document.execCommand( 'useCSS', false, !window.parent.FCKConfig.GeckoUseSPAN ) ;
window.parent.FCK.OnAfterSetHTML() ;
}
if ( window.parent._TempHtml )
{
document.write( window.parent._TempHtml ) ;
window.parent._TempHtml = null ;
}
</script> | zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/fckdocument.html | HTML | asf20 | 425 |
<!--
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fckdebug.html
* This is the Debug window.
* It automatically popups if the Debug = true in the configuration file.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
<title>FCKeditor Debug Window</title>
<script type="text/javascript">
var oWindow ;
var oDiv ;
if ( !window.FCKMessages )
window.FCKMessages = new Array() ;
function Initialize()
{
oWindow = window.frames[ 'eOutput' ]
oWindow.document.open() ;
oWindow.document.write( '<div id="divMsg"><\/div>' ) ;
oWindow.document.close() ;
oDiv = oWindow.document.getElementById('divMsg') ;
}
function Output( message, color )
{
if ( color )
message = '<font color="' + color + '">' + message + '<\/font>' ;
window.FCKMessages[ window.FCKMessages.length ] = message ;
StartTimer() ;
}
function StartTimer()
{
window.setTimeout( 'CheckMessages()', 100 ) ;
}
function CheckMessages()
{
if ( window.FCKMessages.length > 0 )
{
// Get the first item in the queue
var sMessage = window.FCKMessages[0] ;
// Removes the first item from the queue
var oTempArray = new Array() ;
for ( i = 1 ; i < window.FCKMessages.length ; i++ )
oTempArray[ i - 1 ] = window.FCKMessages[ i ] ;
window.FCKMessages = oTempArray ;
var d = new Date() ;
var sTime =
( d.getHours() + 100 + '' ).substr( 1,2 ) + ':' +
( d.getMinutes() + 100 + '' ).substr( 1,2 ) + ':' +
( d.getSeconds() + 100 + '' ).substr( 1,2 ) + ':' +
( d.getMilliseconds() + 1000 + '' ).substr( 1,3 ) ;
var oMsgDiv = oWindow.document.createElement( 'div' ) ;
oMsgDiv.innerHTML = sTime + ': <b>' + sMessage + '<\/b>' ;
oDiv.appendChild( oMsgDiv ) ;
oMsgDiv.scrollIntoView() ;
}
}
function Clear()
{
oDiv.innerHTML = '' ;
}
</script>
</head>
<body onload="Initialize();" bottomMargin="10" leftMargin="10" topMargin="10" rightMargin="10">
<TABLE height="100%" cellSpacing="5" cellPadding="0" width="100%" border="0">
<TR>
<TD>
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<TD><FONT size="+2"><STRONG>FCKeditor Debug Window</STRONG></FONT></TD>
<TD align="right"><INPUT type="button" value="Clear" onclick="Clear();"></TD>
</TR>
</TABLE>
</TD>
</TR>
<TR>
<TD height="100%" style="BORDER-RIGHT: #696969 1px solid; BORDER-TOP: #696969 1px solid; BORDER-LEFT: #696969 1px solid; BORDER-BOTTOM: #696969 1px solid">
<iframe id="eOutput" name="eOutput" width="100%" height="100%" scrolling="auto" src="fckblank.html" frameborder="no"></iframe>
</TD>
</TR>
</TABLE>
</body>
</html> | zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/fckdebug.html | HTML | asf20 | 3,201 |
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: en.js
* English language file.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
var FCKLang =
{
// Language direction : "ltr" (left to right) or "rtl" (right to left).
Dir : "ltr",
ToolbarCollapse : "Collapse Toolbar",
ToolbarExpand : "Expand Toolbar",
// Toolbar Items and Context Menu
Save : "Save",
NewPage : "New Page",
Preview : "Preview",
Cut : "Cut",
Copy : "Copy",
Paste : "Paste",
PasteText : "Paste as plain text",
PasteWord : "Paste from Word",
Print : "Print",
SelectAll : "Select All",
RemoveFormat : "Remove Format",
InsertLinkLbl : "Link",
InsertLink : "Insert/Edit Link",
RemoveLink : "Remove Link",
Anchor : "Insert/Edit Anchor",
InsertImageLbl : "Image",
InsertImage : "Insert/Edit Image",
InsertFlashLbl : "Flash",
InsertFlash : "Insert/Edit Flash",
InsertTableLbl : "Table",
InsertTable : "Insert/Edit Table",
InsertLineLbl : "Line",
InsertLine : "Insert Horizontal Line",
InsertSpecialCharLbl: "Special Char",
InsertSpecialChar : "Insert Special Character",
InsertSmileyLbl : "Smiley",
InsertSmiley : "Insert Smiley",
About : "About FCKeditor",
Bold : "Bold",
Italic : "Italic",
Underline : "Underline",
StrikeThrough : "Strike Through",
Subscript : "Subscript",
Superscript : "Superscript",
LeftJustify : "Left Justify",
CenterJustify : "Center Justify",
RightJustify : "Right Justify",
BlockJustify : "Block Justify",
DecreaseIndent : "Decrease Indent",
IncreaseIndent : "Increase Indent",
Undo : "Undo",
Redo : "Redo",
NumberedListLbl : "Numbered List",
NumberedList : "Insert/Remove Numbered List",
BulletedListLbl : "Bulleted List",
BulletedList : "Insert/Remove Bulleted List",
ShowTableBorders : "Show Table Borders",
ShowDetails : "Show Details",
Style : "Style",
FontFormat : "Format",
Font : "Font",
FontSize : "Size",
TextColor : "Text Color",
BGColor : "Background Color",
Source : "Source",
Find : "Find",
Replace : "Replace",
SpellCheck : "Check Spell",
UniversalKeyboard : "Universal Keyboard",
PageBreakLbl : "Page Break",
PageBreak : "Insert Page Break",
Form : "Form",
Checkbox : "Checkbox",
RadioButton : "Radio Button",
TextField : "Text Field",
Textarea : "Textarea",
HiddenField : "Hidden Field",
Button : "Button",
SelectionField : "Selection Field",
ImageButton : "Image Button",
// Context Menu
EditLink : "Edit Link",
InsertRow : "Insert Row",
DeleteRows : "Delete Rows",
InsertColumn : "Insert Column",
DeleteColumns : "Delete Columns",
InsertCell : "Insert Cell",
DeleteCells : "Delete Cells",
MergeCells : "Merge Cells",
SplitCell : "Split Cell",
TableDelete : "Delete Table",
CellProperties : "Cell Properties",
TableProperties : "Table Properties",
ImageProperties : "Image Properties",
FlashProperties : "Flash Properties",
AnchorProp : "Anchor Properties",
ButtonProp : "Button Properties",
CheckboxProp : "Checkbox Properties",
HiddenFieldProp : "Hidden Field Properties",
RadioButtonProp : "Radio Button Properties",
ImageButtonProp : "Image Button Properties",
TextFieldProp : "Text Field Properties",
SelectionFieldProp : "Selection Field Properties",
TextareaProp : "Textarea Properties",
FormProp : "Form Properties",
FontFormats : "Normal;Formatted;Address;Heading 1;Heading 2;Heading 3;Heading 4;Heading 5;Heading 6;Normal (DIV)",
// Alerts and Messages
ProcessingXHTML : "Processing XHTML. Please wait...",
Done : "Done",
PasteWordConfirm : "The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?",
NotCompatiblePaste : "This command is available for Internet Explorer version 5.5 or more. Do you want to paste without cleaning?",
UnknownToolbarItem : "Unknown toolbar item \"%1\"",
UnknownCommand : "Unknown command name \"%1\"",
NotImplemented : "Command not implemented",
UnknownToolbarSet : "Toolbar set \"%1\" doesn't exist",
NoActiveX : "You browser's security settings could limit some features of the editor. You must enable the option \"Run ActiveX controls and plug-ins\". You may experience errors and notice missing features.",
BrowseServerBlocked : "The resources browser could not be opened. Make sure that all popup blockers are disabled.",
DialogBlocked : "It was not possible to open the dialog window. Make sure all popup blockers are disabled.",
// Dialogs
DlgBtnOK : "OK",
DlgBtnCancel : "Cancel",
DlgBtnClose : "Close",
DlgBtnBrowseServer : "Browse Server",
DlgAdvancedTag : "Advanced",
DlgOpOther : "<Other>",
DlgInfoTab : "Info",
DlgAlertUrl : "Please insert the URL",
// General Dialogs Labels
DlgGenNotSet : "<not set>",
DlgGenId : "Id",
DlgGenLangDir : "Language Direction",
DlgGenLangDirLtr : "Left to Right (LTR)",
DlgGenLangDirRtl : "Right to Left (RTL)",
DlgGenLangCode : "Language Code",
DlgGenAccessKey : "Access Key",
DlgGenName : "Name",
DlgGenTabIndex : "Tab Index",
DlgGenLongDescr : "Long Description URL",
DlgGenClass : "Stylesheet Classes",
DlgGenTitle : "Advisory Title",
DlgGenContType : "Advisory Content Type",
DlgGenLinkCharset : "Linked Resource Charset",
DlgGenStyle : "Style",
// Image Dialog
DlgImgTitle : "Image Properties",
DlgImgInfoTab : "Image Info",
DlgImgBtnUpload : "Send it to the Server",
DlgImgURL : "URL",
DlgImgUpload : "Upload",
DlgImgAlt : "Alternative Text",
DlgImgWidth : "Width",
DlgImgHeight : "Height",
DlgImgLockRatio : "Lock Ratio",
DlgBtnResetSize : "Reset Size",
DlgImgBorder : "Border",
DlgImgHSpace : "HSpace",
DlgImgVSpace : "VSpace",
DlgImgAlign : "Align",
DlgImgAlignLeft : "Left",
DlgImgAlignAbsBottom: "Abs Bottom",
DlgImgAlignAbsMiddle: "Abs Middle",
DlgImgAlignBaseline : "Baseline",
DlgImgAlignBottom : "Bottom",
DlgImgAlignMiddle : "Middle",
DlgImgAlignRight : "Right",
DlgImgAlignTextTop : "Text Top",
DlgImgAlignTop : "Top",
DlgImgPreview : "Preview",
DlgImgAlertUrl : "Please type the image URL",
DlgImgLinkTab : "Link",
// Flash Dialog
DlgFlashTitle : "Flash Properties",
DlgFlashChkPlay : "Auto Play",
DlgFlashChkLoop : "Loop",
DlgFlashChkMenu : "Enable Flash Menu",
DlgFlashScale : "Scale",
DlgFlashScaleAll : "Show all",
DlgFlashScaleNoBorder : "No Border",
DlgFlashScaleFit : "Exact Fit",
// Link Dialog
DlgLnkWindowTitle : "Link",
DlgLnkInfoTab : "Link Info",
DlgLnkTargetTab : "Target",
DlgLnkType : "Link Type",
DlgLnkTypeURL : "URL",
DlgLnkTypeAnchor : "Anchor in this page",
DlgLnkTypeEMail : "E-Mail",
DlgLnkProto : "Protocol",
DlgLnkProtoOther : "<other>",
DlgLnkURL : "URL",
DlgLnkAnchorSel : "Select an Anchor",
DlgLnkAnchorByName : "By Anchor Name",
DlgLnkAnchorById : "By Element Id",
DlgLnkNoAnchors : "<No anchors available in the document>",
DlgLnkEMail : "E-Mail Address",
DlgLnkEMailSubject : "Message Subject",
DlgLnkEMailBody : "Message Body",
DlgLnkUpload : "Upload",
DlgLnkBtnUpload : "Send it to the Server",
DlgLnkTarget : "Target",
DlgLnkTargetFrame : "<frame>",
DlgLnkTargetPopup : "<popup window>",
DlgLnkTargetBlank : "New Window (_blank)",
DlgLnkTargetParent : "Parent Window (_parent)",
DlgLnkTargetSelf : "Same Window (_self)",
DlgLnkTargetTop : "Topmost Window (_top)",
DlgLnkTargetFrameName : "Target Frame Name",
DlgLnkPopWinName : "Popup Window Name",
DlgLnkPopWinFeat : "Popup Window Features",
DlgLnkPopResize : "Resizable",
DlgLnkPopLocation : "Location Bar",
DlgLnkPopMenu : "Menu Bar",
DlgLnkPopScroll : "Scroll Bars",
DlgLnkPopStatus : "Status Bar",
DlgLnkPopToolbar : "Toolbar",
DlgLnkPopFullScrn : "Full Screen (IE)",
DlgLnkPopDependent : "Dependent (Netscape)",
DlgLnkPopWidth : "Width",
DlgLnkPopHeight : "Height",
DlgLnkPopLeft : "Left Position",
DlgLnkPopTop : "Top Position",
DlnLnkMsgNoUrl : "Please type the link URL",
DlnLnkMsgNoEMail : "Please type the e-mail address",
DlnLnkMsgNoAnchor : "Please select an anchor",
// Color Dialog
DlgColorTitle : "Select Color",
DlgColorBtnClear : "Clear",
DlgColorHighlight : "Highlight",
DlgColorSelected : "Selected",
// Smiley Dialog
DlgSmileyTitle : "Insert a Smiley",
// Special Character Dialog
DlgSpecialCharTitle : "Select Special Character",
// Table Dialog
DlgTableTitle : "Table Properties",
DlgTableRows : "Rows",
DlgTableColumns : "Columns",
DlgTableBorder : "Border size",
DlgTableAlign : "Alignment",
DlgTableAlignNotSet : "<Not set>",
DlgTableAlignLeft : "Left",
DlgTableAlignCenter : "Center",
DlgTableAlignRight : "Right",
DlgTableWidth : "Width",
DlgTableWidthPx : "pixels",
DlgTableWidthPc : "percent",
DlgTableHeight : "Height",
DlgTableCellSpace : "Cell spacing",
DlgTableCellPad : "Cell padding",
DlgTableCaption : "Caption",
DlgTableSummary : "Summary",
// Table Cell Dialog
DlgCellTitle : "Cell Properties",
DlgCellWidth : "Width",
DlgCellWidthPx : "pixels",
DlgCellWidthPc : "percent",
DlgCellHeight : "Height",
DlgCellWordWrap : "Word Wrap",
DlgCellWordWrapNotSet : "<Not set>",
DlgCellWordWrapYes : "Yes",
DlgCellWordWrapNo : "No",
DlgCellHorAlign : "Horizontal Alignment",
DlgCellHorAlignNotSet : "<Not set>",
DlgCellHorAlignLeft : "Left",
DlgCellHorAlignCenter : "Center",
DlgCellHorAlignRight: "Right",
DlgCellVerAlign : "Vertical Alignment",
DlgCellVerAlignNotSet : "<Not set>",
DlgCellVerAlignTop : "Top",
DlgCellVerAlignMiddle : "Middle",
DlgCellVerAlignBottom : "Bottom",
DlgCellVerAlignBaseline : "Baseline",
DlgCellRowSpan : "Rows Span",
DlgCellCollSpan : "Columns Span",
DlgCellBackColor : "Background Color",
DlgCellBorderColor : "Border Color",
DlgCellBtnSelect : "Select...",
// Find Dialog
DlgFindTitle : "Find",
DlgFindFindBtn : "Find",
DlgFindNotFoundMsg : "The specified text was not found.",
// Replace Dialog
DlgReplaceTitle : "Replace",
DlgReplaceFindLbl : "Find what:",
DlgReplaceReplaceLbl : "Replace with:",
DlgReplaceCaseChk : "Match case",
DlgReplaceReplaceBtn : "Replace",
DlgReplaceReplAllBtn : "Replace All",
DlgReplaceWordChk : "Match whole word",
// Paste Operations / Dialog
PasteErrorPaste : "Your browser security settings don't permit the editor to automatically execute pasting operations. Please use the keyboard for that (Ctrl+V).",
PasteErrorCut : "Your browser security settings don't permit the editor to automatically execute cutting operations. Please use the keyboard for that (Ctrl+X).",
PasteErrorCopy : "Your browser security settings don't permit the editor to automatically execute copying operations. Please use the keyboard for that (Ctrl+C).",
PasteAsText : "Paste as Plain Text",
PasteFromWord : "Paste from Word",
DlgPasteMsg2 : "Please paste inside the following box using the keyboard (<STRONG>Ctrl+V</STRONG>) and hit <STRONG>OK</STRONG>.",
DlgPasteIgnoreFont : "Ignore Font Face definitions",
DlgPasteRemoveStyles : "Remove Styles definitions",
DlgPasteCleanBox : "Clean Up Box",
// Color Picker
ColorAutomatic : "Automatic",
ColorMoreColors : "More Colors...",
// Document Properties
DocProps : "Document Properties",
// Anchor Dialog
DlgAnchorTitle : "Anchor Properties",
DlgAnchorName : "Anchor Name",
DlgAnchorErrorName : "Please type the anchor name",
// Speller Pages Dialog
DlgSpellNotInDic : "Not in dictionary",
DlgSpellChangeTo : "Change to",
DlgSpellBtnIgnore : "Ignore",
DlgSpellBtnIgnoreAll : "Ignore All",
DlgSpellBtnReplace : "Replace",
DlgSpellBtnReplaceAll : "Replace All",
DlgSpellBtnUndo : "Undo",
DlgSpellNoSuggestions : "- No suggestions -",
DlgSpellProgress : "Spell check in progress...",
DlgSpellNoMispell : "Spell check complete: No misspellings found",
DlgSpellNoChanges : "Spell check complete: No words changed",
DlgSpellOneChange : "Spell check complete: One word changed",
DlgSpellManyChanges : "Spell check complete: %1 words changed",
IeSpellDownload : "Spell checker not installed. Do you want to download it now?",
// Button Dialog
DlgButtonText : "Text (Value)",
DlgButtonType : "Type",
// Checkbox and Radio Button Dialogs
DlgCheckboxName : "Name",
DlgCheckboxValue : "Value",
DlgCheckboxSelected : "Selected",
// Form Dialog
DlgFormName : "Name",
DlgFormAction : "Action",
DlgFormMethod : "Method",
// Select Field Dialog
DlgSelectName : "Name",
DlgSelectValue : "Value",
DlgSelectSize : "Size",
DlgSelectLines : "lines",
DlgSelectChkMulti : "Allow multiple selections",
DlgSelectOpAvail : "Available Options",
DlgSelectOpText : "Text",
DlgSelectOpValue : "Value",
DlgSelectBtnAdd : "Add",
DlgSelectBtnModify : "Modify",
DlgSelectBtnUp : "Up",
DlgSelectBtnDown : "Down",
DlgSelectBtnSetValue : "Set as selected value",
DlgSelectBtnDelete : "Delete",
// Textarea Dialog
DlgTextareaName : "Name",
DlgTextareaCols : "Columns",
DlgTextareaRows : "Rows",
// Text Field Dialog
DlgTextName : "Name",
DlgTextValue : "Value",
DlgTextCharWidth : "Character Width",
DlgTextMaxChars : "Maximum Characters",
DlgTextType : "Type",
DlgTextTypeText : "Text",
DlgTextTypePass : "Password",
// Hidden Field Dialog
DlgHiddenName : "Name",
DlgHiddenValue : "Value",
// Bulleted List Dialog
BulletedListProp : "Bulleted List Properties",
NumberedListProp : "Numbered List Properties",
DlgLstType : "Type",
DlgLstTypeCircle : "Circle",
DlgLstTypeDisc : "Disc",
DlgLstTypeSquare : "Square",
DlgLstTypeNumbers : "Numbers (1, 2, 3)",
DlgLstTypeLCase : "Lowercase Letters (a, b, c)",
DlgLstTypeUCase : "Uppercase Letters (A, B, C)",
DlgLstTypeSRoman : "Small Roman Numerals (i, ii, iii)",
DlgLstTypeLRoman : "Large Roman Numerals (I, II, III)",
// Document Properties Dialog
DlgDocGeneralTab : "General",
DlgDocBackTab : "Background",
DlgDocColorsTab : "Colors and Margins",
DlgDocMetaTab : "Meta Data",
DlgDocPageTitle : "Page Title",
DlgDocLangDir : "Language Direction",
DlgDocLangDirLTR : "Left to Right (LTR)",
DlgDocLangDirRTL : "Right to Left (RTL)",
DlgDocLangCode : "Language Code",
DlgDocCharSet : "Character Set Encoding",
DlgDocCharSetOther : "Other Character Set Encoding",
DlgDocDocType : "Document Type Heading",
DlgDocDocTypeOther : "Other Document Type Heading",
DlgDocIncXHTML : "Include XHTML Declarations",
DlgDocBgColor : "Background Color",
DlgDocBgImage : "Background Image URL",
DlgDocBgNoScroll : "Nonscrolling Background",
DlgDocCText : "Text",
DlgDocCLink : "Link",
DlgDocCVisited : "Visited Link",
DlgDocCActive : "Active Link",
DlgDocMargins : "Page Margins",
DlgDocMaTop : "Top",
DlgDocMaLeft : "Left",
DlgDocMaRight : "Right",
DlgDocMaBottom : "Bottom",
DlgDocMeIndex : "Document Indexing Keywords (comma separated)",
DlgDocMeDescr : "Document Description",
DlgDocMeAuthor : "Author",
DlgDocMeCopy : "Copyright",
DlgDocPreview : "Preview",
// Templates Dialog
Templates : "Templates",
DlgTemplatesTitle : "Content Templates",
DlgTemplatesSelMsg : "Please select the template to open in the editor<br>(the actual contents will be lost):",
DlgTemplatesLoading : "Loading templates list. Please wait...",
DlgTemplatesNoTpl : "(No templates defined)",
// About Dialog
DlgAboutAboutTab : "About",
DlgAboutBrowserInfoTab : "Browser Info",
DlgAboutVersion : "version",
DlgAboutLicense : "Licensed under the terms of the GNU Lesser General Public License",
DlgAboutInfo : "For further information go to"
} | zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/lang/en.js | JavaScript | asf20 | 16,076 |
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fcklanguagemanager.js
* This file list all available languages in the editor.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
var FCKLanguageManager = new Object() ;
FCKLanguageManager.AvailableLanguages =
{
'ar' : 'Arabic',
'bg' : 'Bulgarian',
'bs' : 'Bosnian',
'ca' : 'Catalan',
'cs' : 'Czech',
'da' : 'Danish',
'de' : 'German',
'el' : 'Greek',
'en' : 'English',
'en-au' : 'English (Australia)',
'en-uk' : 'English (United Kingdom)',
'eo' : 'Esperanto',
'es' : 'Spanish',
'et' : 'Estonian',
'eu' : 'Basque',
'fa' : 'Persian',
'fi' : 'Finnish',
'fo' : 'Faroese',
'fr' : 'French',
'gl' : 'Galician',
'he' : 'Hebrew',
'hi' : 'Hindi',
'hr' : 'Croatian',
'hu' : 'Hungarian',
'it' : 'Italian',
'ja' : 'Japanese',
'ko' : 'Korean',
'lt' : 'Lithuanian',
'lv' : 'Latvian',
'mn' : 'Mongolian',
'ms' : 'Malay',
'nl' : 'Dutch',
'no' : 'Norwegian',
'pl' : 'Polish',
'pt' : 'Portuguese (Portugal)',
'pt-br' : 'Portuguese (Brazil)',
'ro' : 'Romanian',
'ru' : 'Russian',
'sk' : 'Slovak',
'sl' : 'Slovenian',
'sr' : 'Serbian (Cyrillic)',
'sr-latn' : 'Serbian (Latin)',
'sv' : 'Swedish',
'th' : 'Thai',
'tr' : 'Turkish',
'uk' : 'Ukrainian',
'vi' : 'Vietnamese',
'zh' : 'Chinese Traditional',
'zh-cn' : 'Chinese Simplified'
} | zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/lang/fcklanguagemanager.js | JavaScript | asf20 | 1,803 |
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: zh.js
* Chinese Traditional language file.
*
* File Authors:
* Zak Fong (zakfong@yahoo.com.tw)
*/
var FCKLang =
{
// Language direction : "ltr" (left to right) or "rtl" (right to left).
Dir : "ltr",
ToolbarCollapse : "隱藏面板",
ToolbarExpand : "顯示面板",
// Toolbar Items and Context Menu
Save : "儲存",
NewPage : "開新檔案",
Preview : "預覽",
Cut : "剪下",
Copy : "複製",
Paste : "貼上",
PasteText : "貼為純文字格式",
PasteWord : "自 Word 貼上",
Print : "列印",
SelectAll : "全選",
RemoveFormat : "清除格式",
InsertLinkLbl : "超連結",
InsertLink : "插入/編輯超連結",
RemoveLink : "移除超連結",
Anchor : "插入/編輯錨點",
InsertImageLbl : "影像",
InsertImage : "插入/編輯影像",
InsertFlashLbl : "Flash",
InsertFlash : "插入/編輯 Flash",
InsertTableLbl : "表格",
InsertTable : "插入/編輯表格",
InsertLineLbl : "水平線",
InsertLine : "插入水平線",
InsertSpecialCharLbl: "特殊符號",
InsertSpecialChar : "插入特殊符號",
InsertSmileyLbl : "表情符號",
InsertSmiley : "插入表情符號",
About : "關於 FCKeditor",
Bold : "粗體",
Italic : "斜體",
Underline : "底線",
StrikeThrough : "刪除線",
Subscript : "下標",
Superscript : "上標",
LeftJustify : "靠左對齊",
CenterJustify : "置中",
RightJustify : "靠右對齊",
BlockJustify : "左右對齊",
DecreaseIndent : "減少縮排",
IncreaseIndent : "增加縮排",
Undo : "復原",
Redo : "重複",
NumberedListLbl : "編號清單",
NumberedList : "插入/移除編號清單",
BulletedListLbl : "項目清單",
BulletedList : "插入/移除項目清單",
ShowTableBorders : "顯示表格邊框",
ShowDetails : "顯示詳細資料",
Style : "樣式",
FontFormat : "格式",
Font : "字體",
FontSize : "大小",
TextColor : "文字顏色",
BGColor : "背景顏色",
Source : "原始碼",
Find : "尋找",
Replace : "取代",
SpellCheck : "拼字檢查",
UniversalKeyboard : "萬國鍵盤",
PageBreakLbl : "分頁符號",
PageBreak : "插入分頁符號",
Form : "表單",
Checkbox : "核取方塊",
RadioButton : "選項按鈕",
TextField : "文字方塊",
Textarea : "文字區域",
HiddenField : "隱藏欄位",
Button : "按鈕",
SelectionField : "清單/選單",
ImageButton : "影像按鈕",
// Context Menu
EditLink : "編輯超連結",
InsertRow : "插入列",
DeleteRows : "刪除列",
InsertColumn : "插入欄",
DeleteColumns : "刪除欄",
InsertCell : "插入儲存格",
DeleteCells : "刪除儲存格",
MergeCells : "合併儲存格",
SplitCell : "分割儲存格",
TableDelete : "刪除表格",
CellProperties : "儲存格屬性",
TableProperties : "表格屬性",
ImageProperties : "影像屬性",
FlashProperties : "Flash 屬性",
AnchorProp : "錨點屬性",
ButtonProp : "按鈕屬性",
CheckboxProp : "核取方塊屬性",
HiddenFieldProp : "隱藏欄位屬性",
RadioButtonProp : "選項按鈕屬性",
ImageButtonProp : "影像按鈕屬性",
TextFieldProp : "文字方塊屬性",
SelectionFieldProp : "清單/選單屬性",
TextareaProp : "文字區域屬性",
FormProp : "表單屬性",
FontFormats : "一般;格式化;地址;標題 1;標題 2;標題 3;標題 4;標題 5;標題 6;段落 (DIV)",
// Alerts and Messages
ProcessingXHTML : "處理 XHTML 中,請稍候…",
Done : "完成",
PasteWordConfirm : "您想貼上的文字似乎是自 Word 複製而來,請問您是否要先清除 Word 的格式後再行貼上?",
NotCompatiblePaste : "此指令僅在 Internet Explorer 5.5 或以上的版本有效。請問您是否同意不清除格式即貼上?",
UnknownToolbarItem : "未知工具列項目 \"%1\"",
UnknownCommand : "未知指令名稱 \"%1\"",
NotImplemented : "尚未安裝此指令",
UnknownToolbarSet : "工具列設定 \"%1\" 不存在",
NoActiveX : "瀏覽器的安全性設定限制了本編輯器的某些功能。您必須啟用安全性設定中的「執行ActiveX控制項與外掛程式」項目,否則本編輯器將會出現錯誤並缺少某些功能",
BrowseServerBlocked : "無法開啟資源瀏覽器,請確定所有快顯視窗封鎖程式是否關閉",
DialogBlocked : "無法開啟對話視窗,請確定所有快顯視窗封鎖程式是否關閉",
// Dialogs
DlgBtnOK : "確定",
DlgBtnCancel : "取消",
DlgBtnClose : "關閉",
DlgBtnBrowseServer : "瀏覽伺服器端",
DlgAdvancedTag : "進階",
DlgOpOther : "<其他>",
DlgInfoTab : "資訊",
DlgAlertUrl : "請插入 URL",
// General Dialogs Labels
DlgGenNotSet : "<尚未設定>",
DlgGenId : "ID",
DlgGenLangDir : "語言方向",
DlgGenLangDirLtr : "由左而右 (LTR)",
DlgGenLangDirRtl : "由右而左 (RTL)",
DlgGenLangCode : "語言代碼",
DlgGenAccessKey : "存取鍵",
DlgGenName : "名稱",
DlgGenTabIndex : "定位順序",
DlgGenLongDescr : "詳細 URL",
DlgGenClass : "樣式表類別",
DlgGenTitle : "標題",
DlgGenContType : "內容類型",
DlgGenLinkCharset : "連結資源之編碼",
DlgGenStyle : "樣式",
// Image Dialog
DlgImgTitle : "影像屬性",
DlgImgInfoTab : "影像資訊",
DlgImgBtnUpload : "上傳至伺服器",
DlgImgURL : "URL",
DlgImgUpload : "上傳",
DlgImgAlt : "替代文字",
DlgImgWidth : "寬度",
DlgImgHeight : "高度",
DlgImgLockRatio : "等比例",
DlgBtnResetSize : "重設為原大小",
DlgImgBorder : "邊框",
DlgImgHSpace : "水平距離",
DlgImgVSpace : "垂直距離",
DlgImgAlign : "對齊",
DlgImgAlignLeft : "靠左對齊",
DlgImgAlignAbsBottom: "絕對下方",
DlgImgAlignAbsMiddle: "絕對中間",
DlgImgAlignBaseline : "基準線",
DlgImgAlignBottom : "靠下對齊",
DlgImgAlignMiddle : "置中對齊",
DlgImgAlignRight : "靠右對齊",
DlgImgAlignTextTop : "文字上方",
DlgImgAlignTop : "靠上對齊",
DlgImgPreview : "預覽",
DlgImgAlertUrl : "請輸入影像 URL",
DlgImgLinkTab : "超連結",
// Flash Dialog
DlgFlashTitle : "Flash 屬性",
DlgFlashChkPlay : "自動播放",
DlgFlashChkLoop : "重複",
DlgFlashChkMenu : "開啟選單",
DlgFlashScale : "縮放",
DlgFlashScaleAll : "全部顯示",
DlgFlashScaleNoBorder : "無邊框",
DlgFlashScaleFit : "精確符合",
// Link Dialog
DlgLnkWindowTitle : "超連結",
DlgLnkInfoTab : "超連結資訊",
DlgLnkTargetTab : "目標",
DlgLnkType : "超連接類型",
DlgLnkTypeURL : "URL",
DlgLnkTypeAnchor : "本頁錨點",
DlgLnkTypeEMail : "電子郵件",
DlgLnkProto : "通訊協定",
DlgLnkProtoOther : "<其他>",
DlgLnkURL : "URL",
DlgLnkAnchorSel : "請選擇錨點",
DlgLnkAnchorByName : "依錨點名稱",
DlgLnkAnchorById : "依元件 ID",
DlgLnkNoAnchors : "<本文件尚無可用之錨點>",
DlgLnkEMail : "電子郵件",
DlgLnkEMailSubject : "郵件主旨",
DlgLnkEMailBody : "郵件內容",
DlgLnkUpload : "上傳",
DlgLnkBtnUpload : "傳送至伺服器",
DlgLnkTarget : "目標",
DlgLnkTargetFrame : "<框架>",
DlgLnkTargetPopup : "<快顯視窗>",
DlgLnkTargetBlank : "新視窗 (_blank)",
DlgLnkTargetParent : "父視窗 (_parent)",
DlgLnkTargetSelf : "本視窗 (_self)",
DlgLnkTargetTop : "最上層視窗 (_top)",
DlgLnkTargetFrameName : "目標框架名稱",
DlgLnkPopWinName : "快顯視窗名稱",
DlgLnkPopWinFeat : "快顯視窗屬性",
DlgLnkPopResize : "可調整大小",
DlgLnkPopLocation : "網址列",
DlgLnkPopMenu : "選單列",
DlgLnkPopScroll : "捲軸",
DlgLnkPopStatus : "狀態列",
DlgLnkPopToolbar : "工具列",
DlgLnkPopFullScrn : "全螢幕 (IE)",
DlgLnkPopDependent : "從屬 (NS)",
DlgLnkPopWidth : "寬",
DlgLnkPopHeight : "高",
DlgLnkPopLeft : "左",
DlgLnkPopTop : "右",
DlnLnkMsgNoUrl : "請輸入欲連結的 URL",
DlnLnkMsgNoEMail : "請輸入電子郵件位址",
DlnLnkMsgNoAnchor : "請選擇錨點",
// Color Dialog
DlgColorTitle : "請選擇顏色",
DlgColorBtnClear : "清除",
DlgColorHighlight : "預覽",
DlgColorSelected : "選擇",
// Smiley Dialog
DlgSmileyTitle : "插入表情符號",
// Special Character Dialog
DlgSpecialCharTitle : "請選擇特殊符號",
// Table Dialog
DlgTableTitle : "表格屬性",
DlgTableRows : "列數",
DlgTableColumns : "欄數",
DlgTableBorder : "邊框",
DlgTableAlign : "對齊",
DlgTableAlignNotSet : "<未設定>",
DlgTableAlignLeft : "靠左對齊",
DlgTableAlignCenter : "置中",
DlgTableAlignRight : "靠右對齊",
DlgTableWidth : "寬度",
DlgTableWidthPx : "像素",
DlgTableWidthPc : "百分比",
DlgTableHeight : "高度",
DlgTableCellSpace : "間距",
DlgTableCellPad : "內距",
DlgTableCaption : "標題",
DlgTableSummary : "摘要",
// Table Cell Dialog
DlgCellTitle : "儲存格屬性",
DlgCellWidth : "寬度",
DlgCellWidthPx : "像素",
DlgCellWidthPc : "百分比",
DlgCellHeight : "高度",
DlgCellWordWrap : "自動換行",
DlgCellWordWrapNotSet : "<尚未設定>",
DlgCellWordWrapYes : "是",
DlgCellWordWrapNo : "否",
DlgCellHorAlign : "水平對齊",
DlgCellHorAlignNotSet : "<尚未設定>",
DlgCellHorAlignLeft : "靠左對齊",
DlgCellHorAlignCenter : "置中",
DlgCellHorAlignRight: "靠右對齊",
DlgCellVerAlign : "垂直對齊",
DlgCellVerAlignNotSet : "<尚未設定>",
DlgCellVerAlignTop : "靠上對齊",
DlgCellVerAlignMiddle : "置中",
DlgCellVerAlignBottom : "靠下對齊",
DlgCellVerAlignBaseline : "基準線",
DlgCellRowSpan : "合併列數",
DlgCellCollSpan : "合併欄数",
DlgCellBackColor : "背景顏色",
DlgCellBorderColor : "邊框顏色",
DlgCellBtnSelect : "請選擇…",
// Find Dialog
DlgFindTitle : "尋找",
DlgFindFindBtn : "尋找",
DlgFindNotFoundMsg : "未找到指定的文字。",
// Replace Dialog
DlgReplaceTitle : "取代",
DlgReplaceFindLbl : "尋找:",
DlgReplaceReplaceLbl : "取代:",
DlgReplaceCaseChk : "大小寫須相符",
DlgReplaceReplaceBtn : "取代",
DlgReplaceReplAllBtn : "全部取代",
DlgReplaceWordChk : "全字相符",
// Paste Operations / Dialog
PasteErrorPaste : "瀏覽器的安全性設定不允許編輯器自動執行貼上動作。請使用快捷鍵 (Ctrl+V) 貼上。",
PasteErrorCut : "瀏覽器的安全性設定不允許編輯器自動執行剪下動作。請使用快捷鍵 (Ctrl+X) 剪下。",
PasteErrorCopy : "瀏覽器的安全性設定不允許編輯器自動執行複製動作。請使用快捷鍵 (Ctrl+C) 複製。",
PasteAsText : "貼為純文字格式",
PasteFromWord : "自 Word 貼上",
DlgPasteMsg2 : "請使用快捷鍵 (<strong>Ctrl+V</strong>) 貼到下方區域中並按下 <strong>確定</strong>",
DlgPasteIgnoreFont : "移除字型設定",
DlgPasteRemoveStyles : "移除樣式設定",
DlgPasteCleanBox : "清除文字區域",
// Color Picker
ColorAutomatic : "自動",
ColorMoreColors : "更多顏色…",
// Document Properties
DocProps : "文件屬性",
// Anchor Dialog
DlgAnchorTitle : "命名錨點",
DlgAnchorName : "錨點名稱",
DlgAnchorErrorName : "請輸入錨點名稱",
// Speller Pages Dialog
DlgSpellNotInDic : "不在字典中",
DlgSpellChangeTo : "更改為",
DlgSpellBtnIgnore : "忽略",
DlgSpellBtnIgnoreAll : "全部忽略",
DlgSpellBtnReplace : "取代",
DlgSpellBtnReplaceAll : "全部取代",
DlgSpellBtnUndo : "復原",
DlgSpellNoSuggestions : "- 無建議值 -",
DlgSpellProgress : "進行拼字檢查中…",
DlgSpellNoMispell : "拼字檢查完成:未發現拼字錯誤",
DlgSpellNoChanges : "拼字檢查完成:未更改任何單字",
DlgSpellOneChange : "拼字檢查完成:更改了 1 個單字",
DlgSpellManyChanges : "拼字檢查完成:更改了 %1 個單字",
IeSpellDownload : "尚未安裝拼字檢查元件。您是否想要現在下載?",
// Button Dialog
DlgButtonText : "顯示文字 (值)",
DlgButtonType : "類型",
// Checkbox and Radio Button Dialogs
DlgCheckboxName : "名稱",
DlgCheckboxValue : "選取值",
DlgCheckboxSelected : "已選取",
// Form Dialog
DlgFormName : "名稱",
DlgFormAction : "動作",
DlgFormMethod : "方法",
// Select Field Dialog
DlgSelectName : "名稱",
DlgSelectValue : "選取值",
DlgSelectSize : "大小",
DlgSelectLines : "行",
DlgSelectChkMulti : "可多選",
DlgSelectOpAvail : "可用選項",
DlgSelectOpText : "顯示文字",
DlgSelectOpValue : "值",
DlgSelectBtnAdd : "新增",
DlgSelectBtnModify : "修改",
DlgSelectBtnUp : "上移",
DlgSelectBtnDown : "下移",
DlgSelectBtnSetValue : "設為預設值",
DlgSelectBtnDelete : "刪除",
// Textarea Dialog
DlgTextareaName : "名稱",
DlgTextareaCols : "字元寬度",
DlgTextareaRows : "列數",
// Text Field Dialog
DlgTextName : "名稱",
DlgTextValue : "值",
DlgTextCharWidth : "字元寬度",
DlgTextMaxChars : "最多字元數",
DlgTextType : "類型",
DlgTextTypeText : "文字",
DlgTextTypePass : "密碼",
// Hidden Field Dialog
DlgHiddenName : "名稱",
DlgHiddenValue : "值",
// Bulleted List Dialog
BulletedListProp : "項目清單屬性",
NumberedListProp : "編號清單屬性",
DlgLstType : "清單類型",
DlgLstTypeCircle : "圓圈",
DlgLstTypeDisc : "圓點",
DlgLstTypeSquare : "方塊",
DlgLstTypeNumbers : "數字 (1, 2, 3)",
DlgLstTypeLCase : "小寫字母 (a, b, c)",
DlgLstTypeUCase : "大寫字母 (A, B, C)",
DlgLstTypeSRoman : "小寫羅馬數字 (i, ii, iii)",
DlgLstTypeLRoman : "大寫羅馬數字 (I, II, III)",
// Document Properties Dialog
DlgDocGeneralTab : "一般",
DlgDocBackTab : "背景",
DlgDocColorsTab : "顯色與邊界",
DlgDocMetaTab : "Meta 資料",
DlgDocPageTitle : "頁面標題",
DlgDocLangDir : "語言方向",
DlgDocLangDirLTR : "由左而右 (LTR)",
DlgDocLangDirRTL : "由右而左 (RTL)",
DlgDocLangCode : "語言代碼",
DlgDocCharSet : "字元編碼",
DlgDocCharSetOther : "其他字元編碼",
DlgDocDocType : "文件類型",
DlgDocDocTypeOther : "其他文件類型",
DlgDocIncXHTML : "包含 XHTML 定義",
DlgDocBgColor : "背景顏色",
DlgDocBgImage : "背景影像",
DlgDocBgNoScroll : "浮水印",
DlgDocCText : "文字",
DlgDocCLink : "超連結",
DlgDocCVisited : "已瀏覽過的超連結",
DlgDocCActive : "作用中的超連結",
DlgDocMargins : "頁面邊界",
DlgDocMaTop : "上",
DlgDocMaLeft : "左",
DlgDocMaRight : "右",
DlgDocMaBottom : "下",
DlgDocMeIndex : "文件索引關鍵字 (用半形逗號[,]分隔)",
DlgDocMeDescr : "文件說明",
DlgDocMeAuthor : "作者",
DlgDocMeCopy : "版權所有",
DlgDocPreview : "預覽",
// Templates Dialog
Templates : "樣版",
DlgTemplatesTitle : "內容樣版",
DlgTemplatesSelMsg : "請選擇欲開啟的樣版<br> (原有的內容將會被清除):",
DlgTemplatesLoading : "讀取樣版清單中,請稍候…",
DlgTemplatesNoTpl : "(無樣版)",
// About Dialog
DlgAboutAboutTab : "關於",
DlgAboutBrowserInfoTab : "瀏覽器資訊",
DlgAboutVersion : "版本",
DlgAboutLicense : "依據 GNU 較寬鬆公共許可證(LGPL)發佈",
DlgAboutInfo : "想獲得更多資訊請至 "
} | zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/lang/zh.js | JavaScript | asf20 | 15,831 |
<!--
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fck_link.html
* Link dialog window.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Link Properties</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex, nofollow" />
<script src="common/fck_dialog_common.js" type="text/javascript"></script>
<script src="fck_link/fck_link.js" type="text/javascript"></script>
</head>
<body scroll="no" style="OVERFLOW: hidden">
<div id="divInfo" style="DISPLAY: none">
<span fckLang="DlgLnkType">Link Type</span><br />
<select id="cmbLinkType" onchange="SetLinkType(this.value);">
<option value="url" fckLang="DlgLnkTypeURL" selected="selected">URL</option>
<option value="anchor" fckLang="DlgLnkTypeAnchor">Anchor in this page</option>
<option value="email" fckLang="DlgLnkTypeEMail">E-Mail</option>
</select>
<br />
<br />
<div id="divLinkTypeUrl">
<table cellspacing="0" cellpadding="0" width="100%" border="0" dir="ltr">
<tr>
<td nowrap="nowrap">
<span fckLang="DlgLnkProto">Protocol</span><br />
<select id="cmbLinkProtocol">
<option value="http://" selected="selected">http://</option>
<option value="https://">https://</option>
<option value="ftp://">ftp://</option>
<option value="news://">news://</option>
<option value="" fckLang="DlgLnkProtoOther"><other></option>
</select>
</td>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap" width="100%">
<span fckLang="DlgLnkURL">URL</span><br />
<input id="txtUrl" style="WIDTH: 100%" type="text" onkeyup="OnUrlChange();" onchange="OnUrlChange();" />
</td>
</tr>
</table>
<br />
<div id="divBrowseServer">
<input type="button" value="Browse Server" fckLang="DlgBtnBrowseServer" onclick="BrowseServer();" />
</div>
</div>
<div id="divLinkTypeAnchor" style="DISPLAY: none" align="center">
<div id="divSelAnchor" style="DISPLAY: none">
<table cellspacing="0" cellpadding="0" border="0" width="70%">
<tr>
<td colspan="3">
<span fckLang="DlgLnkAnchorSel">Select an Anchor</span>
</td>
</tr>
<tr>
<td width="50%">
<span fckLang="DlgLnkAnchorByName">By Anchor Name</span><br />
<select id="cmbAnchorName" onchange="GetE('cmbAnchorId').value='';" style="WIDTH: 100%">
<option value="" selected="selected"></option>
</select>
</td>
<td> </td>
<td width="50%">
<span fckLang="DlgLnkAnchorById">By Element Id</span><br />
<select id="cmbAnchorId" onchange="GetE('cmbAnchorName').value='';" style="WIDTH: 100%">
<option value="" selected="selected"></option>
</select>
</td>
</tr>
</table>
</div>
<div id="divNoAnchor" style="DISPLAY: none">
<span fckLang="DlgLnkNoAnchors"><No anchors available in the document></span>
</div>
</div>
<div id="divLinkTypeEMail" style="DISPLAY: none">
<span fckLang="DlgLnkEMail">E-Mail Address</span><br />
<input id="txtEMailAddress" style="WIDTH: 100%" type="text" /><br />
<span fckLang="DlgLnkEMailSubject">Message Subject</span><br />
<input id="txtEMailSubject" style="WIDTH: 100%" type="text" /><br />
<span fckLang="DlgLnkEMailBody">Message Body</span><br />
<textarea id="txtEMailBody" style="WIDTH: 100%" rows="3" cols="20"></textarea>
</div>
</div>
<div id="divUpload" style="DISPLAY: none">
<form id="frmUpload" method="post" target="UploadWindow" enctype="multipart/form-data" action="" onsubmit="return CheckUpload();">
<span fckLang="DlgLnkUpload">Upload</span><br />
<input id="txtUploadFile" style="WIDTH: 100%" type="file" size="40" name="NewFile" /><br />
<br />
<input id="btnUpload" type="submit" value="Send it to the Server" fckLang="DlgLnkBtnUpload" />
<iframe name="UploadWindow" style="DISPLAY: none" src="../fckblank.html"></iframe>
</form>
</div>
<div id="divTarget" style="DISPLAY: none">
<table cellspacing="0" cellpadding="0" width="100%" border="0">
<tr>
<td nowrap="nowrap">
<span fckLang="DlgLnkTarget">Target</span><br />
<select id="cmbTarget" onchange="SetTarget(this.value);">
<option value="" fckLang="DlgGenNotSet" selected="selected"><not set></option>
<option value="frame" fckLang="DlgLnkTargetFrame"><frame></option>
<option value="popup" fckLang="DlgLnkTargetPopup"><popup window></option>
<option value="_blank" fckLang="DlgLnkTargetBlank">New Window (_blank)</option>
<option value="_top" fckLang="DlgLnkTargetTop">Topmost Window (_top)</option>
<option value="_self" fckLang="DlgLnkTargetSelf">Same Window (_self)</option>
<option value="_parent" fckLang="DlgLnkTargetParent">Parent Window (_parent)</option>
</select>
</td>
<td> </td>
<td id="tdTargetFrame" nowrap="nowrap" width="100%">
<span fckLang="DlgLnkTargetFrameName">Target Frame Name</span><br />
<input id="txtTargetFrame" style="WIDTH: 100%" type="text" onkeyup="OnTargetNameChange();"
onchange="OnTargetNameChange();" />
</td>
<td id="tdPopupName" style="DISPLAY: none" nowrap="nowrap" width="100%">
<span fckLang="DlgLnkPopWinName">Popup Window Name</span><br />
<input id="txtPopupName" style="WIDTH: 100%" type="text" />
</td>
</tr>
</table>
<br />
<table id="tablePopupFeatures" style="DISPLAY: none" cellspacing="0" cellpadding="0" align="center"
border="0">
<tr>
<td>
<span fckLang="DlgLnkPopWinFeat">Popup Window Features</span><br />
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td valign="top" nowrap="nowrap" width="50%">
<input id="chkPopupResizable" name="chkFeature" value="resizable" type="checkbox" /><label for="chkPopupResizable" fckLang="DlgLnkPopResize">Resizable</label><br />
<input id="chkPopupLocationBar" name="chkFeature" value="location" type="checkbox" /><label for="chkPopupLocationBar" fckLang="DlgLnkPopLocation">Location
Bar</label><br />
<input id="chkPopupManuBar" name="chkFeature" value="menubar" type="checkbox" /><label for="chkPopupManuBar" fckLang="DlgLnkPopMenu">Menu
Bar</label><br />
<input id="chkPopupScrollBars" name="chkFeature" value="scrollbars" type="checkbox" /><label for="chkPopupScrollBars" fckLang="DlgLnkPopScroll">Scroll
Bars</label>
</td>
<td></td>
<td valign="top" nowrap="nowrap" width="50%">
<input id="chkPopupStatusBar" name="chkFeature" value="status" type="checkbox" /><label for="chkPopupStatusBar" fckLang="DlgLnkPopStatus">Status
Bar</label><br />
<input id="chkPopupToolbar" name="chkFeature" value="toolbar" type="checkbox" /><label for="chkPopupToolbar" fckLang="DlgLnkPopToolbar">Toolbar</label><br />
<input id="chkPopupFullScreen" name="chkFeature" value="fullscreen" type="checkbox" /><label for="chkPopupFullScreen" fckLang="DlgLnkPopFullScrn">Full
Screen (IE)</label><br />
<input id="chkPopupDependent" name="chkFeature" value="dependent" type="checkbox" /><label for="chkPopupDependent" fckLang="DlgLnkPopDependent">Dependent
(Netscape)</label>
</td>
</tr>
<tr>
<td valign="top" nowrap="nowrap" width="50%"> </td>
<td></td>
<td valign="top" nowrap="nowrap" width="50%"></td>
</tr>
<tr>
<td valign="top">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td nowrap="nowrap"><span fckLang="DlgLnkPopWidth">Width</span></td>
<td> <input id="txtPopupWidth" type="text" maxlength="4" size="4" /></td>
</tr>
<tr>
<td nowrap="nowrap"><span fckLang="DlgLnkPopHeight">Height</span></td>
<td> <input id="txtPopupHeight" type="text" maxlength="4" size="4" /></td>
</tr>
</table>
</td>
<td> </td>
<td valign="top">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td nowrap="nowrap"><span fckLang="DlgLnkPopLeft">Left Position</span></td>
<td> <input id="txtPopupLeft" type="text" maxlength="4" size="4" /></td>
</tr>
<tr>
<td nowrap="nowrap"><span fckLang="DlgLnkPopTop">Top Position</span></td>
<td> <input id="txtPopupTop" type="text" maxlength="4" size="4" /></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id="divAttribs" style="DISPLAY: none">
<table cellspacing="0" cellpadding="0" width="100%" align="center" border="0">
<tr>
<td valign="top" width="50%">
<span fckLang="DlgGenId">Id</span><br />
<input id="txtAttId" style="WIDTH: 100%" type="text" />
</td>
<td width="1"></td>
<td valign="top">
<table cellspacing="0" cellpadding="0" width="100%" align="center" border="0">
<tr>
<td width="60%">
<span fckLang="DlgGenLangDir">Language Direction</span><br />
<select id="cmbAttLangDir" style="WIDTH: 100%">
<option value="" fckLang="DlgGenNotSet" selected><not set></option>
<option value="ltr" fckLang="DlgGenLangDirLtr">Left to Right (LTR)</option>
<option value="rtl" fckLang="DlgGenLangDirRtl">Right to Left (RTL)</option>
</select>
</td>
<td width="1%"> </td>
<td nowrap="nowrap"><span fckLang="DlgGenAccessKey">Access Key</span><br />
<input id="txtAttAccessKey" style="WIDTH: 100%" type="text" maxlength="1" size="1" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<span fckLang="DlgGenName">Name</span><br />
<input id="txtAttName" style="WIDTH: 100%" type="text" />
</td>
<td width="1"></td>
<td valign="top">
<table cellspacing="0" cellpadding="0" width="100%" align="center" border="0">
<tr>
<td width="60%">
<span fckLang="DlgGenLangCode">Language Code</span><br />
<input id="txtAttLangCode" style="WIDTH: 100%" type="text" />
</td>
<td width="1%"> </td>
<td nowrap="nowrap">
<span fckLang="DlgGenTabIndex">Tab Index</span><br />
<input id="txtAttTabIndex" style="WIDTH: 100%" type="text" maxlength="5" size="5" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" width="50%"> </td>
<td width="1"></td>
<td valign="top"></td>
</tr>
<tr>
<td valign="top" width="50%">
<span fckLang="DlgGenTitle">Advisory Title</span><br />
<input id="txtAttTitle" style="WIDTH: 100%" type="text" />
</td>
<td width="1"> </td>
<td valign="top">
<span fckLang="DlgGenContType">Advisory Content Type</span><br />
<input id="txtAttContentType" style="WIDTH: 100%" type="text" />
</td>
</tr>
<tr>
<td valign="top">
<span fckLang="DlgGenClass">Stylesheet Classes</span><br />
<input id="txtAttClasses" style="WIDTH: 100%" type="text" />
</td>
<td></td>
<td valign="top">
<span fckLang="DlgGenLinkCharset">Linked Resource Charset</span><br />
<input id="txtAttCharSet" style="WIDTH: 100%" type="text" />
</td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" width="100%" align="center" border="0">
<tr>
<td>
<span fckLang="DlgGenStyle">Style</span><br />
<input id="txtAttStyle" style="WIDTH: 100%" type="text" />
</td>
</tr>
</table>
</div>
</body>
</html>
| zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/dialog/fck_link.html | HTML | asf20 | 12,671 |
<?php
require_once(dirname(__FILE__)."/../../../dialoguser/config.php");
require_once(dirname(__FILE__)."/../../../inc_photograph.php");
if(empty($dopost)) $dopost="";
if(empty($imgwidthValue)) $imgwidthValue=400;
if(empty($imgheightValue)) $imgheightValue=300;
if(empty($urlValue)) $urlValue="";
if(empty($imgsrcValue)) $imgsrcValue="";
if(empty($imgurl)) $imgurl="";
if(empty($dd)) $dd="";
if($dopost=="upload")
{
if(empty($imgfile)) $imgfile="";
if(!is_uploaded_file($imgfile)){
ShowMsg("你没有选择上传的文件!","-1");
exit();
}
if($imgfile_size > $cfg_mb_upload_size*1024){
@unlink(is_uploaded_file($imgfile));
ShowMsg("你上传的文件超过了{$cfg_mb_upload_size}K,不允许上传!","-1");
exit();
}
if(!eregi("\.(jpg|gif|png|bmp)$",$imgfile_name)){
ShowMsg("你所上传的文件类型被禁止!","-1");
exit();
}
CheckUserSpace($cfg_ml->M_ID);
$sparr = Array("image/pjpeg","image/jpeg","image/gif","image/png","image/x-png","image/wbmp");
$imgfile_type = strtolower(trim($imgfile_type));
if(!in_array($imgfile_type,$sparr)){
ShowMsg("上传的图片格式错误,请使用JPEG、GIF、PNG、WBMP格式的其中一种!","-1");
exit();
}
if($imgfile_type=='image/pjpeg'||$imgfile_type=='image/jpeg'){
$sname = '.jpg';
}else if($imgfile_type=='image/gif'){
$sname = '.gif';
}else if($imgfile_type=='image/png'){
$sname = '.png';
}else if($imgfile_type=='image/wbmp'){
$sname = '.bmp';
}else{
$sname = '.jpg';
}
$nowtime = time();
$savepath = $cfg_user_dir."/".$cfg_ml->M_ID;
CreateDir($savepath);
CloseFtp();
$rndname = dd2char($cfg_ml->M_ID."0".strftime("%y%m%d%H%M%S",$nowtme)."0".mt_rand(1000,9999));
$filename = $savepath."/".$rndname;
$rndname = $rndname.$sname; //仅作注解用
//大小图URL
$bfilename = $filename.$sname;
$litfilename = $filename."_lit".$sname;
//大小图真实地址
$fullfilename = $cfg_basedir.$bfilename;
$full_litfilename = $cfg_basedir.$litfilename;
if(file_exists($fullfilename)){
ShowMsg("本目录已经存在同名的文件,请重试!","-1");
exit();
}
//严格检查最终的文件名
if(eregi("\.(php|asp|pl|shtml|jsp|cgi|aspx)",$fullfilename)){
ShowMsg("你所上传的文件类型被禁止,系统只允许上传<br>".$cfg_mb_mediatype." 类型附件!","-1");
exit();
}
@move_uploaded_file($imgfile,$fullfilename);
$dsql = new DedeSql(false);
if($dd=="yes")
{
copy($fullfilename,$full_litfilename);
if(in_array($imgfile_type,$cfg_photo_typenames)) ImageResize($full_litfilename,$w,$h);
$urlValue = $bfilename;
$imgsrcValue = $litfilename;
$info = "";
$sizes = getimagesize($full_litfilename,$info);
$imgwidthValue = $sizes[0];
$imgheightValue = $sizes[1];
$imgsize = filesize($full_litfilename);
$inquery = "
INSERT INTO #@__uploads(title,url,mediatype,width,height,playtime,filesize,uptime,adminid,memberid)
VALUES ('对话框上传 {$rndname} 的小图','$imgsrcValue','1','$imgwidthValue','$imgheightValue','0','{$imgsize}','{$nowtime}','0','".$cfg_ml->M_ID."');
";
$dsql->ExecuteNoneQuery($inquery);
}else{
$imgsrcValue = $bfilename;
$urlValue = $bfilename;
$info = "";
$sizes = getimagesize($fullfilename,$info);
$imgwidthValue = $sizes[0];
$imgheightValue = $sizes[1];
$imgsize = filesize($fullfilename);
}
$info = '';
$bsizes = getimagesize($fullfilename,$info);
$bimgwidthValue = $bsizes[0];
$bimgheightValue = $bsizes[1];
$bimgsize = filesize($fullfilename);
$inquery = "
INSERT INTO #@__uploads(title,url,mediatype,width,height,playtime,filesize,uptime,adminid,memberid)
VALUES ('对话框上传的图片','$bfilename','1','$bimgwidthValue','$bimgheightValue','0','{$bimgsize}','{$nowtime}','0','".$cfg_ml->M_ID."');
";
$dsql->ExecuteNoneQuery($inquery);
$dsql->Close();
if(in_array($imgfile_type,$cfg_photo_typenames) &&( $imgfile_type!='image/gif' || $cfg_gif_wartermark=='Y')) WaterImg($fullfilename,'up');
$kkkimg = $urlValue;
}
if(empty($kkkimg)) $kkkimg="picview.gif";
if(!eregi("^http:",$imgsrcValue)){
$imgsrcValue = ereg_replace("/{1,}",'/',$imgsrcValue);
$urlValue = ereg_replace("/{1,}",'/',$urlValue);
}
?>
<HTML>
<HEAD>
<title>插入图片</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
td{font-size:10pt;}
</style>
<script language=javascript>
var oEditor = window.parent.InnerDialogLoaded() ;
var oDOM = oEditor.FCK.EditorDocument ;
var FCK = oEditor.FCK;
function ImageOK()
{
var inImg,ialign,iurl,imgwidth,imgheight,ialt,isrc,iborder;
ialign = document.form1.ialign.value;
iborder = document.form1.border.value;
imgwidth = document.form1.imgwidth.value;
imgheight = document.form1.imgheight.value;
ialt = document.form1.alt.value;
isrc = document.form1.imgsrc.value;
iurl = document.form1.url.value;
if(ialign!=0) ialign = " align='"+ialign+"'";
inImg = "<img src='"+ isrc +"' width='"+ imgwidth;
inImg += "' height='"+ imgheight +"' border='"+ iborder +"' alt='"+ ialt +"'"+ialign+"/>";
if(iurl!="") inImg = "<a href='"+ iurl +"' target='_blank'>"+ inImg +"</a>\r\n";
if(document.all) oDOM.selection.createRange().pasteHTML(inImg);
else FCK.InsertHtml(inImg);
window.close();
}
function SelectMedia(fname)
{
var posLeft = 150;
var posTop = 100;
window.open("../../../dialoguser/select_images.php?f="+fname+"&imgstick=big", "popUpImgWin", "scrollbars=yes,resizable=yes,statebar=no,width=600,height=450,left="+posLeft+", top="+posTop);
}
function SeePic(imgid,fobj)
{
if(!fobj) return;
if(fobj.value != "" && fobj.value != null)
{
var cimg = document.getElementById(imgid);
if(cimg) cimg.src = fobj.value;
}
}
function UpdateImageInfo()
{
var imgsrc = document.form1.imgsrc.value;
if(imgsrc!="")
{
var imgObj = new Image();
imgObj.src = imgsrc;
document.form1.himgheight.value = imgObj.height;
document.form1.himgwidth.value = imgObj.width;
document.form1.imgheight.value = imgObj.height;
document.form1.imgwidth.value = imgObj.width;
}
}
function UpImgSizeH()
{
var ih = document.form1.himgheight.value;
var iw = document.form1.himgwidth.value;
var iih = document.form1.imgheight.value;
var iiw = document.form1.imgwidth.value;
if(ih!=iih && iih>0 && ih>0 && document.form1.autoresize.checked)
{
document.form1.imgwidth.value = Math.ceil(iiw * (iih/ih));
}
}
function UpImgSizeW()
{
var ih = document.form1.himgheight.value;
var iw = document.form1.himgwidth.value;
var iih = document.form1.imgheight.value;
var iiw = document.form1.imgwidth.value;
if(iw!=iiw && iiw>0 && iw>0 && document.form1.autoresize.checked)
{
document.form1.imgheight.value = Math.ceil(iih * (iiw/iw));
}
}
</script>
<link href="base.css" rel="stylesheet" type="text/css">
<base target="_self">
</HEAD>
<body bgcolor="#EBF6CD" leftmargin="4" topmargin="2">
<form enctype="multipart/form-data" name="form1" id="form1" method="post">
<input type="hidden" name="dopost" value="upload">
<input type="hidden" name="himgheight" value="<?php echo $imgheightValue?>">
<input type="hidden" name="himgwidth" value="<?php echo $imgwidthValue?>">
<table width="100%" border="0">
<tr height="20">
<td colspan="3">
<fieldset>
<legend>图片属性</legend>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="65" height="25" align="right">网址:</td>
<td colspan="2">
<input name="imgsrc" type="text" id="imgsrc" size="30" onChange="SeePic('picview',this);" value="<?php echo $imgsrcValue?>">
<input onClick="SelectMedia('form1.imgsrc');" type="button" name="selimg" value=" 浏览... " class="binput" style="width:80">
</td>
</tr>
<tr>
<td height="25" align="right">宽度:</td>
<td colspan="2" nowrap>
<input type="text" id="imgwidth" name="imgwidth" size="8" value="<?php echo $imgwidthValue?>" onChange="UpImgSizeW()">
高度:
<input name="imgheight" type="text" id="imgheight" size="8" value="<?php echo $imgheightValue?>" onChange="UpImgSizeH()">
<input type="button" name="Submit" value="原始" class="binput" style="width:40" onclick="UpdateImageInfo()">
<input name="autoresize" type="checkbox" id="autoresize" value="1" checked>
自适应</td>
</tr>
<tr>
<td height="25" align="right">边框:</td>
<td colspan="2" nowrap><input name="border" type="text" id="border" size="4" value="0">
替代文字:
<input name="alt" type="text" id="alt" size="10"></td>
</tr>
<tr>
<td height="25" align="right">链接:</td>
<td width="166" nowrap><input name="url" type="text" id="url" size="30" value="<?php echo $urlValue?>"></td>
<td width="155" align="center" nowrap> </td>
</tr>
<tr>
<td height="25" align="right">对齐:</td>
<td nowrap><select name="ialign" id="ialign">
<option value="0" selected>默认</option>
<option value="right">右对齐</option>
<option value="center">中间</option>
<option value="left">左对齐</option>
<option value="top">顶端</option>
<option value="bottom">底部</option>
</select></td>
<td align="right" nowrap>
<input onClick="ImageOK();" type="button" name="Submit2" value=" 确定 " class="binput">
</td>
</tr>
</table>
</fieldset>
</td>
</tr>
<tr height="25">
<td colspan="3" nowrap> <fieldset>
<legend>上传新图片</legend>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr height="30">
<td align="right" nowrap> 新图片:</td>
<td colspan="2" nowrap><input name="imgfile" type="file" id="imgfile" onChange="SeePic('picview',this);" style="height:22" class="binput">
<input type="submit" name="picSubmit" id="picSubmit" value=" 上 传 " style="height:22" class="binput"></td>
</tr>
<tr height="30">
<td align="right" nowrap> 选 项:</td>
<td colspan="2" nowrap>
<input type="checkbox" name="dd" value="yes">生成缩略图
缩略图宽度
<input name="w" type="text" value="<?php echo $cfg_ddimg_width?>" size="3">
缩略图高度
<input name="h" type="text" value="<?php echo $cfg_ddimg_height?>" size="3">
</td>
</tr>
</table>
</fieldset></td>
</tr>
<tr height="50">
<td height="140" align="right" nowrap>预览区:</td>
<td height="140" colspan="2" nowrap>
<table width="150" height="120" border="0" cellpadding="1" cellspacing="1">
<tr>
<td align="center"><img name="picview" id="picview" src="<?php echo $kkkimg?>" width="160" height="120" alt="预览图片"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</HTML>
| zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/dialog/imageuser.php | PHP | asf20 | 11,570 |
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fck_select.js
* Scripts for the fck_select.html page.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
function Select( combo )
{
var iIndex = combo.selectedIndex ;
oListText.selectedIndex = iIndex ;
oListValue.selectedIndex = iIndex ;
var oTxtText = document.getElementById( "txtText" ) ;
var oTxtValue = document.getElementById( "txtValue" ) ;
oTxtText.value = oListText.value ;
oTxtValue.value = oListValue.value ;
}
function Add()
{
var oTxtText = document.getElementById( "txtText" ) ;
var oTxtValue = document.getElementById( "txtValue" ) ;
AddComboOption( oListText, oTxtText.value, oTxtText.value ) ;
AddComboOption( oListValue, oTxtValue.value, oTxtValue.value ) ;
oListText.selectedIndex = oListText.options.length - 1 ;
oListValue.selectedIndex = oListValue.options.length - 1 ;
oTxtText.value = '' ;
oTxtValue.value = '' ;
oTxtText.focus() ;
}
function Modify()
{
var iIndex = oListText.selectedIndex ;
if ( iIndex < 0 ) return ;
var oTxtText = document.getElementById( "txtText" ) ;
var oTxtValue = document.getElementById( "txtValue" ) ;
oListText.options[ iIndex ].innerHTML = oTxtText.value ;
oListText.options[ iIndex ].value = oTxtText.value ;
oListValue.options[ iIndex ].innerHTML = oTxtValue.value ;
oListValue.options[ iIndex ].value = oTxtValue.value ;
oTxtText.value = '' ;
oTxtValue.value = '' ;
oTxtText.focus() ;
}
function Move( steps )
{
ChangeOptionPosition( oListText, steps ) ;
ChangeOptionPosition( oListValue, steps ) ;
}
function Delete()
{
RemoveSelectedOptions( oListText ) ;
RemoveSelectedOptions( oListValue ) ;
}
function SetSelectedValue()
{
var iIndex = oListValue.selectedIndex ;
if ( iIndex < 0 ) return ;
var oTxtValue = document.getElementById( "txtSelValue" ) ;
oTxtValue.value = oListValue.options[ iIndex ].value ;
}
// Moves the selected option by a number of steps (also negative)
function ChangeOptionPosition( combo, steps )
{
var iActualIndex = combo.selectedIndex ;
if ( iActualIndex < 0 )
return ;
var iFinalIndex = iActualIndex + steps ;
if ( iFinalIndex < 0 )
iFinalIndex = 0 ;
if ( iFinalIndex > ( combo.options.lenght - 1 ) )
iFinalIndex = combo.options.lenght - 1 ;
if ( iActualIndex == iFinalIndex )
return ;
var oOption = combo.options[ iActualIndex ] ;
var sText = oOption.innerHTML ;
var sValue = oOption.value ;
combo.remove( iActualIndex ) ;
oOption = AddComboOption( combo, sText, sValue, null, iFinalIndex ) ;
oOption.selected = true ;
}
// Remove all selected options from a SELECT object
function RemoveSelectedOptions(combo)
{
// Save the selected index
var iSelectedIndex = combo.selectedIndex ;
var oOptions = combo.options ;
// Remove all selected options
for ( var i = oOptions.length - 1 ; i >= 0 ; i-- )
{
if (oOptions[i].selected) combo.remove(i) ;
}
// Reset the selection based on the original selected index
if ( combo.options.length > 0 )
{
if ( iSelectedIndex >= combo.options.length ) iSelectedIndex = combo.options.length - 1 ;
combo.selectedIndex = iSelectedIndex ;
}
}
// Add a new option to a SELECT object (combo or list)
function AddComboOption( combo, optionText, optionValue, documentObject, index )
{
var oOption ;
if ( documentObject )
oOption = documentObject.createElement("OPTION") ;
else
oOption = document.createElement("OPTION") ;
if ( index != null )
combo.options.add( oOption, index ) ;
else
combo.options.add( oOption ) ;
oOption.innerHTML = optionText.length > 0 ? optionText : ' ' ;
oOption.value = optionValue ;
return oOption ;
} | zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/dialog/fck_select/fck_select.js | JavaScript | asf20 | 4,165 |
<!--
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fck_source.html
* Source editor dialog window.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title>Source</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow">
<link href="common/fck_dialog_common.css" rel="stylesheet" type="text/css" />
<script language="javascript">
var oEditor = window.parent.InnerDialogLoaded() ;
var FCK = oEditor.FCK ;
var FCKConfig = oEditor.FCKConfig ;
window.onload = function()
{
// EnableXHTML and EnableSourceXHTML has been deprecated
// document.getElementById('txtSource').value = ( FCKConfig.EnableXHTML && FCKConfig.EnableSourceXHTML ? FCK.GetXHTML( FCKConfig.FormatSource ) : FCK.GetHTML( FCKConfig.FormatSource ) ) ;
document.getElementById('txtSource').value = FCK.GetXHTML( FCKConfig.FormatSource ) ;
// Activate the "OK" button.
window.parent.SetOkButton( true ) ;
}
//#### The OK button was hit.
function Ok()
{
if ( oEditor.FCKBrowserInfo.IsIE )
oEditor.FCKUndo.SaveUndoStep() ;
FCK.SetHTML( document.getElementById('txtSource').value, false ) ;
return true ;
}
</script>
</head>
<body scroll="no" style="OVERFLOW: hidden">
<table width="100%" height="100%">
<tr>
<td height="100%"><textarea id="txtSource" dir="ltr" style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; FONT-SIZE: 14px; PADDING-BOTTOM: 5px; WIDTH: 100%; PADDING-TOP: 5px; FONT-FAMILY: Monospace; HEIGHT: 100%">Loading. Please wait...</textarea></td>
</tr>
</table>
</body>
</html>
| zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/dialog/fck_source.html | HTML | asf20 | 2,072 |
<!--
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fck_tablecell.html
* Cell properties dialog window.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title>Table Cell Properties</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex, nofollow" />
<script src="common/fck_dialog_common.js" type="text/javascript"></script>
<script type="text/javascript">
var oEditor = window.parent.InnerDialogLoaded() ;
// Gets the document DOM
var oDOM = oEditor.FCK.EditorDocument ;
// Array of selected Cells
var aCells = oEditor.FCKTableHandler.GetSelectedCells() ;
window.onload = function()
{
// First of all, translate the dialog box texts
oEditor.FCKLanguageManager.TranslatePage( document ) ;
SetStartupValue() ;
window.parent.SetOkButton( true ) ;
window.parent.SetAutoSize( true ) ;
}
function SetStartupValue()
{
if ( aCells.length > 0 )
{
var oCell = aCells[0] ;
var iWidth = GetAttribute( oCell, 'width' ) ;
if ( iWidth.indexOf && iWidth.indexOf( '%' ) >= 0 )
{
iWidth = iWidth.substr( 0, iWidth.length - 1 ) ;
GetE('selWidthType').value = 'percent' ;
}
if ( oCell.attributes['noWrap'] != null && oCell.attributes['noWrap'].specified )
GetE('selWordWrap').value = !oCell.noWrap ;
GetE('txtWidth').value = iWidth ;
GetE('txtHeight').value = GetAttribute( oCell, 'height' ) ;
GetE('selHAlign').value = GetAttribute( oCell, 'align' ) ;
GetE('selVAlign').value = GetAttribute( oCell, 'vAlign' ) ;
GetE('txtRowSpan').value = GetAttribute( oCell, 'rowSpan' ) ;
GetE('txtCollSpan').value = GetAttribute( oCell, 'colSpan' ) ;
GetE('txtBackColor').value = GetAttribute( oCell, 'bgColor' ) ;
GetE('txtBorderColor').value = GetAttribute( oCell, 'borderColor' ) ;
// GetE('cmbFontStyle').value = oCell.className ;
}
}
// Fired when the user press the OK button
function Ok()
{
for( i = 0 ; i < aCells.length ; i++ )
{
if ( GetE('txtWidth').value.length > 0 )
aCells[i].width = GetE('txtWidth').value + ( GetE('selWidthType').value == 'percent' ? '%' : '') ;
else
aCells[i].removeAttribute( 'width', 0 ) ;
if ( GetE('selWordWrap').value == 'false' )
aCells[i].noWrap = true ;
else
aCells[i].removeAttribute( 'noWrap' ) ;
SetAttribute( aCells[i], 'height' , GetE('txtHeight').value ) ;
SetAttribute( aCells[i], 'align' , GetE('selHAlign').value ) ;
SetAttribute( aCells[i], 'vAlign' , GetE('selVAlign').value ) ;
SetAttribute( aCells[i], 'rowSpan' , GetE('txtRowSpan').value ) ;
SetAttribute( aCells[i], 'colSpan' , GetE('txtCollSpan').value ) ;
SetAttribute( aCells[i], 'bgColor' , GetE('txtBackColor').value ) ;
SetAttribute( aCells[i], 'borderColor' , GetE('txtBorderColor').value ) ;
// SetAttribute( aCells[i], 'className' , GetE('cmbFontStyle').value ) ;
}
return true ;
}
function SelectBackColor( color )
{
if ( color && color.length > 0 )
GetE('txtBackColor').value = color ;
}
function SelectBorderColor( color )
{
if ( color && color.length > 0 )
GetE('txtBorderColor').value = color ;
}
function SelectColor( wich )
{
oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', oEditor.FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 400, 330, wich == 'Back' ? SelectBackColor : SelectBorderColor, window ) ;
}
</script>
</head>
<body scroll="no" style="OVERFLOW: hidden">
<table cellSpacing="0" cellPadding="0" width="100%" border="0" height="100%">
<tr>
<td>
<table cellSpacing="1" cellPadding="1" width="100%" border="0">
<tr>
<td>
<table cellSpacing="0" cellPadding="0" border="0">
<tr>
<td nowrap><span fckLang="DlgCellWidth">Width</span>:</td>
<td> <input onkeypress="return IsDigit();" id="txtWidth" type="text" maxLength="4"
size="3" name="txtWidth"> <select id="selWidthType" name="selWidthType">
<option fckLang="DlgCellWidthPx" value="pixels" selected>pixels</option>
<option fckLang="DlgCellWidthPc" value="percent">percent</option>
</select></td>
</tr>
<tr>
<td nowrap><span fckLang="DlgCellHeight">Height</span>:</td>
<td> <INPUT id="txtHeight" type="text" maxLength="4" size="3" name="txtHeight" onkeypress="return IsDigit();"> <span fckLang="DlgCellWidthPx">pixels</span></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap><span fckLang="DlgCellWordWrap">Word Wrap</span>:</td>
<td> <select id="selWordWrap" name="selAlignment">
<option fckLang="DlgCellWordWrapNotSet" value="" selected><Not set></option>
<option fckLang="DlgCellWordWrapYes" value="true">Yes</option>
<option fckLang="DlgCellWordWrapNo" value="false">No</option>
</select></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap><span fckLang="DlgCellHorAlign">Horizontal Alignment</span>:</td>
<td> <select id="selHAlign" name="selAlignment">
<option fckLang="DlgCellHorAlignNotSet" value="" selected><Not set></option>
<option fckLang="DlgCellHorAlignLeft" value="left">Left</option>
<option fckLang="DlgCellHorAlignCenter" value="center">Center</option>
<option fckLang="DlgCellHorAlignRight" value="right">Right</option>
</select></td>
</tr>
<tr>
<td nowrap><span fckLang="DlgCellVerAlign">Vertival Alignement</span>:</td>
<td> <select id="selVAlign" name="selAlignment">
<option fckLang="DlgCellVerAlignNotSet" value="" selected><Not set></option>
<option fckLang="DlgCellVerAlignTop" value="top">Top</option>
<option fckLang="DlgCellVerAlignMiddle" value="middle">Middle</option>
<option fckLang="DlgCellVerAlignBottom" value="bottom">Bottom</option>
<option fckLang="DlgCellVerAlignBaseline" value="baseline">Baseline</option>
</select></td>
</tr>
</table>
</td>
<td> </td>
<td align="right">
<table cellSpacing="0" cellPadding="0" border="0">
<tr>
<td nowrap><span fckLang="DlgCellRowSpan">Rows Span</span>:</td>
<td> <input onkeypress="return IsDigit();" id="txtRowSpan" type="text" maxLength="3"
size="2" name="txtRows"></td>
<td></td>
</tr>
<tr>
<td nowrap><span fckLang="DlgCellCollSpan">Columns Span</span>:</td>
<td> <input onkeypress="return IsDigit();" id="txtCollSpan" type="text" maxLength="2"
size="2" name="txtColumns"></td>
<td></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td nowrap><span fckLang="DlgCellBackColor">Background Color</span>:</td>
<td> <input id="txtBackColor" type="text" size="8" name="txtCellSpacing"></td>
<td> <input type="button" fckLang="DlgCellBtnSelect" value="Select..." onclick="SelectColor( 'Back' )"></td>
</tr>
<tr>
<td nowrap><span fckLang="DlgCellBorderColor">Border Color</span>:</td>
<td> <input id="txtBorderColor" type="text" size="8" name="txtCellPadding"></td>
<td> <input type="button" fckLang="DlgCellBtnSelect" value="Select..." onclick="SelectColor( 'Border' )"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
| zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/dialog/fck_tablecell.html | HTML | asf20 | 8,383 |
<!--
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fck_specialchar.html
* Special Chars Selector dialog window.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<meta name="robots" content="noindex, nofollow">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
.Hand
{
cursor: pointer ;
cursor: hand ;
}
.Sample { font-size: 24px; }
</style>
<script type="text/javascript">
var oEditor = window.parent.InnerDialogLoaded() ;
var oSample ;
function insertChar(charValue)
{
oEditor.FCK.InsertHtml( charValue || "" ) ;
window.parent.Cancel() ;
}
function over(td)
{
oSample.innerHTML = td.innerHTML ;
td.className = 'LightBackground SpecialCharsOver Hand' ;
}
function out(td)
{
oSample.innerHTML = " " ;
td.className = 'DarkBackground SpecialCharsOut Hand' ;
}
function setDefaults()
{
// Gets the sample placeholder.
oSample = document.getElementById("SampleTD") ;
// First of all, translates the dialog box texts.
oEditor.FCKLanguageManager.TranslatePage(document) ;
}
</script>
</HEAD>
<BODY onload="setDefaults()" scroll="no">
<table cellpadding="0" cellspacing="0" width="100%" height="100%">
<tr>
<td width="100%">
<table cellpadding="1" cellspacing="1" align="center" border="0" width="100%" height="100%">
<script type="text/javascript">
var aChars = ["!",""","#","$","%","&","\\'","(",")","*","+","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~","€","‘","’","’","“","”","–","—","¡","¢","£","¤","¥","¦","§","¨","©","ª","«","¬","®","¯","°","±","²","³","´","µ","¶","·","¸","¹","º","»","¼","½","¾","¿","À","Á","Â","Ã","Ä","Å","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û","Ü","Ý","Þ","ß","à","á","â","ã","ä","å","æ","ç","è","é","ê","ë","ì","í","î","ï","ð","ñ","ò","ó","ô","õ","ö","÷","ø","ù","ú","û","ü","ü","ý","þ","ÿ","Œ","œ","‚","‛","„","…","™","►","•","→","⇒","⇔","♦","≈"] ;
var cols = 20 ;
var i = 0 ;
while (i < aChars.length)
{
document.write("<TR>") ;
for(var j = 0 ; j < cols ; j++)
{
if (aChars[i])
{
document.write('<TD width="1%" class="DarkBackground SpecialCharsOut Hand" align="center" onclick="insertChar(\'' + aChars[i].replace(/&/g, "&") + '\')" onmouseover="over(this)" onmouseout="out(this)">') ;
document.write(aChars[i]) ;
}
else
document.write("<TD class='DarkBackground SpecialCharsOut'> ") ;
document.write("<\/TD>") ;
i++ ;
}
document.write("<\/TR>") ;
}
</script>
</table>
</td>
<td nowrap> </td>
<td valign="top">
<table width="40" cellpadding="0" cellspacing="0" border="0">
<tr>
<td id="SampleTD" width="40" height="40" align="center" class="DarkBackground SpecialCharsOut Sample"> </td>
</tr>
</table>
</td>
</tr>
</table>
</BODY>
</HTML> | zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/dialog/fck_specialchar.html | HTML | asf20 | 4,419 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fck_document_preview.html
* Preview shown in the "Document Properties" dialog window.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
-->
<html>
<head>
<title>Document Properties - Preview</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow">
<script language="javascript">
var eBase = parent.FCK.EditorDocument.getElementsByTagName( 'BASE' ) ;
if ( eBase.length > 0 && eBase[0].href.length > 0 )
{
document.write( '<base href="' + eBase[0].href + '">' ) ;
}
window.onload = function()
{
if ( typeof( parent.OnPreviewLoad ) == 'function' )
parent.OnPreviewLoad( window, document.body ) ;
}
function SetBaseHRef( baseHref )
{
var eBase = document.createElement( 'BASE' ) ;
eBase.href = baseHref ;
var eHead = document.getElementsByTagName( 'HEAD' )[0] ;
eHead.appendChild( eBase ) ;
}
function SetLinkColor( color )
{
if ( color && color.length > 0 )
document.getElementById('eLink').style.color = color ;
else
document.getElementById('eLink').style.color = window.document.linkColor ;
}
function SetVisitedColor( color )
{
if ( color && color.length > 0 )
document.getElementById('eVisited').style.color = color ;
else
document.getElementById('eVisited').style.color = window.document.vlinkColor ;
}
function SetActiveColor( color )
{
if ( color && color.length > 0 )
document.getElementById('eActive').style.color = color ;
else
document.getElementById('eActive').style.color = window.document.alinkColor ;
}
</script>
</head>
<body>
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="center" valign="middle">
Normal Text
</td>
<td id="eLink" align="center" valign="middle">
<u>Link Text</u>
</td>
</tr>
<tr>
<td id="eVisited" valign="middle" align="center">
<u>Visited Link</u>
</td>
<td id="eActive" valign="middle" align="center">
<u>Active Link</u>
</td>
</tr>
</table>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</body>
</html>
| zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/dialog/fck_docprops/fck_document_preview.html | HTML | asf20 | 2,723 |
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fck_link.js
* Scripts related to the Link dialog window (see fck_link.html).
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
var oEditor = window.parent.InnerDialogLoaded() ;
var FCK = oEditor.FCK ;
var FCKLang = oEditor.FCKLang ;
var FCKConfig = oEditor.FCKConfig ;
//#### Dialog Tabs
// Set the dialog tabs.
window.parent.AddTab( 'Info', FCKLang.DlgLnkInfoTab ) ;
if ( !FCKConfig.LinkDlgHideTarget )
window.parent.AddTab( 'Target', FCKLang.DlgLnkTargetTab, true ) ;
if ( FCKConfig.LinkUpload )
window.parent.AddTab( 'Upload', FCKLang.DlgLnkUpload, true ) ;
if ( !FCKConfig.LinkDlgHideAdvanced )
window.parent.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ;
// Function called when a dialog tag is selected.
function OnDialogTabChange( tabCode )
{
ShowE('divInfo' , ( tabCode == 'Info' ) ) ;
ShowE('divTarget' , ( tabCode == 'Target' ) ) ;
ShowE('divUpload' , ( tabCode == 'Upload' ) ) ;
ShowE('divAttribs' , ( tabCode == 'Advanced' ) ) ;
}
//#### Regular Expressions library.
var oRegex = new Object() ;
oRegex.UriProtocol = new RegExp('') ;
oRegex.UriProtocol.compile( '^(((http|https|ftp|news):\/\/)|mailto:)', 'gi' ) ;
oRegex.UrlOnChangeProtocol = new RegExp('') ;
oRegex.UrlOnChangeProtocol.compile( '^(http|https|ftp|news)://(?=.)', 'gi' ) ;
oRegex.UrlOnChangeTestOther = new RegExp('') ;
//oRegex.UrlOnChangeTestOther.compile( '^(javascript:|#|/)', 'gi' ) ;
oRegex.UrlOnChangeTestOther.compile( '^((javascript:)|[#/\.])', 'gi' ) ;
oRegex.ReserveTarget = new RegExp('') ;
oRegex.ReserveTarget.compile( '^_(blank|self|top|parent)$', 'i' ) ;
oRegex.PopupUri = new RegExp('') ;
oRegex.PopupUri.compile( "^javascript:void\\(\\s*window.open\\(\\s*'([^']+)'\\s*,\\s*(?:'([^']*)'|null)\\s*,\\s*'([^']*)'\\s*\\)\\s*\\)\\s*$" ) ;
oRegex.PopupFeatures = new RegExp('') ;
oRegex.PopupFeatures.compile( '(?:^|,)([^=]+)=(\\d+|yes|no)', 'gi' ) ;
//#### Parser Functions
var oParser = new Object() ;
oParser.ParseEMailUrl = function( emailUrl )
{
// Initializes the EMailInfo object.
var oEMailInfo = new Object() ;
oEMailInfo.Address = '' ;
oEMailInfo.Subject = '' ;
oEMailInfo.Body = '' ;
var oParts = emailUrl.match( /^([^\?]+)\??(.+)?/ ) ;
if ( oParts )
{
// Set the e-mail address.
oEMailInfo.Address = oParts[1] ;
// Look for the optional e-mail parameters.
if ( oParts[2] )
{
var oMatch = oParts[2].match( /(^|&)subject=([^&]+)/i ) ;
if ( oMatch ) oEMailInfo.Subject = unescape( oMatch[2] ) ;
oMatch = oParts[2].match( /(^|&)body=([^&]+)/i ) ;
if ( oMatch ) oEMailInfo.Body = unescape( oMatch[2] ) ;
}
}
return oEMailInfo ;
}
oParser.CreateEMailUri = function( address, subject, body )
{
var sBaseUri = 'mailto:' + address ;
var sParams = '' ;
if ( subject.length > 0 )
sParams = '?subject=' + escape( subject ) ;
if ( body.length > 0 )
{
sParams += ( sParams.length == 0 ? '?' : '&' ) ;
sParams += 'body=' + escape( body ) ;
}
return sBaseUri + sParams ;
}
//#### Initialization Code
// oLink: The actual selected link in the editor.
var oLink = FCK.Selection.MoveToAncestorNode( 'A' ) ;
if ( oLink )
FCK.Selection.SelectNode( oLink ) ;
window.onload = function()
{
// Translate the dialog box texts.
oEditor.FCKLanguageManager.TranslatePage(document) ;
// Fill the Anchor Names and Ids combos.
LoadAnchorNamesAndIds() ;
// Load the selected link information (if any).
LoadSelection() ;
// Update the dialog box.
SetLinkType( GetE('cmbLinkType').value ) ;
// Show/Hide the "Browse Server" button.
GetE('divBrowseServer').style.display = FCKConfig.LinkBrowser ? '' : 'none' ;
// Show the initial dialog content.
GetE('divInfo').style.display = '' ;
// Set the actual uploader URL.
if ( FCKConfig.LinkUpload )
GetE('frmUpload').action = FCKConfig.LinkUploadURL ;
// Activate the "OK" button.
window.parent.SetOkButton( true ) ;
}
var bHasAnchors ;
function LoadAnchorNamesAndIds()
{
// Since version 2.0, the anchors are replaced in the DOM by IMGs so the user see the icon
// to edit them. So, we must look for that images now.
var aAnchors = new Array() ;
var oImages = oEditor.FCK.EditorDocument.getElementsByTagName( 'IMG' ) ;
for( var i = 0 ; i < oImages.length ; i++ )
{
if ( oImages[i].getAttribute('_fckanchor') )
aAnchors[ aAnchors.length ] = oEditor.FCK.GetRealElement( oImages[i] ) ;
}
var aIds = oEditor.FCKTools.GetAllChildrenIds( oEditor.FCK.EditorDocument.body ) ;
bHasAnchors = ( aAnchors.length > 0 || aIds.length > 0 ) ;
for ( var i = 0 ; i < aAnchors.length ; i++ )
{
var sName = aAnchors[i].name ;
if ( sName && sName.length > 0 )
oEditor.FCKTools.AddSelectOption( document, GetE('cmbAnchorName'), sName, sName ) ;
}
for ( var i = 0 ; i < aIds.length ; i++ )
{
oEditor.FCKTools.AddSelectOption( document, GetE('cmbAnchorId'), aIds[i], aIds[i] ) ;
}
ShowE( 'divSelAnchor' , bHasAnchors ) ;
ShowE( 'divNoAnchor' , !bHasAnchors ) ;
}
function LoadSelection()
{
if ( !oLink ) return ;
var sType = 'url' ;
// Get the actual Link href.
var sHRef = oLink.getAttribute( '_fcksavedurl' ) ;
if ( !sHRef || sHRef.length == 0 )
sHRef = oLink.getAttribute( 'href' , 2 ) + '' ;
// TODO: Wait stable version and remove the following commented lines.
// if ( sHRef.startsWith( FCK.BaseUrl ) )
// sHRef = sHRef.remove( 0, FCK.BaseUrl.length ) ;
// Look for a popup javascript link.
var oPopupMatch = oRegex.PopupUri.exec( sHRef ) ;
if( oPopupMatch )
{
GetE('cmbTarget').value = 'popup' ;
sHRef = oPopupMatch[1] ;
FillPopupFields( oPopupMatch[2], oPopupMatch[3] ) ;
SetTarget( 'popup' ) ;
}
// Search for the protocol.
var sProtocol = oRegex.UriProtocol.exec( sHRef ) ;
if ( sProtocol )
{
sProtocol = sProtocol[0].toLowerCase() ;
GetE('cmbLinkProtocol').value = sProtocol ;
// Remove the protocol and get the remainig URL.
var sUrl = sHRef.replace( oRegex.UriProtocol, '' ) ;
if ( sProtocol == 'mailto:' ) // It is an e-mail link.
{
sType = 'email' ;
var oEMailInfo = oParser.ParseEMailUrl( sUrl ) ;
GetE('txtEMailAddress').value = oEMailInfo.Address ;
GetE('txtEMailSubject').value = oEMailInfo.Subject ;
GetE('txtEMailBody').value = oEMailInfo.Body ;
}
else // It is a normal link.
{
sType = 'url' ;
GetE('txtUrl').value = sUrl ;
}
}
else if ( sHRef.substr(0,1) == '#' && sHRef.length > 1 ) // It is an anchor link.
{
sType = 'anchor' ;
GetE('cmbAnchorName').value = GetE('cmbAnchorId').value = sHRef.substr(1) ;
}
else // It is another type of link.
{
sType = 'url' ;
GetE('cmbLinkProtocol').value = '' ;
GetE('txtUrl').value = sHRef ;
}
if ( !oPopupMatch )
{
// Get the target.
var sTarget = oLink.target ;
if ( sTarget && sTarget.length > 0 )
{
if ( oRegex.ReserveTarget.test( sTarget ) )
{
sTarget = sTarget.toLowerCase() ;
GetE('cmbTarget').value = sTarget ;
}
else
GetE('cmbTarget').value = 'frame' ;
GetE('txtTargetFrame').value = sTarget ;
}
}
// Get Advances Attributes
GetE('txtAttId').value = oLink.id ;
GetE('txtAttName').value = oLink.name ;
GetE('cmbAttLangDir').value = oLink.dir ;
GetE('txtAttLangCode').value = oLink.lang ;
GetE('txtAttAccessKey').value = oLink.accessKey ;
GetE('txtAttTabIndex').value = oLink.tabIndex <= 0 ? '' : oLink.tabIndex ;
GetE('txtAttTitle').value = oLink.title ;
GetE('txtAttContentType').value = oLink.type ;
GetE('txtAttCharSet').value = oLink.charset ;
if ( oEditor.FCKBrowserInfo.IsIE )
{
GetE('txtAttClasses').value = oLink.getAttribute('className',2) || '' ;
GetE('txtAttStyle').value = oLink.style.cssText ;
}
else
{
GetE('txtAttClasses').value = oLink.getAttribute('class',2) || '' ;
GetE('txtAttStyle').value = oLink.getAttribute('style',2) ;
}
// Update the Link type combo.
GetE('cmbLinkType').value = sType ;
}
//#### Link type selection.
function SetLinkType( linkType )
{
ShowE('divLinkTypeUrl' , (linkType == 'url') ) ;
ShowE('divLinkTypeAnchor' , (linkType == 'anchor') ) ;
ShowE('divLinkTypeEMail' , (linkType == 'email') ) ;
if ( !FCKConfig.LinkDlgHideTarget )
window.parent.SetTabVisibility( 'Target' , (linkType == 'url') ) ;
if ( FCKConfig.LinkUpload )
window.parent.SetTabVisibility( 'Upload' , (linkType == 'url') ) ;
if ( !FCKConfig.LinkDlgHideAdvanced )
window.parent.SetTabVisibility( 'Advanced' , (linkType != 'anchor' || bHasAnchors) ) ;
if ( linkType == 'email' )
window.parent.SetAutoSize( true ) ;
}
//#### Target type selection.
function SetTarget( targetType )
{
GetE('tdTargetFrame').style.display = ( targetType == 'popup' ? 'none' : '' ) ;
GetE('tdPopupName').style.display =
GetE('tablePopupFeatures').style.display = ( targetType == 'popup' ? '' : 'none' ) ;
switch ( targetType )
{
case "_blank" :
case "_self" :
case "_parent" :
case "_top" :
GetE('txtTargetFrame').value = targetType ;
break ;
case "" :
GetE('txtTargetFrame').value = '' ;
break ;
}
if ( targetType == 'popup' )
window.parent.SetAutoSize( true ) ;
}
//#### Called while the user types the URL.
function OnUrlChange()
{
var sUrl = GetE('txtUrl').value ;
var sProtocol = oRegex.UrlOnChangeProtocol.exec( sUrl ) ;
if ( sProtocol )
{
sUrl = sUrl.substr( sProtocol[0].length ) ;
GetE('txtUrl').value = sUrl ;
GetE('cmbLinkProtocol').value = sProtocol[0].toLowerCase() ;
}
else if ( oRegex.UrlOnChangeTestOther.test( sUrl ) )
{
GetE('cmbLinkProtocol').value = '' ;
}
}
//#### Called while the user types the target name.
function OnTargetNameChange()
{
var sFrame = GetE('txtTargetFrame').value ;
if ( sFrame.length == 0 )
GetE('cmbTarget').value = '' ;
else if ( oRegex.ReserveTarget.test( sFrame ) )
GetE('cmbTarget').value = sFrame.toLowerCase() ;
else
GetE('cmbTarget').value = 'frame' ;
}
//#### Builds the javascript URI to open a popup to the specified URI.
function BuildPopupUri( uri )
{
var oReg = new RegExp( "'", "g" ) ;
var sWindowName = "'" + GetE('txtPopupName').value.replace(oReg, "\\'") + "'" ;
var sFeatures = '' ;
var aChkFeatures = document.getElementsByName('chkFeature') ;
for ( var i = 0 ; i < aChkFeatures.length ; i++ )
{
if ( i > 0 ) sFeatures += ',' ;
sFeatures += aChkFeatures[i].value + '=' + ( aChkFeatures[i].checked ? 'yes' : 'no' ) ;
}
if ( GetE('txtPopupWidth').value.length > 0 ) sFeatures += ',width=' + GetE('txtPopupWidth').value ;
if ( GetE('txtPopupHeight').value.length > 0 ) sFeatures += ',height=' + GetE('txtPopupHeight').value ;
if ( GetE('txtPopupLeft').value.length > 0 ) sFeatures += ',left=' + GetE('txtPopupLeft').value ;
if ( GetE('txtPopupTop').value.length > 0 ) sFeatures += ',top=' + GetE('txtPopupTop').value ;
return ( "javascript:void(window.open('" + uri + "'," + sWindowName + ",'" + sFeatures + "'))" ) ;
}
//#### Fills all Popup related fields.
function FillPopupFields( windowName, features )
{
if ( windowName )
GetE('txtPopupName').value = windowName ;
var oFeatures = new Object() ;
var oFeaturesMatch ;
while( ( oFeaturesMatch = oRegex.PopupFeatures.exec( features ) ) != null )
{
var sValue = oFeaturesMatch[2] ;
if ( sValue == ( 'yes' || '1' ) )
oFeatures[ oFeaturesMatch[1] ] = true ;
else if ( ! isNaN( sValue ) && sValue != 0 )
oFeatures[ oFeaturesMatch[1] ] = sValue ;
}
// Update all features check boxes.
var aChkFeatures = document.getElementsByName('chkFeature') ;
for ( var i = 0 ; i < aChkFeatures.length ; i++ )
{
if ( oFeatures[ aChkFeatures[i].value ] )
aChkFeatures[i].checked = true ;
}
// Update position and size text boxes.
if ( oFeatures['width'] ) GetE('txtPopupWidth').value = oFeatures['width'] ;
if ( oFeatures['height'] ) GetE('txtPopupHeight').value = oFeatures['height'] ;
if ( oFeatures['left'] ) GetE('txtPopupLeft').value = oFeatures['left'] ;
if ( oFeatures['top'] ) GetE('txtPopupTop').value = oFeatures['top'] ;
}
//#### The OK button was hit.
function Ok()
{
var sUri ;
switch ( GetE('cmbLinkType').value )
{
case 'url' :
sUri = GetE('txtUrl').value ;
if ( sUri.length == 0 )
{
alert( FCKLang.DlnLnkMsgNoUrl ) ;
return false ;
}
sUri = GetE('cmbLinkProtocol').value + sUri ;
if( GetE('cmbTarget').value == 'popup' )
sUri = BuildPopupUri( sUri ) ;
break ;
case 'email' :
sUri = GetE('txtEMailAddress').value ;
if ( sUri.length == 0 )
{
alert( FCKLang.DlnLnkMsgNoEMail ) ;
return false ;
}
sUri = oParser.CreateEMailUri(
sUri,
GetE('txtEMailSubject').value,
GetE('txtEMailBody').value ) ;
break ;
case 'anchor' :
var sAnchor = GetE('cmbAnchorName').value ;
if ( sAnchor.length == 0 ) sAnchor = GetE('cmbAnchorId').value ;
if ( sAnchor.length == 0 )
{
alert( FCKLang.DlnLnkMsgNoAnchor ) ;
return false ;
}
sUri = '#' + sAnchor ;
break ;
}
if ( oLink ) // Modifying an existent link.
{
oEditor.FCKUndo.SaveUndoStep() ;
oLink.href = sUri ;
}
else // Creating a new link.
{
oLink = oEditor.FCK.CreateLink( sUri ) ;
if ( ! oLink )
return true ;
}
SetAttribute( oLink, '_fcksavedurl', sUri ) ;
// Target
if( GetE('cmbTarget').value != 'popup' )
SetAttribute( oLink, 'target', GetE('txtTargetFrame').value ) ;
else
SetAttribute( oLink, 'target', null ) ;
// Advances Attributes
SetAttribute( oLink, 'id' , GetE('txtAttId').value ) ;
SetAttribute( oLink, 'name' , GetE('txtAttName').value ) ; // No IE. Set but doesnt't update the outerHTML.
SetAttribute( oLink, 'dir' , GetE('cmbAttLangDir').value ) ;
SetAttribute( oLink, 'lang' , GetE('txtAttLangCode').value ) ;
SetAttribute( oLink, 'accesskey', GetE('txtAttAccessKey').value ) ;
SetAttribute( oLink, 'tabindex' , ( GetE('txtAttTabIndex').value > 0 ? GetE('txtAttTabIndex').value : null ) ) ;
SetAttribute( oLink, 'title' , GetE('txtAttTitle').value ) ;
SetAttribute( oLink, 'type' , GetE('txtAttContentType').value ) ;
SetAttribute( oLink, 'charset' , GetE('txtAttCharSet').value ) ;
if ( oEditor.FCKBrowserInfo.IsIE )
{
SetAttribute( oLink, 'className', GetE('txtAttClasses').value ) ;
oLink.style.cssText = GetE('txtAttStyle').value ;
}
else
{
SetAttribute( oLink, 'class', GetE('txtAttClasses').value ) ;
SetAttribute( oLink, 'style', GetE('txtAttStyle').value ) ;
}
return true ;
}
function BrowseServer()
{
OpenFileBrowser( FCKConfig.LinkBrowserURL, FCKConfig.LinkBrowserWindowWidth, FCKConfig.LinkBrowserWindowHeight ) ;
}
function SetUrl( url )
{
document.getElementById('txtUrl').value = url ;
OnUrlChange() ;
window.parent.SetSelectedTab( 'Info' ) ;
}
function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg )
{
switch ( errorNumber )
{
case 0 : // No errors
alert( 'Your file has been successfully uploaded' ) ;
break ;
case 1 : // Custom error
alert( customMsg ) ;
return ;
case 101 : // Custom warning
alert( customMsg ) ;
break ;
case 201 :
alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ;
break ;
case 202 :
alert( 'Invalid file type' ) ;
return ;
case 203 :
alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ;
return ;
default :
alert( 'Error on file upload. Error number: ' + errorNumber ) ;
return ;
}
SetUrl( fileUrl ) ;
GetE('frmUpload').reset() ;
}
var oUploadAllowedExtRegex = new RegExp( FCKConfig.LinkUploadAllowedExtensions, 'i' ) ;
var oUploadDeniedExtRegex = new RegExp( FCKConfig.LinkUploadDeniedExtensions, 'i' ) ;
function CheckUpload()
{
var sFile = GetE('txtUploadFile').value ;
if ( sFile.length == 0 )
{
alert( 'Please select a file to upload' ) ;
return false ;
}
if ( ( FCKConfig.LinkUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) ||
( FCKConfig.LinkUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) )
{
OnUploadCompleted( 202 ) ;
return false ;
}
return true ;
} | zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/dialog/fck_link/fck_link.js | JavaScript | asf20 | 16,972 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fck_replace.html
* "Replace" dialog box window.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
* Abdul-Aziz A. Al-Oraij (aziz.oraij.com)
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta content="noindex, nofollow" name="robots">
<script type="text/javascript">
var oEditor = window.parent.InnerDialogLoaded() ;
function OnLoad()
{
// First of all, translate the dialog box texts
oEditor.FCKLanguageManager.TranslatePage( document ) ;
window.parent.SetAutoSize( true ) ;
oEditor.FCKUndo.SaveUndoStep() ;
}
function btnStat(frm)
{
document.getElementById('btnReplace').disabled =
document.getElementById('btnReplaceAll').disabled =
( document.getElementById('txtFind').value.length == 0 ) ;
}
function ReplaceTextNodes( parentNode, regex, replaceValue, replaceAll, hasFound )
{
for ( var i = 0 ; i < parentNode.childNodes.length ; i++ )
{
var oNode = parentNode.childNodes[i] ;
if ( oNode.nodeType == 3 )
{
var sReplaced = oNode.nodeValue.replace( regex, replaceValue ) ;
if ( oNode.nodeValue != sReplaced )
{
oNode.nodeValue = sReplaced ;
if ( ! replaceAll )
return true ;
hasFound = true ;
}
}
hasFound = ReplaceTextNodes( oNode, regex, replaceValue, replaceAll, hasFound ) ;
if ( ! replaceAll && hasFound )
return true ;
}
return hasFound ;
}
function GetRegexExpr()
{
if ( document.getElementById('chkWord').checked )
var sExpr = '\\b' + document.getElementById('txtFind').value + '\\b' ;
else
var sExpr = document.getElementById('txtFind').value ;
return sExpr ;
}
function GetCase()
{
return ( document.getElementById('chkCase').checked ? '' : 'i' ) ;
}
function Replace()
{
var oRegex = new RegExp( GetRegexExpr(), GetCase() ) ;
ReplaceTextNodes( oEditor.FCK.EditorDocument.body, oRegex, document.getElementById('txtReplace').value, false, false ) ;
}
function ReplaceAll()
{
var oRegex = new RegExp( GetRegexExpr(), GetCase() + 'g' ) ;
ReplaceTextNodes( oEditor.FCK.EditorDocument.body, oRegex, document.getElementById('txtReplace').value, true, false ) ;
window.parent.Cancel() ;
}
</script>
</head>
<body onload="OnLoad()" scroll="no" style="OVERFLOW: hidden">
<table cellSpacing="3" cellPadding="2" width="100%" border="0">
<tr>
<td noWrap><label for="txtFind" fckLang="DlgReplaceFindLbl">Find what:</label>
</td>
<td width="100%"><input id="txtFind" onkeyup="btnStat(this.form)" style="WIDTH: 100%" tabIndex="1" type="text">
</td>
<td><input id="btnReplace" style="WIDTH: 100%" disabled onclick="Replace();" type="button"
value="Replace" fckLang="DlgReplaceReplaceBtn">
</td>
</tr>
<tr>
<td vAlign="top" noWrap><label for="txtReplace" fckLang="DlgReplaceReplaceLbl">Replace
with:</label>
</td>
<td vAlign="top"><input id="txtReplace" style="WIDTH: 100%" tabIndex="2" type="text">
</td>
<td><input id="btnReplaceAll" disabled onclick="ReplaceAll()" type="button" value="Replace All"
fckLang="DlgReplaceReplAllBtn">
</td>
</tr>
<tr>
<td vAlign="bottom" colSpan="3"> <input id="chkCase" tabIndex="3" type="checkbox"><label for="chkCase" fckLang="DlgReplaceCaseChk">Match
case</label>
<br>
<input id="chkWord" tabIndex="4" type="checkbox"><label for="chkWord" fckLang="DlgReplaceWordChk">Match
whole word</label>
</td>
</tr>
</table>
</body>
</html>
| zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/dialog/fck_replace.html | HTML | asf20 | 4,050 |
td {font-size: 9pt;line-height: 1.5;}
a:link { font-size: 9pt; color: #000000; text-decoration: none }
a:visited{ font-size: 9pt; color: #000000; text-decoration: none }
a:hover {color: red;background-color:#C5E8A1}
.linerow{border-bottom: 1px solid #ACACAC;}
.coolbg {border-right: 2px solid #ACACAC; border-bottom: 2px solid #ACACAC; background-color: #E6E6E6}
.ll {border-right: 2px solid #ACACAC; border-bottom: 2px solid #ACACAC; background-color: #E6E6E6}
.pageborder{border-left: 1px solid #ACACAC;border-right: 1px solid #ACACAC;}
.bottomline{border-bottom: 1px solid #ACACAC;}.unnamed1 {
border: thin solid #000000;
}
.inputborder{border: 1px solid #000000;}
.lfborder{border: 1px solid #DDDDDD;}
.aaa{font-size:1pt;color:#EFEFEF;line-height:1%}
body {
font-size: 9pt;
line-height: 1.5;
scrollbar-base-color:#C0D586;
scrollbar-arrow-color:#FFFFFF;
scrollbar-shadow-color:DEEFC6
}
.bline {border-bottom: 1px solid #BCBCBC;background-color: #FFFFFF}
.bline2 {border-bottom: 1px solid #BCBCBC;}
.binput{
background-color:#E0FAAF;
border-bottom: 1px solid #C5CCB2;
border-right: 1px solid #C5CCB2;
} | zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/dialog/base.css | CSS | asf20 | 1,148 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fck_about.html
* "About" dialog window.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow">
<script src="common/fck_dialog_common.js" type="text/javascript"></script>
<script language="javascript">
var oEditor = window.parent.InnerDialogLoaded() ;
var FCKLang = oEditor.FCKLang ;
window.parent.AddTab( 'About', FCKLang.DlgAboutAboutTab ) ;
window.parent.AddTab( 'License', 'License' ) ;
window.parent.AddTab( 'BrowserInfo', FCKLang.DlgAboutBrowserInfoTab ) ;
// Function called when a dialog tag is selected.
function OnDialogTabChange( tabCode )
{
ShowE('divAbout', ( tabCode == 'About' ) ) ;
ShowE('divLicense', ( tabCode == 'License' ) ) ;
ShowE('divInfo' , ( tabCode == 'BrowserInfo' ) ) ;
}
function SendEMail()
{
var eMail = 'mailto:' ;
eMail += 'fredck' ;
eMail += '@' ;
eMail += 'fckeditor' ;
eMail += '.' ;
eMail += 'net' ;
window.location = eMail ;
}
window.onload = function()
{
// Translate the dialog box texts.
oEditor.FCKLanguageManager.TranslatePage(document) ;
window.parent.SetAutoSize( true ) ;
}
</script>
</head>
<body scroll="no" style="OVERFLOW: hidden">
<div id="divAbout">
<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
<tr>
<td>
<img alt="" src="fck_about/logo_fckeditor.gif" width="236" height="41" align="left">
<table width="80" border="0" cellspacing="0" cellpadding="5" bgcolor="#ffffff" align="right">
<tr>
<td align="center" style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid">
<span fckLang="DlgAboutVersion">version</span>
<br>
<b>2.2</b></td>
</tr>
</table>
</td>
</tr>
<tr height="100%">
<td align="center">
<br>
<span style="FONT-SIZE: 14px" dir="ltr">Support <b>Open Source</b> software.<br>
<b><a href="http://www.fckeditor.net/donate/?about" target="_blank" title="Click to go to the donation page">
What about a donation today?</a></b> </span>
<br><br><br>
<span fckLang="DlgAboutInfo">For further information go to</span> <a href="http://www.fckeditor.net/?About" target="_blank">
http://www.fckeditor.net/</a>.
<br>
Copyright © 2003-2005 <a href="#" onclick="SendEMail();">Frederico Caldeira
Knabben</a>
</td>
</tr>
<tr>
<td align="center">
<img alt="" src="fck_about/logo_fredck.gif" width="87" height="36">
</td>
</tr>
</table>
</div>
<div id="divLicense" style="DISPLAY: none">
<table height="100%" width="100%">
<tr>
<td>
<span fckLang="DlgAboutLicense">Licensed under the terms of the GNU Lesser General
Public License</span>
<br>
<a href="http://www.opensource.org/licenses/lgpl-license.php" target="_blank">http://www.opensource.org/licenses/lgpl-license.php</a>
<br>
</td>
</tr>
<tr>
<td height="100%">
<iframe height="100%" width="100%" src="fck_about/lgpl.html"></iframe>
</td>
</tr>
</table>
</div>
<div id="divInfo" style="DISPLAY: none" dir="ltr">
<table align="center" width="80%" border="0">
<tr>
<td>
<script language="javascript">
<!--
document.write( '<b>User Agent<\/b><br>' + window.navigator.userAgent + '<br><br>' ) ;
document.write( '<b>Browser<\/b><br>' + window.navigator.appName + ' ' + window.navigator.appVersion + '<br><br>' ) ;
document.write( '<b>Platform<\/b><br>' + window.navigator.platform + '<br><br>' ) ;
var sUserLang = '?' ;
if ( window.navigator.language )
sUserLang = window.navigator.language.toLowerCase() ;
else if ( window.navigator.userLanguage )
sUserLang = window.navigator.userLanguage.toLowerCase() ;
document.write( '<b>User Language<\/b><br>' + sUserLang ) ;
//-->
</script>
</td>
</tr>
</table>
</div>
</body>
</html>
| zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/dialog/fck_about.html | HTML | asf20 | 4,667 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<!--
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fck_listprop.html
* Bulleted List dialog window.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
-->
<html>
<head>
<title>Bulleted List Properties</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta content="noindex, nofollow" name="robots">
<script src="common/fck_dialog_common.js" type="text/javascript"></script>
<script type="text/javascript">
var oEditor = window.parent.InnerDialogLoaded() ;
// Gets the document DOM
var oDOM = oEditor.FCK.EditorDocument ;
var oActiveEl = oEditor.FCKSelection.MoveToAncestorNode( 'UL' ) ;
var oActiveSel ;
window.onload = function()
{
// First of all, translate the dialog box texts
oEditor.FCKLanguageManager.TranslatePage(document) ;
if ( oActiveEl )
oActiveSel = GetE('selBulleted') ;
else
{
oActiveEl = oEditor.FCKSelection.MoveToAncestorNode( 'OL' ) ;
if ( oActiveEl )
oActiveSel = GetE('selNumbered') ;
}
oActiveSel.style.display = '' ;
if ( oActiveEl )
{
if ( oActiveEl.getAttribute('type') )
oActiveSel.value = oActiveEl.getAttribute('type').toLowerCase() ;
}
window.parent.SetOkButton( true ) ;
}
function Ok()
{
if ( oActiveEl )
SetAttribute( oActiveEl, 'type' , oActiveSel.value ) ;
return true ;
}
</script>
</head>
<body style="OVERFLOW: hidden" scroll="no">
<table width="100%" height="100%">
<tr>
<td>
<table cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
<td>
<span fckLang="DlgLstType">List Type</span><br>
<select id="selBulleted" style="DISPLAY: none">
<option value="" selected></option>
<option value="circle" fckLang="DlgLstTypeCircle">Circle</option>
<option value="disc" fckLang="DlgLstTypeDisc">Disc</option>
<option value="square" fckLang="DlgLstTypeSquare">Square</option>
</select>
<select id="selNumbered" style="DISPLAY: none">
<option value="" selected></option>
<option value="1" fckLang="DlgLstTypeNumbers">Numbers (1, 2, 3)</option>
<option value="a" fckLang="DlgLstTypeLCase">Lowercase Letters (a, b, c)</option>
<option value="A" fckLang="DlgLstTypeUCase">Uppercase Letters (A, B, C)</option>
<option value="i" fckLang="DlgLstTypeSRoman">Small Roman Numerals (i, ii, iii)</option>
<option value="I" fckLang="DlgLstTypeLRoman">Large Roman Numerals (I, II, III)</option>
</select>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
| zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/dialog/fck_listprop.html | HTML | asf20 | 3,100 |
<HTML>
<HEAD>
<title>插入Flash</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
.td{font-size:10pt;}
</style>
<script language=javascript>
var oEditor = window.parent.InnerDialogLoaded() ;
var oDOM = oEditor.FCK.EditorDocument ;
var FCK = oEditor.FCK;
function TableOK(){
var furl,widthdd,heightdd,doflash;
furl = encodeURI(document.form1.furl.value);
widthdd = document.form1.fwidth.value;
heightdd = document.form1.fheight.value;
doflash = "<embed src='"+ furl +"' document.document.form1.='hight' wmode='transparent' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+ widthdd +"' height='"+ heightdd +"'></embed>\r\n";
if(document.all) oDOM.selection.createRange().pasteHTML(doflash);
else FCK.InsertHtml(doflash);
window.close();
}
function SelectMedia(fname)
{
if(document.all){
var posLeft = window.event.clientY-100;
var posTop = window.event.clientX-400;
}
else{
var posLeft = 100;
var posTop = 100;
}
window.open("../../../dialog/select_media.php?f="+fname, "popUpMediaWin", "scrollbars=yes,resizable=yes,statebar=no,width=500,height=350,left="+posLeft+", top="+posTop);
}
</script>
<link href="base.css" rel="stylesheet" type="text/css">
<base target="_self">
</HEAD>
<body bgcolor="#EBF6CD" topmargin="8">
<form name="form1" id="form1">
<table border="0" width="98%" align="center">
<tr>
<td align="right">网 址:</td>
<td colspan="3">
<input name="furl" type="text" id="furl" style="width:200px" value="http://">
<input type="button" name="selmedia" class="binput" style="width:60px" value="浏览..." onClick="SelectMedia('form1.furl')">
</td>
</tr>
<tr>
<td align="right">宽 度:</td>
<td nowrap colspan="3"> <input type="text" name="fwidth" id="fwidth" size="8" value="400" >
高 度:
<input name="fheight" type="text" id="fheight" value="300" size="8" ></td>
</tr>
<tr height="50">
<td align="right"> </td>
<td nowrap> </td>
<td colspan="2" align="right" nowrap>
<input onclick="TableOK();" type="button" name="Submit2" value=" 确定 " class="binput">
</td>
</tr>
</table>
</form>
</body>
</HTML>
| zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/dialog/flash.htm | HTML | asf20 | 2,401 |
<HTML>
<HEAD>
<title>插入多媒体</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
.td{font-size:10pt;}
</style>
<script language=javascript>
var oEditor = window.parent.InnerDialogLoaded() ;
var oDOM = oEditor.FCK.EditorDocument ;
var FCK = oEditor.FCK;
function TableOK(){
var rurl,rurlname,widthdd,heightdd,doflash,playtype;
rurl = encodeURI(form1.murl.value);
widthdd = form1.width.value;
heightdd = form1.height.value;
for(i=0;i<document.form1.mplayer.length;i++)
{
if(document.form1.mplayer[i].checked){
playtype = document.form1.mplayer[i].value;
}
}
if(playtype=="rm"
|| (playtype=="-" && (rurl.indexOf('.rm')>0 || rurl.indexOf('.rmvb')>0 || rurl.indexOf('.ram')>0)) )
{
revalue = "<embed src='"+ rurl +"' quality='hight' wmode='transparent' type='audio/x-pn-realaudio-plugin' autostart='true' controls='IMAGEWINDOW,ControlPanel,StatusBar' console='Clip1' width='"+ widthdd +"' height='"+ heightdd +"'></embed>\r\n";
}
else
{
revalue = "";
revalue += "<embed src='"+ rurl +"' align='baseline' border='0' width='"+ widthdd +"' height='"+ heightdd +"'";
revalue += " type='application/x-mplayer2' pluginspage='http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=media&sba=plugin&'";
revalue += " name='MediaPlayer' showcontrols='1' showpositioncontrols='0'";
revalue += " showaudiocontrols='1' showtracker='1' showdisplay='0' showstatusbar='1' autosize='0'";
revalue += " showgotobar='0' showcaptioning='0' autostart='1' autorewind='0'";
revalue += " animationatstart='0' transparentatstart='0' allowscan='1'";
revalue += " enablecontextmenu='1' clicktoplay='0' invokeurls='1' defaultframe='datawindow'>";
revalue += "</embed>\r\n";
}
if(document.all) oDOM.selection.createRange().pasteHTML(revalue);
else FCK.InsertHtml(revalue);
window.close();
}
function SelectMedia(fname)
{
if(document.all){
var posLeft = window.event.clientY-100;
var posTop = window.event.clientX-400;
}
else{
var posLeft = 100;
var posTop = 100;
}
window.open("../../../dialog/select_media.php?f="+fname, "popUpMediaWin", "scrollbars=yes,resizable=yes,statebar=no,width=500,height=350,left="+posLeft+", top="+posTop);
}
</script>
<link href="base.css" rel="stylesheet" type="text/css">
</HEAD>
<body leftmargin="0" topmargin="8" bgcolor="#EBF6CD">
<form name="form1" id="form1">
<table border="0" width="98%" align="center">
<tr height="30">
<td align="right">网 址:</td>
<td colspan="3" nowrap>
<input name="murl" type="text" id="murl" style="width:200px" value="http://">
<input type="button" name="selmedia" class="binput" style="width:60px" value="浏览..." onClick="SelectMedia('form1.murl')">
</td>
</tr>
<tr height="30">
<td align="right">宽 度:</td>
<td colspan="3" nowrap>
<input type="text" name="width" size="8" value="350" >
高 度:
<input name="height" type="text" id="height" value="68" size="8" >
</td>
</tr>
<tr height="30">
<td align="right">播放器:</td>
<td colspan="3" nowrap>
<input type='radio' name='mplayer' value='-' checked>
自动选择
<input type='radio' name='mplayer' value='rm'>
RealPlay
<input type='radio' name='mplayer' value='wm'>
WM Player
</td>
</tr>
<tr height="30">
<td align="right"> </td>
<td nowrap> </td>
<td colspan="2" align="right" nowrap>
<input onclick="TableOK();" type="button" name="Submit2" value=" 确定 " class="binput">
</td>
</tr>
</table>
</form>
</body>
</HTML>
| zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/dialog/media.htm | HTML | asf20 | 3,879 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fck_paste.html
* This dialog is shown when, for some reason (usually security settings),
* the user is not able to paste data from the clipboard to the editor using
* the toolbar buttons or the context menu.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow">
<script language="javascript">
var oEditor = window.parent.InnerDialogLoaded() ;
window.onload = function ()
{
// First of all, translate the dialog box texts
oEditor.FCKLanguageManager.TranslatePage(document) ;
if ( window.parent.dialogArguments.CustomValue == 'Word' )
{
var oFrame = document.getElementById('frmData')
oFrame.style.display = '' ;
if ( oFrame.contentDocument )
oFrame.contentDocument.designMode = 'on' ;
else
oFrame.contentWindow.document.body.contentEditable = true ;
}
else
{
document.getElementById('txtData').style.display = '' ;
document.getElementById('oWordCommands').style.display = 'none' ;
}
window.parent.SetOkButton( true ) ;
window.parent.SetAutoSize( true ) ;
}
function Ok()
{
var sHtml ;
if ( window.parent.dialogArguments.CustomValue == 'Word' )
{
var oFrame = document.getElementById('frmData') ;
if ( oFrame.contentDocument )
sHtml = oFrame.contentDocument.body.innerHTML ;
else
sHtml = oFrame.contentWindow.document.body.innerHTML ;
sHtml = CleanWord( sHtml ) ;
}
else
{
var sHtml = oEditor.FCKTools.HTMLEncode( document.getElementById('txtData').value ) ;
sHtml = sHtml.replace( /\n/g, '<BR>' ) ;
}
oEditor.FCK.InsertHtml( sHtml ) ;
return true ;
}
function CleanUpBox()
{
var oFrame = document.getElementById('frmData') ;
if ( oFrame.contentDocument )
oFrame.contentDocument.body.innerHTML = '' ;
else
oFrame.contentWindow.document.body.innerHTML = '' ;
}
function CleanWord( html )
{
var bIgnoreFont = document.getElementById('chkRemoveFont').checked ;
var bRemoveStyles = document.getElementById('chkRemoveStyles').checked ;
html = html.replace(/<o:p>\s*<\/o:p>/g, "") ;
html = html.replace(/<o:p>.*?<\/o:p>/g, " ") ;
// Remove mso-xxx styles.
html = html.replace( /\s*mso-[^:]+:[^;"]+;?/gi, "" ) ;
// Remove margin styles.
html = html.replace( /\s*MARGIN: 0cm 0cm 0pt\s*;/gi, "" ) ;
html = html.replace( /\s*MARGIN: 0cm 0cm 0pt\s*"/gi, "\"" ) ;
html = html.replace( /\s*TEXT-INDENT: 0cm\s*;/gi, "" ) ;
html = html.replace( /\s*TEXT-INDENT: 0cm\s*"/gi, "\"" ) ;
html = html.replace( /\s*TEXT-ALIGN: [^\s;]+;?"/gi, "\"" ) ;
html = html.replace( /\s*PAGE-BREAK-BEFORE: [^\s;]+;?"/gi, "\"" ) ;
html = html.replace( /\s*FONT-VARIANT: [^\s;]+;?"/gi, "\"" ) ;
html = html.replace( /\s*tab-stops:[^;"]*;?/gi, "" ) ;
html = html.replace( /\s*tab-stops:[^"]*/gi, "" ) ;
// Remove FONT face attributes.
if ( bIgnoreFont )
{
html = html.replace( /\s*face="[^"]*"/gi, "" ) ;
html = html.replace( /\s*face=[^ >]*/gi, "" ) ;
html = html.replace( /\s*FONT-FAMILY:[^;"]*;?/gi, "" ) ;
}
// Remove Class attributes
html = html.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3") ;
// Remove styles.
if ( bRemoveStyles )
html = html.replace( /<(\w[^>]*) style="([^\"]*)"([^>]*)/gi, "<$1$3" ) ;
// Remove empty styles.
html = html.replace( /\s*style="\s*"/gi, '' ) ;
html = html.replace( /<SPAN\s*[^>]*>\s* \s*<\/SPAN>/gi, ' ' ) ;
html = html.replace( /<SPAN\s*[^>]*><\/SPAN>/gi, '' ) ;
// Remove Lang attributes
html = html.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3") ;
html = html.replace( /<SPAN\s*>(.*?)<\/SPAN>/gi, '$1' ) ;
html = html.replace( /<FONT\s*>(.*?)<\/FONT>/gi, '$1' ) ;
// Remove XML elements and declarations
html = html.replace(/<\\?\?xml[^>]*>/gi, "") ;
// Remove Tags with XML namespace declarations: <o:p></o:p>
html = html.replace(/<\/?\w+:[^>]*>/gi, "") ;
html = html.replace( /<H\d>\s*<\/H\d>/gi, '' ) ;
html = html.replace( /<H1([^>]*)>/gi, '<div$1><b><font size="6">' ) ;
html = html.replace( /<H2([^>]*)>/gi, '<div$1><b><font size="5">' ) ;
html = html.replace( /<H3([^>]*)>/gi, '<div$1><b><font size="4">' ) ;
html = html.replace( /<H4([^>]*)>/gi, '<div$1><b><font size="3">' ) ;
html = html.replace( /<H5([^>]*)>/gi, '<div$1><b><font size="2">' ) ;
html = html.replace( /<H6([^>]*)>/gi, '<div$1><b><font size="1">' ) ;
html = html.replace( /<\/H\d>/gi, '</font></b></div>' ) ;
html = html.replace( /<(U|I|STRIKE)> <\/\1>/g, ' ' ) ;
// Remove empty tags (three times, just to be sure).
html = html.replace( /<([^\s>]+)[^>]*>\s*<\/\1>/g, '' ) ;
html = html.replace( /<([^\s>]+)[^>]*>\s*<\/\1>/g, '' ) ;
html = html.replace( /<([^\s>]+)[^>]*>\s*<\/\1>/g, '' ) ;
// Transform <P> to <DIV>
var re = new RegExp("(<P)([^>]*>.*?)(<\/P>)","gi") ; // Different because of a IE 5.0 error
html = html.replace( re, "<div$2</div>" ) ;
return html ;
}
</script>
</head>
<body scroll="no" style="OVERFLOW: hidden">
<table height="98%" cellspacing="0" cellpadding="0" width="100%" border="0">
<tr>
<td>
<span fckLang="DlgPasteMsg2">Please paste inside the following box using the
keyboard (<STRONG>Ctrl+V</STRONG>) and hit <STRONG>OK</STRONG>.</span>
<br>
</td>
</tr>
<tr>
<td valign="top" height="100%" style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid">
<textarea id="txtData" style="BORDER-RIGHT: #000000 1px; BORDER-TOP: #000000 1px; DISPLAY: none; BORDER-LEFT: #000000 1px; WIDTH: 99%; BORDER-BOTTOM: #000000 1px; HEIGHT: 98%"></textarea>
<iframe id="frmData" src="../fckblank.html" height="98%" width="99%" frameborder="no" style="BORDER-RIGHT: #000000 1px; BORDER-TOP: #000000 1px; DISPLAY: none; BORDER-LEFT: #000000 1px; BORDER-BOTTOM: #000000 1px; BACKGROUND-COLOR: #ffffff">
</iframe>
</td>
</tr>
<tr id="oWordCommands">
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td nowrap>
<input id="chkRemoveFont" type="checkbox" checked="checked"> <label for="chkRemoveFont" fckLang="DlgPasteIgnoreFont">
Ignore Font Face definitions</label>
<br>
<input id="chkRemoveStyles" type="checkbox"> <label for="chkRemoveStyles" fckLang="DlgPasteRemoveStyles">
Remove Styles definitions</label>
</td>
<td align="right" valign="top">
<input type="button" fckLang="DlgPasteCleanBox" value="Clean Up Box" onclick="CleanUpBox()">
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
| zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/dialog/fck_paste.html | HTML | asf20 | 7,356 |
<?php
require_once(dirname(__FILE__)."/../../../config_base.php");
?>
<HTML>
<HEAD>
<title>插入附件</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
.td{font-size:10pt;}
</style>
<script language=javascript>
var oEditor = window.parent.InnerDialogLoaded() ;
var oDOM = oEditor.FCK.EditorDocument ;
var FCK = oEditor.FCK;
function TableOK(){
var rurl,widthdd,heightdd,rvalue,rurlname;
rurlname = form1.rurl.value;
rurl = encodeURI(form1.rurl.value);
rvalue = "<table width='300'>";
rvalue += "<tr><td height='30' width='20'>";
rvalue += "<a href='"+rurl+"' target='_blank'><img src='<?php echo $cfg_plus_dir?>/img/addon.gif' border='0' align='center'></a>";
rvalue += "</td><td>";
rvalue += "<a href='"+ rurl +"' target='_blank'><u>"+ rurlname +"</u></a>";
rvalue += "</td></tr></table>";
if(document.all) oDOM.selection.createRange().pasteHTML(rvalue);
else FCK.InsertHtml(rvalue);
window.close();
}
function SelectAddon(fname)
{
if(document.all){
var posLeft = window.event.clientY-100;
var posTop = window.event.clientX-400;
}
else{
var posLeft = 100;
var posTop = 100;
}
window.open("../../../dialog/select_soft.php?f="+fname, "popUpSoftWin", "scrollbars=yes,resizable=yes,statebar=no,width=500,height=350,left="+posLeft+", top="+posTop);
}
</script>
<link href="base.css" rel="stylesheet" type="text/css">
</HEAD>
<body bgcolor="#EBF6CD" topmargin="8">
<form name="form1" id="form1">
<table border="0" width="98%" align="center">
<tr>
<td align="right">网 址:</td>
<td colspan="3">
<input name="rurl" type="text" id="rurl" style="width:300px" value="http://">
<input type="button" name="selmedia" class="binput" style="width:60px" value="浏览..." onClick="SelectAddon('form1.rurl')">
</td>
</tr>
<tr height="50">
<td align="right"> </td>
<td nowrap> </td>
<td colspan="2" align="right" nowrap>
<input onclick="TableOK();" type="button" name="Submit2" value=" 确定 " class="binput">
</td>
</tr>
</table>
</form>
</body>
</HTML>
| zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/dialog/addon.php | PHP | asf20 | 2,237 |
<?php
require_once(dirname(__FILE__)."/../../../dialog/config.php");
require_once(dirname(__FILE__)."/../../../inc_photograph.php");
if(empty($dopost)) $dopost="";
if(empty($imgwidthValue)) $imgwidthValue=400;
if(empty($imgheightValue)) $imgheightValue=300;
if(empty($urlValue)) $urlValue="";
if(empty($imgsrcValue)) $imgsrcValue="";
if(empty($imgurl)) $imgurl="";
if(empty($dd)) $dd="";
if($dopost=="upload")
{
if(empty($imgfile)) $imgfile="";
if(!is_uploaded_file($imgfile)){
ShowMsg("你没有选择上传的文件!","-1");
exit();
}
if(ereg("^text",$imgfile_type)){
ShowMsg("不允许文本类型附件!","-1");
exit();
}
if(!eregi("\.(jpg|gif|png|bmp)$",$imgfile_name)){
ShowMsg("你所上传的文件类型被禁止!","-1");
exit();
}
$sparr = Array("image/pjpeg","image/jpeg","image/gif","image/png","image/x-png","image/wbmp");
$imgfile_type = strtolower(trim($imgfile_type));
if(!in_array($imgfile_type,$sparr)){
ShowMsg("上传的图片格式错误,请使用JPEG、GIF、PNG、WBMP格式的其中一种!","-1");
exit();
}
$sname = '.jpg';
//上传后的图片的处理
if($imgfile_type=='image/pjpeg'||$imgfile_type=='image/jpeg'){
$sname = '.jpg';
}else if($imgfile_type=='image/gif'){
$sname = '.gif';
}else if($imgfile_type=='image/png'){
$sname = '.png';
}else if($imgfile_type=='image/wbmp'){
$sname = '.bmp';
}
$nowtime = time();
$savepath = $cfg_user_dir."/".$cfg_ml->M_ID."/".strftime("%y%m",$nowtime);
CreateDir($savepath);
CloseFtp();
$rndname = dd2char(strftime("%d%H%M%S",$nowtime).$cfg_ml->M_ID.mt_rand(1000,9999));
$filename = $savepath."/".$rndname;
$rndname = $rndname.$sname; //仅作注解用
//大小图URL
$bfilename = $filename.$sname;
$litfilename = $filename."_lit".$sname;
//大小图真实地址
$fullfilename = $cfg_basedir.$bfilename;
$full_litfilename = $cfg_basedir.$litfilename;
if(file_exists($fullfilename)){
ShowMsg("本目录已经存在同名的文件,请重试!","-1");
exit();
}
//严格检查最终的文件名
if(eregi("\.(php|asp|pl|shtml|jsp|cgi|aspx)",$fullfilename)){
ShowMsg("你所上传的文件类型被禁止,系统只允许上传<br>".$cfg_mb_mediatype." 类型附件!","-1");
exit();
}
if(eregi("\.(php|asp|pl|shtml|jsp|cgi|aspx)",$full_litfilename)){
ShowMsg("你所上传的文件类型被禁止,系统只允许上传<br>".$cfg_mb_mediatype." 类型附件!","-1");
exit();
}
@move_uploaded_file($imgfile,$fullfilename);
$dsql = new DedeSql(false);
if($dd=="yes")
{
copy($fullfilename,$full_litfilename);
if(in_array($imgfile_type,$cfg_photo_typenames)) ImageResize($full_litfilename,$w,$h);
$urlValue = $bfilename;
$imgsrcValue = $litfilename;
$info = "";
$sizes = getimagesize($full_litfilename,$info);
$imgwidthValue = $sizes[0];
$imgheightValue = $sizes[1];
$imgsize = filesize($full_litfilename);
$inquery = "
INSERT INTO #@__uploads(title,url,mediatype,width,height,playtime,filesize,uptime,adminid,memberid)
VALUES ('小图{$dblitfile}','$imgsrcValue','1','$imgwidthValue','$imgheightValue','0','{$imgsize}','{$nowtme}','".$cuserLogin->getUserID()."','0');
";
$dsql->ExecuteNoneQuery($inquery);
}else{
$imgsrcValue = $bfilename;
$urlValue = $bfilename;
$info = "";
$sizes = getimagesize($fullfilename,$info);
$imgwidthValue = $sizes[0];
$imgheightValue = $sizes[1];
$imgsize = filesize($fullfilename);
}
$info = '';
$bsizes = getimagesize($fullfilename,$info);
$bimgwidthValue = $bsizes[0];
$bimgheightValue = $bsizes[1];
$bimgsize = filesize($fullfilename);
$inquery = "
INSERT INTO #@__uploads(title,url,mediatype,width,height,playtime,filesize,uptime,adminid,memberid)
VALUES ('{$dbbigfile}','$bfilename','1','$bimgwidthValue','$bimgheightValue','0','{$bimgsize}','{$nowtme}','".$cuserLogin->getUserID()."','0');
";
$dsql->ExecuteNoneQuery($inquery);
$dsql->Close();
if(in_array($imgfile_type,$cfg_photo_typenames) &&( $imgfile_type!='image/gif' || $cfg_gif_wartermark=='Y')) WaterImg($fullfilename,'up');
$kkkimg = $urlValue;
}
if(empty($kkkimg)) $kkkimg="picview.gif";
if(!eregi("^http:",$imgsrcValue)){
$imgsrcValue = ereg_replace("/{1,}",'/',$imgsrcValue);
$urlValue = ereg_replace("/{1,}",'/',$urlValue);
}
?>
<HTML>
<HEAD>
<title>插入图片</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
td{font-size:10pt;}
</style>
<script language=javascript>
var oEditor = window.parent.InnerDialogLoaded() ;
var oDOM = oEditor.FCK.EditorDocument ;
var FCK = oEditor.FCK;
function ImageOK()
{
var inImg,ialign,iurl,imgwidth,imgheight,ialt,isrc,iborder;
ialign = document.form1.ialign.value;
iborder = document.form1.border.value;
imgwidth = document.form1.imgwidth.value;
imgheight = document.form1.imgheight.value;
ialt = document.form1.alt.value;
isrc = document.form1.imgsrc.value;
iurl = document.form1.url.value;
if(ialign!=0) ialign = " align='"+ialign+"'";
inImg = "<img src='"+ isrc +"' width='"+ imgwidth;
inImg += "' height='"+ imgheight +"' border='"+ iborder +"' alt='"+ ialt +"'"+ialign+"/>";
if(iurl!="") inImg = "<a href='"+ iurl +"' target='_blank'>"+ inImg +"</a>\r\n";
if(document.all) oDOM.selection.createRange().pasteHTML(inImg);
else FCK.InsertHtml(inImg);
window.close();
}
function SelectMedia(fname)
{
if(document.all){
var posLeft = window.event.clientY-100;
var posTop = window.event.clientX-400;
}
else{
var posLeft = 100;
var posTop = 100;
}
window.open("../../../dialog/select_images.php?f="+fname+"&imgstick=big", "popUpImgWin", "scrollbars=yes,resizable=yes,statebar=no,width=600,height=400,left="+posLeft+", top="+posTop);
}
function SeePic(imgid,fobj)
{
if(!fobj) return;
if(fobj.value != "" && fobj.value != null)
{
var cimg = document.getElementById(imgid);
if(cimg) cimg.src = fobj.value;
}
}
function UpdateImageInfo()
{
var imgsrc = document.form1.imgsrc.value;
if(imgsrc!="")
{
var imgObj = new Image();
imgObj.src = imgsrc;
document.form1.himgheight.value = imgObj.height;
document.form1.himgwidth.value = imgObj.width;
document.form1.imgheight.value = imgObj.height;
document.form1.imgwidth.value = imgObj.width;
}
}
function UpImgSizeH()
{
var ih = document.form1.himgheight.value;
var iw = document.form1.himgwidth.value;
var iih = document.form1.imgheight.value;
var iiw = document.form1.imgwidth.value;
if(ih!=iih && iih>0 && ih>0 && document.form1.autoresize.checked)
{
document.form1.imgwidth.value = Math.ceil(iiw * (iih/ih));
}
}
function UpImgSizeW()
{
var ih = document.form1.himgheight.value;
var iw = document.form1.himgwidth.value;
var iih = document.form1.imgheight.value;
var iiw = document.form1.imgwidth.value;
if(iw!=iiw && iiw>0 && iw>0 && document.form1.autoresize.checked)
{
document.form1.imgheight.value = Math.ceil(iih * (iiw/iw));
}
}
</script>
<link href="base.css" rel="stylesheet" type="text/css">
<base target="_self">
</HEAD>
<body bgcolor="#EBF6CD" leftmargin="4" topmargin="2">
<form enctype="multipart/form-data" name="form1" id="form1" method="post">
<input type="hidden" name="dopost" value="upload">
<input type="hidden" name="himgheight" value="<?php echo $imgheightValue?>">
<input type="hidden" name="himgwidth" value="<?php echo $imgwidthValue?>">
<table width="100%" border="0">
<tr height="20">
<td colspan="3">
<fieldset>
<legend>图片属性</legend>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="65" height="25" align="right">网址:</td>
<td colspan="2">
<input name="imgsrc" type="text" id="imgsrc" size="30" onChange="SeePic('picview',this);" value="<?php echo $imgsrcValue?>">
<input onClick="SelectMedia('form1.imgsrc');" type="button" name="selimg" value=" 浏览... " class="binput" style="width:80">
</td>
</tr>
<tr>
<td height="25" align="right">宽度:</td>
<td colspan="2" nowrap>
<input type="text" id="imgwidth" name="imgwidth" size="8" value="<?php echo $imgwidthValue?>" onChange="UpImgSizeW()">
高度:
<input name="imgheight" type="text" id="imgheight" size="8" value="<?php echo $imgheightValue?>" onChange="UpImgSizeH()">
<input type="button" name="Submit" value="原始" class="binput" style="width:40" onclick="UpdateImageInfo()">
<input name="autoresize" type="checkbox" id="autoresize" value="1" checked>
自适应</td>
</tr>
<tr>
<td height="25" align="right">边框:</td>
<td colspan="2" nowrap><input name="border" type="text" id="border" size="4" value="0">
替代文字:
<input name="alt" type="text" id="alt" size="10"></td>
</tr>
<tr>
<td height="25" align="right">链接:</td>
<td width="166" nowrap><input name="url" type="text" id="url" size="30" value="<?php echo $urlValue?>"></td>
<td width="155" align="center" nowrap> </td>
</tr>
<tr>
<td height="25" align="right">对齐:</td>
<td nowrap><select name="ialign" id="ialign">
<option value="0" selected>默认</option>
<option value="right">右对齐</option>
<option value="center">中间</option>
<option value="left">左对齐</option>
<option value="top">顶端</option>
<option value="bottom">底部</option>
</select></td>
<td align="right" nowrap>
<input onClick="ImageOK();" type="button" name="Submit2" value=" 确定 " class="binput">
</td>
</tr>
</table>
</fieldset>
</td>
</tr>
<tr height="25">
<td colspan="3" nowrap> <fieldset>
<legend>上传新图片</legend>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr height="30">
<td align="right" nowrap> 新图片:</td>
<td colspan="2" nowrap><input name="imgfile" type="file" id="imgfile" onChange="SeePic('picview',this);" style="height:22" class="binput">
<input type="submit" name="picSubmit" id="picSubmit" value=" 上 传 " style="height:22" class="binput"></td>
</tr>
<tr height="30">
<td align="right" nowrap> 选 项:</td>
<td colspan="2" nowrap>
<input type="checkbox" name="dd" value="yes">生成缩略图
缩略图宽度
<input name="w" type="text" value="<?php echo $cfg_ddimg_width?>" size="3">
缩略图高度
<input name="h" type="text" value="<?php echo $cfg_ddimg_height?>" size="3">
</td>
</tr>
</table>
</fieldset></td>
</tr>
<tr height="50">
<td height="140" align="right" nowrap>预览区:</td>
<td height="140" colspan="2" nowrap>
<table width="150" height="120" border="0" cellpadding="1" cellspacing="1">
<tr>
<td align="center"><img name="picview" id="picview" src="<?php echo $kkkimg?>" width="160" height="120" alt="预览图片"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</HTML>
| zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/dialog/image.php | PHP | asf20 | 11,809 |
<!--
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fck_smiley.html
* Smileys (emoticons) dialog window.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex, nofollow" />
<style type="text/css">
.HandIE { cursor: hand ; }
.HandMozilla { cursor: pointer ; }
</style>
<script type="text/javascript">
var oEditor = window.parent.InnerDialogLoaded() ;
window.onload = function ()
{
// First of all, translate the dialog box texts
oEditor.FCKLanguageManager.TranslatePage(document) ;
}
function InsertSmiley( url )
{
var oImg = oEditor.FCK.CreateElement( 'IMG' ) ;
oImg.src = url ;
oImg.setAttribute( '_fcksavedurl', url ) ;
window.parent.Cancel() ;
}
function over(td)
{
td.className = 'LightBackground HandIE HandMozilla' ;
}
function out(td)
{
td.className = 'DarkBackground HandIE HandMozilla' ;
}
</script>
</head>
<body scroll="no">
<table cellpadding="2" cellspacing="2" align="center" border="0" width="100%" height="100%">
<script type="text/javascript">
<!--
var FCKConfig = oEditor.FCKConfig ;
var sBasePath = FCKConfig.SmileyPath ;
var aImages = FCKConfig.SmileyImages ;
var cols = FCKConfig.SmileyColumns ;
var i = 0 ;
while (i < aImages.length)
{
document.write("<TR>") ;
for(var j = 0 ; j < cols ; j++)
{
if (aImages[i])
{
var sUrl = sBasePath + aImages[i] ;
document.write("<TD width='1%' align='center' class='DarkBackground HandIE HandMozilla' onclick='InsertSmiley(\"" + sUrl.replace(/"/g, '\\"' ) + "\")' onmouseover='over(this)' onmouseout='out(this)'>") ;
document.write("<img src='" + sUrl + "' border='0'>") ;
}
else
document.write("<TD width='1%' class='DarkBackground'> ") ;
document.write("<\/TD>") ;
i++ ;
}
document.write("<\/TR>") ;
}
//-->
</script>
</table>
</body>
</html>
| zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/dialog/fck_smiley.html | HTML | asf20 | 2,433 |
<!--
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fck_colorselector.html
* Color Selection dialog window.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex, nofollow" />
<style TYPE="text/css">
#ColorTable { cursor: pointer ; cursor: hand ; }
#hicolor { height: 74px ; width: 74px ; border-width: 1px ; border-style: solid ; }
#hicolortext { width: 75px ; text-align: right ; margin-bottom: 7px ; }
#selhicolor { height: 20px ; width: 74px ; border-width: 1px ; border-style: solid ; }
#selcolor { width: 75px ; height: 20px ; margin-top: 0px ; margin-bottom: 7px ; }
#btnClear { width: 75px ; height: 22px ; margin-bottom: 6px ; }
.ColorCell { height: 15px ; width: 15px ; }
</style>
<script type="text/javascript">
var oEditor = window.parent.InnerDialogLoaded() ;
function OnLoad()
{
// First of all, translate the dialog box texts
oEditor.FCKLanguageManager.TranslatePage(document) ;
CreateColorTable() ;
window.parent.SetOkButton( true ) ;
window.parent.SetAutoSize( true ) ;
}
function CreateColorTable()
{
// Get the target table.
var oTable = document.getElementById('ColorTable') ;
// Create the base colors array.
var aColors = ['00','33','66','99','cc','ff'] ;
// This function combines two ranges of three values from the color array into a row.
function AppendColorRow( rangeA, rangeB )
{
for ( var i = rangeA ; i < rangeA + 3 ; i++ )
{
var oRow = oTable.insertRow(-1) ;
for ( var j = rangeB ; j < rangeB + 3 ; j++ )
{
for ( var n = 0 ; n < 6 ; n++ )
{
AppendColorCell( oRow, '#' + aColors[j] + aColors[n] + aColors[i] ) ;
}
}
}
}
// This function create a single color cell in the color table.
function AppendColorCell( targetRow, color )
{
var oCell = targetRow.insertCell(-1) ;
oCell.className = 'ColorCell' ;
oCell.bgColor = color ;
oCell.onmouseover = function()
{
document.getElementById('hicolor').style.backgroundColor = this.bgColor ;
document.getElementById('hicolortext').innerHTML = this.bgColor ;
}
oCell.onclick = function()
{
document.getElementById('selhicolor').style.backgroundColor = this.bgColor ;
document.getElementById('selcolor').value = this.bgColor ;
}
}
AppendColorRow( 0, 0 ) ;
AppendColorRow( 3, 0 ) ;
AppendColorRow( 0, 3 ) ;
AppendColorRow( 3, 3 ) ;
// Create the last row.
var oRow = oTable.insertRow(-1) ;
// Create the gray scale colors cells.
for ( var n = 0 ; n < 6 ; n++ )
{
AppendColorCell( oRow, '#' + aColors[n] + aColors[n] + aColors[n] ) ;
}
// Fill the row with black cells.
for ( var i = 0 ; i < 12 ; i++ )
{
AppendColorCell( oRow, '#000000' ) ;
}
}
function Clear()
{
document.getElementById('selhicolor').style.backgroundColor = '' ;
document.getElementById('selcolor').value = '' ;
}
function ClearActual()
{
document.getElementById('hicolor').style.backgroundColor = '' ;
document.getElementById('hicolortext').innerHTML = ' ' ;
}
function UpdateColor()
{
try { document.getElementById('selhicolor').style.backgroundColor = document.getElementById('selcolor').value ; }
catch (e) { Clear() ; }
}
function Ok()
{
if ( typeof(window.parent.dialogArguments.CustomValue) == 'function' )
window.parent.dialogArguments.CustomValue( document.getElementById('selcolor').value ) ;
return true ;
}
</script>
</head>
<body onload="OnLoad()" scroll="no" style="OVERFLOW: hidden">
<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
<tr>
<td align="center" valign="middle">
<table border="0" cellspacing="5" cellpadding="0" width="100%">
<tr>
<td valign="top" align="center" nowrap width="100%">
<table id="ColorTable" border="0" cellspacing="0" cellpadding="0" width="270" onmouseout="ClearActual();">
</table>
</td>
<td valign="top" align="left" nowrap>
<span fckLang="DlgColorHighlight">Highlight</span>
<div id="hicolor"></div>
<div id="hicolortext"> </div>
<span fckLang="DlgColorSelected">Selected</span>
<div id="selhicolor"></div>
<input id="selcolor" type="text" maxlength="20" onchange="UpdateColor();">
<br>
<input id="btnClear" type="button" fckLang="DlgColorBtnClear" value="Clear" onclick="Clear();" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
| zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/dialog/fck_colorselector.html | HTML | asf20 | 5,129 |
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fck_dialog_common.css
* This is the CSS file used for interface details in some dialog
* windows.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
.ImagePreviewArea
{
border: #000000 1px solid;
overflow: auto;
width: 100%;
height: 170px;
background-color: #ffffff;
}
.FlashPreviewArea
{
border: #000000 1px solid;
padding: 5px;
overflow: auto;
width: 100%;
height: 170px;
background-color: #ffffff;
}
.BtnReset
{
float: left;
background-position: center center;
background-image: url(images/reset.gif);
width: 16px;
height: 16px;
background-repeat: no-repeat;
border: 1px none;
font-size: 1px ;
}
.BtnLocked, .BtnUnlocked
{
float: left;
background-position: center center;
background-image: url(images/locked.gif);
width: 16px;
height: 16px;
background-repeat: no-repeat;
border: 1px none;
font-size: 1px ;
}
.BtnUnlocked
{
background-image: url(images/unlocked.gif);
}
.BtnOver
{
border: 1px outset;
cursor: pointer;
cursor: hand;
}
.FCK__FieldNumeric
{
behavior: url(common/fcknumericfield.htc) ;
} | zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/dialog/common/fck_dialog_common.css | CSS | asf20 | 1,539 |
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fck_dialog_common.js
* Useful functions used by almost all dialog window pages.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
// Gets a element by its Id. Used for shorter coding.
function GetE( elementId )
{
return document.getElementById( elementId ) ;
}
function ShowE( element, isVisible )
{
if ( typeof( element ) == 'string' )
element = GetE( element ) ;
element.style.display = isVisible ? '' : 'none' ;
}
function SetAttribute( element, attName, attValue )
{
if ( attValue == null || attValue.length == 0 )
element.removeAttribute( attName, 0 ) ; // 0 : Case Insensitive
else
element.setAttribute( attName, attValue, 0 ) ; // 0 : Case Insensitive
}
function GetAttribute( element, attName, valueIfNull )
{
var oAtt = element.attributes[attName] ;
if ( oAtt == null || !oAtt.specified )
return valueIfNull ? valueIfNull : '' ;
var oValue ;
if ( !( oValue = element.getAttribute( attName, 2 ) ) )
oValue = oAtt.nodeValue ;
return ( oValue == null ? valueIfNull : oValue ) ;
}
// Functions used by text fiels to accept numbers only.
function IsDigit( e )
{
e = e || event ;
var iCode = ( e.keyCode || e.charCode ) ;
event.returnValue =
(
( iCode >= 48 && iCode <= 57 ) // Numbers
|| (iCode >= 37 && iCode <= 40) // Arrows
|| iCode == 8 // Backspace
|| iCode == 46 // Delete
) ;
return event.returnValue ;
}
String.prototype.trim = function()
{
return this.replace( /(^\s*)|(\s*$)/g, '' ) ;
}
String.prototype.startsWith = function( value )
{
return ( this.substr( 0, value.length ) == value ) ;
}
String.prototype.remove = function( start, length )
{
var s = '' ;
if ( start > 0 )
s = this.substring( 0, start ) ;
if ( start + length < this.length )
s += this.substring( start + length , this.length ) ;
return s ;
}
function OpenFileBrowser( url, width, height )
{
// oEditor must be defined.
var iLeft = ( oEditor.FCKConfig.ScreenWidth - width ) / 2 ;
var iTop = ( oEditor.FCKConfig.ScreenHeight - height ) / 2 ;
var sOptions = "toolbar=no,status=no,resizable=yes,dependent=yes" ;
sOptions += ",width=" + width ;
sOptions += ",height=" + height ;
sOptions += ",left=" + iLeft ;
sOptions += ",top=" + iTop ;
// The "PreserveSessionOnFileBrowser" because the above code could be
// blocked by popup blockers.
if ( oEditor.FCKConfig.PreserveSessionOnFileBrowser && oEditor.FCKBrowserInfo.IsIE )
{
// The following change has been made otherwise IE will open the file
// browser on a different server session (on some cases):
// http://support.microsoft.com/default.aspx?scid=kb;en-us;831678
// by Simone Chiaretta.
var oWindow = oEditor.window.open( url, 'FCKBrowseWindow', sOptions ) ;
if ( oWindow )
oWindow.opener = window ;
else
alert( oEditor.FCKLang.BrowseServerBlocked ) ;
}
else
window.open( url, 'FCKBrowseWindow', sOptions ) ;
} | zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/dialog/common/fck_dialog_common.js | JavaScript | asf20 | 3,426 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<!--
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fck_anchor.html
* Anchor dialog window.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
-->
<html>
<head>
<title>Anchor Properties</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta content="noindex, nofollow" name="robots">
<script src="common/fck_dialog_common.js" type="text/javascript"></script>
<script type="text/javascript">
var oEditor = window.parent.InnerDialogLoaded() ;
var FCK = oEditor.FCK ;
// Gets the document DOM
var oDOM = oEditor.FCK.EditorDocument ;
var oFakeImage = FCK.Selection.GetSelectedElement() ;
var oAnchor ;
if ( oFakeImage )
{
if ( oFakeImage.tagName == 'IMG' && oFakeImage.getAttribute('_fckanchor') )
oAnchor = FCK.GetRealElement( oFakeImage ) ;
else
oFakeImage = null ;
}
window.onload = function()
{
// First of all, translate the dialog box texts
oEditor.FCKLanguageManager.TranslatePage(document) ;
if ( oAnchor )
GetE('txtName').value = oAnchor.name ;
else
oAnchor = null ;
window.parent.SetOkButton( true ) ;
}
function Ok()
{
if ( GetE('txtName').value.length == 0 )
{
alert( oEditor.FCKLang.DlgAnchorErrorName ) ;
return false ;
}
oEditor.FCKUndo.SaveUndoStep() ;
oAnchor = FCK.EditorDocument.createElement( 'DIV' ) ;
oAnchor.innerHTML = '<a name="' + GetE('txtName').value + '"><\/a>' ;
oAnchor = oAnchor.firstChild ;
oFakeImage = oEditor.FCKDocumentProcessors_CreateFakeImage( 'FCK__Anchor', oAnchor ) ;
oFakeImage.setAttribute( '_fckanchor', 'true', 0 ) ;
oFakeImage = FCK.InsertElementAndGetIt( oFakeImage ) ;
// oEditor.FCK.InsertHtml( '<a name="' + GetE('txtName').value + '"><\/a>' ) ;
return true ;
}
</script>
</head>
<body style="OVERFLOW: hidden" scroll="no">
<table height="100%" width="100%">
<tr>
<td align="center">
<table border="0" cellpadding="0" cellspacing="0" width="80%">
<tr>
<td>
<span fckLang="DlgAnchorName">Anchor Name</span><BR>
<input id="txtName" style="WIDTH: 100%" type="text">
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html> | zyyhong | trunk/jiaju001/news/include/FCKeditor/editor/dialog/fck_anchor.html | HTML | asf20 | 2,653 |