<?php

/*
  PHP version 5
  Copyright (c) 2002-2019ECISP.CN、EarcLink.COM
  警告：这不是一个免费的软件，请在许可范围内使用，请尊重知识产权，侵权必究，举报有奖
  作者：黄祥云 E-mail:6326420@qq.com  QQ:6326420 TEL:18665655030 / 13797552220
*/



use modul_application\ESPCMS_ArticleDB;
use inc_application\link\ArticleLink;

class lib_photo {

	public static function call_photo($parameter, $filename = 'photo', $outHTML = null) {
		$espcms_lib_template = espcms_web_template();
		$espcms_lib_template->libfile = true;
		$para = espcms_array_getvalue($parameter);
		if (!espcms_ismatches($para['did']) || !$para['did']) {
			return false;
		}
		$did = $para['did'];
		$doc_read = ESPCMS_ArticleDB::get_article_read($did);
		if (!$doc_read) {
			return false;
		}
		$doc_read['link'] = ArticleLink::doc_link($doc_read);
		$photo_read = ESPCMS_ArticleDB::get_document_album_list($did);
		$espcms_lib_template->into('array', $photo_read);
		$espcms_lib_template->into('read', $doc_read);
		$espcms_lib_template->into('para', $para);
		if (!empty($outHTML)) {
			$output = $espcms_lib_template->fetch(null, null, $outHTML);
		} else {
			$output = $espcms_lib_template->fetch('lib/' . $filename);
		}
		return $output;
	}

}
