[ Index ] |
|
Code source de CMS made simple 1.0.5 |
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 if (!$this->CheckPermission('Modify News')) 28 { 29 echo $this->ShowErrors($this->Lang('needpermission', array('Modify News'))); 30 return; 31 } 32 33 $catid = ''; 34 if (isset($params['catid'])) 35 { 36 $catid = $params['catid']; 37 } 38 39 // Get the category details 40 $query = 'SELECT * FROM '.cms_db_prefix().'module_news_categories 41 WHERE news_category_id = ?'; 42 $row = $db->GetRow( $query, array( $catid ) ); 43 44 //Reset all categories using this parent to have no parent (-1) 45 $query = 'UPDATE '.cms_db_prefix().'module_news_categories SET parent_id=?, modified_date='.$db->DBTimeStamp(time()).' WHERE parent_id=?'; 46 $db->Execute($query, array(-1, $catid)); 47 48 //Now remove the category 49 $query = "DELETE FROM ".cms_db_prefix()."module_news_categories WHERE news_category_id = ?"; 50 $db->Execute($query, array($catid)); 51 52 //And remove it from any articles 53 $query = "DELETE FROM module_news_article_categories WHERE news_category_id = ?"; 54 $db->Execute($query, array($catid)); 55 56 @$this->SendEvent('NewsCategoryDeleted', array('category_id' => $catid, 'name' => $row['news_category_name'])); 57 58 $this->UpdateHierarchyPositions(); 59 60 $params = array('tab_message'=> 'categorydeleted', 'active_tab' => 'categories'); 61 $this->Redirect($id, 'defaultadmin', $returnid, $params); 62 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Tue Apr 3 18:50:37 2007 | par Balluche grâce à PHPXref 0.7 |