[ Index ]
 

Code source de CMS made simple 1.0.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/modules/News/ -> action.deletearticle.php (source)

   1  <?php
   2          if (!isset($gCms)) exit;
   3  
   4          $detailpage = '';
   5          if (isset($params['detailpage']))
   6          {
   7              $manager =& $gCms->GetHierarchyManager();
   8              $node =& $manager->sureGetNodeByAlias($params['detailpage']);
   9              if (isset($node))
  10              {
  11                  $content =& $node->GetContent();
  12                  if (isset($content))
  13                  {
  14                      $detailpage = $content->Id();
  15                  }
  16              }
  17              else
  18              {
  19                  $node =& $manager->sureGetNodeById($params['detailpage']);
  20                  if (isset($node))
  21                  {
  22                      $detailpage = $params['detailpage'];
  23                  }
  24              }
  25          }
  26  
  27  
  28          if (!$this->CheckPermission('Modify News'))
  29          {
  30              echo $this->ShowErrors($this->Lang('needpermission', array('Modify News')));
  31              return;
  32          }
  33  
  34          $articleid = '';
  35          if (isset($params['articleid']))
  36          {
  37              $articleid = $params['articleid'];
  38          }
  39  
  40          //Now remove the article
  41          $query = "DELETE FROM ".cms_db_prefix()."module_news WHERE news_id = ?";
  42          $db->Execute($query, array($articleid));
  43  
  44          //And remove it from any categories
  45          // FIXME: this query seems to be a leftover from the (good?) old days
  46  //        $query = "DELETE FROM module_news_article_categories WHERE news_id = ?";
  47  //        $db->Execute($query, array($articleid));
  48          
  49          //Update search index
  50          $module =& $this->GetModuleInstance('Search');
  51          if ($module != FALSE)
  52          {
  53              $module->DeleteWords($this->GetName(), $articleid, 'article');
  54          }
  55          
  56          @$this->SendEvent('NewsArticleDeleted', array('news_id' => $articleid));
  57  
  58          $params = array('tab_message'=> 'articledeleted', 'active_tab' => 'articles');
  59          $this->Redirect($id, 'defaultadmin', $returnid, $params);
  60  ?>


Généré le : Tue Apr 3 18:50:37 2007 par Balluche grâce à PHPXref 0.7