[ Index ] |
|
Code source de CMS made simple 1.0.5 |
1 <?php 2 #CMS - CMS Made Simple 3 #(c)2004 by Ted Kulp (wishy@users.sf.net) 4 #This project's homepage is: http://cmsmadesimple.sf.net 5 # 6 #This program is free software; you can redistribute it and/or modify 7 #it under the terms of the GNU General Public License as published by 8 #the Free Software Foundation; either version 2 of the License, or 9 #(at your option) any later version. 10 # 11 #This program is distributed in the hope that it will be useful, 12 #but WITHOUT ANY WARRANTY; without even the implied warranty of 13 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 #GNU General Public License for more details. 15 #You should have received a copy of the GNU General Public License 16 #along with this program; if not, write to the Free Software 17 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 # 19 #$Id: deletetemplate.php 3362 2006-08-22 09:55:33Z wishy $ 20 21 $CMS_ADMIN_PAGE=1; 22 23 require_once ("../include.php"); 24 require_once ("../lib/classes/class.template.inc.php"); 25 26 check_login(); 27 28 $dodelete = true; 29 $template_id = -1; 30 if (isset($_GET["template_id"])) 31 { 32 $template_id = $_GET["template_id"]; 33 $template_name = ""; 34 $userid = get_userid(); 35 $access = check_permission($userid, 'Remove Templates'); 36 37 if ($access) 38 { 39 global $gCms; 40 $templateops =& $gCms->GetTemplateOperations(); 41 $onetemplate = $templateops->LoadTemplateByID($template_id); 42 43 if ($templateops->CountPagesUsingTemplateByID($template_id) > 0) 44 { 45 $dodelete = false; 46 } 47 48 if ($dodelete) 49 { 50 #Perform the deletetemplate_pre callback 51 foreach($gCms->modules as $key=>$value) 52 { 53 if ($gCms->modules[$key]['installed'] == true && 54 $gCms->modules[$key]['active'] == true) 55 { 56 $gCms->modules[$key]['object']->DeleteTemplatePre($onetemplate); 57 } 58 } 59 60 Events::SendEvent('Core', 'DeleteTemplatePre', array('template' => &$onetemplate)); 61 62 $result = $templateops->DeleteTemplateByID($template_id); 63 64 if ($result) 65 { 66 #Perform the deletetemplate_post callback 67 foreach($gCms->modules as $key=>$value) 68 { 69 if ($gCms->modules[$key]['installed'] == true && 70 $gCms->modules[$key]['active'] == true) 71 { 72 $gCms->modules[$key]['object']->DeleteTemplatePost($onetemplate); 73 } 74 } 75 76 Events::SendEvent('Core', 'DeleteTemplatePost', array('template' => &$onetemplate)); 77 78 audit($template_id, $onetemplate->name, 'Deleted Template'); 79 } 80 } 81 } 82 } 83 84 if ($dodelete) 85 { 86 redirect("listtemplates.php"); 87 } 88 else 89 { 90 redirect("listtemplates.php?message=".lang('errortemplateinuse')); 91 } 92 93 # vim:ts=4 sw=4 noet 94 ?>
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 |