configWantedPass = & $configWantedPass; $this->configAdminPass = & $configAdminPass; $this->configDirPasswordFile = & $configDirPasswordFile; $this->configOpenGzip = & $configOpenGzip; $this->configShowPicSize = & $configShowPicSize; $this->configExt = & $configExt; $this->strLenMax = & $strLenMax; $this->configEachPageMax = & $configEachPageMax; $this->configEachLineMax = & $configEachLineMax; $this->configTDHeight = & $configTDHeight ; $this->configTDWidth = & $configTDWidth; $this->configPageMax = & $configPageMax; $this->configTilte = & $configTilte; $this->configVer = & $configVer; } /* +----------------------------------+ | Open gzip +----------------------------------+ | C / M : 2003-12-29 / -- +----------------------------------+ */ function gzip() { if ($this->configOpenGzip == true) ob_start("ob_gzhandler"); } /* +----------------------------------+ | Get the querystring +----------------------------------+ | C / M : 2003-12-28 / 2003-12-29 +----------------------------------+ */ function getVars() { $this->page = rawurldecode($_GET['page']); $this->path = rawurldecode($_GET['path']); $this->style = $_GET['style']; if (!$this->style) $this->style = "small"; if (!$this->path) $this->path = "."; } /* +----------------------------------+ | Check error +----------------------------------+ | C / M : 2003-12-28 / 2004-1-1 +----------------------------------+ */ function checkError() { if (preg_match("/\.\./", $this->path)) $pathError = true; if (!is_dir($this->path)) $pathError = true; if ($pathError == true) { header("location:".$_SERVER['PHP_SELF']); exit; } } /* +----------------------------------+ | Path array initialize +----------------------------------+ | C / M : 2003-12-28 / 2003-12-29 +----------------------------------+ */ function pathArrayInitialize() { if (!$this->path) $this->path = "."; $this->pathArray = explode("/", $this->path); $this->pathLevelNum = count($this->pathArray); $this->nowDirName = $this->pathArray[$this->pathLevelNum - 1]; if ($this->nowDirName == ".") $this->nowDirName = "Root dir"; } /* +----------------------------------+ | Timer +----------------------------------+ | C / M : 2003-12-29 / -- +----------------------------------+ */ function timer() { $time = explode( " ", microtime()); $usec = (double)$time[0]; $sec = (double)$time[1]; $this->timer = $usec + $sec; } /* +----------------------------------+ | Show used time +----------------------------------+ | C / M : 2003-12-29 / -- +----------------------------------+ */ function usedTime() { } /* +----------------------------------+ | Make over direct +----------------------------------+ | C / M : 2003-12-28 / 2003-12-29 +----------------------------------+ */ function makeOverdirect() { $overPath = "."; for($i = 1; $i < $this->pathLevelNum - 1; $i++) { $overPath = $overPath."/".$this->pathArray[$i]; } $this->dirArray[] = $overPath; $this->dirNameArray[] = "上级目录"; for($i = 1; $i < $this->pathLevelNum; $i++) { $this->encodePath .= rawurlencode($this->pathArray[$i])."/"; } } /* +----------------------------------+ | GetFileExt +----------------------------------+ | C / M : 2003-12-28 / -- +----------------------------------+ */ function getFileExt($fileName) { $pos = strrpos($fileName, '.'); return strtolower(substr($fileName, $pos+1, (strlen($fileName)-$pos-1))); } /* +----------------------------------+ | Make direct list +----------------------------------+ | C / M : 2003-12-28 / 2003-12-29 +----------------------------------+ */ function makeDirList() { $dir = dir($this->path); while($file = $dir->read()) { if ($file <> "." and $file <> "..") { $fileName = $file; $file = $this->path."/".$file; if (is_dir($file)) { $this->dirArray[] = $file; $this->dirNameArray[] = $fileName; } if (in_array($this->getFileExt($file), $this->configExt)) { $this->picEncodeArray[] = "./" . $this->encodePath . rawurlencode($fileName); $this->picArray[] = $file; $this->picFileArray[] = $fileName; } } } } /* +----------------------------------+ | Get each array number +----------------------------------+ | C / M : 2003-12-28 / -- +----------------------------------+ */ function getEachArrayNum() { $this->dirNum = count($this->dirArray); $this->picNum = count($this->picArray); } /* +----------------------------------+ | Make page bar +----------------------------------+ | C / M : 2003-12-28 / 2003-12-29 +----------------------------------+ */ function makePageBar() { $this->pageTotal = ceil($this->picNum / $this->configEachPageMax); if (!$this->page or $this->page < 0) $this->page =$this->pageTotal; if ($this->page > $this->pageTotal) $this->page = $this->pageTotal; $this->offSet = $this->configEachPageMax * $this->page; $this->start = $this->offSet - $this->configEachPageMax; if ($this->start < 0) $this->start = 0; if ($this->offSet > $this->picNum) $this->offSet = $this->picNum; $this->pageStart = $this->page - $this->configPageMax; if ($this->pageStart <= 0) $this->pageStart = 1; $this->pageMiddle = $this->page + 1; $this->pageEnd = $this->pageMiddle + $this->configPageMax; if ($this->page <= $this->configPageMax) $this->pageEnd = $this->configPageMax * 2 + 1; if ($this->pageEnd > $this->pageTotal) $this->pageEnd = $this->pageTotal + 1; } /* +----------------------------------+ | Show page bar +----------------------------------+ | C / M : 2003-12-28 / 2003-12-29 +----------------------------------+ */ function showPageBar() { print("
\n");
print(" | \n");
print("\n");
print("
\n");
print(" | \n");
print("\n");
print("
\n");
printf(" | \n");
print("
\n");
printf(" 文件authid:%s 作者author:%s | \n");
print("
\n");
printf(" | \n");
print("