当前位置: 首页>>代码示例>>PHP>>正文


PHP Forum::delAttach方法代码示例

本文整理汇总了PHP中Forum::delAttach方法的典型用法代码示例。如果您正苦于以下问题:PHP Forum::delAttach方法的具体用法?PHP Forum::delAttach怎么用?PHP Forum::delAttach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Forum的用法示例。


在下文中一共展示了Forum::delAttach方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ajax_delete

 public function ajax_delete()
 {
     if (!$this->RequestHandler->isPost() && !$this->RequestHandler->isDelete()) {
         $this->error(ECode::$SYS_REQUESTERROR);
     }
     $this->_attOpInit();
     $this->brief = true;
     $u = User::getInstance();
     if (isset($this->params['url']['name'])) {
         $attName = nforum_iconv('utf-8', $this->encoding, $this->params['url']['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);
                 $this->set("postUrl", "/{$article->ID}");
             } else {
                 Forum::delAttach($attName);
             }
             $this->set('ajax_code', ECode::$ATT_DELOK);
         } catch (ArchiveAttException $e) {
             $this->error($e->getMessage());
         } catch (AttException $e) {
             $this->error($e->getMessage());
         } catch (Exception $e) {
             $this->error(ECode::$ATT_NAMEERROR);
         }
     } else {
         $this->error(ECode::$ATT_NAMEERROR);
     }
 }
开发者ID:tilitala,项目名称:nForum,代码行数:41,代码来源:attachment_controller.php

示例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();
     }
 }
开发者ID:tilitala,项目名称:nForum,代码行数:42,代码来源:attachment_controller.php


注:本文中的Forum::delAttach方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。