本文整理汇总了PHP中Forum::listAttach方法的典型用法代码示例。如果您正苦于以下问题:PHP Forum::listAttach方法的具体用法?PHP Forum::listAttach怎么用?PHP Forum::listAttach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Forum
的用法示例。
在下文中一共展示了Forum::listAttach方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _attList
private function _attList()
{
$u = User::getInstance();
if (isset($this->params['id'])) {
$id = $this->params['id'];
try {
$article = Article::getInstance($id, $this->_board);
if (!$article->hasEditPerm($u)) {
$this->error(ECode::$ARTICLE_NOEDIT);
}
$atts = $article->getAttList();
$this->set("postUrl", "/{$article->ID}");
} catch (Exception $e) {
$this->error(ECode::$ARTICLE_NONE);
}
} else {
$atts = Forum::listAttach();
}
return $atts;
}
示例2: delete
public function delete()
{
if (!$this->RequestHandler->isPost()) {
$this->error(ECode::$SYS_REQUESTERROR);
}
$this->_attOpInit();
$u = User::getInstance();
if (!isset($this->params['form']['name'])) {
$this->error(ECode::$ATT_NAMEERROR);
}
$attName = strval($this->params['form']['name']);
try {
if (isset($this->params['id'])) {
$id = $this->params['id'];
$article = Article::getInstance($id, $this->_board);
if (!$article->hasEditPerm($u)) {
$this->error(ECode::$ARTICLE_NOEDIT);
}
$attNum = 0;
foreach ($article->getAttList() as $k => $v) {
if ($v['name'] == $attName) {
$attNum = intval($k + 1);
break;
}
}
$article->delAttach($attNum);
$article = Article::getInstance($id, $this->_board);
} else {
Forum::delAttach($attName);
$article = Forum::listAttach();
}
$wrapper = Wrapper::getInstance();
$this->set('data', $wrapper->attachment($article));
return;
} catch (ArchiveAttException $e) {
$msg = $e->getMessage();
} catch (AttException $e) {
$msg = $e->getMessage();
} catch (Exception $e) {
$this->error();
}
}